Skip to main content

DataStoreOptions Interface

Options which define how to construct a particular DataStoreKind.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/shared-object-base/alpha.

For more information about our API support guarantees, see here.

Input

This type is "input," meaning that code outside of the library defining it should not read from it. Future versions of this type may add optional members or make typing of members more general.

Signature

export interface DataStoreOptions<in out TRoot extends IFluidLoadable, out TOutput>

Type Parameters

ParameterConstraintDescription
TRootIFluidLoadable
TOutput

Remarks

Use defineDataStore(options) to create a DataStoreKind from these options.

Properties

PropertyAlertsModifiersTypeDescription
registryAlphareadonlySharedObjectRegistry

The registry of shared object kinds (including other data stores) that can be loaded or created within this data store.

TODO: actually allow this to contain data stores.

typeAlphareadonlystringThe type identifier for the data object factory.

Methods

MethodAlertsReturn TypeDescription
instantiateFirstTime(rootCreator, context)AlphaPromise<TRoot>Create the initial content of the data store, and return the root shared object.
view(root, context)AlphaPromise<TOutput>Construct a view of the data store's root shared object.

Property Details

registry

The registry of shared object kinds (including other data stores) that can be loaded or created within this data store.

TODO: actually allow this to contain data stores.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly registry: SharedObjectRegistry;

Type: SharedObjectRegistry

type

The type identifier for the data object factory.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly type: string;

Type: string

Remarks

Persisted identifier which specifies which DataStoreKind to use when loading it.

Method Details

instantiateFirstTime

Create the initial content of the data store, and return the root shared object.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

instantiateFirstTime(rootCreator: SharedObjectCreator<TRoot>, context: DataStoreContext): Promise<TRoot>;

Parameters

ParameterTypeDescription
rootCreatorSharedObjectCreator<TRoot>
contextDataStoreContext

Returns

Return type: Promise<TRoot>

view

Construct a view of the data store's root shared object.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

view(root: TRoot, context: DataStoreContext): Promise<TOutput>;

Parameters

ParameterTypeDescription
rootTRootThe root shared object of the data store, created by instantiateFirstTime (though possibly created by another client and loaded by this one).
contextDataStoreContextA DataStoreContext that can be used to create additional shared objects.

Returns

Return type: Promise<TOutput>