Skip to main content

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.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-definitions/legacy.

For more information about our API support guarantees, see here.

Signature

export interface IRuntime extends IDisposable

Extends: IDisposable

Methods

MethodAlertsModifiersReturn TypeDescription
createSummary(blobRedirectTable)BetaISummaryTreeCreate a summary. Used when attaching or serializing a detached container.
getEntryPoint()BetaPromise<FluidObject>Exposes the entryPoint for the container runtime. Use this as the primary way of getting access to the user-defined logic within the container runtime.
getPendingLocalState(props)BetaunknownGet pending local state in a serializable format to be given back to a newly loaded container
notifyOpReplay(message)BetaoptionalPromise<void>Notify runtime that we have processed a saved message, so that it can do async work (applying stashed ops) after having processed it.
process(message, local)BetaanyProcesses the given op (message)
processSignal(message, local)BetaanyProcesses the given signal
setAttachState(attachState)BetavoidPropagate the container state when container is attaching or attached.
setConnectionState(canSendOps, clientId)BetaanyNotifies the runtime of a change in the connection state
setConnectionStatus(status)BetaoptionalvoidNotifies the runtime of a change in the connection state.

Method Details

createSummary

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

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

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

getEntryPoint

Exposes the entryPoint for the container runtime. Use this as the primary way of getting access to the user-defined logic within the container runtime.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

getEntryPoint(): Promise<FluidObject>;

Returns

Return type: Promise<FluidObject>

See Also

getEntryPoint()

getPendingLocalState

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

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

getPendingLocalState(props?: IGetPendingLocalStateProps): unknown;

Parameters

ParameterModifiersTypeDescription
propsoptionalIGetPendingLocalStateProps

Returns

Return type: unknown

notifyOpReplay

Notify runtime that we have processed a saved message, so that it can do async work (applying stashed ops) after having processed it.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

notifyOpReplay?(message: ISequencedDocumentMessage): Promise<void>;

Parameters

ParameterTypeDescription
messageISequencedDocumentMessage

Returns

Return type: Promise<void>

process

Processes the given op (message)

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

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

Parameters

ParameterTypeDescription
messageISequencedDocumentMessagedelta message received from the server
localbooleantrue if the message was originally generated by the client receiving it.

Returns

Return type: any

processSignal

Processes the given signal

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

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

Parameters

ParameterTypeDescription
messageany
localboolean

Returns

Return type: any

setAttachState

Propagate the container state when container is attaching or attached.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

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

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

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

Remarks

This is deprecated when used with @fluidframework/container-loader v2.63 and later. Implement setConnectionStatus(status). Then this method will not be called, when using newer container-loader.

Note: when setConnectionStatus(status) is implemented, there will not be a call exactly when Container loads as happens currently without it.

Parameters

ParameterModifiersTypeDescription
canSendOpsbooleantrue if the runtime is allowed to send ops
clientIdoptionalstringthe ID of the client that is connecting or disconnecting

Returns

Return type: any

setConnectionStatus

Notifies the runtime of a change in the connection state.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

setConnectionStatus?(status: ConnectionStatus): void;

Remarks

This supersedes setConnectionState(canSendOps, clientId).

Parameters

ParameterTypeDescription
statusConnectionStatus