@fluidframework/container-runtime 2.0.0-rc.3.0.0 → 2.0.0-rc.3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-report/container-runtime.api.md +23 -7
- package/dist/channelCollection.d.ts +5 -3
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +65 -15
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +5 -0
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +25 -5
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +2 -0
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -0
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +4 -11
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +45 -29
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +26 -5
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +5 -4
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +14 -2
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +13 -2
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +24 -21
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +2 -2
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +2 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summary/documentSchema.js +1 -1
- package/dist/summary/documentSchema.js.map +1 -1
- package/lib/channelCollection.d.ts +5 -3
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +67 -17
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +5 -0
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +24 -4
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +2 -0
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -0
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +4 -11
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +47 -31
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +26 -5
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +5 -4
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +12 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +13 -2
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +24 -21
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +2 -2
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/summary/documentSchema.js +1 -1
- package/lib/summary/documentSchema.js.map +1 -1
- package/package.json +17 -17
- package/src/channelCollection.ts +85 -35
- package/src/containerRuntime.ts +24 -24
- package/src/dataStoreContexts.ts +12 -0
- package/src/gc/garbageCollection.ts +63 -41
- package/src/gc/gcDefinitions.ts +21 -9
- package/src/gc/gcHelpers.ts +14 -1
- package/src/gc/gcTelemetry.ts +56 -47
- package/src/gc/index.ts +2 -1
- package/src/index.ts +2 -0
- package/src/packageVersion.ts +1 -1
- package/src/summary/documentSchema.ts +1 -1
package/lib/gc/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EACX,6BAA6B,EAC7B,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EACX,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,uBAAuB,EACvB,sCAAsC,GACtC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/lib/gc/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { GarbageCollector } from "./garbageCollection.js";
|
|
6
6
|
export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableDataStoreSweepOptionName, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, gcVersionUpgradeToV4Key, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, disableAutoRecoveryKey, disableDatastoreSweepKey, detectOutboundRoutesViaDDSKey, UnreferencedState, throwOnTombstoneLoadOverrideKey, GarbageCollectionMessageType, } from "./gcDefinitions.js";
|
|
7
|
-
export { cloneGCData, concatGarbageCollectionStates, getGCVersionInEffect,
|
|
7
|
+
export { cloneGCData, concatGarbageCollectionStates, getGCVersionInEffect, unpackChildNodesGCDetails, urlToGCNodePath, } from "./gcHelpers.js";
|
|
8
8
|
export { runGarbageCollection } from "./gcReferenceGraphAlgorithm.js";
|
|
9
9
|
export { gcStateBlobKey, GCSummaryStateTracker, } from "./gcSummaryStateTracker.js";
|
|
10
10
|
export { GCTelemetryTracker, sendGCUnexpectedUsageEvent } from "./gcTelemetry.js";
|
package/lib/gc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EAGtB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EAGtB,uBAAuB,EAavB,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAE/B,4BAA4B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EACX,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAOtE,OAAO,EACN,cAAc,EACd,qBAAqB,GAErB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { GarbageCollector } from \"./garbageCollection.js\";\nexport {\n\tnextGCVersion,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSweepGracePeriodMs,\n\tdefaultSessionExpiryDurationMs,\n\tGCNodeType,\n\tgcTestModeKey,\n\tgcDisableDataStoreSweepOptionName,\n\tgcDisableThrowOnTombstoneLoadOptionName,\n\tgcGenerationOptionName,\n\tGCFeatureMatrix,\n\tGCVersion,\n\tgcVersionUpgradeToV4Key,\n\tIGarbageCollectionRuntime,\n\tIGarbageCollector,\n\tIGarbageCollectorConfigs,\n\tIGarbageCollectorCreateParams,\n\tIGCMetadata,\n\tIGCMetadata_Deprecated,\n\tIGCNodeUpdatedProps,\n\tIGCResult,\n\tIGCRuntimeOptions,\n\tIMarkPhaseStats,\n\tISweepPhaseStats,\n\tIGCStats,\n\toneDayMs,\n\trunGCKey,\n\trunSessionExpiryKey,\n\trunSweepKey,\n\tstableGCVersion,\n\tdisableAutoRecoveryKey,\n\tdisableDatastoreSweepKey,\n\tdetectOutboundRoutesViaDDSKey,\n\tUnreferencedState,\n\tthrowOnTombstoneLoadOverrideKey,\n\tGarbageCollectionMessage,\n\tGarbageCollectionMessageType,\n\tISweepMessage,\n} from \"./gcDefinitions.js\";\nexport {\n\tcloneGCData,\n\tconcatGarbageCollectionStates,\n\tgetGCVersionInEffect,\n\tunpackChildNodesGCDetails,\n\turlToGCNodePath,\n} from \"./gcHelpers.js\";\nexport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm.js\";\nexport {\n\tIGarbageCollectionNodeData,\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n\tIGarbageCollectionSummaryDetailsLegacy,\n} from \"./gcSummaryDefinitions.js\";\nexport {\n\tgcStateBlobKey,\n\tGCSummaryStateTracker,\n\tIGCSummaryTrackingData,\n} from \"./gcSummaryStateTracker.js\";\nexport { GCTelemetryTracker, sendGCUnexpectedUsageEvent } from \"./gcTelemetry.js\";\nexport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker.js\";\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, isRuntimeMessage, agentSchedulerId, ContainerRuntime, TombstoneResponseHeaderKey, InactiveResponseHeaderKey, ISummaryConfiguration, DefaultSummaryConfiguration, ICompressionRuntimeOptions, CompressionAlgorithms, RuntimeHeaderData, disabledCompressionConfig, } from "./containerRuntime.js";
|
|
5
|
+
export { ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, isRuntimeMessage, agentSchedulerId, ContainerRuntime, DeletedResponseHeaderKey, TombstoneResponseHeaderKey, InactiveResponseHeaderKey, ISummaryConfiguration, DefaultSummaryConfiguration, ICompressionRuntimeOptions, CompressionAlgorithms, RuntimeHeaderData, disabledCompressionConfig, } from "./containerRuntime.js";
|
|
6
6
|
export { ContainerMessageType, ContainerRuntimeMessage, IContainerRuntimeMessageCompatDetails, CompatModeBehavior, RecentlyAddedContainerRuntimeMessageDetails, UnknownContainerRuntimeMessage, } from "./messageTypes.js";
|
|
7
7
|
export { IBlobManagerLoadInfo } from "./blobManager.js";
|
|
8
8
|
export { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
|
|
9
9
|
export { detectOutboundReferences, RuntimeHeaders, ChannelCollectionFactory, AllowTombstoneRequestHeaderKey, AllowInactiveRequestHeaderKey, } from "./channelCollection.js";
|
|
10
|
-
export { GCNodeType, IGCMetadata, GCFeatureMatrix, GCVersion, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCStats, } from "./gc/index.js";
|
|
10
|
+
export { GCNodeType, IGCMetadata, GCFeatureMatrix, GCVersion, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCNodeUpdatedProps, IGCStats, } from "./gc/index.js";
|
|
11
11
|
export { IAckedSummary, ISummarizer, ISummarizeResults, ISummaryCancellationToken, neverCancelledSummaryToken, Summarizer, SummarizerStopReason, SummaryCollection, EnqueueSummarizeResult, IAckSummaryResult, IBaseSummarizeResult, IBroadcastSummaryResult, ICancellationToken, IConnectableRuntime, IContainerRuntimeMetadata, ICreateContainerMetadata, IEnqueueSummarizeOptions, IGenerateSummaryTreeResult, IGeneratedSummaryStats, INackSummaryResult, IOnDemandSummarizeOptions, IRefreshSummaryAckOptions, ISubmitSummaryOpResult, ISubmitSummaryOptions, ISerializedElection, ISummarizeOptions, ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, IUploadSummaryResult, SubmitSummaryResult, SummarizeResultPart, IClientSummaryWatcher, ISummary, ISummaryCollectionOpEvents, ISummaryAckMessage, ISummaryMetadataMessage, ISummaryNackMessage, ISummaryOpMessage, OpActionEventListener, OpActionEventName, ICancellableSummarizerController, SubmitSummaryFailureData, SummaryStage, IRetriableFailureResult, ISummarizeEventProps, IdCompressorMode, IDocumentSchema, DocumentSchemaValueType, IDocumentSchemaCurrent, currentDocumentVersionSchema, DocumentsSchemaController, IDocumentSchemaChangeMessage, IDocumentSchemaFeatures, } from "./summary/index.js";
|
|
12
12
|
export { IChunkedOp, unpackRuntimeMessage } from "./opLifecycle/index.js";
|
|
13
13
|
export { ChannelCollection } from "./channelCollection.js";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,oBAAoB,EACpB,uBAAuB,EACvB,qCAAqC,EACrC,kBAAkB,EAClB,2CAA2C,EAC3C,8BAA8B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACN,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,EACV,WAAW,EACX,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,yBAAyB,EACzB,0BAA0B,EAC1B,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,gCAAgC,EAChC,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,wCAAwC,EACxC,4BAA4B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,s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,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,gCAAgC,EAChC,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,8BAA8B,EAC9B,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,wCAAwC,EACxC,4BAA4B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { isRuntimeMessage, agentSchedulerId, ContainerRuntime, TombstoneResponseHeaderKey, InactiveResponseHeaderKey, DefaultSummaryConfiguration, CompressionAlgorithms, disabledCompressionConfig, } from "./containerRuntime.js";
|
|
5
|
+
export { isRuntimeMessage, agentSchedulerId, ContainerRuntime, DeletedResponseHeaderKey, TombstoneResponseHeaderKey, InactiveResponseHeaderKey, DefaultSummaryConfiguration, CompressionAlgorithms, disabledCompressionConfig, } from "./containerRuntime.js";
|
|
6
6
|
export { ContainerMessageType, } from "./messageTypes.js";
|
|
7
7
|
export { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
|
|
8
8
|
export { detectOutboundReferences, RuntimeHeaders, ChannelCollectionFactory, AllowTombstoneRequestHeaderKey, AllowInactiveRequestHeaderKey, } from "./channelCollection.js";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAON,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EAEzB,2BAA2B,EAE3B,qBAAqB,EAErB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,oBAAoB,GAMpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACN,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAON,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EAEzB,2BAA2B,EAE3B,qBAAqB,EAErB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,oBAAoB,GAMpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACN,wBAAwB,EACxB,cAAc,EACd,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,UAAU,GASV,MAAM,eAAe,CAAC;AACvB,OAAO,EAKN,0BAA0B,EAC1B,UAAU,EAEV,iBAAiB,EA4CjB,4BAA4B,EAC5B,yBAAyB,GAGzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAc,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAGN,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,GAKrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tISummaryRuntimeOptions,\n\tISummaryBaseConfiguration,\n\tISummaryConfigurationHeuristics,\n\tISummaryConfigurationDisableSummarizer,\n\tISummaryConfigurationDisableHeuristics,\n\tIContainerRuntimeOptions,\n\tisRuntimeMessage,\n\tagentSchedulerId,\n\tContainerRuntime,\n\tDeletedResponseHeaderKey,\n\tTombstoneResponseHeaderKey,\n\tInactiveResponseHeaderKey,\n\tISummaryConfiguration,\n\tDefaultSummaryConfiguration,\n\tICompressionRuntimeOptions,\n\tCompressionAlgorithms,\n\tRuntimeHeaderData,\n\tdisabledCompressionConfig,\n} from \"./containerRuntime.js\";\nexport {\n\tContainerMessageType,\n\tContainerRuntimeMessage,\n\tIContainerRuntimeMessageCompatDetails,\n\tCompatModeBehavior,\n\tRecentlyAddedContainerRuntimeMessageDetails,\n\tUnknownContainerRuntimeMessage,\n} from \"./messageTypes.js\";\nexport { IBlobManagerLoadInfo } from \"./blobManager.js\";\nexport { FluidDataStoreRegistry } from \"./dataStoreRegistry.js\";\nexport {\n\tdetectOutboundReferences,\n\tRuntimeHeaders,\n\tChannelCollectionFactory,\n\tAllowTombstoneRequestHeaderKey,\n\tAllowInactiveRequestHeaderKey,\n} from \"./channelCollection.js\";\nexport {\n\tGCNodeType,\n\tIGCMetadata,\n\tGCFeatureMatrix,\n\tGCVersion,\n\tIGCRuntimeOptions,\n\tIMarkPhaseStats,\n\tISweepPhaseStats,\n\tIGCNodeUpdatedProps,\n\tIGCStats,\n} from \"./gc/index.js\";\nexport {\n\tIAckedSummary,\n\tISummarizer,\n\tISummarizeResults,\n\tISummaryCancellationToken,\n\tneverCancelledSummaryToken,\n\tSummarizer,\n\tSummarizerStopReason,\n\tSummaryCollection,\n\tEnqueueSummarizeResult,\n\tIAckSummaryResult,\n\tIBaseSummarizeResult,\n\tIBroadcastSummaryResult,\n\tICancellationToken,\n\tIConnectableRuntime,\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tIEnqueueSummarizeOptions,\n\tIGenerateSummaryTreeResult,\n\tIGeneratedSummaryStats,\n\tINackSummaryResult,\n\tIOnDemandSummarizeOptions,\n\tIRefreshSummaryAckOptions,\n\tISubmitSummaryOpResult,\n\tISubmitSummaryOptions,\n\tISerializedElection,\n\tISummarizeOptions,\n\tISummarizerEvents,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tIUploadSummaryResult,\n\tSubmitSummaryResult,\n\tSummarizeResultPart,\n\tIClientSummaryWatcher,\n\tISummary,\n\tISummaryCollectionOpEvents,\n\tISummaryAckMessage,\n\tISummaryMetadataMessage,\n\tISummaryNackMessage,\n\tISummaryOpMessage,\n\tOpActionEventListener,\n\tOpActionEventName,\n\tICancellableSummarizerController,\n\tSubmitSummaryFailureData,\n\tSummaryStage,\n\tIRetriableFailureResult,\n\tISummarizeEventProps,\n\tIdCompressorMode,\n\tIDocumentSchema,\n\tDocumentSchemaValueType,\n\tIDocumentSchemaCurrent,\n\tcurrentDocumentVersionSchema,\n\tDocumentsSchemaController,\n\tIDocumentSchemaChangeMessage,\n\tIDocumentSchemaFeatures,\n} from \"./summary/index.js\";\nexport { IChunkedOp, unpackRuntimeMessage } from \"./opLifecycle/index.js\";\nexport { ChannelCollection } from \"./channelCollection.js\";\nexport {\n\tIFluidDataStoreContextInternal,\n\tISnapshotDetails,\n\tLocalFluidDataStoreContext,\n\tLocalFluidDataStoreContextBase,\n\tFluidDataStoreContext,\n\tIFluidDataStoreContextProps,\n\tILocalFluidDataStoreContextProps,\n\tILocalDetachedFluidDataStoreContextProps,\n\tIFluidDataStoreContextEvents,\n} from \"./dataStoreContext.js\";\nexport { DataStoreContexts } from \"./dataStoreContexts.js\";\n"]}
|
package/lib/legacy.d.ts
CHANGED
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-rc.3.0.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.3.0.2";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-rc.3.0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-rc.3.0.2\";\n"]}
|
|
@@ -332,6 +332,7 @@ export class DocumentsSchemaController {
|
|
|
332
332
|
*/
|
|
333
333
|
maybeSendSchemaMessage() {
|
|
334
334
|
if (this.sendOp && this.futureSchema !== undefined) {
|
|
335
|
+
this.sendOp = false;
|
|
335
336
|
assert(this.explicitSchemaControl &&
|
|
336
337
|
this.futureSchema.runtime.explicitSchemaControl === true, 0x94e /* not legacy */);
|
|
337
338
|
return {
|
|
@@ -339,7 +340,6 @@ export class DocumentsSchemaController {
|
|
|
339
340
|
refSeq: this.documentSchema.refSeq,
|
|
340
341
|
};
|
|
341
342
|
}
|
|
342
|
-
this.sendOp = false;
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
345
|
* Process document schema change message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentSchema.js","sourceRoot":"","sources":["../../src/summary/documentSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuGlD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAwB9C,MAAM,eAAe;IACb,GAAG,CAAC,gBAAuB,EAAE,gBAAuB;QAC1D,OAAO,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;IAEM,EAAE,CAAC,gBAAuB,EAAE,gBAAuB;QACzD,OAAO,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;IAEM,QAAQ,CAAC,CAAU;Q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AC,aAAa,CAAC,CAAC;QAExC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC;CACD;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { pkgVersion } from \"../packageVersion.js\";\n\n/**\n * Descripe allowed type for properties in document schema.\n * Please note that for all property types we should use undefined to indicate that particular capability is off.\n * Using false, or some string value (like \"off\") will result in clients who do not understand that property failing, whereas\n * we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.\n * @alpha\n */\nexport type DocumentSchemaValueType = string | string[] | true | number | undefined;\n\n/**\n * ID Compressor mode.\n * \"on\" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all\n * sessions for a given document. This results in IContainerRuntime.idCompressor to be always available.\n * \"delayed\" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer.\n * In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it \"On\").\n * The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs.\n * undefined - ID compressor is not loaded.\n * While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.\n *\n * @alpha\n */\nexport type IdCompressorMode = \"on\" | \"delayed\" | undefined;\n\n/**\n * Document schema information.\n * Describes overall shape of document schema, including unknown (to this version) properties.\n *\n * Used by runtime to make a call if it can understand document schema.\n * If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures\n * down the road and potentially corrupting documents.\n * For now this structure and appropriate interpretation / behavior is focused only on runtime features.\n * In the future that could be interpolated to more areas, including DDSs used, and even possibly - application\n * schema.\n *\n * Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will\n * stop (and fail session) on any unknown properties within \"runtime\" sub-tree.\n *\n * In most cases values preserved in the document will not dictate if such features should be enabled in a given session.\n * I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know\n * how to interpret such ops, but does not need to actually use compression itself. That said, some options could be\n * sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example.\n * Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's\n * disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail\n * if opened by clients who do not support compression.\n *\n * For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.\n *\n * @alpha\n */\nexport interface IDocumentSchema {\n\t// version that describes how data is stored in this structure.\n\t// If runtime sees a version it does not understand, it should immediately fail and not\n\t// attempt to interpret any further data.\n\tversion: number;\n\n\t// Sequence number when this schema became active.\n\trefSeq: number;\n\n\truntime: Record<string, DocumentSchemaValueType>;\n}\n\n/**\n * Content of the type=ContainerMessageType.DocumentSchemaChange ops.\n * The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent)\n * ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey\n * regSeq of last known schema change (known to a client proposing schema change).\n * @see ContainerRuntimeDocumentSchemaMessage\n * @alpha\n */\nexport type IDocumentSchemaChangeMessage = IDocumentSchema;\n\n/**\n * Settings that this session would like to have, based on options and feature gates.\n *\n * WARNING: This type is used to infer IDocumentSchemaCurrent type!\n * Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!\n *\n * @alpha\n */\nexport interface IDocumentSchemaFeatures {\n\t// Tells if client uses legacy behavior of changing schema.\n\t// - Legacy behavior - changing schema without leveraging schema change ops.\n\t// - New behavior - changes in schema require ops and take into affect with delay.\n\texplicitSchemaControl: boolean;\n\tcompressionLz4: boolean;\n\tidCompressorMode: IdCompressorMode;\n\topGroupingEnabled: boolean;\n\n\t/**\n\t * List of disallowed versions of the runtime.\n\t * This option is sticky. Once a version of runtime is added to this list (when supplied to DocumentsSchemaController's constructor)\n\t * it will be added to the list of disallowed versions and stored in document metadata.\n\t * Each runtime checks if its version is in this list on container open. If it is, it immediately exits with error message\n\t * indicating to the user that this version is no longer supported.\n\t * Currently there is no mechanism to remove version from this list. I.e. If it was once added to the list,\n\t * it gets added to any document metadata (documents that gets open by this runtime) and there is no way to clear it from document's\n\t * metadata.\n\t */\n\tdisallowedVersions: string[];\n}\n\n/**\n * Current version known properties that define document schema\n * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.\n * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.\n * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.\n * @alpha\n */\nexport const currentDocumentVersionSchema = 1;\n\n/**\n * Current document schema.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type IDocumentSchemaCurrent = {\n\tversion: 1;\n\trefSeq: number;\n\n\truntime: {\n\t\t[P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean\n\t\t\t? true\n\t\t\t: IDocumentSchemaFeatures[P];\n\t};\n};\n\ninterface IProperty<T = unknown> {\n\tand: (currentDocSchema: T, desiredDocSchema: T) => T;\n\tor: (currentDocSchema: T, desiredDocSchema: T) => T;\n\tvalidate(t: unknown): boolean;\n}\n\nclass TrueOrUndefined implements IProperty<true | undefined> {\n\tpublic and(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn currentDocSchema === true && desiredDocSchema === true ? true : undefined;\n\t}\n\n\tpublic or(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn currentDocSchema === true || desiredDocSchema === true ? true : undefined;\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || t === true;\n\t}\n}\n\nclass TrueOrUndefinedMax extends TrueOrUndefined {\n\tpublic and(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn this.or(currentDocSchema, desiredDocSchema);\n\t}\n}\n\nclass MultiChoice implements IProperty<string | undefined> {\n\tconstructor(private readonly choices: string[]) {}\n\n\tpublic and(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\tif (currentDocSchema === undefined || desiredDocSchema === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.choices[\n\t\t\tMath.min(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))\n\t\t];\n\t}\n\n\tpublic or(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\tif (currentDocSchema === undefined) {\n\t\t\treturn desiredDocSchema;\n\t\t}\n\t\tif (desiredDocSchema === undefined) {\n\t\t\treturn currentDocSchema;\n\t\t}\n\t\treturn this.choices[\n\t\t\tMath.max(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))\n\t\t];\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || (typeof t === \"string\" && this.choices.includes(t));\n\t}\n}\n\nclass IdCompressorProperty extends MultiChoice {\n\t// document schema always wins!\n\tpublic and(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\treturn currentDocSchema;\n\t}\n}\n\nclass CheckVersions implements IProperty<string[] | undefined> {\n\tpublic or(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {\n\t\tconst set = new Set<string>([...currentDocSchema, ...desiredDocSchema]);\n\t\treturn arrayToProp([...set.values()]);\n\t}\n\n\t// Once version is there, it stays there forever.\n\tpublic and(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {\n\t\treturn this.or(currentDocSchema, desiredDocSchema);\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || (Array.isArray(t) && !t.includes(pkgVersion));\n\t}\n}\n\n/**\n * Helper structure to valida if a schema is compatible with existing code.\n */\nconst documentSchemaSupportedConfigs = {\n\texplicitSchemaControl: new TrueOrUndefinedMax(), // once new behavior shows up, it's sticky\n\tidCompressorMode: new IdCompressorProperty([\"delayed\", \"on\"]),\n\topGroupingEnabled: new TrueOrUndefined(),\n\tcompressionLz4: new TrueOrUndefined(),\n\tdisallowedVersions: new CheckVersions(),\n};\n\n/**\n * Checks if a given schema is compatible with current code, i.e. if current code can understand all the features of that schema.\n * If schema is not compatible with current code, it throws an exception.\n * @param documentSchema - current schema\n */\nfunction checkRuntimeCompatibility(documentSchema?: IDocumentSchema) {\n\t// Back-compat - we can't do anything about legacy documents.\n\t// There is no way to validate them, so we are taking a guess that safe deployment processes used by a given app\n\t// do not run into compat problems.\n\tif (documentSchema === undefined) {\n\t\treturn;\n\t}\n\n\tconst msg = \"Document can't be opened with current version of the code\";\n\tif (documentSchema.version !== currentDocumentVersionSchema) {\n\t\tthrow DataProcessingError.create(\n\t\t\tmsg,\n\t\t\t\"checkRuntimeCompat1\",\n\t\t\tundefined, // message\n\t\t\t{\n\t\t\t\truntimeSchemaVersion: documentSchema.version,\n\t\t\t\tcurrentRuntimeSchemaVersion: currentDocumentVersionSchema,\n\t\t\t},\n\t\t);\n\t}\n\n\tlet unknownProperty: string | undefined;\n\n\tconst regSeq = documentSchema.refSeq;\n\t// defence in depth - it should not be possible to get here anything other than integer, but worth validating it.\n\tif (typeof regSeq !== \"number\" || regSeq < 0 || !Number.isInteger(regSeq)) {\n\t\tunknownProperty = \"refSeq\";\n\t} else if (documentSchema.runtime === null || typeof documentSchema.runtime !== \"object\") {\n\t\tunknownProperty = \"runtime\";\n\t} else {\n\t\tfor (const [name, value] of Object.entries(documentSchema.runtime)) {\n\t\t\tconst validator = documentSchemaSupportedConfigs[name] as IProperty | undefined;\n\t\t\tif (validator === undefined || !validator.validate(value)) {\n\t\t\t\tunknownProperty = `runtime/${name}`;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (unknownProperty !== undefined) {\n\t\tconst value = documentSchema[unknownProperty];\n\t\tthrow DataProcessingError.create(\n\t\t\tmsg,\n\t\t\t\"checkRuntimeCompat2\",\n\t\t\tundefined, // message\n\t\t\t{\n\t\t\t\tcodeVersion: currentDocumentVersionSchema,\n\t\t\t\tproperty: unknownProperty,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t);\n\t}\n}\n\nfunction and(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): IDocumentSchemaCurrent {\n\tconst runtime = {};\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\truntime[key] = (documentSchemaSupportedConfigs[key] as IProperty).and(\n\t\t\tcurrentDocSchema.runtime[key],\n\t\t\tdesiredDocSchema.runtime[key],\n\t\t);\n\t}\n\treturn {\n\t\tversion: currentDocumentVersionSchema,\n\t\trefSeq: currentDocSchema.refSeq,\n\t\truntime,\n\t} as unknown as IDocumentSchemaCurrent;\n}\n\nfunction or(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): IDocumentSchemaCurrent {\n\tconst runtime = {};\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\truntime[key] = (documentSchemaSupportedConfigs[key] as IProperty).or(\n\t\t\tcurrentDocSchema.runtime[key],\n\t\t\tdesiredDocSchema.runtime[key],\n\t\t);\n\t}\n\treturn {\n\t\tversion: currentDocumentVersionSchema,\n\t\trefSeq: currentDocSchema.refSeq,\n\t\truntime,\n\t} as unknown as IDocumentSchemaCurrent;\n}\n\nfunction same(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): boolean {\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\t// If schemas differ only by type of behavior, then we should not send schema change ops!\n\t\tif (\n\t\t\tkey !== \"explicitSchemaControl\" &&\n\t\t\tcurrentDocSchema.runtime[key] !== desiredDocSchema.runtime[key]\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction boolToProp(b: boolean) {\n\treturn b ? true : undefined;\n}\n\nfunction arrayToProp(arr: string[]) {\n\treturn arr.length === 0 ? undefined : arr;\n}\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Controller of document schema.\n *\n * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md\n *\n * This class manages current document schema and transitions between document schemas.\n * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data\n * (summary and op format), features & capabilities that a version of runtime has to support and understand in\n * order to collaborate on a document.\n * New features that modify document format have to be included in document schema definition.\n * Usage of such features could only happen after document schema has been updated to reflect such feature.\n *\n * This formality allows clients that do not understand such features to fail right away when they observe\n * document schema listing capabilities that such client does not understand.\n * Old clients will fail in predictable way. This allows us to\n * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.\n * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are\n * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along\n * and potentially corrupt the document. This is especially true for summarizer client, who could simply \"undo\"\n * changes it does not understands.\n *\n * It's important to note how it overlaps with feature gates and safe velocity.\n * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.\n * But, developers (through code deployment or feature gates) could disable usage of such features.\n * That will stop a process of further document schema changes (for documents that were not using such feature).\n * And documents that already list such capability in their schema will continue to do so. Later ensures that old\n * clients who do not understand such feature will continue to fail to open such documents, as such documents very\n * likely contain data in a new format.\n *\n * Controller operates with 4 schemas:\n * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).\n * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).\n * - session schema - current session schema. It's \"and\" of the above two schemas.\n * - future schema - \"or\" of document and desires schemas.\n *\n * \"or\" & \"and\" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.\n * But for other properties it's more nuanced.\n *\n * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to\n * future schema.\n *\n * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.\n *\n * There are two modes this class can operate:\n * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,\n * right away, and new features are available right away\n * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.\n * However code should assume that any new features that were not enabled in a given document will not be available\n * for a given session. That's because this session may never send any ops (including read-only documents). Or it may\n * fail to convert schema.\n * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),\n * then eventually all documents that are modified will have that feature reflected in their schema. It could require\n * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults\n * schema on document load).\n *\n * How schemas are changed (in non-legacy mode):\n * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.\n * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.\n * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will\n * reference old schema that is no longer in effect.\n * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do\n * recalc and decide if schema needs to be changed or not).\n *\n * @alpha\n */\nexport class DocumentsSchemaController {\n\tprivate explicitSchemaControl: boolean;\n\tprivate sendOp = true;\n\n\t// schema coming from document metadata (snapshot we loaded from)\n\tprivate documentSchema: IDocumentSchemaCurrent;\n\n\t// desired schema, based on feature gates / runtime options.\n\t// This includes requests to enable to disable functionality\n\tprivate readonly desiredSchema: IDocumentSchemaCurrent;\n\n\t// OR() of document schema and desired schema. It enables all the features that are enabled in either of schemas.\n\tprivate futureSchema: IDocumentSchemaCurrent | undefined;\n\n\t// Current schema this session operates with.\n\t// 1) Legacy mode: this is same as desired schema - all options that were requested to be on are on, and all options requested to be off are off.\n\t// 2) Non-legacy mode: this is AND() of document schema and desired schema. Only options that are enabled in both are enabled here.\n\t// If there are any options that are not enabled in document schema, but are enabled in desired schema, then attempt to change schema\n\t// (and enable such options) will be made through the session.\n\tpublic sessionSchema: IDocumentSchemaCurrent;\n\n\t/**\n\t * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.\n\t * @param existing - Is the document existing document, or a new doc.\n\t * @param documentMetadataSchema - current document's schema, if present.\n\t * @param features - features of the document schema that current session wants to see enabled.\n\t * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)\n\t */\n\tconstructor(\n\t\texisting: boolean,\n\t\tdocumentMetadataSchema: IDocumentSchema | undefined,\n\t\tfeatures: IDocumentSchemaFeatures,\n\t\tprivate readonly onSchemaChange: (schema: IDocumentSchemaCurrent) => void,\n\t) {\n\t\tcheckRuntimeCompatibility(documentMetadataSchema);\n\n\t\t// For simplicity, let's only support new schema features for explicit schema control mode\n\t\tassert(\n\t\t\tfeatures.disallowedVersions.length === 0 || features.explicitSchemaControl,\n\t\t\t0x949 /* not supported */,\n\t\t);\n\n\t\t// Desired schema by this session - almost all props are coming from arguments\n\t\tthis.desiredSchema = {\n\t\t\tversion: currentDocumentVersionSchema,\n\t\t\trefSeq: documentMetadataSchema?.refSeq ?? 0,\n\t\t\truntime: {\n\t\t\t\texplicitSchemaControl: boolToProp(features.explicitSchemaControl),\n\t\t\t\tcompressionLz4: boolToProp(features.compressionLz4),\n\t\t\t\tidCompressorMode: features.idCompressorMode,\n\t\t\t\topGroupingEnabled: boolToProp(features.opGroupingEnabled),\n\t\t\t\tdisallowedVersions: arrayToProp(features.disallowedVersions),\n\t\t\t},\n\t\t};\n\n\t\t// Schema coming from document metadata (snapshot we loaded from), or if no document exists\n\t\t// (this is a new document) then this is the same as desiredSchema (same as session schema in such case).\n\t\t// Latter is importnat sure that's what will go into summary.\n\t\tthis.documentSchema = !existing\n\t\t\t? this.desiredSchema\n\t\t\t: (documentMetadataSchema as IDocumentSchemaCurrent) ??\n\t\t\t ({\n\t\t\t\t\tversion: currentDocumentVersionSchema,\n\t\t\t\t\t// see comment in summarizeDocumentSchema() on why it has to stay zero\n\t\t\t\t\trefSeq: 0,\n\t\t\t\t\t// If it's existing document and it has no schema, then it was written by legacy client.\n\t\t\t\t\t// If it's a new document, then we define it's legacy-related behaviors.\n\t\t\t\t\truntime: {\n\t\t\t\t\t\texplicitSchemaControl: boolToProp(\n\t\t\t\t\t\t\t!existing && features.explicitSchemaControl,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t } satisfies IDocumentSchemaCurrent);\n\n\t\t// Use legacy behavior only if both document and options tell us to use legacy.\n\t\t// Otherwise it's no longer legacy time!\n\t\tthis.explicitSchemaControl =\n\t\t\tthis.documentSchema.runtime.explicitSchemaControl === true ||\n\t\t\tfeatures.explicitSchemaControl;\n\n\t\t// Calculate\n\t\t// - current session schema (overlap of document schema and desired schema)\n\t\t// - future schema to propose (concatination of document schema and desired schema)\n\t\tif (!this.explicitSchemaControl || !existing) {\n\t\t\tthis.sessionSchema = this.desiredSchema;\n\t\t\tassert(\n\t\t\t\tboolToProp(this.explicitSchemaControl) ===\n\t\t\t\t\tthis.sessionSchema.runtime.explicitSchemaControl,\n\t\t\t\t0x94a /* explicitSchemaControl */,\n\t\t\t);\n\t\t\tthis.futureSchema = undefined;\n\t\t} else {\n\t\t\tthis.sessionSchema = and(this.documentSchema, this.desiredSchema);\n\t\t\tthis.futureSchema = or(this.documentSchema, this.desiredSchema);\n\t\t\tassert(this.sessionSchema.runtime.explicitSchemaControl === true, 0x94b /* legacy */);\n\t\t\tassert(this.futureSchema.runtime.explicitSchemaControl === true, 0x94c /* legacy */);\n\t\t\tif (same(this.documentSchema, this.futureSchema)) {\n\t\t\t\tthis.futureSchema = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// Validate that schema we are operating in is actually a schema we consider compatible with current runtime.\n\t\tcheckRuntimeCompatibility(this.sessionSchema);\n\t\tcheckRuntimeCompatibility(this.futureSchema);\n\t}\n\n\tpublic summarizeDocumentSchema(refSeq: number): IDocumentSchemaCurrent | undefined {\n\t\t// For legacy behavior, we could write nothing (return undefined).\n\t\t// It does not buy us anything, as whatever written in summary does not actually impact clients operating in legacy mode.\n\t\t// But writing current used config (and assuming most of the clients settle on same config over time) will help with transition\n\t\t// out of legacy mode, as clients transitioning out of it would be able to use all the\n\t\t// features that are mentioned in schema right away, without a need to go through schema transition (and thus for a session or\n\t\t// two losing ability to use all the features)\n\n\t\tconst schema = this.explicitSchemaControl ? this.documentSchema : this.desiredSchema;\n\n\t\t// It's important to keep refSeq at zero in legacy mode, such that transition out of it is simple and we do not have\n\t\t// race conditions. If we put any other number (including latest seq number), then we will have two clients\n\t\t// (loading from two different summaries) with different numbers, and eventual consistency will be broken as schema\n\t\t// change ops will be interpretted differently by those two clients.\n\t\tassert(\n\t\t\tthis.explicitSchemaControl || schema.refSeq === 0,\n\t\t\t0x94d /* refSeq should be zero */,\n\t\t);\n\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Called by Container runtime whenever it is about to send some op.\n\t * It gives opportunity for controller to issue its own ops - we do not want to send ops if there are no local changes in document.\n\t * @returns Optional message to send.\n\t */\n\tpublic maybeSendSchemaMessage(): IDocumentSchemaChangeMessage | undefined {\n\t\tif (this.sendOp && this.futureSchema !== undefined) {\n\t\t\tassert(\n\t\t\t\tthis.explicitSchemaControl &&\n\t\t\t\t\tthis.futureSchema.runtime.explicitSchemaControl === true,\n\t\t\t\t0x94e /* not legacy */,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t...this.futureSchema,\n\t\t\t\trefSeq: this.documentSchema.refSeq,\n\t\t\t};\n\t\t}\n\t\tthis.sendOp = false;\n\t}\n\n\t/**\n\t * Process document schema change message\n\t * Called by ContainerRuntime whenever it sees document schema messages.\n\t * @param content - content of the message\n\t * @param local - whether op is local\n\t * @param sequenceNumber - sequence number of the op\n\t * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)\n\t */\n\tpublic processDocumentSchemaOp(\n\t\tcontent: IDocumentSchemaChangeMessage,\n\t\tlocal: boolean,\n\t\tsequenceNumber: number,\n\t) {\n\t\tassert(\n\t\t\tcontent.refSeq <= this.documentSchema.refSeq,\n\t\t\t0x94f /* did we lose a message somewhere? */,\n\t\t);\n\t\tassert(\n\t\t\tthis.documentSchema.refSeq < sequenceNumber,\n\t\t\t0x950 /* time should move forward only! */,\n\t\t);\n\t\tif (content.refSeq !== this.documentSchema.refSeq) {\n\t\t\t// CAS failed\n\t\t\treturn false;\n\t\t}\n\n\t\t// This assert should be after checking for successful CAS above.\n\t\t// This will ensure we do not trip on our own messages that are no longer wanted as we processed someone else schema change message.\n\t\tassert(\n\t\t\t!local || (this.explicitSchemaControl && this.futureSchema !== undefined),\n\t\t\t0x951 /* not sending ops */,\n\t\t);\n\n\t\t// Changes are in effect. Immediately check that this client understands these changes\n\t\tcheckRuntimeCompatibility(content);\n\n\t\tconst schema: IDocumentSchema = { ...content, refSeq: sequenceNumber };\n\t\tthis.documentSchema = schema as IDocumentSchemaCurrent;\n\t\tthis.sessionSchema = and(this.documentSchema, this.desiredSchema);\n\n\t\t// legacy behavior is automatically off for the document once someone sends a schema op -\n\t\t// from now on it's fully controlled by ops.\n\t\t// This is very important, as summarizeDocumentSchema() should use this new schema!\n\t\tthis.explicitSchemaControl = true;\n\n\t\t// Stop attempting changing schema.\n\t\t// If it was local op, then we succeeded and do not need to try again.\n\t\t// If it was remote op, then some changes happened to schema.\n\t\t// We would need to recalculate this.futureSchema by merging changes that we just received.\n\t\t// Avoid this complexity for now - a new client session (loading from new summary with these changes)\n\t\t// will automatically do this recalculation and will figure out\n\t\tthis.futureSchema = undefined;\n\n\t\tthis.onSchemaChange(this.sessionSchema);\n\n\t\treturn true;\n\t}\n\n\tpublic onDisconnect() {\n\t\tthis.sendOp = true;\n\t}\n}\n\n/* eslint-enable jsdoc/check-indentation */\n"]}
|
|
1
|
+
{"version":3,"file":"documentSchema.js","sourceRoot":"","sources":["../../src/summary/documentSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuG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,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QACvE,IAAI,CAAC,cAAc,GAAG,MAAgC,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAElE,yFAAyF;QACzF,4CAA4C;QAC5C,mFAAmF;QACnF,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAElC,mCAAmC;QACnC,sEAAsE;QACtE,6DAA6D;QAC7D,2FAA2F;QAC3F,qGAAqG;QACrG,+DAA+D;QAC/D,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAE9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAExC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC;CACD;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { pkgVersion } from \"../packageVersion.js\";\n\n/**\n * Descripe allowed type for properties in document schema.\n * Please note that for all property types we should use undefined to indicate that particular capability is off.\n * Using false, or some string value (like \"off\") will result in clients who do not understand that property failing, whereas\n * we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.\n * @alpha\n */\nexport type DocumentSchemaValueType = string | string[] | true | number | undefined;\n\n/**\n * ID Compressor mode.\n * \"on\" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all\n * sessions for a given document. This results in IContainerRuntime.idCompressor to be always available.\n * \"delayed\" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer.\n * In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it \"On\").\n * The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs.\n * undefined - ID compressor is not loaded.\n * While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.\n *\n * @alpha\n */\nexport type IdCompressorMode = \"on\" | \"delayed\" | undefined;\n\n/**\n * Document schema information.\n * Describes overall shape of document schema, including unknown (to this version) properties.\n *\n * Used by runtime to make a call if it can understand document schema.\n * If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures\n * down the road and potentially corrupting documents.\n * For now this structure and appropriate interpretation / behavior is focused only on runtime features.\n * In the future that could be interpolated to more areas, including DDSs used, and even possibly - application\n * schema.\n *\n * Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will\n * stop (and fail session) on any unknown properties within \"runtime\" sub-tree.\n *\n * In most cases values preserved in the document will not dictate if such features should be enabled in a given session.\n * I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know\n * how to interpret such ops, but does not need to actually use compression itself. That said, some options could be\n * sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example.\n * Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's\n * disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail\n * if opened by clients who do not support compression.\n *\n * For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.\n *\n * @alpha\n */\nexport interface IDocumentSchema {\n\t// version that describes how data is stored in this structure.\n\t// If runtime sees a version it does not understand, it should immediately fail and not\n\t// attempt to interpret any further data.\n\tversion: number;\n\n\t// Sequence number when this schema became active.\n\trefSeq: number;\n\n\truntime: Record<string, DocumentSchemaValueType>;\n}\n\n/**\n * Content of the type=ContainerMessageType.DocumentSchemaChange ops.\n * The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent)\n * ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey\n * regSeq of last known schema change (known to a client proposing schema change).\n * @see ContainerRuntimeDocumentSchemaMessage\n * @alpha\n */\nexport type IDocumentSchemaChangeMessage = IDocumentSchema;\n\n/**\n * Settings that this session would like to have, based on options and feature gates.\n *\n * WARNING: This type is used to infer IDocumentSchemaCurrent type!\n * Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!\n *\n * @alpha\n */\nexport interface IDocumentSchemaFeatures {\n\t// Tells if client uses legacy behavior of changing schema.\n\t// - Legacy behavior - changing schema without leveraging schema change ops.\n\t// - New behavior - changes in schema require ops and take into affect with delay.\n\texplicitSchemaControl: boolean;\n\tcompressionLz4: boolean;\n\tidCompressorMode: IdCompressorMode;\n\topGroupingEnabled: boolean;\n\n\t/**\n\t * List of disallowed versions of the runtime.\n\t * This option is sticky. Once a version of runtime is added to this list (when supplied to DocumentsSchemaController's constructor)\n\t * it will be added to the list of disallowed versions and stored in document metadata.\n\t * Each runtime checks if its version is in this list on container open. If it is, it immediately exits with error message\n\t * indicating to the user that this version is no longer supported.\n\t * Currently there is no mechanism to remove version from this list. I.e. If it was once added to the list,\n\t * it gets added to any document metadata (documents that gets open by this runtime) and there is no way to clear it from document's\n\t * metadata.\n\t */\n\tdisallowedVersions: string[];\n}\n\n/**\n * Current version known properties that define document schema\n * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.\n * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.\n * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.\n * @alpha\n */\nexport const currentDocumentVersionSchema = 1;\n\n/**\n * Current document schema.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type IDocumentSchemaCurrent = {\n\tversion: 1;\n\trefSeq: number;\n\n\truntime: {\n\t\t[P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean\n\t\t\t? true\n\t\t\t: IDocumentSchemaFeatures[P];\n\t};\n};\n\ninterface IProperty<T = unknown> {\n\tand: (currentDocSchema: T, desiredDocSchema: T) => T;\n\tor: (currentDocSchema: T, desiredDocSchema: T) => T;\n\tvalidate(t: unknown): boolean;\n}\n\nclass TrueOrUndefined implements IProperty<true | undefined> {\n\tpublic and(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn currentDocSchema === true && desiredDocSchema === true ? true : undefined;\n\t}\n\n\tpublic or(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn currentDocSchema === true || desiredDocSchema === true ? true : undefined;\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || t === true;\n\t}\n}\n\nclass TrueOrUndefinedMax extends TrueOrUndefined {\n\tpublic and(currentDocSchema?: true, desiredDocSchema?: true) {\n\t\treturn this.or(currentDocSchema, desiredDocSchema);\n\t}\n}\n\nclass MultiChoice implements IProperty<string | undefined> {\n\tconstructor(private readonly choices: string[]) {}\n\n\tpublic and(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\tif (currentDocSchema === undefined || desiredDocSchema === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.choices[\n\t\t\tMath.min(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))\n\t\t];\n\t}\n\n\tpublic or(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\tif (currentDocSchema === undefined) {\n\t\t\treturn desiredDocSchema;\n\t\t}\n\t\tif (desiredDocSchema === undefined) {\n\t\t\treturn currentDocSchema;\n\t\t}\n\t\treturn this.choices[\n\t\t\tMath.max(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))\n\t\t];\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || (typeof t === \"string\" && this.choices.includes(t));\n\t}\n}\n\nclass IdCompressorProperty extends MultiChoice {\n\t// document schema always wins!\n\tpublic and(currentDocSchema?: string, desiredDocSchema?: string) {\n\t\treturn currentDocSchema;\n\t}\n}\n\nclass CheckVersions implements IProperty<string[] | undefined> {\n\tpublic or(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {\n\t\tconst set = new Set<string>([...currentDocSchema, ...desiredDocSchema]);\n\t\treturn arrayToProp([...set.values()]);\n\t}\n\n\t// Once version is there, it stays there forever.\n\tpublic and(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {\n\t\treturn this.or(currentDocSchema, desiredDocSchema);\n\t}\n\n\tpublic validate(t: unknown) {\n\t\treturn t === undefined || (Array.isArray(t) && !t.includes(pkgVersion));\n\t}\n}\n\n/**\n * Helper structure to valida if a schema is compatible with existing code.\n */\nconst documentSchemaSupportedConfigs = {\n\texplicitSchemaControl: new TrueOrUndefinedMax(), // once new behavior shows up, it's sticky\n\tidCompressorMode: new IdCompressorProperty([\"delayed\", \"on\"]),\n\topGroupingEnabled: new TrueOrUndefined(),\n\tcompressionLz4: new TrueOrUndefined(),\n\tdisallowedVersions: new CheckVersions(),\n};\n\n/**\n * Checks if a given schema is compatible with current code, i.e. if current code can understand all the features of that schema.\n * If schema is not compatible with current code, it throws an exception.\n * @param documentSchema - current schema\n */\nfunction checkRuntimeCompatibility(documentSchema?: IDocumentSchema) {\n\t// Back-compat - we can't do anything about legacy documents.\n\t// There is no way to validate them, so we are taking a guess that safe deployment processes used by a given app\n\t// do not run into compat problems.\n\tif (documentSchema === undefined) {\n\t\treturn;\n\t}\n\n\tconst msg = \"Document can't be opened with current version of the code\";\n\tif (documentSchema.version !== currentDocumentVersionSchema) {\n\t\tthrow DataProcessingError.create(\n\t\t\tmsg,\n\t\t\t\"checkRuntimeCompat1\",\n\t\t\tundefined, // message\n\t\t\t{\n\t\t\t\truntimeSchemaVersion: documentSchema.version,\n\t\t\t\tcurrentRuntimeSchemaVersion: currentDocumentVersionSchema,\n\t\t\t},\n\t\t);\n\t}\n\n\tlet unknownProperty: string | undefined;\n\n\tconst regSeq = documentSchema.refSeq;\n\t// defence in depth - it should not be possible to get here anything other than integer, but worth validating it.\n\tif (typeof regSeq !== \"number\" || regSeq < 0 || !Number.isInteger(regSeq)) {\n\t\tunknownProperty = \"refSeq\";\n\t} else if (documentSchema.runtime === null || typeof documentSchema.runtime !== \"object\") {\n\t\tunknownProperty = \"runtime\";\n\t} else {\n\t\tfor (const [name, value] of Object.entries(documentSchema.runtime)) {\n\t\t\tconst validator = documentSchemaSupportedConfigs[name] as IProperty | undefined;\n\t\t\tif (validator === undefined || !validator.validate(value)) {\n\t\t\t\tunknownProperty = `runtime/${name}`;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (unknownProperty !== undefined) {\n\t\tconst value = documentSchema[unknownProperty];\n\t\tthrow DataProcessingError.create(\n\t\t\tmsg,\n\t\t\t\"checkRuntimeCompat2\",\n\t\t\tundefined, // message\n\t\t\t{\n\t\t\t\tcodeVersion: currentDocumentVersionSchema,\n\t\t\t\tproperty: unknownProperty,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t);\n\t}\n}\n\nfunction and(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): IDocumentSchemaCurrent {\n\tconst runtime = {};\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\truntime[key] = (documentSchemaSupportedConfigs[key] as IProperty).and(\n\t\t\tcurrentDocSchema.runtime[key],\n\t\t\tdesiredDocSchema.runtime[key],\n\t\t);\n\t}\n\treturn {\n\t\tversion: currentDocumentVersionSchema,\n\t\trefSeq: currentDocSchema.refSeq,\n\t\truntime,\n\t} as unknown as IDocumentSchemaCurrent;\n}\n\nfunction or(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): IDocumentSchemaCurrent {\n\tconst runtime = {};\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\truntime[key] = (documentSchemaSupportedConfigs[key] as IProperty).or(\n\t\t\tcurrentDocSchema.runtime[key],\n\t\t\tdesiredDocSchema.runtime[key],\n\t\t);\n\t}\n\treturn {\n\t\tversion: currentDocumentVersionSchema,\n\t\trefSeq: currentDocSchema.refSeq,\n\t\truntime,\n\t} as unknown as IDocumentSchemaCurrent;\n}\n\nfunction same(\n\tcurrentDocSchema: IDocumentSchemaCurrent,\n\tdesiredDocSchema: IDocumentSchemaCurrent,\n): boolean {\n\tfor (const key of new Set([\n\t\t...Object.keys(currentDocSchema.runtime),\n\t\t...Object.keys(desiredDocSchema.runtime),\n\t])) {\n\t\t// If schemas differ only by type of behavior, then we should not send schema change ops!\n\t\tif (\n\t\t\tkey !== \"explicitSchemaControl\" &&\n\t\t\tcurrentDocSchema.runtime[key] !== desiredDocSchema.runtime[key]\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction boolToProp(b: boolean) {\n\treturn b ? true : undefined;\n}\n\nfunction arrayToProp(arr: string[]) {\n\treturn arr.length === 0 ? undefined : arr;\n}\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Controller of document schema.\n *\n * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md\n *\n * This class manages current document schema and transitions between document schemas.\n * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data\n * (summary and op format), features & capabilities that a version of runtime has to support and understand in\n * order to collaborate on a document.\n * New features that modify document format have to be included in document schema definition.\n * Usage of such features could only happen after document schema has been updated to reflect such feature.\n *\n * This formality allows clients that do not understand such features to fail right away when they observe\n * document schema listing capabilities that such client does not understand.\n * Old clients will fail in predictable way. This allows us to\n * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.\n * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are\n * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along\n * and potentially corrupt the document. This is especially true for summarizer client, who could simply \"undo\"\n * changes it does not understands.\n *\n * It's important to note how it overlaps with feature gates and safe velocity.\n * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.\n * But, developers (through code deployment or feature gates) could disable usage of such features.\n * That will stop a process of further document schema changes (for documents that were not using such feature).\n * And documents that already list such capability in their schema will continue to do so. Later ensures that old\n * clients who do not understand such feature will continue to fail to open such documents, as such documents very\n * likely contain data in a new format.\n *\n * Controller operates with 4 schemas:\n * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).\n * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).\n * - session schema - current session schema. It's \"and\" of the above two schemas.\n * - future schema - \"or\" of document and desires schemas.\n *\n * \"or\" & \"and\" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.\n * But for other properties it's more nuanced.\n *\n * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to\n * future schema.\n *\n * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.\n *\n * There are two modes this class can operate:\n * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,\n * right away, and new features are available right away\n * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.\n * However code should assume that any new features that were not enabled in a given document will not be available\n * for a given session. That's because this session may never send any ops (including read-only documents). Or it may\n * fail to convert schema.\n * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),\n * then eventually all documents that are modified will have that feature reflected in their schema. It could require\n * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults\n * schema on document load).\n *\n * How schemas are changed (in non-legacy mode):\n * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.\n * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.\n * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will\n * reference old schema that is no longer in effect.\n * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do\n * recalc and decide if schema needs to be changed or not).\n *\n * @alpha\n */\nexport class DocumentsSchemaController {\n\tprivate explicitSchemaControl: boolean;\n\tprivate sendOp = true;\n\n\t// schema coming from document metadata (snapshot we loaded from)\n\tprivate documentSchema: IDocumentSchemaCurrent;\n\n\t// desired schema, based on feature gates / runtime options.\n\t// This includes requests to enable to disable functionality\n\tprivate readonly desiredSchema: IDocumentSchemaCurrent;\n\n\t// OR() of document schema and desired schema. It enables all the features that are enabled in either of schemas.\n\tprivate futureSchema: IDocumentSchemaCurrent | undefined;\n\n\t// Current schema this session operates with.\n\t// 1) Legacy mode: this is same as desired schema - all options that were requested to be on are on, and all options requested to be off are off.\n\t// 2) Non-legacy mode: this is AND() of document schema and desired schema. Only options that are enabled in both are enabled here.\n\t// If there are any options that are not enabled in document schema, but are enabled in desired schema, then attempt to change schema\n\t// (and enable such options) will be made through the session.\n\tpublic sessionSchema: IDocumentSchemaCurrent;\n\n\t/**\n\t * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.\n\t * @param existing - Is the document existing document, or a new doc.\n\t * @param documentMetadataSchema - current document's schema, if present.\n\t * @param features - features of the document schema that current session wants to see enabled.\n\t * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)\n\t */\n\tconstructor(\n\t\texisting: boolean,\n\t\tdocumentMetadataSchema: IDocumentSchema | undefined,\n\t\tfeatures: IDocumentSchemaFeatures,\n\t\tprivate readonly onSchemaChange: (schema: IDocumentSchemaCurrent) => void,\n\t) {\n\t\tcheckRuntimeCompatibility(documentMetadataSchema);\n\n\t\t// For simplicity, let's only support new schema features for explicit schema control mode\n\t\tassert(\n\t\t\tfeatures.disallowedVersions.length === 0 || features.explicitSchemaControl,\n\t\t\t0x949 /* not supported */,\n\t\t);\n\n\t\t// Desired schema by this session - almost all props are coming from arguments\n\t\tthis.desiredSchema = {\n\t\t\tversion: currentDocumentVersionSchema,\n\t\t\trefSeq: documentMetadataSchema?.refSeq ?? 0,\n\t\t\truntime: {\n\t\t\t\texplicitSchemaControl: boolToProp(features.explicitSchemaControl),\n\t\t\t\tcompressionLz4: boolToProp(features.compressionLz4),\n\t\t\t\tidCompressorMode: features.idCompressorMode,\n\t\t\t\topGroupingEnabled: boolToProp(features.opGroupingEnabled),\n\t\t\t\tdisallowedVersions: arrayToProp(features.disallowedVersions),\n\t\t\t},\n\t\t};\n\n\t\t// Schema coming from document metadata (snapshot we loaded from), or if no document exists\n\t\t// (this is a new document) then this is the same as desiredSchema (same as session schema in such case).\n\t\t// Latter is importnat sure that's what will go into summary.\n\t\tthis.documentSchema = !existing\n\t\t\t? this.desiredSchema\n\t\t\t: (documentMetadataSchema as IDocumentSchemaCurrent) ??\n\t\t\t ({\n\t\t\t\t\tversion: currentDocumentVersionSchema,\n\t\t\t\t\t// see comment in summarizeDocumentSchema() on why it has to stay zero\n\t\t\t\t\trefSeq: 0,\n\t\t\t\t\t// If it's existing document and it has no schema, then it was written by legacy client.\n\t\t\t\t\t// If it's a new document, then we define it's legacy-related behaviors.\n\t\t\t\t\truntime: {\n\t\t\t\t\t\texplicitSchemaControl: boolToProp(\n\t\t\t\t\t\t\t!existing && features.explicitSchemaControl,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t } satisfies IDocumentSchemaCurrent);\n\n\t\t// Use legacy behavior only if both document and options tell us to use legacy.\n\t\t// Otherwise it's no longer legacy time!\n\t\tthis.explicitSchemaControl =\n\t\t\tthis.documentSchema.runtime.explicitSchemaControl === true ||\n\t\t\tfeatures.explicitSchemaControl;\n\n\t\t// Calculate\n\t\t// - current session schema (overlap of document schema and desired schema)\n\t\t// - future schema to propose (concatination of document schema and desired schema)\n\t\tif (!this.explicitSchemaControl || !existing) {\n\t\t\tthis.sessionSchema = this.desiredSchema;\n\t\t\tassert(\n\t\t\t\tboolToProp(this.explicitSchemaControl) ===\n\t\t\t\t\tthis.sessionSchema.runtime.explicitSchemaControl,\n\t\t\t\t0x94a /* explicitSchemaControl */,\n\t\t\t);\n\t\t\tthis.futureSchema = undefined;\n\t\t} else {\n\t\t\tthis.sessionSchema = and(this.documentSchema, this.desiredSchema);\n\t\t\tthis.futureSchema = or(this.documentSchema, this.desiredSchema);\n\t\t\tassert(this.sessionSchema.runtime.explicitSchemaControl === true, 0x94b /* legacy */);\n\t\t\tassert(this.futureSchema.runtime.explicitSchemaControl === true, 0x94c /* legacy */);\n\t\t\tif (same(this.documentSchema, this.futureSchema)) {\n\t\t\t\tthis.futureSchema = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// Validate that schema we are operating in is actually a schema we consider compatible with current runtime.\n\t\tcheckRuntimeCompatibility(this.sessionSchema);\n\t\tcheckRuntimeCompatibility(this.futureSchema);\n\t}\n\n\tpublic summarizeDocumentSchema(refSeq: number): IDocumentSchemaCurrent | undefined {\n\t\t// For legacy behavior, we could write nothing (return undefined).\n\t\t// It does not buy us anything, as whatever written in summary does not actually impact clients operating in legacy mode.\n\t\t// But writing current used config (and assuming most of the clients settle on same config over time) will help with transition\n\t\t// out of legacy mode, as clients transitioning out of it would be able to use all the\n\t\t// features that are mentioned in schema right away, without a need to go through schema transition (and thus for a session or\n\t\t// two losing ability to use all the features)\n\n\t\tconst schema = this.explicitSchemaControl ? this.documentSchema : this.desiredSchema;\n\n\t\t// It's important to keep refSeq at zero in legacy mode, such that transition out of it is simple and we do not have\n\t\t// race conditions. If we put any other number (including latest seq number), then we will have two clients\n\t\t// (loading from two different summaries) with different numbers, and eventual consistency will be broken as schema\n\t\t// change ops will be interpretted differently by those two clients.\n\t\tassert(\n\t\t\tthis.explicitSchemaControl || schema.refSeq === 0,\n\t\t\t0x94d /* refSeq should be zero */,\n\t\t);\n\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Called by Container runtime whenever it is about to send some op.\n\t * It gives opportunity for controller to issue its own ops - we do not want to send ops if there are no local changes in document.\n\t * @returns Optional message to send.\n\t */\n\tpublic maybeSendSchemaMessage(): IDocumentSchemaChangeMessage | undefined {\n\t\tif (this.sendOp && this.futureSchema !== undefined) {\n\t\t\tthis.sendOp = false;\n\t\t\tassert(\n\t\t\t\tthis.explicitSchemaControl &&\n\t\t\t\t\tthis.futureSchema.runtime.explicitSchemaControl === true,\n\t\t\t\t0x94e /* not legacy */,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t...this.futureSchema,\n\t\t\t\trefSeq: this.documentSchema.refSeq,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Process document schema change message\n\t * Called by ContainerRuntime whenever it sees document schema messages.\n\t * @param content - content of the message\n\t * @param local - whether op is local\n\t * @param sequenceNumber - sequence number of the op\n\t * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)\n\t */\n\tpublic processDocumentSchemaOp(\n\t\tcontent: IDocumentSchemaChangeMessage,\n\t\tlocal: boolean,\n\t\tsequenceNumber: number,\n\t) {\n\t\tassert(\n\t\t\tcontent.refSeq <= this.documentSchema.refSeq,\n\t\t\t0x94f /* did we lose a message somewhere? */,\n\t\t);\n\t\tassert(\n\t\t\tthis.documentSchema.refSeq < sequenceNumber,\n\t\t\t0x950 /* time should move forward only! */,\n\t\t);\n\t\tif (content.refSeq !== this.documentSchema.refSeq) {\n\t\t\t// CAS failed\n\t\t\treturn false;\n\t\t}\n\n\t\t// This assert should be after checking for successful CAS above.\n\t\t// This will ensure we do not trip on our own messages that are no longer wanted as we processed someone else schema change message.\n\t\tassert(\n\t\t\t!local || (this.explicitSchemaControl && this.futureSchema !== undefined),\n\t\t\t0x951 /* not sending ops */,\n\t\t);\n\n\t\t// Changes are in effect. Immediately check that this client understands these changes\n\t\tcheckRuntimeCompatibility(content);\n\n\t\tconst schema: IDocumentSchema = { ...content, refSeq: sequenceNumber };\n\t\tthis.documentSchema = schema as IDocumentSchemaCurrent;\n\t\tthis.sessionSchema = and(this.documentSchema, this.desiredSchema);\n\n\t\t// legacy behavior is automatically off for the document once someone sends a schema op -\n\t\t// from now on it's fully controlled by ops.\n\t\t// This is very important, as summarizeDocumentSchema() should use this new schema!\n\t\tthis.explicitSchemaControl = true;\n\n\t\t// Stop attempting changing schema.\n\t\t// If it was local op, then we succeeded and do not need to try again.\n\t\t// If it was remote op, then some changes happened to schema.\n\t\t// We would need to recalculate this.futureSchema by merging changes that we just received.\n\t\t// Avoid this complexity for now - a new client session (loading from new summary with these changes)\n\t\t// will automatically do this recalculation and will figure out\n\t\tthis.futureSchema = undefined;\n\n\t\tthis.onSchemaChange(this.sessionSchema);\n\n\t\treturn true;\n\t}\n\n\tpublic onDisconnect() {\n\t\tthis.sendOp = true;\n\t}\n}\n\n/* eslint-enable jsdoc/check-indentation */\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-runtime",
|
|
3
|
-
"version": "2.0.0-rc.3.0.
|
|
3
|
+
"version": "2.0.0-rc.3.0.2",
|
|
4
4
|
"description": "Fluid container runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -127,20 +127,20 @@
|
|
|
127
127
|
"temp-directory": "nyc/.nyc_output"
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
|
-
"@fluid-internal/client-utils": ">=2.0.0-rc.3.0.
|
|
130
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
131
131
|
"@fluidframework/common-definitions": "^1.1.0",
|
|
132
|
-
"@fluidframework/container-definitions": ">=2.0.0-rc.3.0.
|
|
133
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-rc.3.0.
|
|
134
|
-
"@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.
|
|
135
|
-
"@fluidframework/core-utils": ">=2.0.0-rc.3.0.
|
|
136
|
-
"@fluidframework/datastore": ">=2.0.0-rc.3.0.
|
|
137
|
-
"@fluidframework/driver-definitions": ">=2.0.0-rc.3.0.
|
|
138
|
-
"@fluidframework/driver-utils": ">=2.0.0-rc.3.0.
|
|
139
|
-
"@fluidframework/id-compressor": ">=2.0.0-rc.3.0.
|
|
132
|
+
"@fluidframework/container-definitions": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
133
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
134
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
135
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
136
|
+
"@fluidframework/datastore": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
137
|
+
"@fluidframework/driver-definitions": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
138
|
+
"@fluidframework/driver-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
139
|
+
"@fluidframework/id-compressor": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
140
140
|
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
141
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-rc.3.0.
|
|
142
|
-
"@fluidframework/runtime-utils": ">=2.0.0-rc.3.0.
|
|
143
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-rc.3.0.
|
|
141
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
142
|
+
"@fluidframework/runtime-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
143
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
144
144
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
145
145
|
"double-ended-queue": "^2.1.0-0",
|
|
146
146
|
"lz4js": "^0.2.0",
|
|
@@ -149,16 +149,16 @@
|
|
|
149
149
|
"devDependencies": {
|
|
150
150
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
151
151
|
"@biomejs/biome": "^1.6.2",
|
|
152
|
-
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.
|
|
153
|
-
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.3.0.
|
|
154
|
-
"@fluid-private/test-pairwise-generator": ">=2.0.0-rc.3.0.
|
|
152
|
+
"@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
153
|
+
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
154
|
+
"@fluid-private/test-pairwise-generator": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
155
155
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
156
156
|
"@fluid-tools/build-cli": "^0.37.0",
|
|
157
157
|
"@fluidframework/build-common": "^2.0.3",
|
|
158
158
|
"@fluidframework/build-tools": "^0.37.0",
|
|
159
159
|
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.8.0.0",
|
|
160
160
|
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
161
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.3.0.
|
|
161
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.3.0.2 <2.0.0-rc.3.1.0",
|
|
162
162
|
"@microsoft/api-extractor": "^7.42.3",
|
|
163
163
|
"@types/double-ended-queue": "^2.1.0",
|
|
164
164
|
"@types/mocha": "^9.1.1",
|
package/src/channelCollection.ts
CHANGED
|
@@ -63,7 +63,11 @@ import {
|
|
|
63
63
|
tagCodeArtifacts,
|
|
64
64
|
} from "@fluidframework/telemetry-utils/internal";
|
|
65
65
|
|
|
66
|
-
import {
|
|
66
|
+
import {
|
|
67
|
+
DeletedResponseHeaderKey,
|
|
68
|
+
RuntimeHeaderData,
|
|
69
|
+
defaultRuntimeHeaderData,
|
|
70
|
+
} from "./containerRuntime.js";
|
|
67
71
|
import {
|
|
68
72
|
IDataStoreAliasMessage,
|
|
69
73
|
channelToDataStore,
|
|
@@ -83,7 +87,8 @@ import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
|
|
|
83
87
|
import {
|
|
84
88
|
GCNodeType,
|
|
85
89
|
detectOutboundRoutesViaDDSKey,
|
|
86
|
-
|
|
90
|
+
IGCNodeUpdatedProps,
|
|
91
|
+
urlToGCNodePath,
|
|
87
92
|
} from "./gc/index.js";
|
|
88
93
|
import { ContainerMessageType, LocalContainerRuntimeMessage } from "./messageTypes.js";
|
|
89
94
|
import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs.js";
|
|
@@ -276,14 +281,7 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
276
281
|
protected readonly baseSnapshot: ISnapshotTree | undefined,
|
|
277
282
|
public readonly parentContext: IFluidParentContext,
|
|
278
283
|
baseLogger: ITelemetryBaseLogger,
|
|
279
|
-
private readonly gcNodeUpdated: (
|
|
280
|
-
nodePath: string,
|
|
281
|
-
reason: "Loaded" | "Changed",
|
|
282
|
-
timestampMs?: number,
|
|
283
|
-
packagePath?: readonly string[],
|
|
284
|
-
request?: IRequest,
|
|
285
|
-
headerData?: RuntimeHeaderData,
|
|
286
|
-
) => void,
|
|
284
|
+
private readonly gcNodeUpdated: (props: IGCNodeUpdatedProps) => void,
|
|
287
285
|
private readonly isDataStoreDeleted: (nodePath: string) => boolean,
|
|
288
286
|
private readonly aliasMap: Map<string, string>,
|
|
289
287
|
provideEntryPoint: (runtime: ChannelCollection) => Promise<FluidObject>,
|
|
@@ -876,17 +874,18 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
876
874
|
|
|
877
875
|
// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is
|
|
878
876
|
// being used.
|
|
879
|
-
this.gcNodeUpdated(
|
|
880
|
-
`/${address}
|
|
881
|
-
"Changed",
|
|
882
|
-
message.timestamp,
|
|
883
|
-
context.isLoaded ? context.packagePath : undefined,
|
|
884
|
-
);
|
|
877
|
+
this.gcNodeUpdated({
|
|
878
|
+
node: { type: "DataStore", path: `/${address}` },
|
|
879
|
+
reason: "Changed",
|
|
880
|
+
timestampMs: message.timestamp,
|
|
881
|
+
packagePath: context.isLoaded ? context.packagePath : undefined,
|
|
882
|
+
});
|
|
885
883
|
}
|
|
886
884
|
|
|
887
|
-
|
|
885
|
+
private async getDataStore(
|
|
888
886
|
id: string,
|
|
889
887
|
requestHeaderData: RuntimeHeaderData,
|
|
888
|
+
originalRequest: IRequest,
|
|
890
889
|
): Promise<IFluidDataStoreContextInternal> {
|
|
891
890
|
const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
|
|
892
891
|
if (
|
|
@@ -896,13 +895,15 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
896
895
|
"Requested",
|
|
897
896
|
"getDataStore",
|
|
898
897
|
requestHeaderData,
|
|
898
|
+
originalRequest,
|
|
899
899
|
)
|
|
900
900
|
) {
|
|
901
901
|
// The requested data store has been deleted by gc. Create a 404 response exception.
|
|
902
|
-
const request: IRequest = { url: id };
|
|
903
902
|
throw responseToException(
|
|
904
|
-
createResponseError(404, "DataStore was deleted",
|
|
905
|
-
|
|
903
|
+
createResponseError(404, "DataStore was deleted", originalRequest, {
|
|
904
|
+
[DeletedResponseHeaderKey]: true,
|
|
905
|
+
}),
|
|
906
|
+
originalRequest,
|
|
906
907
|
);
|
|
907
908
|
}
|
|
908
909
|
|
|
@@ -946,28 +947,69 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
946
947
|
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
947
948
|
* @param id - The data store's id.
|
|
948
949
|
* @param context - The data store context.
|
|
950
|
+
* @param deletedLogSuffix - Whether it was Changed or Requested (will go into the eventName)
|
|
949
951
|
* @param callSite - The function name this is called from.
|
|
950
952
|
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
953
|
+
* @param originalRequest - The original request (could be for a child of the DataStore)
|
|
951
954
|
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
952
955
|
*/
|
|
953
956
|
private checkAndLogIfDeleted(
|
|
954
957
|
id: string,
|
|
955
958
|
context: IFluidDataStoreContext | undefined,
|
|
956
|
-
deletedLogSuffix:
|
|
959
|
+
deletedLogSuffix: "Changed" | "Requested",
|
|
957
960
|
callSite: string,
|
|
958
961
|
requestHeaderData?: RuntimeHeaderData,
|
|
962
|
+
originalRequest?: IRequest,
|
|
959
963
|
) {
|
|
960
964
|
const dataStoreNodePath = `/${id}`;
|
|
961
965
|
if (!this.isDataStoreDeleted(dataStoreNodePath)) {
|
|
962
966
|
return false;
|
|
963
967
|
}
|
|
964
968
|
|
|
969
|
+
const idToLog =
|
|
970
|
+
originalRequest !== undefined
|
|
971
|
+
? urlToGCNodePath(originalRequest.url)
|
|
972
|
+
: dataStoreNodePath;
|
|
973
|
+
|
|
974
|
+
// Log the package details asynchronously since getInitialSnapshotDetails is async
|
|
975
|
+
const recentelyDeletedContext = this.contexts.getRecentlyDeletedContext(id);
|
|
976
|
+
if (recentelyDeletedContext !== undefined) {
|
|
977
|
+
recentelyDeletedContext
|
|
978
|
+
.getInitialSnapshotDetails()
|
|
979
|
+
.then((details) => {
|
|
980
|
+
return details.pkg.join("/");
|
|
981
|
+
})
|
|
982
|
+
.then(
|
|
983
|
+
(pkg) => ({ pkg, error: undefined }),
|
|
984
|
+
(error) => ({ pkg: undefined, error }),
|
|
985
|
+
)
|
|
986
|
+
.then(({ pkg, error }) => {
|
|
987
|
+
this.mc.logger.sendTelemetryEvent(
|
|
988
|
+
{
|
|
989
|
+
eventName: `GC_DeletedDataStore_PathInfo`,
|
|
990
|
+
...tagCodeArtifacts({
|
|
991
|
+
id: idToLog,
|
|
992
|
+
pkg,
|
|
993
|
+
}),
|
|
994
|
+
callSite,
|
|
995
|
+
},
|
|
996
|
+
error,
|
|
997
|
+
);
|
|
998
|
+
})
|
|
999
|
+
.catch(() => {});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
965
1002
|
this.mc.logger.sendErrorEvent({
|
|
966
1003
|
eventName: `GC_Deleted_DataStore_${deletedLogSuffix}`,
|
|
967
|
-
...tagCodeArtifacts({ id }),
|
|
1004
|
+
...tagCodeArtifacts({ id: idToLog }),
|
|
968
1005
|
callSite,
|
|
969
1006
|
headers: JSON.stringify(requestHeaderData),
|
|
970
1007
|
exists: context !== undefined,
|
|
1008
|
+
details: {
|
|
1009
|
+
url: originalRequest?.url,
|
|
1010
|
+
headers: JSON.stringify(originalRequest?.headers),
|
|
1011
|
+
aliased: this.aliasedDataStores.has(id),
|
|
1012
|
+
},
|
|
971
1013
|
});
|
|
972
1014
|
return true;
|
|
973
1015
|
}
|
|
@@ -1214,6 +1256,16 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
1214
1256
|
const dataStoreContext = this.contexts.get(dataStoreId);
|
|
1215
1257
|
assert(dataStoreContext !== undefined, 0x2d7 /* No data store with specified id */);
|
|
1216
1258
|
|
|
1259
|
+
if (dataStoreContext.isLoaded) {
|
|
1260
|
+
this.mc.logger.sendTelemetryEvent({
|
|
1261
|
+
eventName: "GC_DeletingLoadedDataStore",
|
|
1262
|
+
...tagCodeArtifacts({
|
|
1263
|
+
id: dataStoreId,
|
|
1264
|
+
pkg: dataStoreContext.packagePath.join("/"),
|
|
1265
|
+
}),
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1217
1269
|
dataStoreContext.delete();
|
|
1218
1270
|
// Delete the contexts of unused data stores.
|
|
1219
1271
|
this.contexts.delete(dataStoreId);
|
|
@@ -1355,31 +1407,29 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
|
1355
1407
|
headerData.allowInactive = request.headers[AllowInactiveRequestHeaderKey];
|
|
1356
1408
|
}
|
|
1357
1409
|
|
|
1358
|
-
// We allow Tombstone requests for sub-DataStore objects
|
|
1410
|
+
// We allow Tombstone/Inactive requests for sub-DataStore objects
|
|
1359
1411
|
if (requestForChild) {
|
|
1360
1412
|
headerData.allowTombstone = true;
|
|
1413
|
+
headerData.allowInactive = true;
|
|
1361
1414
|
}
|
|
1362
1415
|
|
|
1363
1416
|
await this.waitIfPendingAlias(id);
|
|
1364
1417
|
const internalId = this.internalId(id);
|
|
1365
|
-
const dataStoreContext = await this.getDataStore(internalId, headerData);
|
|
1418
|
+
const dataStoreContext = await this.getDataStore(internalId, headerData, request);
|
|
1366
1419
|
|
|
1367
|
-
// Remove query params, leading and trailing slashes from the url. This is done to make sure the format is
|
|
1368
|
-
// the same as GC nodes id.
|
|
1369
|
-
const urlWithoutQuery = trimLeadingAndTrailingSlashes(request.url.split("?")[0]);
|
|
1370
1420
|
// Get the initial snapshot details which contain the data store package path.
|
|
1371
1421
|
const details = await dataStoreContext.getInitialSnapshotDetails();
|
|
1372
1422
|
|
|
1373
|
-
//
|
|
1374
|
-
// is
|
|
1375
|
-
this.gcNodeUpdated(
|
|
1376
|
-
`/${
|
|
1377
|
-
"Loaded",
|
|
1378
|
-
|
|
1379
|
-
details.pkg,
|
|
1423
|
+
// When notifying GC of this node being loaded, we only indicate the DataStore itself, not the full subDataStore url if applicable.
|
|
1424
|
+
// This is in case the url is to a route that Fluid doesn't understand or track for GC (e.g. if suited for a custom request handler)
|
|
1425
|
+
this.gcNodeUpdated({
|
|
1426
|
+
node: { type: "DataStore", path: `/${id}` },
|
|
1427
|
+
reason: "Loaded",
|
|
1428
|
+
packagePath: details.pkg,
|
|
1380
1429
|
request,
|
|
1381
1430
|
headerData,
|
|
1382
|
-
);
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1383
1433
|
const dataStore = await dataStoreContext.realize();
|
|
1384
1434
|
|
|
1385
1435
|
const subRequest = requestParser.createSubRequest(1);
|