Skip to main content

FluidDataStoreRuntime Class

Base data store class

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/datastore/legacy.

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

Signature

export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext

Extends: TypedEventEmitter<IFluidDataStoreRuntimeEvents>

Implements: IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext

Constructors

ConstructorAlertsDescription
(constructor)(dataStoreContext, sharedObjectRegistry, existing, provideEntryPoint, policies)BetaCreate an instance of a DataStore runtime.

Properties

PropertyAlertsModifiersTypeDescription
absolutePathBetareadonlystring
activeLocalOperationActivityBetareadonly"applyStashed" | "rollback" | undefined
attachStateBetareadonlyAttachState
channelsRoutingContextBetareadonlythis
clientDetailsBetareadonlyIClientDetails
clientIdBetareadonlystring | undefined
connectedBetareadonlyboolean
deltaManagerBetareadonlyIDeltaManagerErased
deltaManagerInternalBetareadonlyIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
disposedBetareadonlyboolean
entryPointBetareadonlyIFluidHandleInternal<FluidObject>Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting with it.
idBetareadonlystring
idCompressorBetareadonlyIIdCompressor | undefined
IFluidHandleContextBetareadonlythis
ILayerCompatDetailsBetaoptional, readonlyunknownThe compatibility details of the DataStore layer that is exposed to the Runtime layer for validating Runtime-DataStore compatibility.
isAttachedBetareadonlyboolean
isReadOnlyBetareadonly() => booleanGet the current readonly state.
loggerBetareadonlyITelemetryLoggerExt
minVersionForCollabBetaoptional, readonlyMinimumVersionForCollab | undefinedSee IFluidDataStoreRuntimeInternalConfig.minVersionForCollab.
objectsRoutingContextBetareadonlythis
optionsBetareadonlyRecord<string | number, any>
policiesBetareadonlyIFluidDataStorePolicies
rootRoutingContextBetareadonlythis
routeContextBetareadonlyIFluidHandleContext
visibilityStateBetaVisibilityState

Methods

MethodAlertsModifiersReturn TypeDescription
addChannel(channel)BetavoidApi which allows caller to create the channel first and then add it to the runtime. The channel type should be present in the registry, otherwise the runtime would reject the channel. Also the runtime used to create the channel object should be same to which it is added.
applyStashedOp(content)BetaPromise<unknown>
attachGraph()BetavoidThis function is called when a handle to this data store is added to a visible DDS.
bind(handle)Betavoid
bindChannel(channel)BetavoidBinds a channel with the runtime. If the runtime is attached we will attach the channel right away. If the runtime is not attached we will defer the attach until the runtime attaches.
createChannel(idArg, type)BetaIChannel
dispose()Betavoid
getAttachGCData(telemetryContext)BetaIGarbageCollectionDataGet the GC Data for the initial state being attached so remote clients can learn of this DataStore's outbound routes
getAttachSummary(telemetryContext)BetaISummaryTreeWithStats
getAudience()BetaIAudience
getChannel(id)BetaPromise<IChannel>
getGCData(fullGC)BetaPromise<IGarbageCollectionData>

Generates data used for garbage collection. This includes a list of GC nodes that represent this channel including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the document. It does the following:

  1. Calls into each child context to get its GC data.
  1. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be identified as belonging to the child.
  1. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent the GC data of this channel.
getQuorum()BetaIQuorumClients
makeVisibleAndAttachGraph()Betavoid

This function is called when a data store becomes root. It does the following:

  1. Marks the data store locally visible in the container.
  1. Attaches the graph of all the handles bound to it.
  1. Calls into the data store context to mark it visible in the container too. If the container is globally visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes globally visible.
notifyReadOnlyState(readonly)BetavoidThis function is used by the datastore context to configure the readonly state of this object. It should not be invoked by any other callers.
processMessages(messageCollection)BetavoidProcess messages for this data store. The messages here are contiguous messages in a batch.
processSignal(message, local)Betavoid
request(request)BetaPromise<IResponse>
resolveHandle(request)BetaPromise<IResponse>
reSubmit(type, content, localOpMetadata, squash)BetavoidFor messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message. For all other messages, just submit it again. This typically happens when we reconnect and there are unacked messages.
rollback(type, content, localOpMetadata)BetaoptionalvoidRevert a local op.
setAttachState(attachState)Betavoid
setConnectionState(connected, clientId)Betavoid
submitSignal(type, content, targetClientId)BetavoidSubmits the signal to be sent to other clients.
summarize(fullTree, trackState, telemetryContext)BetaPromise<ISummaryTreeWithStats>Returns a summary at the current sequence number.
updateUsedRoutes(usedRoutes)BetavoidAfter GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to update their used routes.
uploadBlob(blob, signal)BetaPromise<IFluidHandle<ArrayBufferLike>>
validateChannelId(id)BetavoidValidate user provided channel ID Channel ID has limitations. "/" is not allowed as IDs in storage can not have slashes - we parse tree paths and use "/" as separator. IDs cannot start with "_" as it could result in collision of IDs with auto-assigned (by FF) short IDs.
waitAttached()BetaPromise<void>Will return when the data store is attached.

