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;