Skip to main content
Version: v1

Container Class

Signature

export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer

Extends: EventEmitterWithErrorHandling<IContainerEvents

Implements: IContainer

Constructors

Constructor Description
(constructor)(loader, config) Constructs a new instance of the Container class

Static Properties

Property Type Description
version string

Static Methods

Method Return Type Description
createDetached(loader, codeDetails) Promise<Container> Create a new container in a detached state.
load(loader, loadOptions, pendingLocalState) Promise<Container> Load an existing container.
rehydrateDetachedFromSnapshot(loader, snapshot) Promise<Container> Create a new container in a detached state that is initialized with a snapshot from a previous detached container.

Properties

Property Type Description
attachState AttachState
audience IAudience Retrieves the audience associated with the document
clientDetails IClientDetails
clientId string | undefined The server provided id of the client. Set once this.connected is true, otherwise undefined
closed boolean
closeSignal AbortSignal
connected boolean
connectionState ConnectionState
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
IFluidRouter IFluidRouter
isDirty boolean Returns true if container is dirty. Which means data loss if container is closed at that same moment Most likely that happens when there is no network connection to ordering service
loadedFromVersion IVersion | undefined
options ILoaderOptions
readOnlyInfo ReadOnlyInfo
resolvedUrl IResolvedUrl | undefined
scopes string[] | undefined The server provided claims of the client. Set once this.connected is true, otherwise undefined
serviceConfiguration IClientConfiguration | undefined Service configuration details. If running in offline mode will be undefined otherwise will contain service configuration details returned as part of the initial connection.
storage IDocumentStorageService
subLogger TelemetryLogger

Methods

Method Return Type Description
attach(request) Promise<void>
close(error) void
closeAndGetPendingLocalState() string
connect() void
disconnect() void
forceReadonly(readonly) void Tracks host requiring read-only mode.
getAbsoluteUrl(relativeUrl) Promise<string | undefined>
getLoadedCodeDetails() IFluidCodeDetails | undefined Get the code details that were used to load the container.
getQuorum() IQuorumClients Retrieves the quorum associated with the document
getSpecifiedCodeDetails() IFluidCodeDetails | undefined Get the code details that are currently specified for the container.
proposeCodeDetails(codeDetails) Promise<boolean>
request(path) Promise<IResponse>
serialize() string

Constructor Details

(constructor)

Constructs a new instance of the Container class

Signature
constructor(loader: Loader, config: IContainerConfig);

Parameters

Parameter Type Description
loader Loader
config IContainerConfig

Property Details

attachState

Signature
get attachState(): AttachState;

Type: AttachState

audience

Retrieves the audience associated with the document

Signature
get audience(): IAudience;

Type: IAudience

clientDetails

Signature
get clientDetails(): IClientDetails;

Type: IClientDetails

clientId

The server provided id of the client. Set once this.connected is true, otherwise undefined

Signature
get clientId(): string | undefined;

Type: string | undefined

closed

Signature
get closed(): boolean;

Type: boolean

closeSignal

Signature
get closeSignal(): AbortSignal;

Type: AbortSignal

connected

Signature
get connected(): boolean;

Type: boolean

connectionState

Signature
get connectionState(): ConnectionState;

Type: ConnectionState

deltaManager

Signature
get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

Type: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>

IFluidRouter

Signature
get IFluidRouter(): IFluidRouter;

Type: IFluidRouter

isDirty

Returns true if container is dirty. Which means data loss if container is closed at that same moment Most likely that happens when there is no network connection to ordering service

Signature
get isDirty(): boolean;

Type: boolean

loadedFromVersion

Signature
get loadedFromVersion(): IVersion | undefined;

Type: IVersion | undefined

options

Signature
readonly options: ILoaderOptions;

Type: ILoaderOptions

readOnlyInfo

Signature
get readOnlyInfo(): ReadOnlyInfo;

Type: ReadOnlyInfo

resolvedUrl

Signature
get resolvedUrl(): IResolvedUrl | undefined;

Type: IResolvedUrl | undefined

scopes

The server provided claims of the client. Set once this.connected is true, otherwise undefined

Signature
get scopes(): string[] | undefined;

Type: string[] | undefined

serviceConfiguration

Service configuration details. If running in offline mode will be undefined otherwise will contain service configuration details returned as part of the initial connection.

Signature
get serviceConfiguration(): IClientConfiguration | undefined;

Type: IClientConfiguration | undefined

storage

Signature
get storage(): IDocumentStorageService;

Type: IDocumentStorageService

subLogger

Signature
subLogger: TelemetryLogger;

Type: TelemetryLogger

version

Signature
static version: string;

Type: string

Method Details

attach

Signature
attach(request: IRequest): Promise<void>;

Parameters

Parameter Type Description
request IRequest

Returns

Return type: Promise<void>

close

Signature
close(error?: ICriticalContainerError): void;

Parameters

Parameter Modifiers Type Description
error optional ICriticalContainerError

closeAndGetPendingLocalState

Signature
closeAndGetPendingLocalState(): string;

Returns

Return type: string

connect

Signature
connect(): void;

createDetached

Create a new container in a detached state.

Signature
static createDetached(loader: Loader, codeDetails: IFluidCodeDetails): Promise<Container>;

Parameters

Parameter Type Description
loader Loader
codeDetails IFluidCodeDetails

Returns

Return type: Promise<Container>

disconnect

Signature
disconnect(): void;

forceReadonly

Tracks host requiring read-only mode.

Signature
forceReadonly(readonly: boolean): void;

Parameters

Parameter Type Description
readonly boolean

getAbsoluteUrl

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

Parameters

Parameter Type Description
relativeUrl string

Returns

Return type: Promise<string | undefined>

getLoadedCodeDetails

Get the code details that were used to load the container.

Signature
getLoadedCodeDetails(): IFluidCodeDetails | undefined;

Returns

The code details that were used to load the container if it is loaded, undefined if it is not yet loaded.

Return type: IFluidCodeDetails | undefined

getQuorum

Retrieves the quorum associated with the document

Signature
getQuorum(): IQuorumClients;

Returns

Return type: IQuorumClients

getSpecifiedCodeDetails

Get the code details that are currently specified for the container.

Signature
getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;

Returns

The current code details if any are specified, undefined if none are specified.

Return type: IFluidCodeDetails | undefined

load

Load an existing container.

Signature
static load(loader: Loader, loadOptions: IContainerLoadOptions, pendingLocalState?: IPendingContainerState): Promise<Container>;

Parameters

Parameter Modifiers Type Description
loader Loader
loadOptions IContainerLoadOptions
pendingLocalState optional IPendingContainerState

Returns

Return type: Promise<Container>

proposeCodeDetails

Signature
proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise<boolean>;

Parameters

Parameter Type Description
codeDetails IFluidCodeDetails

Returns

Return type: Promise<boolean>

rehydrateDetachedFromSnapshot

Create a new container in a detached state that is initialized with a snapshot from a previous detached container.

Signature
static rehydrateDetachedFromSnapshot(loader: Loader, snapshot: string): Promise<Container>;

Parameters

Parameter Type Description
loader Loader
snapshot string

Returns

Return type: Promise<Container>

request

Signature
request(path: IRequest): Promise<IResponse>;

Parameters

Parameter Type Description
path IRequest

Returns

Return type: Promise<IResponse>

serialize

Signature
serialize(): string;

Returns

Return type: string