Skip to main content
Version: v1

Container Class

Signature​

export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer

Extends: EventEmitterWithErrorHandling<IContainerEvents

Implements: IContainer

Constructors​

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

Static Properties​

PropertyTypeDescription
versionstring

Static Methods​

MethodReturn TypeDescription
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​

PropertyTypeDescription
attachStateAttachState
audienceIAudienceRetrieves the audience associated with the document
clientDetailsIClientDetails
clientIdstring | undefinedThe server provided id of the client. Set once this.connected is true, otherwise undefined
closedboolean
closeSignalAbortSignal
connectedboolean
connectionStateConnectionState
deltaManagerIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
IFluidRouterIFluidRouter
isDirtybooleanReturns 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
loadedFromVersionIVersion | undefined
optionsILoaderOptions
readOnlyInfoReadOnlyInfo
resolvedUrlIResolvedUrl | undefined
scopesstring[] | undefinedThe server provided claims of the client. Set once this.connected is true, otherwise undefined
serviceConfigurationIClientConfiguration | undefinedService configuration details. If running in offline mode will be undefined otherwise will contain service configuration details returned as part of the initial connection.
storageIDocumentStorageService
subLoggerTelemetryLogger

Methods​

MethodReturn TypeDescription
attach(request)Promise<void>
close(error)void
closeAndGetPendingLocalState()string
connect()void
disconnect()void
forceReadonly(readonly)voidTracks host requiring read-only mode.
getAbsoluteUrl(relativeUrl)Promise<string | undefined>
getLoadedCodeDetails()IFluidCodeDetails | undefinedGet the code details that were used to load the container.
getQuorum()IQuorumClientsRetrieves the quorum associated with the document
getSpecifiedCodeDetails()IFluidCodeDetails | undefinedGet 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​

ParameterTypeDescription
loaderLoader
configIContainerConfig

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​

ParameterTypeDescription
requestIRequest

Returns​

Return type: Promise<void>

close​

Signature​

close(error?: ICriticalContainerError): void;

Parameters​

ParameterModifiersTypeDescription
erroroptionalICriticalContainerError

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​

ParameterTypeDescription
loaderLoader
codeDetailsIFluidCodeDetails

Returns​

Return type: Promise<Container>

disconnect​

Signature​

disconnect(): void;

forceReadonly​

Tracks host requiring read-only mode.

Signature​

forceReadonly(readonly: boolean): void;

Parameters​

ParameterTypeDescription
readonlyboolean

getAbsoluteUrl​

Signature​

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

Parameters​

ParameterTypeDescription
relativeUrlstring

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​

ParameterModifiersTypeDescription
loaderLoader
loadOptionsIContainerLoadOptions
pendingLocalStateoptionalIPendingContainerState

Returns​

Return type: Promise<Container>

proposeCodeDetails​

Signature​

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

Parameters​

ParameterTypeDescription
codeDetailsIFluidCodeDetails

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​

ParameterTypeDescription
loaderLoader
snapshotstring

Returns​

Return type: Promise<Container>

request​

Signature​

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

Parameters​

ParameterTypeDescription
pathIRequest

Returns​

Return type: Promise<IResponse>

serialize​

Signature​

serialize(): string;

Returns​

Return type: string