Skip to main content
Version: v1

IRuntime Interface

The IRuntime represents an instantiation of a code package within a Container. Primarily held by the ContainerContext to be able to interact with the running instance of the Container.

Signature​

export interface IRuntime extends IDisposable

Extends: IDisposable

Methods​

MethodReturn TypeDescription
createSummary(blobRedirectTable)ISummaryTreeCreate a summary. Used when attaching or serializing a detached container.
getPendingLocalState()unknownGet pending local state in a serializable format to be given back to a newly loaded container
notifyAttaching(snapshot)voidNotify runtime that container is moving to "Attaching" state
process(message, local, context)anyProcesses the given op (message)
processSignal(message, local)anyProcesses the given signal
request(request)Promise<IResponse>Executes a request against the runtime
setAttachState(attachState)voidPropagate the container state when container is attaching or attached.
setConnectionState(connected, clientId)anyNotifies the runtime of a change in the connection state

Method Details​

createSummary​

Create a summary. Used when attaching or serializing a detached container.

Signature​

createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;

Parameters​

ParameterModifiersTypeDescription
blobRedirectTableoptionalMap<string, string>A table passed during the attach process. While detached, blob upload is supported using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the new storage IDs so requests can be redirected.

Returns​

Return type: ISummaryTree

getPendingLocalState​

Get pending local state in a serializable format to be given back to a newly loaded container

Signature​

getPendingLocalState(): unknown;

Returns​

Return type: unknown

notifyAttaching​

Notify runtime that container is moving to "Attaching" state

Signature​

notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;

Parameters​

ParameterTypeDescription
snapshotISnapshotTreeWithBlobContentssnapshot created at attach time

process​

Processes the given op (message)

Signature​

process(message: ISequencedDocumentMessage, local: boolean, context: any): any;

Parameters​

ParameterTypeDescription
messageISequencedDocumentMessage
localboolean
contextany

Returns​

Return type: any

processSignal​

Processes the given signal

Signature​

processSignal(message: any, local: boolean): any;

Parameters​

ParameterTypeDescription
messageany
localboolean

Returns​

Return type: any

request​

Executes a request against the runtime

Signature​

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

Parameters​

ParameterTypeDescription
requestIRequest

Returns​

Return type: Promise<IResponse>

setAttachState​

Propagate the container state when container is attaching or attached.

Signature​

setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;

Parameters​

ParameterTypeDescription
attachStateAttachState.Attaching | AttachState.AttachedState of the container.

setConnectionState​

Notifies the runtime of a change in the connection state

Signature​

setConnectionState(connected: boolean, clientId?: string): any;

Parameters​

ParameterModifiersTypeDescription
connectedboolean
clientIdoptionalstring

Returns​

Return type: any