Constructor Details

(constructor)

Create an instance of a DataStore runtime.

This API is provided for existing users, but is not recommended for new users.

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

Signature

constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>, policies?: Partial<IFluidDataStorePolicies>);

Parameters

ParameterModifiersTypeDescription
dataStoreContextIFluidDataStoreContextContext object for the runtime.
sharedObjectRegistryISharedObjectRegistryThe registry of shared objects that this data store will be able to instantiate.
existingbooleanPass 'true' if loading this datastore from an existing file; pass 'false' otherwise.
provideEntryPoint(runtime: IFluidDataStoreRuntime) => Promise<FluidObject>Function to initialize the entryPoint object for the data store runtime. The handle to this data store runtime will point to the object returned by this function. If this function is not provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen and the primary way of interacting with some Fluid objects, and should be used if possible.
policiesoptionalPartial<IFluidDataStorePolicies>

Property Details

absolutePath

This API is provided for existing users, but is not recommended for new users.

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

Signature

get absolutePath(): string;

Type: string

activeLocalOperationActivity

This API is provided for existing users, but is not recommended for new users.

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

Signature

get activeLocalOperationActivity(): "applyStashed" | "rollback" | undefined;

Type: "applyStashed" | "rollback" | undefined

attachState

This API is provided for existing users, but is not recommended for new users.

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

Signature

get attachState(): AttachState;

Type: AttachState

channelsRoutingContext

This API is provided for existing users, but is not recommended for new users.

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

Signature

get channelsRoutingContext(): this;

Type: this

clientDetails

This API is provided for existing users, but is not recommended for new users.

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

Signature

get clientDetails(): IClientDetails;

Type: IClientDetails

clientId

This API is provided for existing users, but is not recommended for new users.

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

Signature

get clientId(): string | undefined;

Type: string | undefined

connected

This API is provided for existing users, but is not recommended for new users.

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

Signature

get connected(): boolean;

Type: boolean

deltaManager

This API is provided for existing users, but is not recommended for new users.

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

Signature

get deltaManager(): IDeltaManagerErased;

Type: IDeltaManagerErased

deltaManagerInternal

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly deltaManagerInternal: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

Type: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>

disposed

This API is provided for existing users, but is not recommended for new users.

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

Signature

get disposed(): boolean;

Type: boolean

entryPoint

Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting with it.

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly entryPoint: IFluidHandleInternal<FluidObject>;

Type: IFluidHandleInternal<FluidObject>

id

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly id: string;

Type: string

idCompressor

This API is provided for existing users, but is not recommended for new users.

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

Signature

get idCompressor(): IIdCompressor | undefined;

Type: IIdCompressor | undefined

IFluidHandleContext

This API is provided for existing users, but is not recommended for new users.

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

Signature

get IFluidHandleContext(): this;

Type: this

ILayerCompatDetails

The compatibility details of the DataStore layer that is exposed to the Runtime layer for validating Runtime-DataStore compatibility.

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly ILayerCompatDetails?: unknown;

Type: unknown

Remarks

This is for internal use only. The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class is currently marked as legacy alpha. So, using unknown here.

isAttached

This API is provided for existing users, but is not recommended for new users.

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

Signature

get isAttached(): boolean;

Type: boolean

isReadOnly

Get the current readonly state.

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly isReadOnly: () => boolean;

Type: () => boolean

logger

This API is provided for existing users, but is not recommended for new users.

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

Signature

get logger(): ITelemetryLoggerExt;

Type: ITelemetryLoggerExt

minVersionForCollab

See IFluidDataStoreRuntimeInternalConfig.minVersionForCollab.

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly minVersionForCollab?: MinimumVersionForCollab | undefined;

Type: MinimumVersionForCollab | undefined

objectsRoutingContext

This API is provided for existing users, but is not recommended for new users.

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

Signature

get objectsRoutingContext(): this;

Type: this

