Skip to main content
Version: v1

IFluidDataStoreContext Interface

Represents the context for the data store. It is used by the data store runtime to get information and call functionality to the container.

Signature

export interface IFluidDataStoreContext extends IEventProvider<IFluidDataStoreContextEvents>, Partial<IProvideFluidDataStoreRegistry>, IProvideFluidHandleContext

Extends: IEventProvider<IFluidDataStoreContextEvents>, Partial<IProvideFluidDataStoreRegistry>, IProvideFluidHandleContext

Properties

Property Alerts Modifiers Type Description
attachState AttachState Indicates the attachment state of the data store to a host service.
baseSnapshot ISnapshotTree | undefined
clientDetails IClientDetails
clientId string | undefined
connected boolean
containerRuntime IContainerRuntimeBase
createProps Deprecated optional any
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
id string
isLocalDataStore boolean A data store created by a client, is a local data store for that client. Also, when a detached container loads from a snapshot, all the data stores are treated as local data stores because at that stage the container still doesn't exists in storage and so the data store couldn't have been created by any other client. Value of this never changes even after the data store is attached. As implementer of data store runtime, you can use this property to check that this data store belongs to this client and hence implement any scenario based on that.
logger ITelemetryBaseLogger
options ILoaderOptions
packagePath readonly string[] The package path of the data store as per the package factory.
scope FluidObject Ambient services provided with the context
storage IDocumentStorageService

Methods

Method Alerts Modifiers Return Type Description
addedGCOutboundReference(srcHandle, outboundHandle) optional void Called when a new outbound reference is added to another node. This is used by garbage collection to identify all references added in the system.
bindToContext() Deprecated void
getAbsoluteUrl(relativeUrl) Promise<string | undefined> Get an absolute url to the container based on the provided relativeUrl. Returns undefined if the container or data store isn't attached to storage.
getAudience() IAudience Returns the current audience.
getBaseGCDetails() optional Promise<IGarbageCollectionDetailsBase> Returns the GC details in the initial summary of this data store. This is used to initialize the data store and its children with the GC details from the previous summary.
getCreateChildSummarizerNodeFn(id, createParam) CreateChildSummarizerNodeFn
getInitialGCSummaryDetails() Deprecated Promise<IGarbageCollectionSummaryDetails>
getQuorum() IQuorumClients Returns the current quorum.
makeLocallyVisible() optional void Called to make the data store locally visible in the container. This happens automatically for root data stores when they are marked as root. For non-root data stores, this happens when their handle is added to a visible DDS.
setChannelDirty(address) void Call by IFluidDataStoreChannel, indicates that a channel is dirty and needs to be part of the summary.
submitMessage(type, content, localOpMetadata) void Submits the message to be sent to other clients.
submitSignal(type, content) void Submits the signal to be sent to other clients.
uploadBlob(blob) Promise<IFluidHandle<ArrayBufferLike>>

Property Details

attachState

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

Signature

readonly attachState: AttachState;

Type: AttachState

baseSnapshot

Signature

readonly baseSnapshot: ISnapshotTree | undefined;

Type: ISnapshotTree | undefined

clientDetails

Signature

readonly clientDetails: IClientDetails;

Type: IClientDetails

clientId

Signature

readonly clientId: string | undefined;

Type: string | undefined

connected

Signature

readonly connected: boolean;

Type: boolean

containerRuntime

Signature

readonly containerRuntime: IContainerRuntimeBase;

Type: IContainerRuntimeBase

createProps

This API is deprecated and will be removed in a future release.

0.16 Issue #1635, #3631

Signature

readonly createProps?: any;

Type: any

deltaManager

Signature

readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

Type: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>

id

Signature

readonly id: string;

Type: string

isLocalDataStore

A data store created by a client, is a local data store for that client. Also, when a detached container loads from a snapshot, all the data stores are treated as local data stores because at that stage the container still doesn't exists in storage and so the data store couldn't have been created by any other client. Value of this never changes even after the data store is attached. As implementer of data store runtime, you can use this property to check that this data store belongs to this client and hence implement any scenario based on that.

Signature

readonly isLocalDataStore: boolean;

Type: boolean

logger

Signature

readonly logger: ITelemetryBaseLogger;

Type: ITelemetryBaseLogger

options

Signature

readonly options: ILoaderOptions;

Type: ILoaderOptions

packagePath

The package path of the data store as per the package factory.

Signature

readonly packagePath: readonly string[];

Type: readonly string[]

scope

Ambient services provided with the context

Signature

readonly scope: FluidObject;

Type: FluidObject

storage

Signature

readonly storage: IDocumentStorageService;

Type: IDocumentStorageService

Method Details

addedGCOutboundReference

Called when a new outbound reference is added to another node. This is used by garbage collection to identify all references added in the system.

Signature

addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;

Parameters

Parameter Type Description
srcHandle IFluidHandle The handle of the node that added the reference.
outboundHandle IFluidHandle The handle of the outbound node that is referenced.

bindToContext

This API is deprecated and will be removed in a future release.
  • To be removed in favor of makeVisible. Register the runtime to the container

Signature

bindToContext(): void;

getAbsoluteUrl

Get an absolute url to the container based on the provided relativeUrl. Returns undefined if the container or data store isn't attached to storage.

Signature

getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;

Parameters

Parameter Type Description
relativeUrl string A relative request within the container

Returns

Return type: Promise<string | undefined>

getAudience

Returns the current audience.

Signature

getAudience(): IAudience;

Returns

Return type: IAudience

getBaseGCDetails

Returns the GC details in the initial summary of this data store. This is used to initialize the data store and its children with the GC details from the previous summary.

Signature

getBaseGCDetails?(): Promise<IGarbageCollectionDetailsBase>;

Returns

Return type: Promise<IGarbageCollectionDetailsBase>

getCreateChildSummarizerNodeFn

Signature

getCreateChildSummarizerNodeFn(
id: string,
createParam: CreateChildSummarizerNodeParam): CreateChildSummarizerNodeFn;

Parameters

Parameter Type Description
id string
createParam CreateChildSummarizerNodeParam

Returns

Return type: CreateChildSummarizerNodeFn

getInitialGCSummaryDetails

This API is deprecated and will be removed in a future release.
  • Renamed to getBaseGCDetails.

Signature

getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;

Returns

Return type: Promise<IGarbageCollectionSummaryDetails>

getQuorum

Returns the current quorum.

Signature

getQuorum(): IQuorumClients;

Returns

Return type: IQuorumClients

makeLocallyVisible

Called to make the data store locally visible in the container. This happens automatically for root data stores when they are marked as root. For non-root data stores, this happens when their handle is added to a visible DDS.

Signature

makeLocallyVisible?(): void;

setChannelDirty

Call by IFluidDataStoreChannel, indicates that a channel is dirty and needs to be part of the summary.

Signature

setChannelDirty(address: string): void;

Parameters

Parameter Type Description
address string The address of the channel that is dirty.

submitMessage

Submits the message to be sent to other clients.

Signature

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

Parameters

Parameter Type Description
type string Type of the message.
content any Content of the message.
localOpMetadata unknown The local metadata associated with the message. This is kept locally and not sent to the server. This will be sent back when this message is received back from the server. This is also sent if we are asked to resubmit the message.

submitSignal

Submits the signal to be sent to other clients.

Signature

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

Parameters

Parameter Type Description
type string Type of the signal.
content any Content of the signal.

uploadBlob

Signature

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

Parameters

Parameter Type Description
blob ArrayBufferLike

Returns

Return type: Promise<IFluidHandle<ArrayBufferLike>>