@fluidframework/container-runtime Package

Packages > @fluidframework/container-runtime

Interfaces

Interface Alerts Description
IAckedSummary Legacy, Alpha A single summary which has already been acked by the server.
IAckSummaryResult Legacy, Alpha
IBaseSummarizeResult Legacy, Alpha Base results for all submitSummary attempts.
IBlobManagerLoadInfo Legacy, Alpha Information from a snapshot needed to load BlobManager
IBroadcastSummaryResult Legacy, Alpha
ICancellableSummarizerController Legacy, Alpha Similar to AbortController, but using promise instead of events
ICancellationToken Legacy, Alpha Similar to AbortSignal, but using promise instead of events
IClientSummaryWatcher Legacy, Alpha Watches summaries created by a specific client.
ICompressionRuntimeOptions Legacy, Alpha Options for op compression.
IConnectableRuntime Legacy, Alpha
IContainerRuntimeMetadata Legacy, Alpha
IContainerRuntimeOptions Legacy, Alpha Options for container runtime.
ICreateContainerMetadata Legacy, Alpha
IDocumentSchema Legacy, Alpha

Document schema information. Describes overall shape of document schema, including unknown (to this version) properties.

Used by runtime to make a call if it can understand document schema. If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures down the road and potentially corrupting documents. For now this structure and appropriate interpretation / behavior is focused only on runtime features. In the future that could be interpolated to more areas, including DDSs used, and even possibly - application schema.

Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will stop (and fail session) on any unknown properties within "runtime" sub-tree.

In most cases values preserved in the document will not dictate if such features should be enabled in a given session. I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know how to interpret such ops, but does not need to actually use compression itself. That said, some options could be sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example. Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail if opened by clients who do not support compression.

For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.

IDocumentSchemaFeatures Legacy, Alpha

Settings that this session would like to have, based on options and feature gates.

WARNING: This type is used to infer IDocumentSchemaCurrent type! Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!

IEnqueueSummarizeOptions Legacy, Alpha Options to use when enqueueing a summarize attempt.
IFluidDataStoreAttributes0 Deprecated, Legacy, Alpha
IFluidDataStoreAttributes1 Deprecated, Legacy, Alpha
IFluidDataStoreAttributes2 Deprecated, Legacy, Alpha
IGCMetadata Legacy, Alpha GC-specific metadata to be written into the summary.
IGCRuntimeOptions Legacy, Alpha
IGCStats Legacy, Alpha The statistics of the system state after a garbage collection run.
IGeneratedSummaryStats Legacy, Alpha In addition to the normal summary tree + stats, this contains additional stats only relevant at the root of the tree.
IGenerateSummaryTreeResult Legacy, Alpha Results of submitSummary after generating the summary tree.
IMarkPhaseStats Legacy, Alpha The statistics of the system state after a garbage collection mark phase run.
INackSummaryResult Legacy, Alpha
IOnDemandSummarizeOptions Legacy, Alpha
IRefreshSummaryAckOptions Legacy, Alpha Data required to update internal tracking state after receiving a Summary Ack.
IRetriableFailureError Legacy, Alpha Type for summarization failures that are retriable.
ISerializedElection Legacy, Alpha Serialized state of IOrderedClientElection.
ISubmitSummaryOpResult Legacy, Alpha Results of submitSummary after submitting the summarize op.
ISubmitSummaryOptions Legacy, Alpha
ISummarizeEventProps Legacy, Alpha
ISummarizeOptions Legacy, Alpha Options affecting summarize behavior.
ISummarizer Legacy, Alpha
ISummarizeResults Legacy, Alpha
ISummarizerEvents Legacy, Alpha
ISummarizerInternalsProvider Legacy, Alpha
ISummarizerRuntime Legacy, Alpha
ISummary Legacy, Alpha A single summary which can be tracked as it goes through its life cycle. The life cycle is: Local to Broadcast to Acked/Nacked.
ISummaryAckMessage Legacy, Alpha Interface for summary ack messages with typed contents.
ISummaryBaseConfiguration Legacy, Alpha
ISummaryCollectionOpEvents Legacy, Alpha
ISummaryConfigurationDisableHeuristics Legacy, Alpha
ISummaryConfigurationDisableSummarizer Legacy, Alpha
ISummaryConfigurationHeuristics Legacy, Alpha
ISummaryNackMessage Legacy, Alpha Interface for summary nack messages with typed contents.
ISummaryOpMessage Legacy, Alpha Interface for summary op messages with typed contents.
ISummaryRuntimeOptions Legacy, Alpha
ISweepPhaseStats Legacy, Alpha The statistics of the system state after a garbage collection sweep phase run.
IUploadSummaryResult Legacy, Alpha Results of submitSummary after uploading the tree to storage.
LoadContainerRuntimeParams Legacy, Alpha This object holds the parameters necessary for the loadContainerRuntime(params) function.
SubmitSummaryFailureData Legacy, Alpha The data in summarizer result when submit summary stage fails.