options

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly options: Record<string | number, any>;

Type: Record<string | number, any>

policies

This API is provided for existing users, but is not recommended for new users.

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

Signature

readonly policies: IFluidDataStorePolicies;

Type: IFluidDataStorePolicies

rootRoutingContext

This API is provided for existing users, but is not recommended for new users.

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

Signature

get rootRoutingContext(): this;

Type: this

routeContext

This API is provided for existing users, but is not recommended for new users.

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

Signature

get routeContext(): IFluidHandleContext;

Type: IFluidHandleContext

visibilityState

This API is provided for existing users, but is not recommended for new users.

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

Signature

visibilityState: VisibilityState;

Type: VisibilityState

Method Details

addChannel

Api which allows caller to create the channel first and then add it to the runtime. The channel type should be present in the registry, otherwise the runtime would reject the channel. Also the runtime used to create the channel object should be same to which it is added.

This API is provided for existing users, but is not recommended for new users.

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

Signature

addChannel(channel: IChannel): void;

Parameters

ParameterTypeDescription
channelIChannelchannel which needs to be added to the runtime.

applyStashedOp

This API is provided for existing users, but is not recommended for new users.

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

Signature

applyStashedOp(content: any): Promise<unknown>;

Parameters

ParameterTypeDescription
contentany

Returns

Return type: Promise<unknown>

attachGraph

This function is called when a handle to this data store is added to a visible DDS.

This API is provided for existing users, but is not recommended for new users.

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

Signature

attachGraph(): void;

bind

This API is provided for existing users, but is not recommended for new users.

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

Signature

bind(handle: IFluidHandle): void;

Parameters

ParameterTypeDescription
handleIFluidHandle

bindChannel

Binds a channel with the runtime. If the runtime is attached we will attach the channel right away. If the runtime is not attached we will defer the attach until the runtime attaches.

This API is provided for existing users, but is not recommended for new users.

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

Signature

bindChannel(channel: IChannel): void;

Parameters

ParameterTypeDescription
channelIChannelchannel to be registered.

createChannel

This API is provided for existing users, but is not recommended for new users.

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

Signature

createChannel(idArg: string | undefined, type: string): IChannel;

Parameters

ParameterTypeDescription
idArgstring | undefined
typestring

Returns

Return type: IChannel

dispose

This API is provided for existing users, but is not recommended for new users.

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

Signature

dispose(): void;

getAttachGCData

Get the GC Data for the initial state being attached so remote clients can learn of this DataStore's outbound routes

This API is provided for existing users, but is not recommended for new users.

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

Signature

getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;

Parameters

ParameterModifiersTypeDescription
telemetryContextoptionalITelemetryContext

Returns

Return type: IGarbageCollectionData

getAttachSummary

This API is provided for existing users, but is not recommended for new users.

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

Signature

getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;

Parameters

ParameterModifiersTypeDescription
telemetryContextoptionalITelemetryContext

Returns

Return type: ISummaryTreeWithStats

getAudience

This API is provided for existing users, but is not recommended for new users.

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

Signature

getAudience(): IAudience;

Returns

Return type: IAudience

getChannel

This API is provided for existing users, but is not recommended for new users.

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

Signature

getChannel(id: string): Promise<IChannel>;

Parameters

ParameterTypeDescription
idstring

Returns

Return type: Promise<IChannel>

getGCData

Generates data used for garbage collection. This includes a list of GC nodes that represent this channel including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the document. It does the following:

  1. Calls into each child context to get its GC data.
  1. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be identified as belonging to the child.
  1. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent the GC data of this channel.
This API is provided for existing users, but is not recommended for new users.

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

Signature

getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;

Parameters

ParameterModifiersTypeDescription
fullGCoptionalbooleantrue to bypass optimizations and force full generation of GC data.

Returns

Return type: Promise<IGarbageCollectionData>

getQuorum

This API is provided for existing users, but is not recommended for new users.

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

Signature

getQuorum(): IQuorumClients;

Returns

Return type: IQuorumClients

makeVisibleAndAttachGraph

This function is called when a data store becomes root. It does the following:

  1. Marks the data store locally visible in the container.
  1. Attaches the graph of all the handles bound to it.
  1. Calls into the data store context to mark it visible in the container too. If the container is globally visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes globally visible.
This API is provided for existing users, but is not recommended for new users.

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

Signature

makeVisibleAndAttachGraph(): void;

notifyReadOnlyState

This function is used by the datastore context to configure the readonly state of this object. It should not be invoked by any other callers.

