IContainerRuntimeBase Interface

Packages > @fluidframework/runtime-definitions > IContainerRuntimeBase

A reduced set of functionality of IContainerRuntime that a data store context/data store runtime will need TODO: this should be merged into IFluidDataStoreContext

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/runtime-definitions/legacy.

For more information about our API support guarantees, see here .

Signature

/** @sealed */
export interface IContainerRuntimeBase extends IEventProvider<IContainerRuntimeBaseEvents>

Extends: IEventProvider <IContainerRuntimeBaseEvents >

Properties

Property Alerts Modifiers Type Description
baseLogger Alpha readonly ITelemetryBaseLogger
clientDetails Alpha readonly IClientDetails
disposed Alpha readonly boolean
submitSignal Alpha (type: string, content: unknown, targetClientId?: string) => void Submits a container runtime level signal to be sent to other clients.

Methods

Method Alerts Return Type Description
_createDataStoreWithProps(pkg, props, id) Deprecated, Alpha Promise<IDataStore>
createDataStore(pkg, loadingGroupId) Alpha Promise<IDataStore> Creates a data store and returns an object that exposes a handle to the data store's entryPoint, and also serves as the data store's router. The data store is not bound to a container, and in such state is not persisted to storage (file). Storing the entryPoint handle (or any other handle inside the data store, e.g. for DDS) into an already attached DDS (or non-attached DDS that will eventually get attached to storage) will result in this store being attached to storage.
createDetachedDataStore(pkg, loadingGroupId) Alpha IFluidDataStoreContextDetached Creates detached data store context. Only after context.attachRuntime() is called, data store initialization is considered complete.
generateDocumentUniqueId() Alpha number | string

Generates a new ID that is guaranteed to be unique across all sessions for this container. It could be in compact form (non-negative integer, oppotunistic), but it could also be UUID string. UUIDs generated will have low entropy in groups and will compress well. It can be leveraged anywhere in container where container unique IDs are required, i.e. any place that uses uuid() and stores result in container is likely candidate to start leveraging this API. If you always want to convert to string, instead of doing String(generateDocumentUniqueId()), consider doing encodeCompactIdToString(generateDocumentUniqueId()).

For more details, please see IIdCompressor.generateDocumentUniqueId()

getAbsoluteUrl(relativeUrl) Alpha Promise<string | undefined> Get an absolute url for a provided container-relative request. Returns undefined if the container or data store isn't attached to storage.
getAliasedDataStoreEntryPoint(alias) Alpha Promise<IFluidHandle<FluidObject> | undefined> Returns the aliased data store's entryPoint, given the alias.
getAudience() Alpha IAudience Returns the current audience.
getQuorum() Alpha IQuorumClients Returns the current quorum.
getSnapshotForLoadingGroupId(loadingGroupIds, pathParts) Alpha Promise<{ snapshotTree: ISnapshotTree; sequenceNumber: number; }> Api to fetch the snapshot from the service for a loadingGroupIds.
orderSequentially(callback) Alpha void

Invokes the given callback and guarantees that all operations generated within the callback will be ordered sequentially.

If the callback throws an error, the container will close and the error will be logged.

uploadBlob(blob, signal) Alpha Promise<IFluidHandle<ArrayBufferLike>>

Property Details

baseLogger

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

readonly baseLogger: ITelemetryBaseLogger;

Type: ITelemetryBaseLogger

clientDetails

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

readonly clientDetails: IClientDetails;

Type: IClientDetails

disposed

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

readonly disposed: boolean;

Type: boolean

submitSignal

Submits a container runtime level signal to be sent to other clients.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

submitSignal: (type: string, content: unknown, targetClientId?: string) => void;

Type: (type: string, content: unknown, targetClientId?: string) => void

Method Details

_createDataStoreWithProps

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

0.16 Issue #1537, #3631

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

_createDataStoreWithProps(pkg: Readonly<string | string[]>, props?: any, id?: string): Promise<IDataStore>;

Parameters

Parameter Modifiers Type Description
pkg Readonly<string | string[]>
props optional any
id optional string

