Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    BundleOdbBackend Class

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

    Object Database Backend (ODB) implementation that bundles multiple chunks into a .bundle files, optionally compressed with LZ4.

    System.Object → BundleOdbBackend
    Derived from BundleOdbBackend:

    [DataSerializerGlobal(null, typeof(List<string>), DataSerializerGenericMode.None, false, false)]
    [DataSerializerGlobal(null, typeof(List<ObjectId>), DataSerializerGenericMode.None, false, false)]
    [DataSerializerGlobal(null, typeof(List<KeyValuePair<ObjectId, BundleOdbBackend.ObjectInfo>>), DataSerializerGenericMode.None, false, false)]
    [DataSerializerGlobal(null, typeof(List<KeyValuePair<string, ObjectId>>), DataSerializerGenericMode.None, false, false)]
    public class BundleOdbBackend : IOdbBackend, IDisposable
    Name Description
    Constructors
    BundleOdbBackend(String)
    Fields
    BundleExtension

    The bundle file extension.

    Properties
    BundleDirectory
    BundleResolve

    Bundle resolve event asynchronous handler.

    ContentIndexMap

    Gets the asset index map.

    Methods
    CreateBundle(String, IOdbBackend, ObjectId[], ISet<ObjectId>, Dictionary<String, ObjectId>, IList<String>, Boolean)
    CreateStream()
    Delete(ObjectId)
    DeleteBundles(Func<String, Boolean>)
    Dispose()
    EnumerateObjects()
    Exists(ObjectId)
    GetFilePath(ObjectId)
    GetObjectInfos()
    GetSize(ObjectId)
    LoadBundle(String, ObjectDatabaseContentIndexMap)

    Loads the specified bundle.

    LoadBundleFromUrl(String, ObjectDatabaseContentIndexMap, String, Boolean)
    OpenStream(ObjectId, VirtualFileMode, VirtualFileAccess, VirtualFileShare)
    ReadBundleDescription(Stream)

    Reads the bundle description.

    ReadBundleHeader(String, out List<String>)
    TryGetObjectLocation(ObjectId, out String, out Int64, out Int64)
    UnloadBundle(String, ObjectDatabaseContentIndexMap)

    Unload the specified bundle.

    Write(ObjectId, Stream, Int32, Boolean)
    | Improve this Doc View Source

    Constructors


    BundleOdbBackend(String)

    public BundleOdbBackend(string vfsRootUrl)
    Parameters
    Type Name Description
    System.String vfsRootUrl
    | Improve this Doc View Source

    Fields


    BundleExtension

    The bundle file extension.

    public const string BundleExtension = ".bundle"
    Field Value
    Type Description
    System.String
    | Improve this Doc View Source

    Properties


    BundleDirectory

    public string BundleDirectory { get; }
    Property Value
    Type Description
    System.String

    BundleResolve

    Bundle resolve event asynchronous handler.

    public BundleOdbBackend.BundleResolveDelegate BundleResolve { get; set; }
    Property Value
    Type Description
    BundleOdbBackend.BundleResolveDelegate

    ContentIndexMap

    Gets the asset index map.

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

    The asset index map.

    | Improve this Doc View Source

    Methods


    CreateBundle(String, IOdbBackend, ObjectId[], ISet<ObjectId>, Dictionary<String, ObjectId>, IList<String>, Boolean)

    public static void CreateBundle(string bundleUrl, IOdbBackend backend, ObjectId[] objectIds, ISet<ObjectId> disableCompressionIds, Dictionary<string, ObjectId> indexMap, IList<string> dependencies, bool useIncrementalBundle)
    Parameters
    Type Name Description
    System.String bundleUrl
    IOdbBackend backend
    ObjectId[] objectIds
    System.Collections.Generic.ISet<ObjectId> disableCompressionIds
    System.Collections.Generic.Dictionary<System.String, ObjectId> indexMap
    System.Collections.Generic.IList<System.String> dependencies
    System.Boolean useIncrementalBundle

    CreateStream()

    public OdbStreamWriter CreateStream()
    Returns
    Type Description
    OdbStreamWriter

    Delete(ObjectId)

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

    DeleteBundles(Func<String, Boolean>)

    public void DeleteBundles(Func<string, bool> bundleFileDeletePredicate)
    Parameters
    Type Name Description
    System.Func<System.String, System.Boolean> bundleFileDeletePredicate

    Dispose()

    public void Dispose()

    EnumerateObjects()

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

    Exists(ObjectId)

    public bool Exists(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId
    Returns
    Type Description
    System.Boolean

    GetFilePath(ObjectId)

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

    GetObjectInfos()

    public Dictionary<ObjectId, BundleOdbBackend.ObjectInfo> GetObjectInfos()
    Returns
    Type Description
    System.Collections.Generic.Dictionary<ObjectId, BundleOdbBackend.ObjectInfo>

    GetSize(ObjectId)

    public int GetSize(ObjectId objectId)
    Parameters
    Type Name Description
    ObjectId objectId
    Returns
    Type Description
    System.Int32

    LoadBundle(String, ObjectDatabaseContentIndexMap)

    Loads the specified bundle.

    public async Task LoadBundle(string bundleName, ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap)
    Parameters
    Type Name Description
    System.String bundleName

    Name of the bundle.

    ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap

    The object database asset index map, where newly loaded assets will be merged (ignored if null).

    Returns
    Type Description
    System.Threading.Tasks.Task

    Task that will complete when bundle is loaded.


    LoadBundleFromUrl(String, ObjectDatabaseContentIndexMap, String, Boolean)

    public async Task LoadBundleFromUrl(string bundleName, ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap, string bundleUrl, bool ignoreDependencies = false)
    Parameters
    Type Name Description
    System.String bundleName
    ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap
    System.String bundleUrl
    System.Boolean ignoreDependencies
    Returns
    Type Description
    System.Threading.Tasks.Task

    OpenStream(ObjectId, VirtualFileMode, VirtualFileAccess, VirtualFileShare)

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

    ReadBundleDescription(Stream)

    Reads the bundle description.

    public static BundleDescription ReadBundleDescription(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream.

    Returns
    Type Description
    BundleDescription

    The bundle description.

    Exceptions
    Type Condition
    System.InvalidOperationException

    Invalid bundle header or Bundle has not been properly written


    ReadBundleHeader(String, out List<String>)

    public static BundleDescription ReadBundleHeader(string bundleUrl, out List<string> bundleUrls)
    Parameters
    Type Name Description
    System.String bundleUrl
    System.Collections.Generic.List<System.String> bundleUrls
    Returns
    Type Description
    BundleDescription

    TryGetObjectLocation(ObjectId, out String, out Int64, out Int64)

    public bool TryGetObjectLocation(ObjectId objectId, out string filePath, out long start, out long end)
    Parameters
    Type Name Description
    ObjectId objectId
    System.String filePath
    System.Int64 start
    System.Int64 end
    Returns
    Type Description
    System.Boolean

    UnloadBundle(String, ObjectDatabaseContentIndexMap)

    Unload the specified bundle.

    public void UnloadBundle(string bundleName, ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap)
    Parameters
    Type Name Description
    System.String bundleName

    Name of the bundle.

    ObjectDatabaseContentIndexMap objectDatabaseContentIndexMap

    The object database asset index map, where newly loaded assets will be merged (ignored if null).


    Write(ObjectId, Stream, Int32, Boolean)

    public ObjectId Write(ObjectId objectId, Stream dataStream, int length, bool forceWrite)
    Parameters
    Type Name Description
    ObjectId objectId
    System.IO.Stream dataStream
    System.Int32 length
    System.Boolean forceWrite
    Returns
    Type Description
    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