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.
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
| Method | Alerts | Modifiers | Return Type | Description |
|---|---|---|---|---|
| close() | Beta | optional | void | Closes the runtime, releasing timers and other transient resources which are only useful while changes to the content or service are still possible. The entryPoint is preserved, allowing content to still be read/inspected. |
| createSummary(blobRedirectTable) | Beta | ISummaryTree | Create a summary. Used when attaching or serializing a detached container. | |
| getEntryPoint() | Beta | Promise<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) | Beta | unknown | Get pending local state in a serializable format to be given back to a newly loaded container | |
| notifyOpReplay(message) | Beta | optional | Promise<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) | Beta | any | Processes the given op (message) | |
| processSignal(message, local) | Beta | any | Processes the given signal | |
| setAttachState(attachState) | Beta | void | Propagate the container state when container is attaching or attached. | |
| setConnectionState(canSendOps, clientId) | Beta | any | Notifies the runtime of a change in the connection state | |
| setConnectionStatus(status) | Beta | optional | void | Notifies the runtime of a change in the connection state. |
Method Details
close
Closes the runtime, releasing timers and other transient resources which are only useful while changes to the content or service are still possible. The entryPoint is preserved, allowing content to still be read/inspected.
For more information about our API support guarantees, see here.
Signature
close?(): void;
Remarks
This enters an intermediate lifecycle stage between connected operation and full disposal. The container may call this when it closes, before eventually calling dispose(error). Any resources this cleans up should also be cleaned up by dispose in the case when close is not called.
This is optional for backwards compatibility with older runtime implementations.
Do not confuse this with with the various closeFn callbacks (such as closeFn or IGarbageCollectorCreateParams.closeFn: those callbacks expose a way to initiate container close, not a way to get notified of container close (which might come from another source). This method on the other hand is invoked for all the cases in which the container is closing (though this does not include when its disposing without closing first!), and thus this is where the runtime should actually transition to the closed state, and do any appropriate cleanup.
createSummary
Create a summary. Used when attaching or serializing a detached container.
For more information about our API support guarantees, see here.
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
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.
For more information about our API support guarantees, see here.
Signature
getEntryPoint(): Promise<FluidObject>;
Returns
Return type: Promise<FluidObject>
See Also
getPendingLocalState
Get pending local state in a serializable format to be given back to a newly loaded container
For more information about our API support guarantees, see here.
Signature
getPendingLocalState(props?: IGetPendingLocalStateProps): unknown;
Parameters
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| props | optional | IGetPendingLocalStateProps |
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.
For more information about our API support guarantees, see here.
Signature
notifyOpReplay?(message: ISequencedDocumentMessage): Promise<void>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| message | ISequencedDocumentMessage |
Returns
Return type: Promise<void>
process
Processes the given op (message)
For more information about our API support guarantees, see here.
Signature
process(message: ISequencedDocumentMessage, local: boolean): any;
Parameters
| Parameter | Type | Description |
|---|---|---|
| message | ISequencedDocumentMessage | delta message received from the server |
| local | boolean | true if the message was originally generated by the client receiving it. |
Returns
Return type: any
processSignal
Processes the given signal
For more information about our API support guarantees, see here.
Signature
processSignal(message: any, local: boolean): any;
Parameters
| Parameter | Type | Description |
|---|---|---|
| message | any | |
| local | boolean |
Returns
Return type: any
setAttachState
Propagate the container state when container is attaching or attached.
For more information about our API support guarantees, see here.
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
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
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| canSendOps | boolean | true if the runtime is allowed to send ops | |
| clientId | optional | string | the ID of the client that is connecting or disconnecting |
Returns
Return type: any
setConnectionStatus
Notifies the runtime of a change in the connection state.
For more information about our API support guarantees, see here.
Signature
setConnectionStatus?(status: ConnectionStatus): void;
Remarks
This supersedes setConnectionState(canSendOps, clientId).
Parameters
| Parameter | Type | Description |
|---|---|---|
| status | ConnectionStatus |