Returns

Return type: Promise<IDataStore >

createDataStore

Creates a data store and returns an object that exposes a handle to the data store’s entryPoint, and also serves as the data store’s router. The data store is not bound to a container, and in such state is not persisted to storage (file). Storing the entryPoint handle (or any other handle inside the data store, e.g. for DDS) into an already attached DDS (or non-attached DDS that will eventually get attached to storage) will result in this store being attached to storage.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

createDataStore(pkg: Readonly<string | string[]>, loadingGroupId?: string): Promise<IDataStore>;

Parameters

Parameter Modifiers Type Description
pkg Readonly<string | string[]> Package name of the data store factory
loadingGroupId optional string This represents the group of the datastore within a container or its snapshot. When not specified the datastore will belong to a default group. Read more about it in this README

Returns

Return type: Promise<IDataStore >

createDetachedDataStore

Creates detached data store context. Only after context.attachRuntime() is called, data store initialization is considered complete.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

createDetachedDataStore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;

Parameters

Parameter Modifiers Type Description
pkg Readonly<string[]> Package name of the data store factory
loadingGroupId optional string This represents the group of the datastore within a container or its snapshot. When not specified the datastore will belong to a default group. Read more about it in this README.

Returns

Return type: IFluidDataStoreContextDetached

generateDocumentUniqueId

Generates a new ID that is guaranteed to be unique across all sessions for this container. It could be in compact form (non-negative integer, oppotunistic), but it could also be UUID string. UUIDs generated will have low entropy in groups and will compress well. It can be leveraged anywhere in container where container unique IDs are required, i.e. any place that uses uuid() and stores result in container is likely candidate to start leveraging this API. If you always want to convert to string, instead of doing String(generateDocumentUniqueId()), consider doing encodeCompactIdToString(generateDocumentUniqueId()).

For more details, please see IIdCompressor.generateDocumentUniqueId()

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

generateDocumentUniqueId(): number | string;

Returns

Return type: number | string

getAbsoluteUrl

Get an absolute url for a provided container-relative request. Returns undefined if the container or data store isn’t attached to storage.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

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>

getAliasedDataStoreEntryPoint

Returns the aliased data store’s entryPoint, given the alias.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

getAliasedDataStoreEntryPoint(alias: string): Promise<IFluidHandle<FluidObject> | undefined>;

Parameters

Parameter Type Description
alias string The alias for the data store.

Returns

The data store’s entry point (@fluidframework/core-interfaces#IFluidHandle) if it exists and is aliased. Returns undefined if no data store has been assigned the given alias.

Return type: Promise<IFluidHandle <FluidObject > | undefined>

getAudience

Returns the current audience.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

getAudience(): IAudience;

Returns

Return type: IAudience

getQuorum

Returns the current quorum.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

getQuorum(): IQuorumClients;

Returns

Return type: IQuorumClients

getSnapshotForLoadingGroupId

Api to fetch the snapshot from the service for a loadingGroupIds.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

getSnapshotForLoadingGroupId(loadingGroupIds: string[], pathParts: string[]): Promise<{
        snapshotTree: ISnapshotTree;
        sequenceNumber: number;
    }>;

Parameters

Parameter Type Description
loadingGroupIds string[] LoadingGroupId for which the snapshot is asked for.
pathParts string[] Parts of the path, which we want to extract from the snapshot tree.

Returns

  • snapshotTree and the sequence number of the snapshot.

Return type: Promise<{ snapshotTree: ISnapshotTree ; sequenceNumber: number; }>

orderSequentially

Invokes the given callback and guarantees that all operations generated within the callback will be ordered sequentially.

If the callback throws an error, the container will close and the error will be logged.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

orderSequentially(callback: () => void): void;

Parameters

Parameter Type Description
callback () => void

uploadBlob

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/runtime-definitions/alpha.

For more information about our API support guarantees, see here .

Signature

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

Parameters

Parameter Modifiers Type Description
blob ArrayBufferLike
signal optional AbortSignal

Returns

Return type: Promise<IFluidHandle <ArrayBufferLike>>