Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    FileOdbBackend Class

    Namespace: Stride.Core.Storage
    Assembly: Stride.Core.Serialization.dll

    Object Database Backend (ODB) implementation using VirtualFileSystem

    System.Object → FileOdbBackend
    Derived from FileOdbBackend:

    public class FileOdbBackend : IOdbBackend, IDisposable
    Name Description
    Constructors
    FileOdbBackend(String, String, Boolean)
    Properties
    ContentIndexMap

    Gets the asset index map.

    IsReadOnly
    Methods
    BuildUrl(String, ObjectId)
    CreateStream()

    Creates a stream that will be saved to database when closed and/or disposed.

    Delete(ObjectId)

    Deletes the specified ObjectId.

    Dispose()
    EnumerateObjects()

    Enumerates the object stored in this backend.

    Exists(ObjectId)

    Determines weither the object with the specified ObjectId exists.

    GetFilePath(ObjectId)
    GetSize(ObjectId)

    Requests that this backend read an object's length (but not its contents).

    OpenStream(ObjectId, VirtualFileMode, VirtualFileAccess, VirtualFileShare)

    Opens a NativeStream of the object with the specified ObjectId.

    Write(ObjectId, Stream, Int32, Boolean)

    Writes an object to the backing store. The backend may need to compute the object ID and return it to the caller.

    | Improve this Doc View Source

    Constructors


    FileOdbBackend(String, String, Boolean)

    public FileOdbBackend(string vfsRootUrl, string indexName, bool isReadOnly)
    Parameters
    Type Name Description
    System.String vfsRootUrl
    System.String indexName
    System.Boolean isReadOnly
    | Improve this Doc View Source

    Properties


    ContentIndexMap

    Gets the asset index map.

    public IContentIndexMap ContentIndexMap { get; }
    Property Value
    Type Description
    IContentIndexMap

    The asset index map.


    IsReadOnly

    public bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Methods


    BuildUrl(String, ObjectId)

    public static string BuildUrl(string vfsRootUrl, ObjectId objectId)
    Parameters
    Type Name Description
    System.String vfsRootUrl
    ObjectId objectId
    Returns
    Type Description
    System.String

    CreateStream()

    Creates a stream that will be saved to database when closed and/or disposed.

    public OdbStreamWriter CreateStream()
    Returns
    Type Description
    OdbStreamWriter

    a stream writer that should be passed to in order to be stored in the database


    Delete(ObjectId)

    Deletes the specified ObjectId.

    public void Delete(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId

    The object id.


    Dispose()

    public void Dispose()

    EnumerateObjects()

    Enumerates the object stored in this backend.

    public IEnumerable<ObjectId> EnumerateObjects()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<ObjectId>

    Exists(ObjectId)

    Determines weither the object with the specified ObjectId exists.

    public virtual bool Exists(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId

    The ObjectId to check existence for.

    Returns
    Type Description
    System.Boolean

    true if an object with the specified ObjectId exists; otherwise, false.


    GetFilePath(ObjectId)

    public string GetFilePath(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId
    Returns
    Type Description
    System.String

    GetSize(ObjectId)

    Requests that this backend read an object's length (but not its contents).

    public virtual int GetSize(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId

    The ObjectId.

    Returns
    Type Description
    System.Int32

    The object size.


    OpenStream(ObjectId, VirtualFileMode, VirtualFileAccess, VirtualFileShare)

    Opens a NativeStream of the object with the specified ObjectId.

    public virtual Stream OpenStream(ObjectId objectId, VirtualFileMode mode = VirtualFileMode.Open, VirtualFileAccess access = VirtualFileAccess.Read, VirtualFileShare share = VirtualFileShare.Read)
    Parameters
    Type Name Description
    ObjectId objectId

    The ObjectId.

    VirtualFileMode mode

    The mode.

    VirtualFileAccess access

    The access.

    VirtualFileShare share

    The process share mode.

    Returns
    Type Description
    System.IO.Stream

    A NativeStream opened from the specified ObjectId.


    Write(ObjectId, Stream, Int32, Boolean)

    Writes an object to the backing store. The backend may need to compute the object ID and return it to the caller.

    public virtual ObjectId Write(ObjectId objectId, Stream dataStream, int length, bool forceWrite = false)
    Parameters
    Type Name Description
    ObjectId objectId

    The ObjectId if already computed, or Empty if not determined yet.

    System.IO.Stream dataStream

    The data stream.

    System.Int32 length

    The data length.

    System.Boolean forceWrite

    Set to true to force writing the datastream even if a content is already stored with the same id. Default is false.

    Returns
    Type Description
    ObjectId

    The generated ObjectId.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation