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

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

Static Methods

Method Return Type Description
load(context, sharedObjectRegistry, existing) FluidDataStoreRuntime Loads the data store runtime

Properties

Property Type Description
absolutePath string
attachState AttachState
channelsRoutingContext this
clientDetails IClientDetails
clientId string | undefined
connected boolean
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
disposed boolean
id string
IFluidHandleContext this
IFluidRouter this
isAttached boolean
logger ITelemetryLogger
objectsRoutingContext this
options ILoaderOptions
rootRoutingContext this
routeContext IFluidHandleContext
visibilityState VisibilityState

Methods

Method Modifiers Return Type Description
applyStashedOp(content) Promise<unknown>
attachGraph() void This function is called when a handle to this data store is added to a visible DDS.
bind(handle) void
bindChannel(channel) void 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.
bindToContext() void 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.
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() void 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.
process(message, local, localOpMetadata) void
processSignal(message, local) void
request(request) Promise<IResponse>
resolveHandle(request) Promise<IResponse>
reSubmit(type, content, localOpMetadata) void 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.
rollback(type, content, localOpMetadata) optional void Revert 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) void 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.
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

Parameter Type Description
dataStoreContext IFluidDataStoreContext
sharedObjectRegistry ISharedObjectRegistry
existing boolean

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

Parameter Type Description
content any

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

Parameter Type Description
handle IFluidHandle

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

Parameter Type Description
channel IChannel channel 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

Parameter Type Description
id string | undefined
type string

Returns

Return type: IChannel

dispose

Signature
dispose(): void;

getAttachSummary

Signature
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;

Parameters

Parameter Modifiers Type Description
telemetryContext optional ITelemetryContext

Returns

Return type: ISummaryTreeWithStats

getAudience

Signature
getAudience(): IAudience;

Returns

Return type: IAudience

getChannel

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

Parameters

Parameter Type Description
id string

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

Parameter Modifiers Type Description
fullGC optional boolean true 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

Parameter Type Description
context IFluidDataStoreContext The data store context
sharedObjectRegistry ISharedObjectRegistry The registry of shared objects used by this data store
existing boolean If 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

Parameter Type Description
message ISequencedDocumentMessage
local boolean
localOpMetadata unknown

processSignal

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

Parameters

Parameter Type Description
message IInboundSignalMessage
local boolean

request

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

Parameters

Parameter Type Description
request IRequest

Returns

Return type: Promise<IResponse>

resolveHandle

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

Parameters

Parameter Type Description
request IRequest

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

Parameter Type Description
type DataStoreMessageType
content any The content of the original message.
localOpMetadata unknown The local metadata associated with the original message.

rollback

Revert a local op.

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

Parameters

Parameter Type Description
type DataStoreMessageType
content any The content of the original message.
localOpMetadata unknown The local metadata associated with the original message.

setConnectionState

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

Parameters

Parameter Modifiers Type Description
connected boolean
clientId optional string

submitMessage

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

Parameters

Parameter Type Description
type DataStoreMessageType
content any
localOpMetadata unknown

submitSignal

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

Parameters

Parameter Type Description
type string
content any

summarize

Returns a summary at the current sequence number.

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

Parameters

Parameter Modifiers Type Description
fullTree optional boolean true to bypass optimizations and force a full summary tree
trackState optional boolean This tells whether we should track state from this summary.
telemetryContext optional ITelemetryContext summary 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

Parameter Modifiers Type Description
usedRoutes string[] The routes that are used in all contexts in this channel.
gcTimestamp optional number The 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

Parameter Type Description
blob ArrayBufferLike

Returns

Return type: Promise<IFluidHandle<ArrayBufferLike>>

waitAttached

Will return when the data store is attached.

Signature
waitAttached(): Promise<void>;

Returns

Return type: Promise<void>