Classes

Class Alerts Modifiers Description
ContainerRuntime Legacy, Alpha Represents the runtime of the container. Contains helper functions/state of the container. It will define the store level mappings.
DocumentsSchemaController Legacy, Alpha sealed

Controller of document schema.

Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md

This class manages current document schema and transitions between document schemas. At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data (summary and op format), features & capabilities that a version of runtime has to support and understand in order to collaborate on a document. New features that modify document format have to be included in document schema definition. Usage of such features could only happen after document schema has been updated to reflect such feature.

This formality allows clients that do not understand such features to fail right away when they observe document schema listing capabilities that such client does not understand. Old clients will fail in predictable way. This allows us to 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated. 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along and potentially corrupt the document. This is especially true for summarizer client, who could simply "undo" changes it does not understands.

It's important to note how it overlaps with feature gates and safe velocity. If new feature was in use, that resulted in a number of documents referencing such feature in document schema. But, developers (through code deployment or feature gates) could disable usage of such features. That will stop a process of further document schema changes (for documents that were not using such feature). And documents that already list such capability in their schema will continue to do so. Later ensures that old clients who do not understand such feature will continue to fail to open such documents, as such documents very likely contain data in a new format.

Controller operates with 4 schemas: - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS). - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates). - session schema - current session schema. It's "and" of the above two schemas. - future schema - "or" of document and desires schemas.

"or" & "and" operators are defined individually for each property. For Boolean properties it's literally &&, || operators. But for other properties it's more nuanced.

Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to future schema.

Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.

There are two modes this class can operate: 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly, right away, and new features are available right away 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions. However code should assume that any new features that were not enabled in a given document will not be available for a given session. That's because this session may never send any ops (including read-only documents). Or it may fail to convert schema. This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates), then eventually all documents that are modified will have that feature reflected in their schema. It could require multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults schema on document load).

How schemas are changed (in non-legacy mode): If a client needs to change a schema, it will attempt to do so as part of normal ops sending process. Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to. When a number of clients race to change a schema, then only one of them will win, all others will fail because they will reference old schema that is no longer in effect. Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do recalc and decide if schema needs to be changed or not).

Summarizer Legacy, Alpha Summarizer is responsible for coordinating when to generate and send summaries. It is the main entry point for summary work. It is created only by summarizing container (i.e. one with clientType === "summarizer")
SummaryCollection Legacy, Alpha Data structure that looks at the op stream to track summaries as they are broadcast, acked and nacked. It provides functionality for watching specific summaries.

Enumerations

Enum Alerts Description
CompressionAlgorithms Legacy, Alpha Available compression algorithms for op compression.
ContainerMessageType Legacy, Alpha

Types

TypeAlias Alerts Description
DocumentSchemaValueType Legacy, Alpha Descripe allowed type for properties in document schema. Please note that for all property types we should use undefined to indicate that particular capability is off. Using false, or some string value (like "off") will result in clients who do not understand that property failing, whereas we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.
EnqueueSummarizeResult Legacy, Alpha
GCFeatureMatrix Legacy, Alpha
GCNodeType Legacy, Alpha
GCVersion Legacy, Alpha
IdCompressorMode Legacy, Alpha ID Compressor mode. "on" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all sessions for a given document. This results in IContainerRuntime.idCompressor to be always available. "delayed" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer. In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it "On"). The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs. undefined - ID compressor is not loaded. While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.
IDocumentSchemaChangeMessage Legacy, Alpha Content of the type=ContainerMessageType.DocumentSchemaChange ops. The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent) ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey regSeq of last known schema change (known to a client proposing schema change).
IDocumentSchemaCurrent Legacy, Alpha Current document schema.
ISummaryCancellationToken Legacy, Alpha Similar to AbortSignal, but using promise instead of events
ISummaryConfiguration Legacy, Alpha
ISummaryMetadataMessage Legacy, Alpha The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.
OmitAttributesVersions Deprecated, Legacy, Alpha
OpActionEventListener Legacy, Alpha
OpActionEventName Legacy, Alpha
ReadFluidDataStoreAttributes Deprecated, Legacy, Alpha Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a store like the package, snapshotFormatVersion to take different decisions based on a particular snapshotFormatVersion.
SubmitSummaryResult Legacy, Alpha

