Skip to content 

IContainerRuntime Interface

Packages > @fluidframework/container-runtime-definitions > IContainerRuntime

Represents the runtime of the container. Contains helper functions/state of the container.

Signature:

export interface IContainerRuntime extends IProvideContainerRuntime, Partial<IProvideContainerRuntimeDirtyable>, IContainerRuntimeBase 

Extends: IProvideContainerRuntime, Partial<IProvideContainerRuntimeDirtyable>, IContainerRuntimeBase

Properties

List of properties of this interface
Property Type Description
attachState AttachState Indicates the attachment state of the container to a host service.
blobManager IBlobManager
branch string
clientDetails IClientDetails
clientId string | undefined
connected boolean
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
existing boolean
flushMode FlushMode
id string
leader boolean
loader ILoader
options any
parentBranch string | null
scope IFluidObject
snapshotFn (message: string) => Promise
storage IDocumentStorageService

Methods

List of methods of this class
Method Description
createRootDataStore(pkg, rootDataStoreId) Creates root data store in container. Such store is automatically bound to container, and thus is attached to storage when/if container is attached to storage. Such stores are never garbage collected and can be found / loaded by name. Majority of data stores in container should not be roots, and should be reachable (directly or indirectly) through one of the roots.
flush() Flushes any ops currently being batched to the loader
getAbsoluteUrl(relativeUrl) Get an absolute url for a provided container-relative request. Returns undefined if the container isn't attached to storage.
getAudience() Returns the current audience.
getQuorum() Returns the current quorum.
getRootDataStore(id, wait) Returns the runtime of the data store.
isDocumentDirty() Returns true of document is dirty, i.e. there are some pending local changes that either were not sent out to delta stream or were not yet acknowledged.
on(event, listener)
on(event, listener)
on(event, listener)
on(event, listener)
on(event, listener)
on(event, listener)
on(event, listener)
on(event, listener)
raiseContainerWarning(warning) Used to raise an unrecoverable error on the runtime.

Events

attachState

Indicates the attachment state of the container to a host service.

Signature:

readonly attachState: AttachState;

blobManager

Signature:

readonly blobManager: IBlobManager;

branch

Signature:

readonly branch: string;

clientDetails

Signature:

readonly clientDetails: IClientDetails;

clientId

Signature:

readonly clientId: string | undefined;

connected

Signature:

readonly connected: boolean;

deltaManager

Signature:

readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

existing

Signature:

readonly existing: boolean;

flushMode

Signature:

readonly flushMode: FlushMode;

id

Signature:

readonly id: string;

leader

Signature:

readonly leader: boolean;

loader

Signature:

readonly loader: ILoader;

options

Signature:

readonly options: any;

parentBranch

Signature:

readonly parentBranch: string | null;

scope

Signature:

readonly scope: IFluidObject;

snapshotFn

Signature:

readonly snapshotFn: (message: string) => Promise<void>;

storage

Signature:

readonly storage: IDocumentStorageService;

Methods

createRootDataStore

Creates root data store in container. Such store is automatically bound to container, and thus is attached to storage when/if container is attached to storage. Such stores are never garbage collected and can be found / loaded by name. Majority of data stores in container should not be roots, and should be reachable (directly or indirectly) through one of the roots.

Signature:

createRootDataStore(pkg: string | string[], rootDataStoreId: string): Promise<IFluidRouter>;

Parameters

List of parameters
Parameter Type Description
pkg string | string[] Package name of the data store factory
rootDataStoreId string data store ID. IDs naming space is global in container. If collision on name occurs, it results in container corruption - loading this file after that will always result in error.

Returns:

Promise<IFluidRouter>

flush

Flushes any ops currently being batched to the loader

Signature:

flush(): void;

Returns:

void

getAbsoluteUrl

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

Signature:

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

Parameters

List of parameters
Parameter Type Description
relativeUrl string A relative request within the container

Returns:

Promise<string | undefined>

getAudience

Returns the current audience.

Signature:

getAudience(): IAudience;

Returns:

IAudience

getQuorum

Returns the current quorum.

Signature:

getQuorum(): IQuorum;

Returns:

IQuorum

getRootDataStore

Returns the runtime of the data store.

Signature:

getRootDataStore(id: string, wait?: boolean): Promise<IFluidRouter>;

Parameters

List of parameters
Parameter Type Description
id string Id supplied during creating the data store.
wait boolean True if you want to wait for it.

Returns:

Promise<IFluidRouter>

isDocumentDirty

Returns true of document is dirty, i.e. there are some pending local changes that either were not sent out to delta stream or were not yet acknowledged.

Signature:

isDocumentDirty(): boolean;

Returns:

boolean

on

Signature:

on(event: "batchBegin", listener: (op: ISequencedDocumentMessage) => void): this;

Parameters

List of parameters
Parameter Type Description
event "batchBegin"
listener (op: ISequencedDocumentMessage) => void

Returns:

this

on

Signature:

on(event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void): this;

Parameters

List of parameters
Parameter Type Description
event "batchEnd"
listener (error: any, op: ISequencedDocumentMessage) => void

Returns:

this

on

Signature:

on(event: "op", listener: (message: ISequencedDocumentMessage) => void): this;

Parameters

List of parameters
Parameter Type Description
event "op"
listener (message: ISequencedDocumentMessage) => void

Returns:

this

on

Signature:

on(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void): this;

Parameters

List of parameters
Parameter Type Description
event "signal"
listener (message: IInboundSignalMessage, local: boolean) => void

Returns:

this

on

Signature:

on(event: "dirtyDocument" | "disconnected" | "dispose" | "savedDocument" | "leader" | "notleader", listener: () => void): this;

Parameters

List of parameters
Parameter Type Description
event "dirtyDocument" | "disconnected" | "dispose" | "savedDocument" | "leader" | "notleader"
listener () => void

Returns:

this

on

Signature:

on(event: "connected", listener: (clientId: string) => void): this;

Parameters

List of parameters
Parameter Type Description
event "connected"
listener (clientId: string) => void

Returns:

this

on

Signature:

on(event: "localHelp", listener: (message: IHelpMessage) => void): this;

Parameters

List of parameters
Parameter Type Description
event "localHelp"
listener (message: IHelpMessage) => void

Returns:

this

on

Signature:

on(event: "fluidDataStoreInstantiated", listener: (dataStorePkgName: string, registryPath: string, createNew: boolean) => void): this;

Parameters

List of parameters
Parameter Type Description
event "fluidDataStoreInstantiated"
listener (dataStorePkgName: string, registryPath: string, createNew: boolean) => void

Returns:

this

raiseContainerWarning

Used to raise an unrecoverable error on the runtime.

Signature:

raiseContainerWarning(warning: ContainerWarning): void;

Parameters

List of parameters
Parameter Type Description
warning ContainerWarning

Returns:

void