Skip to content 

Container Class

Packages > @fluidframework/container-loader > Container

Signature:

export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer 

Extends: EventEmitterWithErrorHandling<IContainerEvents>

Implements: IContainer

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(options, scope, codeLoader, loader, serviceFactory, urlResolver, config, logger) Constructs a new instance of the Container class

Properties

List of properties for this class
Property Modifiers Type Description
attachState AttachState
audience IAudience Retrieves the audience associated with the document
canReconnect boolean
chaincodePackage IFluidCodeDetails | undefined
clientDetails IClientDetails
clientId string | undefined The server provided id of the client. Set once this.connected is true, otherwise undefined
closed boolean
connected boolean
connectionState ConnectionState
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
existing boolean | undefined Flag indicating whether the document already existed at the time of load
id string
IFluidRouter IFluidRouter
loadedFromVersion IVersion | undefined
options any
parentBranch string | null Returns the parent branch for this document
readonly boolean | undefined Tells if container is in read-only mode. Data stores should listen for "readonly" notifications and disallow user making changes to data stores. Readonly state can be because of no storage write permission, or due to host forcing readonly mode for container. It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.
readonlyPermissions boolean | undefined Tells if user has no write permissions for file in storage It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.
resolvedUrl IResolvedUrl | undefined
scopes string[] | undefined The server provided claims of the client. Set once this.connected is true, otherwise undefined
serviceConfiguration IServiceConfiguration | 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 | undefined
subLogger TelemetryLogger
version static string

Methods

List of methods on this class
Method Modifiers Description
attach(request)
close(error)
create(codeLoader, options, scope, loader, source, serviceFactory, urlResolver, logger) static
forceReadonly(readonly)
getAbsoluteUrl(relativeUrl)
getQuorum() Retrieves the quorum associated with the document
hasNullRuntime()
load(id, serviceFactory, codeLoader, options, scope, loader, request, resolvedUrl, urlResolver, logger) static Load container.
raiseContainerWarning(warning) Raise non-critical error to host. Calling this API will not close container. For critical errors, please call Container.close(error).
reloadContext()
request(path)
resume()
resumeInternal(args)
serialize()
setAutoReconnect(reconnect)
snapshot(tagMessage, fullTree)

Constructors

Container.(constructor)

Constructs a new instance of the Container class

Signature:

constructor(options: any, scope: IFluidObject, codeLoader: ICodeLoader, loader: ILoader, serviceFactory: IDocumentServiceFactory, urlResolver: IUrlResolver, config: IContainerConfig, logger: ITelemetryBaseLogger | undefined);

Parameters

List of parameters
Parameter Type Description
options any
scope IFluidObject
codeLoader ICodeLoader
loader ILoader
serviceFactory IDocumentServiceFactory
urlResolver IUrlResolver
config IContainerConfig
logger ITelemetryBaseLogger | undefined

Properties

attachState

Signature:

get attachState(): AttachState;

audience

Retrieves the audience associated with the document

Signature:

get audience(): IAudience;

canReconnect

Signature:

get canReconnect(): boolean;

chaincodePackage

Signature:

get chaincodePackage(): IFluidCodeDetails | undefined;

clientDetails

Signature:

get clientDetails(): IClientDetails;

clientId

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

Signature:

get clientId(): string | undefined;

closed

Signature:

get closed(): boolean;

connected

Signature:

get connected(): boolean;

connectionState

Signature:

get connectionState(): ConnectionState;

deltaManager

Signature:

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

existing

Flag indicating whether the document already existed at the time of load

Signature:

get existing(): boolean | undefined;

id

Signature:

get id(): string;

IFluidRouter

Signature:

get IFluidRouter(): IFluidRouter;

loadedFromVersion

Signature:

get loadedFromVersion(): IVersion | undefined;

options

Signature:

readonly options: any;

parentBranch

Returns the parent branch for this document

Signature:

get parentBranch(): string | null;