Strict type representing result of a submitSummary attempt. The result consists of 4 possible stages, each with its own data. The data is cumulative, so each stage will contain the data from the previous stages. If the final "submitted" stage is not reached, the result may contain the error object.

Stages:

1. "base" - stopped before the summary tree was even generated, and the result only contains the base data

2. "generate" - the summary tree was generated, and the result will contain that tree + stats

3. "upload" - the summary was uploaded to storage, and the result contains the server-provided handle

4. "submit" - the summarize op was submitted, and the result contains the op client sequence number.

SummarizeResultPart Legacy, Alpha
SummarizerStopReason Legacy, Alpha
SummaryStage Legacy, Alpha The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.

Functions

Function Alerts Return Type Description
loadContainerRuntime(params) Legacy, Alpha Promise<IContainerRuntime & IRuntime> This is meant to be used by a @fluidframework/container-definitions#IRuntimeFactory to instantiate a container runtime.

Variables

Variable Alerts Modifiers Type Description
AllowTombstoneRequestHeaderKey Legacy, Alpha readonly True if a tombstoned object should be returned without erroring
currentDocumentVersionSchema Legacy, Alpha readonly Current version known properties that define document schema This must be bumped whenever the format of document schema or protocol for changing the current document schema changes. Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version. Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
DefaultSummaryConfiguration Legacy, Alpha readonly ISummaryConfiguration
DeletedResponseHeaderKey Legacy, Alpha readonly Error responses when requesting a deleted object will have this header set to true
disabledCompressionConfig Legacy, Alpha readonly ICompressionRuntimeOptions
GCNodeType Legacy, Alpha readonly { readonly DataStore: "DataStore"; readonly SubDataStore: "SubDataStore"; readonly Blob: "Blob"; readonly Other: "Other"; } The types of GC nodes in the GC reference graph.
InactiveResponseHeaderKey Deprecated, Legacy, Alpha readonly Inactive error responses will have this header set to true
TombstoneResponseHeaderKey Legacy, Alpha readonly Tombstone error responses will have this header set to true

Function Details

loadContainerRuntime

This is meant to be used by a @fluidframework/container-definitions#IRuntimeFactory to instantiate a container runtime.

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

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

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

Signature

export declare function loadContainerRuntime(params: LoadContainerRuntimeParams): Promise<IContainerRuntime & IRuntime>;

Parameters

Parameter Type Description
params LoadContainerRuntimeParams An object which specifies all required and optional params necessary to instantiate a runtime.

Returns

A runtime which provides all the functionality necessary to bind with the loader layer via the IRuntime interface and provide a runtime environment via the IContainerRuntime interface.

Return type: Promise<IContainerRuntime & IRuntime >

Variable Details

AllowTombstoneRequestHeaderKey

True if a tombstoned object should be returned without erroring

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

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

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

Signature

AllowTombstoneRequestHeaderKey = "allowTombstone"

currentDocumentVersionSchema

Current version known properties that define document schema This must be bumped whenever the format of document schema or protocol for changing the current document schema changes. Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version. Ex: Changing the ‘document schema acceptance’ mechanism from convert-and-swap to one requiring consensus does require changing this version.

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

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

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

Signature

currentDocumentVersionSchema = 1

DefaultSummaryConfiguration

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

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

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

Signature

DefaultSummaryConfiguration: ISummaryConfiguration

Type: ISummaryConfiguration

DeletedResponseHeaderKey

Error responses when requesting a deleted object will have this header set to true

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

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

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

Signature

DeletedResponseHeaderKey = "wasDeleted"

disabledCompressionConfig

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

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

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

Signature

disabledCompressionConfig: ICompressionRuntimeOptions

Type: ICompressionRuntimeOptions

GCNodeType

The types of GC nodes in the GC reference graph.

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

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

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

Signature

GCNodeType: {
    readonly DataStore: "DataStore";
    readonly SubDataStore: "SubDataStore";
    readonly Blob: "Blob";
    readonly Other: "Other";
}

Type: { readonly DataStore: “DataStore”; readonly SubDataStore: “SubDataStore”; readonly Blob: “Blob”; readonly Other: “Other”; }

InactiveResponseHeaderKey

Inactive error responses will have this header set to true

This API is deprecated and will be removed in a future release.

this header is deprecated and will be removed in the future. The functionality corresponding to this was experimental and is no longer supported.

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

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

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

Signature

InactiveResponseHeaderKey = "isInactive"

TombstoneResponseHeaderKey

Tombstone error responses will have this header set to true

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

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

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

Signature

TombstoneResponseHeaderKey = "isTombstoned"