This API is provided for existing users, but is not recommended for new users.

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

Signature

notifyReadOnlyState(readonly: boolean): void;

Parameters

ParameterTypeDescription
readonlyboolean

processMessages

Process messages for this data store. The messages here are contiguous messages in a batch.

This API is provided for existing users, but is not recommended for new users.

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

Signature

processMessages(messageCollection: IRuntimeMessageCollection): void;

Parameters

ParameterTypeDescription
messageCollectionIRuntimeMessageCollectionThe collection of messages to process.

processSignal

This API is provided for existing users, but is not recommended for new users.

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

Signature

processSignal(message: IInboundSignalMessage, local: boolean): void;

Parameters

ParameterTypeDescription
messageIInboundSignalMessage
localboolean

request

This API is provided for existing users, but is not recommended for new users.

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

Signature

request(request: IRequest): Promise<IResponse>;

Parameters

ParameterTypeDescription
requestIRequest

Returns

Return type: Promise<IResponse>

resolveHandle

This API is provided for existing users, but is not recommended for new users.

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

Signature

resolveHandle(request: IRequest): Promise<IResponse>;

Parameters

ParameterTypeDescription
requestIRequest

Returns

Return type: Promise<IResponse>

reSubmit

For messages of type MessageType.Operation, finds the right channel and asks it to resubmit the message. For all other messages, just submit it again. This typically happens when we reconnect and there are unacked messages.

This API is provided for existing users, but is not recommended for new users.

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

Signature

reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown, squash?: boolean): void;

Parameters

ParameterModifiersTypeDescription
typeDataStoreMessageType
contentanyThe content of the original message.
localOpMetadataunknownThe local metadata associated with the original message.
squashoptionalboolean

rollback

Revert a local op.

This API is provided for existing users, but is not recommended for new users.

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

Signature

rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;

Parameters

ParameterTypeDescription
typeDataStoreMessageType
contentanyThe content of the original message.
localOpMetadataunknownThe local metadata associated with the original message.

setAttachState

This API is provided for existing users, but is not recommended for new users.

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

Signature

setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;

Parameters

ParameterTypeDescription
attachStateAttachState.Attaching | AttachState.Attached

setConnectionState

This API is provided for existing users, but is not recommended for new users.

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

Signature

setConnectionState(connected: boolean, clientId?: string): void;

Parameters

ParameterModifiersTypeDescription
connectedboolean
clientIdoptionalstring

submitSignal

Submits the signal to be sent to other clients.

This API is provided for existing users, but is not recommended for new users.

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

Signature

submitSignal(type: string, content: unknown, targetClientId?: string): void;

Parameters

ParameterModifiersTypeDescription
typestringType of the signal.
contentunknownContent of the signal. Should be a JSON serializable object or primitive.
targetClientIdoptionalstringWhen specified, the signal is only sent to the provided client id.

summarize

Returns a summary at the current sequence number.

This API is provided for existing users, but is not recommended for new users.

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

Signature

summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;

Parameters

ParameterModifiersTypeDescription
fullTreeoptionalbooleantrue to bypass optimizations and force a full summary tree
trackStateoptionalbooleanThis tells whether we should track state from this summary.
telemetryContextoptionalITelemetryContextsummary data passed through the layers for telemetry purposes

Returns

Return type: Promise<ISummaryTreeWithStats>

updateUsedRoutes

After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to update their used routes.

This API is provided for existing users, but is not recommended for new users.

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

Signature

updateUsedRoutes(usedRoutes: string[]): void;

Parameters

ParameterTypeDescription
usedRoutesstring[]The routes that are used in all contexts in this channel.

uploadBlob

This API is provided for existing users, but is not recommended for new users.

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

Signature

uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;

Parameters

ParameterModifiersTypeDescription
blobArrayBufferLike
signaloptionalAbortSignal

Returns

Return type: Promise<IFluidHandle<ArrayBufferLike>>

validateChannelId

Validate user provided channel ID Channel ID has limitations. "/" is not allowed as IDs in storage can not have slashes - we parse tree paths and use "/" as separator. IDs cannot start with "_" as it could result in collision of IDs with auto-assigned (by FF) short IDs.

This API is provided for existing users, but is not recommended for new users.

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

Signature

protected validateChannelId(id: string): void;

Parameters

ParameterTypeDescription
idstringchannel ID.

waitAttached

Will return when the data store is attached.

This API is provided for existing users, but is not recommended for new users.

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

Signature

waitAttached(): Promise<void>;

Returns

Return type: Promise<void>