@fluidframework/container-runtime 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.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 +111 -0
- package/api-extractor.json +13 -1
- package/api-report/container-runtime.api.md +799 -0
- package/dist/blobManager.d.ts +1 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +7 -7
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +75 -42
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +1554 -0
- package/dist/container-runtime-beta.d.ts +1554 -0
- package/dist/container-runtime-public.d.ts +1554 -0
- package/dist/container-runtime.d.ts +1611 -0
- package/dist/containerHandleContext.js +3 -3
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +28 -24
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +277 -256
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +9 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +1 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +54 -58
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreRegistry.js +3 -3
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/deltaManagerProxyBase.js +4 -4
- package/dist/deltaManagerProxyBase.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.js +6 -6
- package/dist/deltaManagerSummarizerProxy.js.map +1 -1
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/gc/garbageCollection.js +13 -13
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +4 -15
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +3 -3
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/id-compressor/identifiers.d.ts +3 -3
- package/dist/id-compressor/identifiers.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +17 -17
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.js +6 -6
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +2 -2
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +7 -2
- package/dist/opLifecycle/outbox.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 +3 -19
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +23 -40
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.js +6 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +3 -3
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +54 -54
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +6 -6
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.js +37 -37
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -0
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +17 -8
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.js +6 -6
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.js +9 -9
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +7 -7
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -3
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +12 -12
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summaryCollection.d.ts +2 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +22 -21
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +5 -5
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +3 -3
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +2 -2
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +10 -10
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/throttler.js +16 -16
- package/dist/throttler.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/blobManager.d.ts +1 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +7 -7
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +76 -43
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.js +3 -3
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +28 -24
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +268 -252
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +9 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +1 -3
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +54 -58
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreRegistry.js +3 -3
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/deltaManagerProxyBase.js +4 -4
- package/lib/deltaManagerProxyBase.js.map +1 -1
- package/lib/deltaManagerSummarizerProxy.js +6 -6
- package/lib/deltaManagerSummarizerProxy.js.map +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/gc/garbageCollection.js +13 -13
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +4 -15
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +3 -3
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/id-compressor/identifiers.d.ts +3 -3
- package/lib/id-compressor/identifiers.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +17 -17
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +6 -6
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +2 -2
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +7 -2
- package/lib/opLifecycle/outbox.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 +3 -19
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +23 -40
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.js +6 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +3 -3
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +54 -54
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +6 -6
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.js +37 -37
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -0
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +18 -9
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.js +6 -6
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.js +9 -9
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +7 -7
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js +3 -3
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +12 -12
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summaryCollection.d.ts +2 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +22 -21
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +5 -5
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +3 -3
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +2 -2
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +9 -9
- package/lib/summary/summaryManager.js.map +1 -1
- package/lib/throttler.js +16 -16
- package/lib/throttler.js.map +1 -1
- package/package.json +27 -27
- package/src/blobManager.ts +1 -1
- package/src/connectionTelemetry.ts +97 -52
- package/src/containerRuntime.ts +96 -73
- package/src/dataStore.ts +1 -1
- package/src/dataStoreContext.ts +1 -6
- package/src/error.ts +4 -1
- package/src/gc/gcDefinitions.ts +3 -15
- package/src/gc/gcEarlyAdoption.md +1 -1
- package/src/index.ts +1 -0
- package/src/opLifecycle/README.md +53 -28
- package/src/opLifecycle/outbox.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +8 -46
- package/src/scheduleManager.ts +2 -0
- package/src/summary/summarizer.ts +20 -7
- package/src/summary/summaryCollection.ts +1 -0
- package/src/summary/summaryGenerator.ts +3 -3
- package/src/summary/summaryManager.ts +2 -2
package/dist/containerRuntime.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.ContainerRuntime = exports.makeLegacySendBatchFn = exports.getDeviceSpec = exports.agentSchedulerId = exports.isRuntimeMessage = exports.RuntimeMessage = exports.defaultPendingOpsRetryDelayMs = exports.defaultPendingOpsWaitTimeoutMs = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.InactiveResponseHeaderKey = exports.TombstoneResponseHeaderKey = exports.AllowInactiveRequestHeaderKey = exports.AllowTombstoneRequestHeaderKey = exports.RuntimeHeaders = exports.DefaultSummaryConfiguration = void 0;
|
|
26
|
+
exports.ContainerRuntime = exports.TEST_requestSummarizer = exports.makeLegacySendBatchFn = exports.getDeviceSpec = exports.agentSchedulerId = exports.isRuntimeMessage = exports.RuntimeMessage = exports.defaultPendingOpsRetryDelayMs = exports.defaultPendingOpsWaitTimeoutMs = exports.CompressionAlgorithms = exports.defaultRuntimeHeaderData = exports.InactiveResponseHeaderKey = exports.TombstoneResponseHeaderKey = exports.AllowInactiveRequestHeaderKey = exports.AllowTombstoneRequestHeaderKey = exports.RuntimeHeaders = exports.DefaultSummaryConfiguration = void 0;
|
|
23
27
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
24
28
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
25
29
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
@@ -87,7 +91,7 @@ var RuntimeHeaders;
|
|
|
87
91
|
RuntimeHeaders["wait"] = "wait";
|
|
88
92
|
/** True if the request is coming from an IFluidHandle. */
|
|
89
93
|
RuntimeHeaders["viaHandle"] = "viaHandle";
|
|
90
|
-
})(RuntimeHeaders
|
|
94
|
+
})(RuntimeHeaders || (exports.RuntimeHeaders = RuntimeHeaders = {}));
|
|
91
95
|
/** True if a tombstoned object should be returned without erroring */
|
|
92
96
|
exports.AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
|
|
93
97
|
/** [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring */
|
|
@@ -108,7 +112,7 @@ exports.defaultRuntimeHeaderData = {
|
|
|
108
112
|
var CompressionAlgorithms;
|
|
109
113
|
(function (CompressionAlgorithms) {
|
|
110
114
|
CompressionAlgorithms["lz4"] = "lz4";
|
|
111
|
-
})(CompressionAlgorithms
|
|
115
|
+
})(CompressionAlgorithms || (exports.CompressionAlgorithms = CompressionAlgorithms = {}));
|
|
112
116
|
const maxConsecutiveReconnectsKey = "Fluid.ContainerRuntime.MaxConsecutiveReconnects";
|
|
113
117
|
const defaultFlushMode = runtime_definitions_1.FlushMode.TurnBased;
|
|
114
118
|
// The actual limit is 1Mb (socket.io and Kafka limits)
|
|
@@ -144,7 +148,7 @@ var RuntimeMessage;
|
|
|
144
148
|
RuntimeMessage["Rejoin"] = "rejoin";
|
|
145
149
|
RuntimeMessage["Alias"] = "alias";
|
|
146
150
|
RuntimeMessage["Operation"] = "op";
|
|
147
|
-
})(RuntimeMessage
|
|
151
|
+
})(RuntimeMessage || (exports.RuntimeMessage = RuntimeMessage = {}));
|
|
148
152
|
/**
|
|
149
153
|
* @deprecated - please use version in driver-utils
|
|
150
154
|
*/
|
|
@@ -187,20 +191,275 @@ const makeLegacySendBatchFn = (submitFn, deltaManager) => (batch) => {
|
|
|
187
191
|
deltaManager.flush();
|
|
188
192
|
};
|
|
189
193
|
exports.makeLegacySendBatchFn = makeLegacySendBatchFn;
|
|
194
|
+
const summarizerRequestUrl = "_summarizer";
|
|
195
|
+
/**
|
|
196
|
+
* Create and retrieve the summmarizer
|
|
197
|
+
*/
|
|
198
|
+
async function createSummarizer(loader, url) {
|
|
199
|
+
const request = {
|
|
200
|
+
headers: {
|
|
201
|
+
[container_definitions_1.LoaderHeader.cache]: false,
|
|
202
|
+
[container_definitions_1.LoaderHeader.clientDetails]: {
|
|
203
|
+
capabilities: { interactive: false },
|
|
204
|
+
type: summary_1.summarizerClientType,
|
|
205
|
+
},
|
|
206
|
+
[driver_definitions_1.DriverHeader.summarizingClient]: true,
|
|
207
|
+
[container_definitions_1.LoaderHeader.reconnect]: false,
|
|
208
|
+
},
|
|
209
|
+
url,
|
|
210
|
+
};
|
|
211
|
+
const resolvedContainer = await loader.resolve(request);
|
|
212
|
+
let fluidObject;
|
|
213
|
+
// Older containers may not have the "getEntryPoint" API
|
|
214
|
+
// ! This check will need to stay until LTS of loader moves past 2.0.0-internal.7.0.0
|
|
215
|
+
if (resolvedContainer.getEntryPoint !== undefined) {
|
|
216
|
+
fluidObject = await resolvedContainer.getEntryPoint();
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const response = await resolvedContainer.request({ url: `/${summarizerRequestUrl}` });
|
|
220
|
+
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
221
|
+
throw (0, runtime_utils_1.responseToException)(response, request);
|
|
222
|
+
}
|
|
223
|
+
fluidObject = response.value;
|
|
224
|
+
}
|
|
225
|
+
if (fluidObject?.ISummarizer === undefined) {
|
|
226
|
+
throw new telemetry_utils_1.UsageError("Fluid object does not implement ISummarizer");
|
|
227
|
+
}
|
|
228
|
+
return fluidObject.ISummarizer;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* This function is not supported publicly and exists for e2e testing
|
|
232
|
+
*/
|
|
233
|
+
async function TEST_requestSummarizer(loader, url) {
|
|
234
|
+
return createSummarizer(loader, url);
|
|
235
|
+
}
|
|
236
|
+
exports.TEST_requestSummarizer = TEST_requestSummarizer;
|
|
190
237
|
/**
|
|
191
238
|
* Represents the runtime of the container. Contains helper functions/state of the container.
|
|
192
239
|
* It will define the store level mappings.
|
|
193
240
|
*/
|
|
194
241
|
class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
242
|
+
/**
|
|
243
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
244
|
+
*/
|
|
245
|
+
get IFluidRouter() {
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated - use loadRuntime instead.
|
|
250
|
+
* Load the stores from a snapshot and returns the runtime.
|
|
251
|
+
* @param context - Context of the container.
|
|
252
|
+
* @param registryEntries - Mapping to the stores.
|
|
253
|
+
* @param requestHandler - Request handlers for the container runtime
|
|
254
|
+
* @param runtimeOptions - Additional options to be passed to the runtime
|
|
255
|
+
* @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
|
|
256
|
+
* @param containerRuntimeCtor - (optional) Constructor to use to create the ContainerRuntime instance. This
|
|
257
|
+
* allows mixin classes to leverage this method to define their own async initializer.
|
|
258
|
+
*/
|
|
259
|
+
static async load(context, registryEntries, requestHandler, runtimeOptions = {}, containerScope = context.scope, existing, containerRuntimeCtor = ContainerRuntime) {
|
|
260
|
+
let existingFlag = true;
|
|
261
|
+
if (!existing) {
|
|
262
|
+
existingFlag = false;
|
|
263
|
+
}
|
|
264
|
+
return this.loadRuntime({
|
|
265
|
+
context,
|
|
266
|
+
registryEntries,
|
|
267
|
+
existing: existingFlag,
|
|
268
|
+
runtimeOptions,
|
|
269
|
+
containerScope,
|
|
270
|
+
containerRuntimeCtor,
|
|
271
|
+
requestHandler,
|
|
272
|
+
provideEntryPoint: () => {
|
|
273
|
+
throw new telemetry_utils_1.UsageError("ContainerRuntime.load is deprecated and should no longer be used");
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Load the stores from a snapshot and returns the runtime.
|
|
279
|
+
* @param params - An object housing the runtime properties:
|
|
280
|
+
* - context - Context of the container.
|
|
281
|
+
* - registryEntries - Mapping from data store types to their corresponding factories.
|
|
282
|
+
* - existing - Pass 'true' if loading from an existing snapshot.
|
|
283
|
+
* - requestHandler - (optional) Request handler for the request() method of the container runtime.
|
|
284
|
+
* Only relevant for back-compat while we remove the request() method and move fully to entryPoint as the main pattern.
|
|
285
|
+
* - runtimeOptions - Additional options to be passed to the runtime
|
|
286
|
+
* - containerScope - runtime services provided with context
|
|
287
|
+
* - containerRuntimeCtor - Constructor to use to create the ContainerRuntime instance.
|
|
288
|
+
* This allows mixin classes to leverage this method to define their own async initializer.
|
|
289
|
+
* - provideEntryPoint - Promise that resolves to an object which will act as entryPoint for the Container.
|
|
290
|
+
* This object should provide all the functionality that the Container is expected to provide to the loader layer.
|
|
291
|
+
*/
|
|
292
|
+
static async loadRuntime(params) {
|
|
293
|
+
const { context, registryEntries, existing, requestHandler, provideEntryPoint, runtimeOptions = {}, containerScope = {}, containerRuntimeCtor = ContainerRuntime, } = params;
|
|
294
|
+
// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
|
|
295
|
+
// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
|
|
296
|
+
const backCompatContext = context;
|
|
297
|
+
const passLogger = backCompatContext.taggedLogger ??
|
|
298
|
+
// eslint-disable-next-line import/no-deprecated
|
|
299
|
+
new telemetry_utils_1.TaggedLoggerAdapter(backCompatContext.logger);
|
|
300
|
+
const logger = (0, telemetry_utils_1.createChildLogger)({
|
|
301
|
+
logger: passLogger,
|
|
302
|
+
properties: {
|
|
303
|
+
all: {
|
|
304
|
+
runtimeVersion: packageVersion_1.pkgVersion,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close", flushMode = defaultFlushMode, compressionOptions = defaultCompressionConfig, maxBatchSizeInBytes = defaultMaxBatchSizeInBytes, enableRuntimeIdCompressor = false, chunkSizeInBytes = defaultChunkSizeInBytes, enableOpReentryCheck = false, enableGroupedBatching = false, } = runtimeOptions;
|
|
309
|
+
const registry = new dataStoreRegistry_1.FluidDataStoreRegistry(registryEntries);
|
|
310
|
+
const tryFetchBlob = async (blobName) => {
|
|
311
|
+
const blobId = context.baseSnapshot?.blobs[blobName];
|
|
312
|
+
if (context.baseSnapshot && blobId) {
|
|
313
|
+
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
314
|
+
// So once we release 0.40 container-defn package we can remove this check.
|
|
315
|
+
(0, core_utils_1.assert)(context.storage !== undefined, 0x1f5 /* "Attached state should have storage" */);
|
|
316
|
+
return (0, driver_utils_1.readAndParse)(context.storage, blobId);
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const [chunks, metadata, electedSummarizerData, aliases, serializedIdCompressor] = await Promise.all([
|
|
320
|
+
tryFetchBlob(summary_1.chunksBlobName),
|
|
321
|
+
tryFetchBlob(summary_1.metadataBlobName),
|
|
322
|
+
tryFetchBlob(summary_1.electedSummarizerBlobName),
|
|
323
|
+
tryFetchBlob(summary_1.aliasBlobName),
|
|
324
|
+
tryFetchBlob(summary_1.idCompressorBlobName),
|
|
325
|
+
]);
|
|
326
|
+
// read snapshot blobs needed for BlobManager to load
|
|
327
|
+
const blobManagerSnapshot = await blobManager_1.BlobManager.load(context.baseSnapshot?.trees[summary_1.blobsTreeName], async (id) => {
|
|
328
|
+
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
329
|
+
// So once we release 0.40 container-defn package we can remove this check.
|
|
330
|
+
(0, core_utils_1.assert)(context.storage !== undefined, 0x256 /* "storage undefined in attached container" */);
|
|
331
|
+
return (0, driver_utils_1.readAndParse)(context.storage, id);
|
|
332
|
+
});
|
|
333
|
+
// Verify summary runtime sequence number matches protocol sequence number.
|
|
334
|
+
const runtimeSequenceNumber = metadata?.message?.sequenceNumber;
|
|
335
|
+
// When we load with pending state, we reuse an old snapshot so we don't expect these numbers to match
|
|
336
|
+
if (!context.pendingLocalState && runtimeSequenceNumber !== undefined) {
|
|
337
|
+
const protocolSequenceNumber = context.deltaManager.initialSequenceNumber;
|
|
338
|
+
// Unless bypass is explicitly set, then take action when sequence numbers mismatch.
|
|
339
|
+
if (loadSequenceNumberVerification !== "bypass" &&
|
|
340
|
+
runtimeSequenceNumber !== protocolSequenceNumber) {
|
|
341
|
+
// "Load from summary, runtime metadata sequenceNumber !== initialSequenceNumber"
|
|
342
|
+
const error = new telemetry_utils_1.DataCorruptionError(
|
|
343
|
+
// pre-0.58 error message: SummaryMetadataMismatch
|
|
344
|
+
"Summary metadata mismatch", { runtimeVersion: packageVersion_1.pkgVersion, runtimeSequenceNumber, protocolSequenceNumber });
|
|
345
|
+
if (loadSequenceNumberVerification === "log") {
|
|
346
|
+
logger.sendErrorEvent({ eventName: "SequenceNumberMismatch" }, error);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
context.closeFn(error);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const idCompressorEnabled = metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
|
|
354
|
+
let idCompressor;
|
|
355
|
+
if (idCompressorEnabled) {
|
|
356
|
+
const { IdCompressor, createSessionId } = await Promise.resolve().then(() => __importStar(require("./id-compressor")));
|
|
357
|
+
idCompressor =
|
|
358
|
+
serializedIdCompressor !== undefined
|
|
359
|
+
? IdCompressor.deserialize(serializedIdCompressor, createSessionId())
|
|
360
|
+
: IdCompressor.create(logger);
|
|
361
|
+
}
|
|
362
|
+
const runtime = new containerRuntimeCtor(context, registry, metadata, electedSummarizerData, chunks ?? [], aliases ?? [], {
|
|
363
|
+
summaryOptions,
|
|
364
|
+
gcOptions,
|
|
365
|
+
loadSequenceNumberVerification,
|
|
366
|
+
flushMode,
|
|
367
|
+
compressionOptions,
|
|
368
|
+
maxBatchSizeInBytes,
|
|
369
|
+
chunkSizeInBytes,
|
|
370
|
+
enableRuntimeIdCompressor,
|
|
371
|
+
enableOpReentryCheck,
|
|
372
|
+
enableGroupedBatching,
|
|
373
|
+
}, containerScope, logger, existing, blobManagerSnapshot, context.storage, idCompressor, provideEntryPoint, requestHandler, undefined);
|
|
374
|
+
// Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,
|
|
375
|
+
// or zero. This must be done before Container replays saved ops.
|
|
376
|
+
await runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);
|
|
377
|
+
// Initialize the base state of the runtime before it's returned.
|
|
378
|
+
await runtime.initializeBaseState();
|
|
379
|
+
return runtime;
|
|
380
|
+
}
|
|
381
|
+
get clientId() {
|
|
382
|
+
return this._getClientId();
|
|
383
|
+
}
|
|
384
|
+
get storage() {
|
|
385
|
+
return this._storage;
|
|
386
|
+
}
|
|
387
|
+
get flushMode() {
|
|
388
|
+
return this._flushMode;
|
|
389
|
+
}
|
|
390
|
+
get scope() {
|
|
391
|
+
return this.containerScope;
|
|
392
|
+
}
|
|
393
|
+
get IFluidDataStoreRegistry() {
|
|
394
|
+
return this.registry;
|
|
395
|
+
}
|
|
396
|
+
get attachState() {
|
|
397
|
+
return this._getAttachState();
|
|
398
|
+
}
|
|
399
|
+
get IFluidHandleContext() {
|
|
400
|
+
return this.handleContext;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Invokes the given callback and expects that no ops are submitted
|
|
404
|
+
* until execution finishes. If an op is submitted, an error will be raised.
|
|
405
|
+
*
|
|
406
|
+
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
407
|
+
*
|
|
408
|
+
* @param callback - the callback to be invoked
|
|
409
|
+
*/
|
|
410
|
+
ensureNoDataModelChanges(callback) {
|
|
411
|
+
this.ensureNoDataModelChangesCalls++;
|
|
412
|
+
try {
|
|
413
|
+
return callback();
|
|
414
|
+
}
|
|
415
|
+
finally {
|
|
416
|
+
this.ensureNoDataModelChangesCalls--;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
get connected() {
|
|
420
|
+
return this._connected;
|
|
421
|
+
}
|
|
422
|
+
/** clientId of parent (non-summarizing) container that owns summarizer container */
|
|
423
|
+
get summarizerClientId() {
|
|
424
|
+
return this.summarizerClientElection?.electedClientId;
|
|
425
|
+
}
|
|
426
|
+
get disposed() {
|
|
427
|
+
return this._disposed;
|
|
428
|
+
}
|
|
429
|
+
get summarizer() {
|
|
430
|
+
(0, core_utils_1.assert)(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
431
|
+
return this._summarizer;
|
|
432
|
+
}
|
|
433
|
+
isSummariesDisabled() {
|
|
434
|
+
return this.summaryConfiguration.state === "disabled";
|
|
435
|
+
}
|
|
436
|
+
isHeuristicsDisabled() {
|
|
437
|
+
return this.summaryConfiguration.state === "disableHeuristics";
|
|
438
|
+
}
|
|
439
|
+
getMaxOpsSinceLastSummary() {
|
|
440
|
+
return this.summaryConfiguration.state !== "disabled"
|
|
441
|
+
? this.summaryConfiguration.maxOpsSinceLastSummary
|
|
442
|
+
: 0;
|
|
443
|
+
}
|
|
444
|
+
getInitialSummarizerDelayMs() {
|
|
445
|
+
// back-compat: initialSummarizerDelayMs was moved from ISummaryRuntimeOptions
|
|
446
|
+
// to ISummaryConfiguration in 0.60.
|
|
447
|
+
if (this.runtimeOptions.summaryOptions.initialSummarizerDelayMs !== undefined) {
|
|
448
|
+
return this.runtimeOptions.summaryOptions.initialSummarizerDelayMs;
|
|
449
|
+
}
|
|
450
|
+
return this.summaryConfiguration.state !== "disabled"
|
|
451
|
+
? this.summaryConfiguration.initialSummarizerDelayMs
|
|
452
|
+
: 0;
|
|
453
|
+
}
|
|
195
454
|
/**
|
|
196
455
|
* @internal
|
|
197
456
|
*/
|
|
198
|
-
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, _storage, idCompressor, requestHandler, summaryConfiguration = {
|
|
457
|
+
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, _storage, idCompressor, provideEntryPoint, requestHandler, summaryConfiguration = {
|
|
199
458
|
// the defaults
|
|
200
459
|
...exports.DefaultSummaryConfiguration,
|
|
201
460
|
// the runtime configuration overrides
|
|
202
461
|
...runtimeOptions.summaryOptions?.summaryConfigOverrides,
|
|
203
|
-
}
|
|
462
|
+
}) {
|
|
204
463
|
super();
|
|
205
464
|
this.registry = registry;
|
|
206
465
|
this.runtimeOptions = runtimeOptions;
|
|
@@ -492,7 +751,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
492
751
|
this.summaryCollection.on("default", defaultAction);
|
|
493
752
|
// Create the SummaryManager and mark the initial state
|
|
494
753
|
this.summaryManager = new summary_1.SummaryManager(this.summarizerClientElection, this, // IConnectedState
|
|
495
|
-
this.summaryCollection, this.logger, this.
|
|
754
|
+
this.summaryCollection, this.logger, this.formCreateSummarizerFn(loader), new throttler_1.Throttler(60 * 1000, // 60 sec delay window
|
|
496
755
|
30 * 1000, // 30 sec max delay
|
|
497
756
|
// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
|
|
498
757
|
(0, throttler_1.formExponentialFn)({ coefficient: 20, initialDelay: 0 })), {
|
|
@@ -537,233 +796,9 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
537
796
|
(0, core_utils_1.assert)(this._summarizer !== undefined, 0x5bf /* Summarizer object is undefined in a summarizer client */);
|
|
538
797
|
return this._summarizer;
|
|
539
798
|
}
|
|
540
|
-
return
|
|
799
|
+
return provideEntryPoint(this);
|
|
541
800
|
});
|
|
542
801
|
}
|
|
543
|
-
/**
|
|
544
|
-
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
545
|
-
*/
|
|
546
|
-
get IFluidRouter() {
|
|
547
|
-
return this;
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* @deprecated - use loadRuntime instead.
|
|
551
|
-
* Load the stores from a snapshot and returns the runtime.
|
|
552
|
-
* @param context - Context of the container.
|
|
553
|
-
* @param registryEntries - Mapping to the stores.
|
|
554
|
-
* @param requestHandler - Request handlers for the container runtime
|
|
555
|
-
* @param runtimeOptions - Additional options to be passed to the runtime
|
|
556
|
-
* @param existing - (optional) When loading from an existing snapshot. Precedes context.existing if provided
|
|
557
|
-
* @param containerRuntimeCtor - (optional) Constructor to use to create the ContainerRuntime instance. This
|
|
558
|
-
* allows mixin classes to leverage this method to define their own async initializer.
|
|
559
|
-
*/
|
|
560
|
-
static async load(context, registryEntries, requestHandler, runtimeOptions = {}, containerScope = context.scope, existing, containerRuntimeCtor = ContainerRuntime) {
|
|
561
|
-
let existingFlag = true;
|
|
562
|
-
if (!existing) {
|
|
563
|
-
existingFlag = false;
|
|
564
|
-
}
|
|
565
|
-
return this.loadRuntime({
|
|
566
|
-
context,
|
|
567
|
-
registryEntries,
|
|
568
|
-
existing: existingFlag,
|
|
569
|
-
requestHandler,
|
|
570
|
-
runtimeOptions,
|
|
571
|
-
containerScope,
|
|
572
|
-
containerRuntimeCtor,
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Load the stores from a snapshot and returns the runtime.
|
|
577
|
-
* @param params - An object housing the runtime properties:
|
|
578
|
-
* - context - Context of the container.
|
|
579
|
-
* - registryEntries - Mapping from data store types to their corresponding factories.
|
|
580
|
-
* - existing - Pass 'true' if loading from an existing snapshot.
|
|
581
|
-
* - requestHandler - (optional) Request handler for the request() method of the container runtime.
|
|
582
|
-
* Only relevant for back-compat while we remove the request() method and move fully to entryPoint as the main pattern.
|
|
583
|
-
* - runtimeOptions - Additional options to be passed to the runtime
|
|
584
|
-
* - containerScope - runtime services provided with context
|
|
585
|
-
* - containerRuntimeCtor - Constructor to use to create the ContainerRuntime instance.
|
|
586
|
-
* This allows mixin classes to leverage this method to define their own async initializer.
|
|
587
|
-
* - initializeEntryPoint - Promise that resolves to an object which will act as entryPoint for the Container.
|
|
588
|
-
* This object should provide all the functionality that the Container is expected to provide to the loader layer.
|
|
589
|
-
*/
|
|
590
|
-
static async loadRuntime(params) {
|
|
591
|
-
const { context, registryEntries, existing, requestHandler, runtimeOptions = {}, containerScope = {}, containerRuntimeCtor = ContainerRuntime, } = params;
|
|
592
|
-
const initializeEntryPoint = params.initializeEntryPoint ??
|
|
593
|
-
(async (containerRuntime) => ({
|
|
594
|
-
get IFluidRouter() {
|
|
595
|
-
return this;
|
|
596
|
-
},
|
|
597
|
-
async request(req) {
|
|
598
|
-
return containerRuntime.request(req);
|
|
599
|
-
},
|
|
600
|
-
}));
|
|
601
|
-
// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
|
|
602
|
-
// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
|
|
603
|
-
const backCompatContext = context;
|
|
604
|
-
const passLogger = backCompatContext.taggedLogger ??
|
|
605
|
-
// eslint-disable-next-line import/no-deprecated
|
|
606
|
-
new telemetry_utils_1.TaggedLoggerAdapter(backCompatContext.logger);
|
|
607
|
-
const logger = (0, telemetry_utils_1.createChildLogger)({
|
|
608
|
-
logger: passLogger,
|
|
609
|
-
properties: {
|
|
610
|
-
all: {
|
|
611
|
-
runtimeVersion: packageVersion_1.pkgVersion,
|
|
612
|
-
},
|
|
613
|
-
},
|
|
614
|
-
});
|
|
615
|
-
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close", flushMode = defaultFlushMode, compressionOptions = defaultCompressionConfig, maxBatchSizeInBytes = defaultMaxBatchSizeInBytes, enableRuntimeIdCompressor = false, chunkSizeInBytes = defaultChunkSizeInBytes, enableOpReentryCheck = false, enableGroupedBatching = false, } = runtimeOptions;
|
|
616
|
-
const registry = new dataStoreRegistry_1.FluidDataStoreRegistry(registryEntries);
|
|
617
|
-
const tryFetchBlob = async (blobName) => {
|
|
618
|
-
const blobId = context.baseSnapshot?.blobs[blobName];
|
|
619
|
-
if (context.baseSnapshot && blobId) {
|
|
620
|
-
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
621
|
-
// So once we release 0.40 container-defn package we can remove this check.
|
|
622
|
-
(0, core_utils_1.assert)(context.storage !== undefined, 0x1f5 /* "Attached state should have storage" */);
|
|
623
|
-
return (0, driver_utils_1.readAndParse)(context.storage, blobId);
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
const [chunks, metadata, electedSummarizerData, aliases, serializedIdCompressor] = await Promise.all([
|
|
627
|
-
tryFetchBlob(summary_1.chunksBlobName),
|
|
628
|
-
tryFetchBlob(summary_1.metadataBlobName),
|
|
629
|
-
tryFetchBlob(summary_1.electedSummarizerBlobName),
|
|
630
|
-
tryFetchBlob(summary_1.aliasBlobName),
|
|
631
|
-
tryFetchBlob(summary_1.idCompressorBlobName),
|
|
632
|
-
]);
|
|
633
|
-
// read snapshot blobs needed for BlobManager to load
|
|
634
|
-
const blobManagerSnapshot = await blobManager_1.BlobManager.load(context.baseSnapshot?.trees[summary_1.blobsTreeName], async (id) => {
|
|
635
|
-
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
636
|
-
// So once we release 0.40 container-defn package we can remove this check.
|
|
637
|
-
(0, core_utils_1.assert)(context.storage !== undefined, 0x256 /* "storage undefined in attached container" */);
|
|
638
|
-
return (0, driver_utils_1.readAndParse)(context.storage, id);
|
|
639
|
-
});
|
|
640
|
-
// Verify summary runtime sequence number matches protocol sequence number.
|
|
641
|
-
const runtimeSequenceNumber = metadata?.message?.sequenceNumber;
|
|
642
|
-
// When we load with pending state, we reuse an old snapshot so we don't expect these numbers to match
|
|
643
|
-
if (!context.pendingLocalState && runtimeSequenceNumber !== undefined) {
|
|
644
|
-
const protocolSequenceNumber = context.deltaManager.initialSequenceNumber;
|
|
645
|
-
// Unless bypass is explicitly set, then take action when sequence numbers mismatch.
|
|
646
|
-
if (loadSequenceNumberVerification !== "bypass" &&
|
|
647
|
-
runtimeSequenceNumber !== protocolSequenceNumber) {
|
|
648
|
-
// "Load from summary, runtime metadata sequenceNumber !== initialSequenceNumber"
|
|
649
|
-
const error = new telemetry_utils_1.DataCorruptionError(
|
|
650
|
-
// pre-0.58 error message: SummaryMetadataMismatch
|
|
651
|
-
"Summary metadata mismatch", { runtimeVersion: packageVersion_1.pkgVersion, runtimeSequenceNumber, protocolSequenceNumber });
|
|
652
|
-
if (loadSequenceNumberVerification === "log") {
|
|
653
|
-
logger.sendErrorEvent({ eventName: "SequenceNumberMismatch" }, error);
|
|
654
|
-
}
|
|
655
|
-
else {
|
|
656
|
-
context.closeFn(error);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
const idCompressorEnabled = metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
|
|
661
|
-
let idCompressor;
|
|
662
|
-
if (idCompressorEnabled) {
|
|
663
|
-
const { IdCompressor, createSessionId } = await Promise.resolve().then(() => __importStar(require("./id-compressor")));
|
|
664
|
-
idCompressor =
|
|
665
|
-
serializedIdCompressor !== undefined
|
|
666
|
-
? IdCompressor.deserialize(serializedIdCompressor, createSessionId())
|
|
667
|
-
: IdCompressor.create(logger);
|
|
668
|
-
}
|
|
669
|
-
const runtime = new containerRuntimeCtor(context, registry, metadata, electedSummarizerData, chunks ?? [], aliases ?? [], {
|
|
670
|
-
summaryOptions,
|
|
671
|
-
gcOptions,
|
|
672
|
-
loadSequenceNumberVerification,
|
|
673
|
-
flushMode,
|
|
674
|
-
compressionOptions,
|
|
675
|
-
maxBatchSizeInBytes,
|
|
676
|
-
chunkSizeInBytes,
|
|
677
|
-
enableRuntimeIdCompressor,
|
|
678
|
-
enableOpReentryCheck,
|
|
679
|
-
enableGroupedBatching,
|
|
680
|
-
}, containerScope, logger, existing, blobManagerSnapshot, context.storage, idCompressor, requestHandler, undefined, // summaryConfiguration
|
|
681
|
-
initializeEntryPoint);
|
|
682
|
-
// Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,
|
|
683
|
-
// or zero. This must be done before Container replays saved ops.
|
|
684
|
-
await runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);
|
|
685
|
-
// Initialize the base state of the runtime before it's returned.
|
|
686
|
-
await runtime.initializeBaseState();
|
|
687
|
-
return runtime;
|
|
688
|
-
}
|
|
689
|
-
get clientId() {
|
|
690
|
-
return this._getClientId();
|
|
691
|
-
}
|
|
692
|
-
get storage() {
|
|
693
|
-
return this._storage;
|
|
694
|
-
}
|
|
695
|
-
/** @deprecated - The functionality is no longer exposed publicly */
|
|
696
|
-
get reSubmitFn() {
|
|
697
|
-
return (type, contents, localOpMetadata, opMetadata) => this.reSubmitCore({ type, contents }, localOpMetadata, opMetadata);
|
|
698
|
-
// Note: compatDetails is not included in this deprecated API
|
|
699
|
-
}
|
|
700
|
-
get flushMode() {
|
|
701
|
-
return this._flushMode;
|
|
702
|
-
}
|
|
703
|
-
get scope() {
|
|
704
|
-
return this.containerScope;
|
|
705
|
-
}
|
|
706
|
-
get IFluidDataStoreRegistry() {
|
|
707
|
-
return this.registry;
|
|
708
|
-
}
|
|
709
|
-
get attachState() {
|
|
710
|
-
return this._getAttachState();
|
|
711
|
-
}
|
|
712
|
-
get IFluidHandleContext() {
|
|
713
|
-
return this.handleContext;
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Invokes the given callback and expects that no ops are submitted
|
|
717
|
-
* until execution finishes. If an op is submitted, an error will be raised.
|
|
718
|
-
*
|
|
719
|
-
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
720
|
-
*
|
|
721
|
-
* @param callback - the callback to be invoked
|
|
722
|
-
*/
|
|
723
|
-
ensureNoDataModelChanges(callback) {
|
|
724
|
-
this.ensureNoDataModelChangesCalls++;
|
|
725
|
-
try {
|
|
726
|
-
return callback();
|
|
727
|
-
}
|
|
728
|
-
finally {
|
|
729
|
-
this.ensureNoDataModelChangesCalls--;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
get connected() {
|
|
733
|
-
return this._connected;
|
|
734
|
-
}
|
|
735
|
-
/** clientId of parent (non-summarizing) container that owns summarizer container */
|
|
736
|
-
get summarizerClientId() {
|
|
737
|
-
return this.summarizerClientElection?.electedClientId;
|
|
738
|
-
}
|
|
739
|
-
get disposed() {
|
|
740
|
-
return this._disposed;
|
|
741
|
-
}
|
|
742
|
-
get summarizer() {
|
|
743
|
-
(0, core_utils_1.assert)(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
744
|
-
return this._summarizer;
|
|
745
|
-
}
|
|
746
|
-
isSummariesDisabled() {
|
|
747
|
-
return this.summaryConfiguration.state === "disabled";
|
|
748
|
-
}
|
|
749
|
-
isHeuristicsDisabled() {
|
|
750
|
-
return this.summaryConfiguration.state === "disableHeuristics";
|
|
751
|
-
}
|
|
752
|
-
getMaxOpsSinceLastSummary() {
|
|
753
|
-
return this.summaryConfiguration.state !== "disabled"
|
|
754
|
-
? this.summaryConfiguration.maxOpsSinceLastSummary
|
|
755
|
-
: 0;
|
|
756
|
-
}
|
|
757
|
-
getInitialSummarizerDelayMs() {
|
|
758
|
-
// back-compat: initialSummarizerDelayMs was moved from ISummaryRuntimeOptions
|
|
759
|
-
// to ISummaryConfiguration in 0.60.
|
|
760
|
-
if (this.runtimeOptions.summaryOptions.initialSummarizerDelayMs !== undefined) {
|
|
761
|
-
return this.runtimeOptions.summaryOptions.initialSummarizerDelayMs;
|
|
762
|
-
}
|
|
763
|
-
return this.summaryConfiguration.state !== "disabled"
|
|
764
|
-
? this.summaryConfiguration.initialSummarizerDelayMs
|
|
765
|
-
: 0;
|
|
766
|
-
}
|
|
767
802
|
/**
|
|
768
803
|
* Initializes the state from the base snapshot this container runtime loaded from.
|
|
769
804
|
*/
|
|
@@ -800,7 +835,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
800
835
|
try {
|
|
801
836
|
const parser = runtime_utils_1.RequestParser.create(request);
|
|
802
837
|
const id = parser.pathParts[0];
|
|
803
|
-
if (id ===
|
|
838
|
+
if (id === summarizerRequestUrl && parser.pathParts.length === 1) {
|
|
804
839
|
if (this._summarizer !== undefined) {
|
|
805
840
|
return {
|
|
806
841
|
status: 200,
|
|
@@ -811,6 +846,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
811
846
|
return (0, runtime_utils_1.create404Response)(request);
|
|
812
847
|
}
|
|
813
848
|
if (this.requestHandler !== undefined) {
|
|
849
|
+
// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures
|
|
814
850
|
return this.requestHandler(parser, this);
|
|
815
851
|
}
|
|
816
852
|
return (0, runtime_utils_1.create404Response)(request);
|
|
@@ -828,6 +864,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
828
864
|
const requestParser = runtime_utils_1.RequestParser.create(request);
|
|
829
865
|
const id = requestParser.pathParts[0];
|
|
830
866
|
if (id === "_channels") {
|
|
867
|
+
// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures
|
|
831
868
|
return this.resolveHandle(requestParser.createSubRequest(1));
|
|
832
869
|
}
|
|
833
870
|
if (id === blobManager_1.BlobManager.basePath && requestParser.isLeaf(2)) {
|
|
@@ -846,6 +883,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
846
883
|
// We always expect createSubRequest to include a leading slash, but asserting here to protect against
|
|
847
884
|
// unintentionally modifying the url if that changes.
|
|
848
885
|
(0, core_utils_1.assert)(subRequest.url.startsWith("/"), 0x126 /* "Expected createSubRequest url to include a leading slash" */);
|
|
886
|
+
// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures
|
|
849
887
|
return dataStore.request(subRequest);
|
|
850
888
|
}
|
|
851
889
|
return (0, runtime_utils_1.create404Response)(request);
|
|
@@ -1306,6 +1344,7 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
1306
1344
|
* @param wait - True if you want to wait for it.
|
|
1307
1345
|
* @deprecated - Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
|
|
1308
1346
|
*/
|
|
1347
|
+
// eslint-disable-next-line import/no-deprecated
|
|
1309
1348
|
async getRootDataStore(id, wait = true) {
|
|
1310
1349
|
return this.getRootDataStoreChannel(id, wait);
|
|
1311
1350
|
}
|
|
@@ -2489,29 +2528,11 @@ class ContainerRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
2489
2528
|
}
|
|
2490
2529
|
}
|
|
2491
2530
|
/**
|
|
2492
|
-
*
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
formRequestSummarizerFn(loaderRouter) {
|
|
2531
|
+
* Forms a function that will create and retrieve a Summarizer.
|
|
2532
|
+
*/
|
|
2533
|
+
formCreateSummarizerFn(loader) {
|
|
2496
2534
|
return async () => {
|
|
2497
|
-
|
|
2498
|
-
headers: {
|
|
2499
|
-
[container_definitions_1.LoaderHeader.cache]: false,
|
|
2500
|
-
[container_definitions_1.LoaderHeader.clientDetails]: {
|
|
2501
|
-
capabilities: { interactive: false },
|
|
2502
|
-
type: summary_1.summarizerClientType,
|
|
2503
|
-
},
|
|
2504
|
-
[driver_definitions_1.DriverHeader.summarizingClient]: true,
|
|
2505
|
-
[container_definitions_1.LoaderHeader.reconnect]: false,
|
|
2506
|
-
},
|
|
2507
|
-
url: "/_summarizer",
|
|
2508
|
-
};
|
|
2509
|
-
const fluidObject = await (0, runtime_utils_1.requestFluidObject)(loaderRouter, request);
|
|
2510
|
-
const summarizer = fluidObject.ISummarizer;
|
|
2511
|
-
if (!summarizer) {
|
|
2512
|
-
throw new telemetry_utils_1.UsageError("Fluid object does not implement ISummarizer");
|
|
2513
|
-
}
|
|
2514
|
-
return summarizer;
|
|
2535
|
+
return createSummarizer(loader, `/${summarizerRequestUrl}`);
|
|
2515
2536
|
};
|
|
2516
2537
|
}
|
|
2517
2538
|
validateSummaryHeuristicConfiguration(configuration) {
|