@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0
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/CHANGELOG.md +50 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/container-runtime.api.md +123 -123
- package/dist/blobManager.d.ts +4 -4
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1444 -0
- package/dist/container-runtime-beta.d.ts +292 -0
- package/dist/container-runtime-public.d.ts +292 -0
- package/dist/container-runtime-untrimmed.d.ts +1792 -0
- package/dist/containerRuntime.d.ts +36 -66
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +68 -104
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +0 -12
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.js +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +10 -15
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +77 -40
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +41 -13
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +215 -78
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +34 -37
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +121 -46
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +26 -18
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +18 -25
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +29 -45
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +0 -5
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +14 -42
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +43 -19
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +4 -5
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +15 -7
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +6 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +1 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +1 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/dist/summary/runWhileConnectedCoordinator.js +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -13
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +1 -47
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +30 -30
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +10 -10
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +4 -4
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/container-runtime-alpha.d.ts +1444 -0
- package/lib/container-runtime-beta.d.ts +292 -0
- package/lib/container-runtime-public.d.ts +292 -0
- package/lib/container-runtime-untrimmed.d.ts +1792 -0
- package/lib/containerRuntime.d.ts +36 -66
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +69 -104
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +0 -12
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +10 -15
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +80 -43
- package/lib/dataStores.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +41 -13
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +217 -80
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +37 -40
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +121 -46
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +25 -17
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +18 -25
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +27 -43
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +0 -5
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +15 -43
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +43 -19
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- 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 +15 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +16 -2
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +15 -7
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +6 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +1 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -13
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +1 -47
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +30 -30
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +10 -10
- package/lib/summary/summaryCollection.js +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +46 -19
- package/src/blobManager.ts +5 -5
- package/src/containerRuntime.ts +93 -141
- package/src/dataStore.ts +1 -15
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +140 -69
- package/src/gc/garbageCollection.md +14 -15
- package/src/gc/garbageCollection.ts +256 -96
- package/src/gc/gcConfigs.ts +50 -52
- package/src/gc/gcDefinitions.ts +137 -52
- package/src/gc/gcHelpers.ts +31 -52
- package/src/gc/gcTelemetry.ts +16 -57
- package/src/gc/gcUnreferencedStateTracker.ts +61 -22
- package/src/gc/index.ts +6 -4
- package/src/index.ts +19 -2
- package/src/messageTypes.ts +19 -4
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -0
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +2 -2
- package/src/summary/summarizer.ts +2 -51
- package/src/summary/summarizerTypes.ts +30 -30
- package/src/summary/summaryCollection.ts +10 -10
- package/src/summary/summaryFormat.ts +3 -3
- package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/dist/id-compressor/appendOnlySortedMap.js +0 -318
- package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/dist/id-compressor/finalSpace.d.ts +0 -29
- package/dist/id-compressor/finalSpace.d.ts.map +0 -1
- package/dist/id-compressor/finalSpace.js +0 -62
- package/dist/id-compressor/finalSpace.js.map +0 -1
- package/dist/id-compressor/idCompressor.d.ts +0 -54
- package/dist/id-compressor/idCompressor.d.ts.map +0 -1
- package/dist/id-compressor/idCompressor.js +0 -495
- package/dist/id-compressor/idCompressor.js.map +0 -1
- package/dist/id-compressor/identifiers.d.ts +0 -32
- package/dist/id-compressor/identifiers.d.ts.map +0 -1
- package/dist/id-compressor/identifiers.js +0 -15
- package/dist/id-compressor/identifiers.js.map +0 -1
- package/dist/id-compressor/index.d.ts +0 -13
- package/dist/id-compressor/index.d.ts.map +0 -1
- package/dist/id-compressor/index.js +0 -32
- package/dist/id-compressor/index.js.map +0 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
- package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/dist/id-compressor/persistanceUtilities.js +0 -43
- package/dist/id-compressor/persistanceUtilities.js.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/dist/id-compressor/sessions.d.ts +0 -115
- package/dist/id-compressor/sessions.d.ts.map +0 -1
- package/dist/id-compressor/sessions.js +0 -305
- package/dist/id-compressor/sessions.js.map +0 -1
- package/dist/id-compressor/utilities.d.ts +0 -52
- package/dist/id-compressor/utilities.d.ts.map +0 -1
- package/dist/id-compressor/utilities.js +0 -169
- package/dist/id-compressor/utilities.js.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
- package/lib/id-compressor/appendOnlySortedMap.js +0 -314
- package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
- package/lib/id-compressor/finalSpace.d.ts +0 -29
- package/lib/id-compressor/finalSpace.d.ts.map +0 -1
- package/lib/id-compressor/finalSpace.js +0 -58
- package/lib/id-compressor/finalSpace.js.map +0 -1
- package/lib/id-compressor/idCompressor.d.ts +0 -54
- package/lib/id-compressor/idCompressor.d.ts.map +0 -1
- package/lib/id-compressor/idCompressor.js +0 -491
- package/lib/id-compressor/idCompressor.js.map +0 -1
- package/lib/id-compressor/identifiers.d.ts +0 -32
- package/lib/id-compressor/identifiers.d.ts.map +0 -1
- package/lib/id-compressor/identifiers.js +0 -11
- package/lib/id-compressor/identifiers.js.map +0 -1
- package/lib/id-compressor/index.d.ts +0 -13
- package/lib/id-compressor/index.d.ts.map +0 -1
- package/lib/id-compressor/index.js +0 -13
- package/lib/id-compressor/index.js.map +0 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
- package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
- package/lib/id-compressor/persistanceUtilities.js +0 -34
- package/lib/id-compressor/persistanceUtilities.js.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
- package/lib/id-compressor/sessions.d.ts +0 -115
- package/lib/id-compressor/sessions.d.ts.map +0 -1
- package/lib/id-compressor/sessions.js +0 -290
- package/lib/id-compressor/sessions.js.map +0 -1
- package/lib/id-compressor/utilities.d.ts +0 -52
- package/lib/id-compressor/utilities.d.ts.map +0 -1
- package/lib/id-compressor/utilities.js +0 -151
- package/lib/id-compressor/utilities.js.map +0 -1
- package/src/id-compressor/README.md +0 -3
- package/src/id-compressor/appendOnlySortedMap.ts +0 -366
- package/src/id-compressor/finalSpace.ts +0 -67
- package/src/id-compressor/idCompressor.ts +0 -630
- package/src/id-compressor/identifiers.ts +0 -42
- package/src/id-compressor/index.ts +0 -26
- package/src/id-compressor/persistanceUtilities.ts +0 -58
- package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
- package/src/id-compressor/sessions.ts +0 -405
- package/src/id-compressor/utilities.ts +0 -190
package/lib/containerRuntime.js
CHANGED
|
@@ -3,7 +3,7 @@ import { assert, delay, LazyPromise } from "@fluidframework/core-utils";
|
|
|
3
3
|
import { Trace, TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
4
4
|
import { createChildLogger, createChildMonitoringContext, DataCorruptionError, DataProcessingError, GenericError, raiseConnectedEvent, PerformanceEvent,
|
|
5
5
|
// eslint-disable-next-line import/no-deprecated
|
|
6
|
-
TaggedLoggerAdapter, wrapError, UsageError, } from "@fluidframework/telemetry-utils";
|
|
6
|
+
TaggedLoggerAdapter, wrapError, UsageError, LoggingError, } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { DriverHeader, FetchSource, } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { readAndParse } from "@fluidframework/driver-utils";
|
|
9
9
|
import { MessageType, SummaryType, } from "@fluidframework/protocol-definitions";
|
|
@@ -19,7 +19,7 @@ import { BlobManager } from "./blobManager";
|
|
|
19
19
|
import { DataStores, getSummaryForDatastores } from "./dataStores";
|
|
20
20
|
import { aliasBlobName, blobsTreeName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, Summarizer, SummaryManager, wrapSummaryInChannelsTree, SummaryCollection, OrderedClientCollection, OrderedClientElection, SummarizerClientElection, summarizerClientType, RunWhileConnectedCoordinator, RetriableSummaryError, } from "./summary";
|
|
21
21
|
import { formExponentialFn, Throttler } from "./throttler";
|
|
22
|
-
import { GarbageCollector, GCNodeType,
|
|
22
|
+
import { GarbageCollector, GCNodeType, gcGenerationOptionName, trimLeadingAndTrailingSlashes, } from "./gc";
|
|
23
23
|
import { channelToDataStore, isDataStoreAliasMessage } from "./dataStore";
|
|
24
24
|
import { BindBatchTracker } from "./batchTracker";
|
|
25
25
|
import { ScheduleManager } from "./scheduleManager";
|
|
@@ -39,7 +39,7 @@ function compatBehaviorAllowsMessageType(_unknownContainerRuntimeMessageType, co
|
|
|
39
39
|
return compatBehavior === "Ignore";
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* @
|
|
42
|
+
* @internal
|
|
43
43
|
*/
|
|
44
44
|
export const DefaultSummaryConfiguration = {
|
|
45
45
|
state: "enabled",
|
|
@@ -57,7 +57,7 @@ export const DefaultSummaryConfiguration = {
|
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
59
|
* Accepted header keys for requests coming to the runtime.
|
|
60
|
-
* @
|
|
60
|
+
* @internal
|
|
61
61
|
*/
|
|
62
62
|
export var RuntimeHeaders;
|
|
63
63
|
(function (RuntimeHeaders) {
|
|
@@ -67,22 +67,22 @@ export var RuntimeHeaders;
|
|
|
67
67
|
RuntimeHeaders["viaHandle"] = "viaHandle";
|
|
68
68
|
})(RuntimeHeaders || (RuntimeHeaders = {}));
|
|
69
69
|
/** True if a tombstoned object should be returned without erroring
|
|
70
|
-
* @
|
|
70
|
+
* @internal
|
|
71
71
|
*/
|
|
72
72
|
export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
|
|
73
73
|
/**
|
|
74
74
|
* [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
|
|
75
|
-
* @
|
|
75
|
+
* @internal
|
|
76
76
|
*/
|
|
77
77
|
export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
|
|
78
78
|
/**
|
|
79
79
|
* Tombstone error responses will have this header set to true
|
|
80
|
-
* @
|
|
80
|
+
* @internal
|
|
81
81
|
*/
|
|
82
82
|
export const TombstoneResponseHeaderKey = "isTombstoned";
|
|
83
83
|
/**
|
|
84
84
|
* Inactive error responses will have this header set to true
|
|
85
|
-
* @
|
|
85
|
+
* @internal
|
|
86
86
|
*/
|
|
87
87
|
export const InactiveResponseHeaderKey = "isInactive";
|
|
88
88
|
/** Default values for Runtime Headers */
|
|
@@ -94,7 +94,7 @@ export const defaultRuntimeHeaderData = {
|
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
96
|
* Available compression algorithms for op compression.
|
|
97
|
-
* @
|
|
97
|
+
* @alpha
|
|
98
98
|
*/
|
|
99
99
|
export var CompressionAlgorithms;
|
|
100
100
|
(function (CompressionAlgorithms) {
|
|
@@ -125,7 +125,7 @@ export const defaultPendingOpsRetryDelayMs = 1000;
|
|
|
125
125
|
const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
|
|
126
126
|
/**
|
|
127
127
|
* @deprecated use ContainerRuntimeMessageType instead
|
|
128
|
-
* @
|
|
128
|
+
* @internal
|
|
129
129
|
*/
|
|
130
130
|
export var RuntimeMessage;
|
|
131
131
|
(function (RuntimeMessage) {
|
|
@@ -139,7 +139,7 @@ export var RuntimeMessage;
|
|
|
139
139
|
})(RuntimeMessage || (RuntimeMessage = {}));
|
|
140
140
|
/**
|
|
141
141
|
* @deprecated please use version in driver-utils
|
|
142
|
-
* @
|
|
142
|
+
* @internal
|
|
143
143
|
*/
|
|
144
144
|
export function isRuntimeMessage(message) {
|
|
145
145
|
return Object.values(RuntimeMessage).includes(message.type);
|
|
@@ -148,7 +148,7 @@ export function isRuntimeMessage(message) {
|
|
|
148
148
|
* Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
|
|
149
149
|
* special-case for document dirty state. Ultimately we should have no special-cases from the
|
|
150
150
|
* ContainerRuntime's perspective.
|
|
151
|
-
* @
|
|
151
|
+
* @internal
|
|
152
152
|
*/
|
|
153
153
|
export const agentSchedulerId = "_scheduler";
|
|
154
154
|
// safely check navigator and get the hardware spec value
|
|
@@ -203,7 +203,9 @@ async function createSummarizer(loader, url) {
|
|
|
203
203
|
fluidObject = await resolvedContainer.getEntryPoint();
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
|
-
const response = await resolvedContainer.request({
|
|
206
|
+
const response = await resolvedContainer.request({
|
|
207
|
+
url: `/${summarizerRequestUrl}`,
|
|
208
|
+
});
|
|
207
209
|
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
208
210
|
throw responseToException(response, request);
|
|
209
211
|
}
|
|
@@ -214,54 +216,12 @@ async function createSummarizer(loader, url) {
|
|
|
214
216
|
}
|
|
215
217
|
return fluidObject.ISummarizer;
|
|
216
218
|
}
|
|
217
|
-
/**
|
|
218
|
-
* This function is not supported publicly and exists for e2e testing
|
|
219
|
-
* @internal
|
|
220
|
-
*/
|
|
221
|
-
export async function TEST_requestSummarizer(loader, url) {
|
|
222
|
-
return createSummarizer(loader, url);
|
|
223
|
-
}
|
|
224
219
|
/**
|
|
225
220
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
226
221
|
* It will define the store level mappings.
|
|
227
|
-
* @
|
|
222
|
+
* @alpha
|
|
228
223
|
*/
|
|
229
224
|
export class ContainerRuntime extends TypedEventEmitter {
|
|
230
|
-
/**
|
|
231
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
232
|
-
*/
|
|
233
|
-
get IFluidRouter() {
|
|
234
|
-
return this;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* @deprecated use loadRuntime instead.
|
|
238
|
-
* Load the stores from a snapshot and returns the runtime.
|
|
239
|
-
* @param context - Context of the container.
|
|
240
|
-
* @param registryEntries - Mapping to the stores.
|
|
241
|
-
* @param requestHandler - Request handlers for the container runtime
|
|
242
|
-
* @param runtimeOptions - Additional options to be passed to the runtime
|
|
243
|
-
* @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
|
|
244
|
-
* @param containerRuntimeCtor - (optional) Constructor to use to create the ContainerRuntime instance. This
|
|
245
|
-
* allows mixin classes to leverage this method to define their own async initializer.
|
|
246
|
-
*/
|
|
247
|
-
static async load(context, registryEntries, requestHandler, runtimeOptions = {}, containerScope = context.scope, existing, containerRuntimeCtor = ContainerRuntime) {
|
|
248
|
-
let existingFlag = true;
|
|
249
|
-
if (!existing) {
|
|
250
|
-
existingFlag = false;
|
|
251
|
-
}
|
|
252
|
-
return this.loadRuntime({
|
|
253
|
-
context,
|
|
254
|
-
registryEntries,
|
|
255
|
-
existing: existingFlag,
|
|
256
|
-
runtimeOptions,
|
|
257
|
-
containerScope,
|
|
258
|
-
containerRuntimeCtor,
|
|
259
|
-
requestHandler,
|
|
260
|
-
provideEntryPoint: () => {
|
|
261
|
-
throw new UsageError("ContainerRuntime.load is deprecated and should no longer be used");
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
225
|
/**
|
|
266
226
|
* Load the stores from a snapshot and returns the runtime.
|
|
267
227
|
* @param params - An object housing the runtime properties:
|
|
@@ -341,16 +301,16 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
341
301
|
const idCompressorEnabled = metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
|
|
342
302
|
let idCompressor;
|
|
343
303
|
if (idCompressorEnabled) {
|
|
344
|
-
const {
|
|
304
|
+
const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import("@fluidframework/id-compressor");
|
|
345
305
|
const pendingLocalState = context.pendingLocalState;
|
|
346
306
|
if (pendingLocalState?.pendingIdCompressorState !== undefined) {
|
|
347
|
-
idCompressor =
|
|
307
|
+
idCompressor = deserializeIdCompressor(pendingLocalState.pendingIdCompressorState);
|
|
348
308
|
}
|
|
349
309
|
else if (serializedIdCompressor !== undefined) {
|
|
350
|
-
idCompressor =
|
|
310
|
+
idCompressor = deserializeIdCompressor(serializedIdCompressor, createSessionId());
|
|
351
311
|
}
|
|
352
312
|
else {
|
|
353
|
-
idCompressor =
|
|
313
|
+
idCompressor = createIdCompressor(logger);
|
|
354
314
|
}
|
|
355
315
|
}
|
|
356
316
|
const runtime = new containerRuntimeCtor(context, registry, metadata, electedSummarizerData, chunks ?? [], aliases ?? [], {
|
|
@@ -453,9 +413,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
453
413
|
get gcThrowOnTombstoneUsage() {
|
|
454
414
|
return this.garbageCollector.throwOnTombstoneUsage;
|
|
455
415
|
}
|
|
456
|
-
|
|
457
|
-
* @internal
|
|
458
|
-
*/
|
|
416
|
+
/***/
|
|
459
417
|
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, _storage, idCompressor, provideEntryPoint, requestHandler, summaryConfiguration = {
|
|
460
418
|
// the defaults
|
|
461
419
|
...DefaultSummaryConfiguration,
|
|
@@ -470,6 +428,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
470
428
|
this._storage = _storage;
|
|
471
429
|
this.requestHandler = requestHandler;
|
|
472
430
|
this.summaryConfiguration = summaryConfiguration;
|
|
431
|
+
this.imminentClosure = false;
|
|
473
432
|
this.defaultMaxConsecutiveReconnects = 7;
|
|
474
433
|
this._orderSequentiallyCalls = 0;
|
|
475
434
|
this.flushTaskExists = false;
|
|
@@ -561,7 +520,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
561
520
|
eventName: "GCFeatureMatrix",
|
|
562
521
|
metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
|
|
563
522
|
inputs: JSON.stringify({
|
|
564
|
-
|
|
523
|
+
gcOptions_gcGeneration: this.runtimeOptions.gcOptions[gcGenerationOptionName],
|
|
565
524
|
}),
|
|
566
525
|
});
|
|
567
526
|
this.telemetryDocumentId = metadata?.telemetryDocumentId ?? uuid();
|
|
@@ -627,6 +586,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
627
586
|
// GC runs in summarizer client and needs access to the real (non-proxy) active information. The proxy
|
|
628
587
|
// delta manager would always return false for summarizer client.
|
|
629
588
|
activeConnection: () => this.innerDeltaManager.active,
|
|
589
|
+
submitMessage: (message) => this.submit(message),
|
|
630
590
|
});
|
|
631
591
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
632
592
|
this.summarizerNode = createRootSummarizerNodeWithGC(createChildLogger({ logger: this.logger, namespace: "SummarizerNode" }),
|
|
@@ -834,8 +794,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
834
794
|
/**
|
|
835
795
|
* Notifies this object about the request made to the container.
|
|
836
796
|
* @param request - Request made to the handler.
|
|
837
|
-
* @deprecated Will be removed in future major release.
|
|
797
|
+
* @deprecated Will be removed in future major release. This method needs to stay private until LTS version of Loader moves to "2.0.0-internal.7.0.0".
|
|
838
798
|
*/
|
|
799
|
+
// @ts-expect-error expected to be used by LTS Loaders and Containers
|
|
839
800
|
async request(request) {
|
|
840
801
|
try {
|
|
841
802
|
const parser = RequestParser.create(request);
|
|
@@ -1079,6 +1040,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1079
1040
|
throw new Error("chunkedOp not expected here");
|
|
1080
1041
|
case ContainerMessageType.Rejoin:
|
|
1081
1042
|
throw new Error("rejoin not expected here");
|
|
1043
|
+
case ContainerMessageType.GC:
|
|
1044
|
+
// GC op is only sent in summarizer which should never have stashed ops.
|
|
1045
|
+
throw new LoggingError("GC op not expected to be stashed in summarizer");
|
|
1082
1046
|
default: {
|
|
1083
1047
|
// This should be extremely rare for stashed ops.
|
|
1084
1048
|
// It would require a newer runtime stashing ops and then an older one applying them,
|
|
@@ -1263,6 +1227,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1263
1227
|
this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
|
|
1264
1228
|
}
|
|
1265
1229
|
break;
|
|
1230
|
+
case ContainerMessageType.GC:
|
|
1231
|
+
this.garbageCollector.processMessage(messageWithContext.message, local);
|
|
1232
|
+
break;
|
|
1266
1233
|
case ContainerMessageType.ChunkedOp:
|
|
1267
1234
|
case ContainerMessageType.Rejoin:
|
|
1268
1235
|
break;
|
|
@@ -1346,23 +1313,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1346
1313
|
}
|
|
1347
1314
|
this.dataStores.processSignal(envelope.address, transformed, local);
|
|
1348
1315
|
}
|
|
1349
|
-
/**
|
|
1350
|
-
* Returns the runtime of the data store.
|
|
1351
|
-
* @param id - Id supplied during creating the data store.
|
|
1352
|
-
* @param wait - True if you want to wait for it.
|
|
1353
|
-
* @deprecated Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
|
|
1354
|
-
*/
|
|
1355
|
-
// eslint-disable-next-line import/no-deprecated
|
|
1356
|
-
async getRootDataStore(id, wait = true) {
|
|
1357
|
-
return this.getRootDataStoreChannel(id, wait);
|
|
1358
|
-
}
|
|
1359
|
-
async getRootDataStoreChannel(id, wait = true) {
|
|
1360
|
-
await this.dataStores.waitIfPendingAlias(id);
|
|
1361
|
-
const internalId = this.internalId(id);
|
|
1362
|
-
const context = await this.dataStores.getDataStore(internalId, { wait });
|
|
1363
|
-
assert(await context.isRoot(), 0x12b /* "did not get root data store" */);
|
|
1364
|
-
return context.realize();
|
|
1365
|
-
}
|
|
1366
1316
|
/**
|
|
1367
1317
|
* Flush the pending ops manually.
|
|
1368
1318
|
* This method is expected to be called at the end of a batch.
|
|
@@ -1452,7 +1402,6 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1452
1402
|
}
|
|
1453
1403
|
/**
|
|
1454
1404
|
* @deprecated 0.16 Issue #1537, #3631
|
|
1455
|
-
* @internal
|
|
1456
1405
|
*/
|
|
1457
1406
|
async _createDataStoreWithProps(pkg, props, id = uuid()) {
|
|
1458
1407
|
return channelToDataStore(await this.dataStores
|
|
@@ -1462,7 +1411,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1462
1411
|
canSendOps() {
|
|
1463
1412
|
// Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because
|
|
1464
1413
|
// container runtime's ability to send ops depend on the actual readonly state of the delta manager.
|
|
1465
|
-
return this.connected && !this.innerDeltaManager.readOnlyInfo.readonly;
|
|
1414
|
+
return (this.connected && !this.innerDeltaManager.readOnlyInfo.readonly && !this.imminentClosure);
|
|
1466
1415
|
}
|
|
1467
1416
|
/**
|
|
1468
1417
|
* Are we in the middle of batching ops together?
|
|
@@ -1484,19 +1433,28 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1484
1433
|
return this.dirtyContainer;
|
|
1485
1434
|
}
|
|
1486
1435
|
isContainerMessageDirtyable({ type, contents }) {
|
|
1487
|
-
//
|
|
1488
|
-
//
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1436
|
+
// Certain container runtime messages should not mark the container dirty such as the old built-in
|
|
1437
|
+
// AgentScheduler and Garbage collector messages.
|
|
1438
|
+
switch (type) {
|
|
1439
|
+
case ContainerMessageType.Attach: {
|
|
1440
|
+
const attachMessage = contents;
|
|
1441
|
+
if (attachMessage.id === agentSchedulerId) {
|
|
1442
|
+
return false;
|
|
1443
|
+
}
|
|
1444
|
+
break;
|
|
1493
1445
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1446
|
+
case ContainerMessageType.FluidDataStoreOp: {
|
|
1447
|
+
const envelope = contents;
|
|
1448
|
+
if (envelope.address === agentSchedulerId) {
|
|
1449
|
+
return false;
|
|
1450
|
+
}
|
|
1451
|
+
break;
|
|
1452
|
+
}
|
|
1453
|
+
case ContainerMessageType.GC: {
|
|
1498
1454
|
return false;
|
|
1499
1455
|
}
|
|
1456
|
+
default:
|
|
1457
|
+
break;
|
|
1500
1458
|
}
|
|
1501
1459
|
return true;
|
|
1502
1460
|
}
|
|
@@ -1787,10 +1745,10 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1787
1745
|
properties: { all: { safeSummary: true } },
|
|
1788
1746
|
}));
|
|
1789
1747
|
}
|
|
1790
|
-
// If there are pending
|
|
1791
|
-
// incorrect. So, wait for the container to be saved with a timeout. If the container is not
|
|
1792
|
-
// within the timeout, check if it should be failed or can continue.
|
|
1793
|
-
if (this.validateSummaryBeforeUpload && this.
|
|
1748
|
+
// If the container is dirty, i.e., there are pending unacked ops, the summary will not be eventual consistent
|
|
1749
|
+
// and it may even be incorrect. So, wait for the container to be saved with a timeout. If the container is not
|
|
1750
|
+
// saved within the timeout, check if it should be failed or can continue.
|
|
1751
|
+
if (this.validateSummaryBeforeUpload && this.isDirty) {
|
|
1794
1752
|
const countBefore = this.pendingMessagesCount;
|
|
1795
1753
|
// The timeout for waiting for pending ops can be overridden via configurations.
|
|
1796
1754
|
const pendingOpsTimeout = this.mc.config.getNumber("Fluid.Summarizer.waitForPendingOpsTimeoutMs") ??
|
|
@@ -1810,7 +1768,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1810
1768
|
// happens, whether we attempted to wait for these ops to be acked and what was the result.
|
|
1811
1769
|
summaryNumberLogger.sendTelemetryEvent({
|
|
1812
1770
|
eventName: "PendingOpsWhileSummarizing",
|
|
1813
|
-
saved: this.
|
|
1771
|
+
saved: !this.isDirty,
|
|
1814
1772
|
timeout: pendingOpsTimeout,
|
|
1815
1773
|
countBefore,
|
|
1816
1774
|
countAfter: this.pendingMessagesCount,
|
|
@@ -2035,7 +1993,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2035
1993
|
}
|
|
2036
1994
|
}
|
|
2037
1995
|
/**
|
|
2038
|
-
* This helper is called during summarization. If
|
|
1996
|
+
* This helper is called during summarization. If the container is dirty, it will return a failed summarize result
|
|
2039
1997
|
* (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.
|
|
2040
1998
|
* @param logger - The logger to be used for sending telemetry.
|
|
2041
1999
|
* @param referenceSequenceNumber - The reference sequence number of the summary attempt.
|
|
@@ -2045,7 +2003,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2045
2003
|
* @returns failed summarize result (IBaseSummarizeResult) if summary should be failed, undefined otherwise.
|
|
2046
2004
|
*/
|
|
2047
2005
|
async shouldFailSummaryOnPendingOps(logger, referenceSequenceNumber, minimumSequenceNumber, finalAttempt, beforeSummaryGeneration) {
|
|
2048
|
-
if (!this.
|
|
2006
|
+
if (!this.isDirty) {
|
|
2049
2007
|
return;
|
|
2050
2008
|
}
|
|
2051
2009
|
// If "SkipFailingIncorrectSummary" option is true, don't fail the summary in the last attempt.
|
|
@@ -2315,6 +2273,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2315
2273
|
/**
|
|
2316
2274
|
* Finds the right store and asks it to resubmit the message. This typically happens when we
|
|
2317
2275
|
* reconnect and there are pending messages.
|
|
2276
|
+
* ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)
|
|
2318
2277
|
* @param message - The original LocalContainerRuntimeMessage.
|
|
2319
2278
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
2320
2279
|
*/
|
|
@@ -2339,6 +2298,9 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2339
2298
|
case ContainerMessageType.Rejoin:
|
|
2340
2299
|
this.submit(message);
|
|
2341
2300
|
break;
|
|
2301
|
+
case ContainerMessageType.GC:
|
|
2302
|
+
// GC op is only sent in summarizer which should never reconnect.
|
|
2303
|
+
throw new LoggingError("GC op not expected to be resubmitted in summarizer");
|
|
2342
2304
|
default: {
|
|
2343
2305
|
// This case should be very rare - it would imply an op was stashed from a
|
|
2344
2306
|
// future version of runtime code and now is being applied on an older version
|
|
@@ -2473,14 +2435,17 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2473
2435
|
};
|
|
2474
2436
|
});
|
|
2475
2437
|
}
|
|
2476
|
-
notifyAttaching() { } // do nothing (deprecated method)
|
|
2477
2438
|
async getPendingLocalState(props) {
|
|
2478
2439
|
return PerformanceEvent.timedExecAsync(this.mc.logger, {
|
|
2479
2440
|
eventName: "getPendingLocalState",
|
|
2480
2441
|
notifyImminentClosure: props?.notifyImminentClosure,
|
|
2481
2442
|
}, async (event) => {
|
|
2482
2443
|
this.verifyNotClosed();
|
|
2483
|
-
|
|
2444
|
+
// in case imminentClosure is set to true by future code, we don't
|
|
2445
|
+
// try to change its value
|
|
2446
|
+
if (!this.imminentClosure) {
|
|
2447
|
+
this.imminentClosure = props?.notifyImminentClosure ?? this.imminentClosure;
|
|
2448
|
+
}
|
|
2484
2449
|
const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
|
|
2485
2450
|
if (this._orderSequentiallyCalls !== 0) {
|
|
2486
2451
|
throw new UsageError("can't get state during orderSequentially");
|
|
@@ -2489,7 +2454,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2489
2454
|
// getPendingLocalState() is only exposed through Container.closeAndGetPendingLocalState(), so it's safe
|
|
2490
2455
|
// to close current batch.
|
|
2491
2456
|
this.flush();
|
|
2492
|
-
const pendingAttachmentBlobs =
|
|
2457
|
+
const pendingAttachmentBlobs = this.imminentClosure
|
|
2493
2458
|
? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
|
|
2494
2459
|
: undefined;
|
|
2495
2460
|
const pending = this.pendingStateManager.getLocalState();
|