Packages > @fluidframework/datastore-definitions > IFluidDataStoreRuntime

IFluidDataStoreRuntime Interface

Represents the runtime for the data store. Contains helper functions/state of the data store.

Signature

export interface IFluidDataStoreRuntime extends IEventProvider<IFluidDataStoreRuntimeEvents>, IDisposable

Extends: IEventProvider <IFluidDataStoreRuntimeEvents >, IDisposable

Properties

Property Modifiers Type Description
attachState readonly AttachState Indicates the attachment state of the data store to a host service.
channelsRoutingContext readonly IFluidHandleContext
clientId readonly string | undefined
connected readonly boolean
deltaManager readonly IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
entryPoint readonly IFluidHandle<FluidObject> Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting with it.
id readonly string
idCompressor optional, readonly IIdCompressor
IFluidHandleContext readonly IFluidHandleContext
logger readonly ITelemetryBaseLogger
objectsRoutingContext readonly IFluidHandleContext
options readonly Record<string | number, any>
rootRoutingContext readonly IFluidHandleContext

Methods

Method Return Type Description
addChannel(channel) void This api allows adding channel to data store after it was created. This allows callers to cusmomize channel instance. For example, channel implementation could have various modes of operations. As long as such configuration is provided at creation and stored in summaries (such that all users of such channel instance behave the same), this could be useful technique to have customized solutions without introducing a number of data structures that all have same implementation. This is also useful for scenarios like SharedTree DDS, where schema is provided at creation and stored in a summary. The channel type should be present in the registry, otherwise the runtime would reject the channel. The runtime used to create the channel object should be same to which it is added.
bindChannel(channel) void Bind the channel with the data store runtime. If the runtime is attached then we attach the channel to make it live.
createChannel(id, type) IChannel Creates a new channel of the given type.
ensureNoDataModelChanges(callback) T

Invokes the given callback and expects that no ops are submitted until execution finishes. If an op is submitted, an error will be raised.

Can be disabled by feature gate Fluid.ContainerRuntime.DisableOpReentryCheck

getAudience() IAudience Returns the current audience.
getChannel(id) Promise<IChannel> Returns the channel with the given id
getQuorum() IQuorumClients Returns the current quorum.
submitSignal(type, content, targetClientId) void Submits the signal to be sent to other clients.
uploadBlob(blob, signal) Promise<IFluidHandle<ArrayBufferLike>> Api to upload a blob of data.
waitAttached() Promise<void> Resolves when a local data store is attached.

Property Details

attachState

Indicates the attachment state of the data store to a host service.

Signature

readonly attachState: AttachState;

channelsRoutingContext

Signature

readonly channelsRoutingContext: IFluidHandleContext;

clientId

Signature

readonly clientId: string | undefined;

connected

Signature

readonly connected: boolean;

deltaManager

Signature

readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

entryPoint

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

Signature

readonly entryPoint: IFluidHandle<FluidObject>;

id

Signature

readonly id: string;

idCompressor

Signature

readonly idCompressor?: IIdCompressor;

IFluidHandleContext

Signature

readonly IFluidHandleContext: IFluidHandleContext;

logger

Signature

readonly logger: ITelemetryBaseLogger;

objectsRoutingContext

Signature

readonly objectsRoutingContext: IFluidHandleContext;

options

Signature

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

rootRoutingContext

Signature

readonly rootRoutingContext: IFluidHandleContext;

Method Details

addChannel

This api allows adding channel to data store after it was created. This allows callers to cusmomize channel instance. For example, channel implementation could have various modes of operations. As long as such configuration is provided at creation and stored in summaries (such that all users of such channel instance behave the same), this could be useful technique to have customized solutions without introducing a number of data structures that all have same implementation. This is also useful for scenarios like SharedTree DDS, where schema is provided at creation and stored in a summary. The channel type should be present in the registry, otherwise the runtime would reject the channel. The runtime used to create the channel object should be same to which it is added.

Signature

addChannel(channel: IChannel): void;

Parameters

Parameter Type Description
channel IChannel channel which needs to be added to the runtime.

bindChannel

Bind the channel with the data store runtime. If the runtime is attached then we attach the channel to make it live.

Signature

bindChannel(channel: IChannel): void;

Parameters

Parameter Type Description
channel IChannel

createChannel

Creates a new channel of the given type.

Signature

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

Parameters

Parameter Type Description
id string | undefined ID of the channel to be created. A unique ID will be generated if left undefined.
type string Type of the channel.

Returns

Return type: IChannel

ensureNoDataModelChanges

Invokes the given callback and expects that no ops are submitted until execution finishes. If an op is submitted, an error will be raised.

Can be disabled by feature gate Fluid.ContainerRuntime.DisableOpReentryCheck

Signature

ensureNoDataModelChanges<T>(callback: () => T): T;

Parameters

Parameter Type Description
callback () => T the callback to be invoked

Returns

Return type: T

getAudience

Returns the current audience.

Signature

getAudience(): IAudience;

Returns

Return type: IAudience

getChannel

Returns the channel with the given id

Signature

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

Parameters

Parameter Type Description
id string

Returns

Return type: Promise<IChannel >

getQuorum

Returns the current quorum.

Signature

getQuorum(): IQuorumClients;

Returns

Return type: IQuorumClients

submitSignal

Submits the signal to be sent to other clients.

Signature

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

Parameters

Parameter Modifiers Type Description
type string Type of the signal.
content any Content of the signal.
targetClientId optional string When specified, the signal is only sent to the provided client id.

uploadBlob

Api to upload a blob of data.

Signature

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

Parameters

Parameter Modifiers Type Description
blob ArrayBufferLike blob to be uploaded.
signal optional AbortSignal

Returns

Return type: Promise<IFluidHandle <ArrayBufferLike>>

waitAttached

Resolves when a local data store is attached.

Signature

waitAttached(): Promise<void>;

Returns

Return type: Promise<void>