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

Method Return Type Description
createSummary(blobRedirectTable) ISummaryTree Create a summary. Used when attaching or serializing a detached container.
getPendingLocalState() unknown Get pending local state in a serializable format to be given back to a newly loaded container
notifyAttaching(snapshot) void Notify runtime that container is moving to "Attaching" state
process(message, local, context) any Processes the given op (message)
processSignal(message, local) any Processes the given signal
request(request) Promise<IResponse> Executes a request against the runtime
setAttachState(attachState) void Propagate the container state when container is attaching or attached.
setConnectionState(connected, clientId) any Notifies 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

Parameter Modifiers Type Description
blobRedirectTable optional Map<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

Parameter Type Description
snapshot ISnapshotTreeWithBlobContents snapshot created at attach time

process

Processes the given op (message)

Signature

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

Parameters

Parameter Type Description
message ISequencedDocumentMessage
local boolean
context any

Returns

Return type: any

processSignal

Processes the given signal

Signature

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

Parameters

Parameter Type Description
message any
local boolean

Returns

Return type: any

request

Executes a request against the runtime

Signature

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

Parameters

Parameter Type Description
request IRequest

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

Parameter Type Description
attachState AttachState.Attaching | AttachState.Attached State of the container.

setConnectionState

Notifies the runtime of a change in the connection state

Signature

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

Parameters

Parameter Modifiers Type Description
connected boolean
clientId optional string

Returns

Return type: any