readonly

Tells if container is in read-only mode. Data stores should listen for “readonly” notifications and disallow user making changes to data stores. Readonly state can be because of no storage write permission, or due to host forcing readonly mode for container. It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.

Signature:

get readonly(): boolean | undefined;

readonlyPermissions

Tells if user has no write permissions for file in storage It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.

Signature:

get readonlyPermissions(): boolean | undefined;

resolvedUrl

Signature:

get resolvedUrl(): IResolvedUrl | undefined;

scopes

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

Signature:

get scopes(): 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(): IServiceConfiguration | undefined;

storage

Signature:

get storage(): IDocumentStorageService | undefined;

subLogger

Signature:

subLogger: TelemetryLogger;

version

Signature:

static version: string;

Methods

attach

Signature:

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

Parameters

List of parameters
Parameter Type Description
request IRequest

Returns:

Promise<void>

close

Signature:

close(error?: ICriticalContainerError): void;

Parameters

List of parameters
Parameter Type Description
error ICriticalContainerError

Returns:

void

create

Signature:

static create(codeLoader: ICodeLoader, options: any, scope: IFluidObject, loader: Loader, source: DetachedContainerSource, serviceFactory: IDocumentServiceFactory, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<Container>;

Parameters

List of parameters
Parameter Type Description
codeLoader ICodeLoader
options any
scope IFluidObject
loader Loader
source DetachedContainerSource
serviceFactory IDocumentServiceFactory
urlResolver IUrlResolver
logger ITelemetryBaseLogger

Returns:

Promise<Container>

forceReadonly

Signature:

forceReadonly(readonly: boolean): void;

Parameters

List of parameters
Parameter Type Description
readonly boolean

Returns:

void

getAbsoluteUrl

Signature:

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

Parameters

List of parameters
Parameter Type Description
relativeUrl string

Returns:

Promise<string | undefined>

getQuorum

Retrieves the quorum associated with the document

Signature:

getQuorum(): IQuorum;

Returns:

IQuorum

hasNullRuntime

Signature:

hasNullRuntime(): boolean;

Returns:

boolean

load

Load container.

Signature:

static load(id: string, serviceFactory: IDocumentServiceFactory, codeLoader: ICodeLoader, options: any, scope: IFluidObject, loader: ILoader, request: IRequest, resolvedUrl: IFluidResolvedUrl, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<Container>;

Parameters

List of parameters
Parameter Type Description
id string
serviceFactory IDocumentServiceFactory
codeLoader ICodeLoader
options any
scope IFluidObject
loader ILoader
request IRequest
resolvedUrl IFluidResolvedUrl
urlResolver IUrlResolver
logger ITelemetryBaseLogger

Returns:

Promise<Container>

raiseContainerWarning

Raise non-critical error to host. Calling this API will not close container. For critical errors, please call Container.close(error).

Signature:

raiseContainerWarning(warning: ContainerWarning): void;

Parameters

List of parameters
Parameter Type Description
warning ContainerWarning

Returns:

void

reloadContext

Signature:

reloadContext(): Promise<void>;

Returns:

Promise<void>

request

Signature:

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

Parameters

List of parameters
Parameter Type Description
path IRequest

Returns:

Promise<IResponse>

resume

Signature:

resume(): void;

Returns:

void

resumeInternal

Signature:

protected resumeInternal(args?: IConnectionArgs): void;

Parameters

List of parameters
Parameter Type Description
args IConnectionArgs

Returns:

void

serialize

Signature:

serialize(): string;

Returns:

string

setAutoReconnect

Signature:

setAutoReconnect(reconnect: boolean): void;

Parameters

List of parameters
Parameter Type Description
reconnect boolean

Returns:

void

snapshot

Signature:

snapshot(tagMessage: string, fullTree?: boolean): Promise<void>;

Parameters

List of parameters
Parameter Type Description
tagMessage string
fullTree boolean

Returns:

Promise<void>