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

PropertyAlertsModifiersTypeDescription
attachStateAttachStateIndicates the attachment state of the data store to a host service.
baseSnapshotISnapshotTree | undefined
clientDetailsIClientDetails
clientIdstring | undefined
connectedboolean
containerRuntimeIContainerRuntimeBase
createPropsDeprecatedoptionalany
deltaManagerIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
idstring
isLocalDataStorebooleanA 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.
loggerITelemetryBaseLogger
optionsILoaderOptions
packagePathreadonly string[]The package path of the data store as per the package factory.
scopeFluidObjectAmbient services provided with the context
storageIDocumentStorageService

Methods

MethodAlertsModifiersReturn TypeDescription
addedGCOutboundReference(srcHandle, outboundHandle)optionalvoidCalled 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()Deprecatedvoid
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()IAudienceReturns the current audience.
getBaseGCDetails()optionalPromise<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()DeprecatedPromise<IGarbageCollectionSummaryDetails>
getQuorum()IQuorumClientsReturns the current quorum.
makeLocallyVisible()optionalvoidCalled 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)voidCall by IFluidDataStoreChannel, indicates that a channel is dirty and needs to be part of the summary.
submitMessage(type, content, localOpMetadata)voidSubmits the message to be sent to other clients.
submitSignal(type, content)voidSubmits 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

ParameterTypeDescription
srcHandleIFluidHandleThe handle of the node that added the reference.
outboundHandleIFluidHandleThe 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

ParameterTypeDescription
relativeUrlstringA 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

ParameterTypeDescription
idstring
createParamCreateChildSummarizerNodeParam

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

ParameterTypeDescription
addressstringThe 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

ParameterTypeDescription
typestringType of the message.
contentanyContent of the message.
localOpMetadataunknownThe 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

ParameterTypeDescription
typestringType of the signal.
contentanyContent of the signal.

uploadBlob

Signature

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

Parameters

ParameterTypeDescription
blobArrayBufferLike

Returns

Return type: Promise<IFluidHandle<ArrayBufferLike>>