IContainer Interface

Packages > @fluidframework/container-definitions > IContainer

The Host’s view of the Container and its connection to storage

Signature:

export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRouter 

Extends: IEventProvider<IContainerEvents>, IFluidRouter

Properties

List of properties of this interface
Property Type Description
attachState AttachState Indicates the attachment state of the container to a host service.
closed boolean Returns true if the container has been closed, otherwise false
codeDetails IFluidCodeDetails | undefined The current code details for the container's runtime
deltaManager IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> The Delta Manager supporting the op stream for this Container
isDirty boolean Returns true if the container is dirty, i.e. there are user changes that has not been saved Closing container in this state results in data loss for user. Container usually gets into this situation due to loss of connectivity.
resolvedUrl IResolvedUrl | undefined Represents the resolved url to the Container

Methods

List of methods of this class
Method Description
attach(request) Attaches the Container to the Container specified by the given Request.TODO - in the case of failure options should give a retry policy. Or some continuation function that allows attachment to a secondary document.
close(error) Closes the container
closeAndGetPendingLocalState() Closes the container and returns serialized local state intended to be given to a newly loaded container
getAbsoluteUrl(relativeUrl) Get an absolute url for a provided container-relative request url. If the container is not attached, this will return undefined.
getQuorum() The collection of write clients which were connected as of the current sequence number. Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.
proposeCodeDetails(codeDetails) Propose new code details that define the code to be loaded for this container's runtime. The returned promise will be true when the proposal is accepted, and false if the proposal is rejected.
request(request) Issue a request against the container for a resource.
serialize() Extract the snapshot from the detached container.

Events

attachState

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

Signature:

readonly attachState: AttachState;

closed

Returns true if the container has been closed, otherwise false

Signature:

readonly closed: boolean;

codeDetails

The current code details for the container’s runtime

Signature:

readonly codeDetails: IFluidCodeDetails | undefined;

deltaManager

The Delta Manager supporting the op stream for this Container

Signature:

deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

isDirty

Returns true if the container is dirty, i.e. there are user changes that has not been saved Closing container in this state results in data loss for user. Container usually gets into this situation due to loss of connectivity.

Signature:

readonly isDirty: boolean;

resolvedUrl

Represents the resolved url to the Container

Signature:

resolvedUrl: IResolvedUrl | undefined;

Methods

attach

Attaches the Container to the Container specified by the given Request.

TODO - in the case of failure options should give a retry policy. Or some continuation function that allows attachment to a secondary document.

Signature:

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

Parameters

List of parameters
Parameter Type Description
request IRequest

Returns:

Promise<void>

close

Closes the container

Signature:

close(error?: ICriticalContainerError): void;

Parameters

List of parameters
Parameter Type Description
error ICriticalContainerError

Returns:

void

closeAndGetPendingLocalState

Closes the container and returns serialized local state intended to be given to a newly loaded container

Signature:

closeAndGetPendingLocalState(): string;

Returns:

string

getAbsoluteUrl

Get an absolute url for a provided container-relative request url. If the container is not attached, this will return undefined.

Signature:

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

Parameters

List of parameters
Parameter Type Description
relativeUrl string A container-relative request URL

Returns:

Promise<string | undefined>

getQuorum

The collection of write clients which were connected as of the current sequence number. Also contains a map of key-value pairs that must be agreed upon by all clients before being accepted.

Signature:

getQuorum(): IQuorum;

Returns:

IQuorum

proposeCodeDetails

Propose new code details that define the code to be loaded for this container’s runtime. The returned promise will be true when the proposal is accepted, and false if the proposal is rejected.

Signature:

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

Parameters

List of parameters
Parameter Type Description
codeDetails IFluidCodeDetails

Returns:

Promise<boolean>

request

Issue a request against the container for a resource.

Signature:

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

Parameters

List of parameters
Parameter Type Description
request IRequest The request to be issued against the container

Returns:

Promise<IResponse>

serialize

Extract the snapshot from the detached container.

Signature:

serialize(): string;

Returns:

string