Skip to main content
Version: v1

FluidDataStoreRuntime Class

Base data store class

Signature​

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

Extends: TypedEventEmitter<IFluidDataStoreRuntimeEvents

Implements: IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext

Constructors​

ConstructorDescription
(constructor)(dataStoreContext, sharedObjectRegistry, existing)Constructs a new instance of the FluidDataStoreRuntime class

Static Methods​

MethodReturn TypeDescription
load(context, sharedObjectRegistry, existing)FluidDataStoreRuntimeLoads the data store runtime

Properties​

PropertyTypeDescription
absolutePathstring
attachStateAttachState
channelsRoutingContextthis
clientDetailsIClientDetails
clientIdstring | undefined
connectedboolean
deltaManagerIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
disposedboolean
idstring
IFluidHandleContextthis
IFluidRouterthis
isAttachedboolean
loggerITelemetryLogger
objectsRoutingContextthis
optionsILoaderOptions
rootRoutingContextthis
routeContextIFluidHandleContext
visibilityStateVisibilityState

Methods​

MethodModifiersReturn TypeDescription
applyStashedOp(content)Promise<unknown>
attachGraph()voidThis function is called when a handle to this data store is added to a visible DDS.
bind(handle)void
bindChannel(channel)voidBinds 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.
bindToContext()voidBinds this runtime to the container This includes the following: 1. Sending an Attach op that includes all existing state 2. Attaching the graph if the data store becomes attached.
createChannel(id, type)IChannel
dispose()void
getAttachSummary(telemetryContext)ISummaryTreeWithStats
getAudience()IAudience
getChannel(id)Promise<IChannel>
getGCData(fullGC)Promise<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. 2. 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. 3. 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()IQuorumClients
makeVisibleAndAttachGraph()voidThis function is called when a data store becomes root. It does the following: 1. Marks the data store locally visible in the container. 2. Attaches the graph of all the handles bound to it. 3. 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.
process(message, local, localOpMetadata)void
processSignal(message, local)void
request(request)Promise<IResponse>
resolveHandle(request)Promise<IResponse>
reSubmit(type, content, localOpMetadata)voidFor 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)optionalvoidRevert a local op.
setConnectionState(connected, clientId)void
submitMessage(type, content, localOpMetadata)void
submitSignal(type, content)void
summarize(fullTree, trackState, telemetryContext)Promise<ISummaryTreeWithStats>Returns a summary at the current sequence number.
updateUsedRoutes(usedRoutes, gcTimestamp)voidAfter 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)Promise<IFluidHandle<ArrayBufferLike>>
waitAttached()Promise<void>Will return when the data store is attached.

Constructor Details​

(constructor)​

Constructs a new instance of the FluidDataStoreRuntime class

Signature​

constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean);

Parameters​

ParameterTypeDescription
dataStoreContextIFluidDataStoreContext
sharedObjectRegistryISharedObjectRegistry
existingboolean

Property Details​

absolutePath​

Signature​

get absolutePath(): string;

Type: string

attachState​

Signature​

get attachState(): AttachState;

Type: AttachState

channelsRoutingContext​

Signature​

get channelsRoutingContext(): this;

Type: this

clientDetails​

Signature​

get clientDetails(): IClientDetails;

Type: IClientDetails

clientId​

Signature​

get clientId(): string | undefined;

Type: string | undefined

connected​

Signature​

get connected(): boolean;

Type: boolean

deltaManager​

Signature​

readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

Type: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>

disposed​

Signature​

get disposed(): boolean;

Type: boolean

id​

Signature​

readonly id: string;

Type: string

IFluidHandleContext​

Signature​

get IFluidHandleContext(): this;

Type: this

IFluidRouter​

Signature​

get IFluidRouter(): this;

Type: this

isAttached​

Signature​

get isAttached(): boolean;

Type: boolean

logger​

Signature​

readonly logger: ITelemetryLogger;

Type: ITelemetryLogger

objectsRoutingContext​

Signature​

get objectsRoutingContext(): this;

Type: this

options​

Signature​

readonly options: ILoaderOptions;

Type: ILoaderOptions

rootRoutingContext​

Signature​

get rootRoutingContext(): this;

Type: this

routeContext​

Signature​

get routeContext(): IFluidHandleContext;

Type: IFluidHandleContext

visibilityState​

Signature​

visibilityState: VisibilityState;

Type: VisibilityState

Method Details​

applyStashedOp​

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.

Signature​

attachGraph(): void;

bind​

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.

Signature​

bindChannel(channel: IChannel): void;

Parameters​

ParameterTypeDescription
channelIChannelchannel to be registered.

bindToContext​

Binds this runtime to the container This includes the following: 1. Sending an Attach op that includes all existing state 2. Attaching the graph if the data store becomes attached.

Signature​

bindToContext(): void;

createChannel​

Signature​

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

Parameters​

ParameterTypeDescription
idstring | undefined
typestring

Returns​

Return type: IChannel

dispose​

Signature​

dispose(): void;

getAttachSummary​

Signature​

getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;

Parameters​

ParameterModifiersTypeDescription
telemetryContextoptionalITelemetryContext

Returns​

Return type: ISummaryTreeWithStats

getAudience​

Signature​

getAudience(): IAudience;

Returns​

Return type: IAudience

getChannel​

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. 2. 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. 3. 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.

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​

Signature​

getQuorum(): IQuorumClients;

Returns​

Return type: IQuorumClients

load​

Loads the data store runtime

Signature​

static load(context: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean): FluidDataStoreRuntime;

Parameters​

ParameterTypeDescription
contextIFluidDataStoreContextThe data store context
sharedObjectRegistryISharedObjectRegistryThe registry of shared objects used by this data store
existingbooleanIf loading from an existing file.

Returns​

Return type: FluidDataStoreRuntime

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. 2. Attaches the graph of all the handles bound to it. 3. 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.

Signature​

makeVisibleAndAttachGraph(): void;

process​

Signature​

process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;

Parameters​

ParameterTypeDescription
messageISequencedDocumentMessage
localboolean
localOpMetadataunknown

processSignal​

Signature​

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

Parameters​

ParameterTypeDescription
messageIInboundSignalMessage
localboolean

request​

Signature​

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

Parameters​

ParameterTypeDescription
requestIRequest

Returns​

Return type: Promise<IResponse>

resolveHandle​

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.

Signature​

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

Parameters​

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

rollback​

Revert a local op.

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.

setConnectionState​

Signature​

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

Parameters​

ParameterModifiersTypeDescription
connectedboolean
clientIdoptionalstring

submitMessage​

Signature​

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

Parameters​

ParameterTypeDescription
typeDataStoreMessageType
contentany
localOpMetadataunknown

submitSignal​

Signature​

submitSignal(type: string, content: any): void;

Parameters​

ParameterTypeDescription
typestring
contentany

summarize​

Returns a summary at the current sequence number.

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.

Signature​

updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;

Parameters​

ParameterModifiersTypeDescription
usedRoutesstring[]The routes that are used in all contexts in this channel.
gcTimestampoptionalnumberThe time when GC was run that generated these used routes. If any node becomes unreferenced as part of this GC run, this should be used to update the time when it happens.

uploadBlob​

Signature​

uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;

Parameters​

ParameterTypeDescription
blobArrayBufferLike

Returns​

Return type: Promise<IFluidHandle<ArrayBufferLike>>

waitAttached​

Will return when the data store is attached.

Signature​

waitAttached(): Promise<void>;

Returns​

Return type: Promise<void>