@fluidframework/container-runtime 0.59.2001 → 0.59.3000-66610
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/.eslintrc.js +0 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.js +8 -8
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.js +8 -8
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.js +1 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +27 -17
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +149 -174
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +1 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +44 -44
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +2 -2
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +8 -8
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStores.d.ts +4 -2
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +45 -33
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +23 -23
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +81 -50
- package/dist/garbageCollection.js.map +1 -1
- package/dist/opTelemetry.js +1 -1
- package/dist/opTelemetry.js.map +1 -1
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +2 -2
- package/dist/orderedClientElection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.js +17 -17
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runWhileConnectedCoordinator.js +1 -1
- package/dist/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +7 -6
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +4 -3
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts +1 -1
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +1 -1
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +4 -2
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.js +2 -2
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +37 -11
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +12 -4
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +6 -4
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.js +5 -5
- package/dist/summaryManager.js.map +1 -1
- package/dist/throttler.js +2 -2
- package/dist/throttler.js.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +27 -17
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +68 -93
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +2 -2
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +2 -2
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStores.d.ts +4 -2
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +22 -10
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +23 -23
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +68 -37
- package/lib/garbageCollection.js.map +1 -1
- package/lib/opTelemetry.js.map +1 -1
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +4 -3
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +1 -0
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts +1 -1
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +1 -1
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +4 -2
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +37 -11
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +10 -2
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +2 -0
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.js.map +1 -1
- package/lib/throttler.js.map +1 -1
- package/package.json +26 -20
- package/src/blobManager.ts +3 -3
- package/src/containerRuntime.ts +108 -137
- package/src/dataStoreContext.ts +8 -11
- package/src/dataStoreContexts.ts +5 -5
- package/src/dataStores.ts +30 -13
- package/src/garbageCollection.ts +100 -57
- package/src/orderedClientElection.ts +5 -10
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +2 -2
- package/src/runningSummarizer.ts +8 -9
- package/src/summarizer.ts +2 -2
- package/src/summarizerHeuristics.ts +1 -1
- package/src/summarizerTypes.ts +8 -6
- package/src/summaryFormat.ts +38 -11
- package/src/summaryGenerator.ts +7 -5
- package/src/summaryManager.ts +2 -2
- package/src/throttler.ts +1 -1
package/dist/containerRuntime.js
CHANGED
|
@@ -115,11 +115,11 @@ function unpackRuntimeMessage(message) {
|
|
|
115
115
|
else {
|
|
116
116
|
// new format
|
|
117
117
|
const innerContents = message.contents;
|
|
118
|
-
common_utils_1.assert(innerContents.type !== undefined, 0x121 /* "Undefined inner contents type!" */);
|
|
118
|
+
(0, common_utils_1.assert)(innerContents.type !== undefined, 0x121 /* "Undefined inner contents type!" */);
|
|
119
119
|
message.type = innerContents.type;
|
|
120
120
|
message.contents = innerContents.contents;
|
|
121
121
|
}
|
|
122
|
-
common_utils_1.assert(isRuntimeMessage(message), 0x122 /* "Message to unpack is not proper runtime message" */);
|
|
122
|
+
(0, common_utils_1.assert)(isRuntimeMessage(message), 0x122 /* "Message to unpack is not proper runtime message" */);
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
125
125
|
// Legacy format, but it's already "unpacked",
|
|
@@ -164,7 +164,7 @@ class ScheduleManagerCore {
|
|
|
164
164
|
this.trackPending(message);
|
|
165
165
|
});
|
|
166
166
|
// Start with baseline - empty inbound queue.
|
|
167
|
-
common_utils_1.assert(!this.localPaused, 0x293 /* "initial state" */);
|
|
167
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x293 /* "initial state" */);
|
|
168
168
|
const allPending = this.deltaManager.inbound.toArray();
|
|
169
169
|
for (const pending of allPending) {
|
|
170
170
|
this.trackPending(pending);
|
|
@@ -179,10 +179,10 @@ class ScheduleManagerCore {
|
|
|
179
179
|
* to make decision if op processing should be paused or not afer that.
|
|
180
180
|
*/
|
|
181
181
|
afterOpProcessing(sequenceNumber) {
|
|
182
|
-
common_utils_1.assert(!this.localPaused, 0x294 /* "can't have op processing paused if we are processing an op" */);
|
|
182
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x294 /* "can't have op processing paused if we are processing an op" */);
|
|
183
183
|
// If the inbound queue is ever empty, nothing to do!
|
|
184
184
|
if (this.deltaManager.inbound.length === 0) {
|
|
185
|
-
common_utils_1.assert(this.pauseSequenceNumber === undefined, 0x295 /* "there should be no pending batch if we have no ops" */);
|
|
185
|
+
(0, common_utils_1.assert)(this.pauseSequenceNumber === undefined, 0x295 /* "there should be no pending batch if we have no ops" */);
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
188
|
// The queue is
|
|
@@ -192,7 +192,7 @@ class ScheduleManagerCore {
|
|
|
192
192
|
// 2. resumed when batch end comes in (in trackPending())
|
|
193
193
|
// do we have incomplete batch to worry about?
|
|
194
194
|
if (this.pauseSequenceNumber !== undefined) {
|
|
195
|
-
common_utils_1.assert(sequenceNumber < this.pauseSequenceNumber, 0x296 /* "we should never start processing incomplete batch!" */);
|
|
195
|
+
(0, common_utils_1.assert)(sequenceNumber < this.pauseSequenceNumber, 0x296 /* "we should never start processing incomplete batch!" */);
|
|
196
196
|
// If the next op is the start of incomplete batch, then we can't process it until it's fully in - pause!
|
|
197
197
|
if (sequenceNumber + 1 === this.pauseSequenceNumber) {
|
|
198
198
|
this.pauseQueue();
|
|
@@ -200,7 +200,7 @@ class ScheduleManagerCore {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
pauseQueue() {
|
|
203
|
-
common_utils_1.assert(!this.localPaused, 0x297 /* "always called from resumed state" */);
|
|
203
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x297 /* "always called from resumed state" */);
|
|
204
204
|
this.localPaused = true;
|
|
205
205
|
this.timePaused = common_utils_1.performance.now();
|
|
206
206
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -241,20 +241,20 @@ class ScheduleManagerCore {
|
|
|
241
241
|
* Called for each incoming op (i.e. inbound "push" notification)
|
|
242
242
|
*/
|
|
243
243
|
trackPending(message) {
|
|
244
|
-
common_utils_1.assert(this.deltaManager.inbound.length !== 0, 0x298 /* "we have something in the queue that generates this event" */);
|
|
245
|
-
common_utils_1.assert((this.currentBatchClientId === undefined) === (this.pauseSequenceNumber === undefined), 0x299 /* "non-synchronized state" */);
|
|
244
|
+
(0, common_utils_1.assert)(this.deltaManager.inbound.length !== 0, 0x298 /* "we have something in the queue that generates this event" */);
|
|
245
|
+
(0, common_utils_1.assert)((this.currentBatchClientId === undefined) === (this.pauseSequenceNumber === undefined), 0x299 /* "non-synchronized state" */);
|
|
246
246
|
const metadata = message.metadata;
|
|
247
247
|
const batchMetadata = metadata === null || metadata === void 0 ? void 0 : metadata.batch;
|
|
248
248
|
// Protocol messages are never part of a runtime batch of messages
|
|
249
249
|
if (!isRuntimeMessage(message)) {
|
|
250
250
|
// Protocol messages should never show up in the middle of the batch!
|
|
251
|
-
common_utils_1.assert(this.currentBatchClientId === undefined, 0x29a /* "System message in the middle of batch!" */);
|
|
252
|
-
common_utils_1.assert(batchMetadata === undefined, 0x29b /* "system op in a batch?" */);
|
|
253
|
-
common_utils_1.assert(!this.localPaused, 0x29c /* "we should be processing ops when there is no active batch" */);
|
|
251
|
+
(0, common_utils_1.assert)(this.currentBatchClientId === undefined, 0x29a /* "System message in the middle of batch!" */);
|
|
252
|
+
(0, common_utils_1.assert)(batchMetadata === undefined, 0x29b /* "system op in a batch?" */);
|
|
253
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x29c /* "we should be processing ops when there is no active batch" */);
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
256
|
if (this.currentBatchClientId === undefined && batchMetadata === undefined) {
|
|
257
|
-
common_utils_1.assert(!this.localPaused, 0x29d /* "we should be processing ops when there is no active batch" */);
|
|
257
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x29d /* "we should be processing ops when there is no active batch" */);
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
// If the client ID changes then we can move the pause point. If it stayed the same then we need to check.
|
|
@@ -263,7 +263,7 @@ class ScheduleManagerCore {
|
|
|
263
263
|
if (this.currentBatchClientId !== undefined || batchMetadata === false) {
|
|
264
264
|
if (this.currentBatchClientId !== message.clientId) {
|
|
265
265
|
// "Batch not closed, yet message from another client!"
|
|
266
|
-
throw new container_utils_1.DataCorruptionError("OpBatchIncomplete", Object.assign({ batchClientId: this.currentBatchClientId }, container_utils_1.extractSafePropertiesFromMessage(message)));
|
|
266
|
+
throw new container_utils_1.DataCorruptionError("OpBatchIncomplete", Object.assign({ batchClientId: this.currentBatchClientId }, (0, container_utils_1.extractSafePropertiesFromMessage)(message)));
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
// The queue is
|
|
@@ -272,8 +272,8 @@ class ScheduleManagerCore {
|
|
|
272
272
|
// - here (batchMetadata == false below), when queue was empty and start of batch showed up.
|
|
273
273
|
// 2. resumed when batch end comes in (batchMetadata === true case below)
|
|
274
274
|
if (batchMetadata) {
|
|
275
|
-
common_utils_1.assert(this.currentBatchClientId === undefined, 0x29e /* "there can't be active batch" */);
|
|
276
|
-
common_utils_1.assert(!this.localPaused, 0x29f /* "we should be processing ops when there is no active batch" */);
|
|
275
|
+
(0, common_utils_1.assert)(this.currentBatchClientId === undefined, 0x29e /* "there can't be active batch" */);
|
|
276
|
+
(0, common_utils_1.assert)(!this.localPaused, 0x29f /* "we should be processing ops when there is no active batch" */);
|
|
277
277
|
this.pauseSequenceNumber = message.sequenceNumber;
|
|
278
278
|
this.currentBatchClientId = message.clientId;
|
|
279
279
|
// Start of the batch
|
|
@@ -284,7 +284,7 @@ class ScheduleManagerCore {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
else if (batchMetadata === false) {
|
|
287
|
-
common_utils_1.assert(this.pauseSequenceNumber !== undefined, 0x2a0 /* "batch presence was validated above" */);
|
|
287
|
+
(0, common_utils_1.assert)(this.pauseSequenceNumber !== undefined, 0x2a0 /* "batch presence was validated above" */);
|
|
288
288
|
// Batch is complete, we can process it!
|
|
289
289
|
this.resumeQueue(this.pauseSequenceNumber, message);
|
|
290
290
|
this.pauseSequenceNumber = undefined;
|
|
@@ -292,7 +292,7 @@ class ScheduleManagerCore {
|
|
|
292
292
|
}
|
|
293
293
|
else {
|
|
294
294
|
// Continuation of current batch. Do nothing
|
|
295
|
-
common_utils_1.assert(this.currentBatchClientId !== undefined, 0x2a1 /* "logic error" */);
|
|
295
|
+
(0, common_utils_1.assert)(this.currentBatchClientId !== undefined, 0x2a1 /* "logic error" */);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}
|
|
@@ -315,7 +315,7 @@ class ScheduleManager {
|
|
|
315
315
|
beforeOpProcessing(message) {
|
|
316
316
|
var _a;
|
|
317
317
|
if (this.batchClientId !== message.clientId) {
|
|
318
|
-
common_utils_1.assert(this.batchClientId === undefined, 0x2a2 /* "Batch is interrupted by other client op. Should be caught by trackPending()" */);
|
|
318
|
+
(0, common_utils_1.assert)(this.batchClientId === undefined, 0x2a2 /* "Batch is interrupted by other client op. Should be caught by trackPending()" */);
|
|
319
319
|
// This could be the beginning of a new batch or an individual message.
|
|
320
320
|
this.emitter.emit("batchBegin", message);
|
|
321
321
|
this.deltaScheduler.batchBegin(message);
|
|
@@ -331,7 +331,7 @@ class ScheduleManager {
|
|
|
331
331
|
afterOpProcessing(error, message) {
|
|
332
332
|
var _a;
|
|
333
333
|
// If this is no longer true, we need to revisit what we do where we set this.hitError.
|
|
334
|
-
common_utils_1.assert(!this.hitError, 0x2a3 /* "container should be closed on any error" */);
|
|
334
|
+
(0, common_utils_1.assert)(!this.hitError, 0x2a3 /* "container should be closed on any error" */);
|
|
335
335
|
if (error) {
|
|
336
336
|
// We assume here that loader will close container and stop processing all future ops.
|
|
337
337
|
// This is implicit dependency. If this flow changes, this code might no longer be correct.
|
|
@@ -379,8 +379,8 @@ exports.getDeviceSpec = getDeviceSpec;
|
|
|
379
379
|
* It will define the store level mappings.
|
|
380
380
|
*/
|
|
381
381
|
class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
382
|
-
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, requestHandler
|
|
383
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
382
|
+
constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, requestHandler) {
|
|
383
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
384
384
|
super();
|
|
385
385
|
this.context = context;
|
|
386
386
|
this.registry = registry;
|
|
@@ -388,7 +388,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
388
388
|
this.containerScope = containerScope;
|
|
389
389
|
this.logger = logger;
|
|
390
390
|
this.requestHandler = requestHandler;
|
|
391
|
-
this._storage = _storage;
|
|
392
391
|
this.defaultMaxConsecutiveReconnects = 15;
|
|
393
392
|
this._orderSequentiallyCalls = 0;
|
|
394
393
|
this.needsFlush = false;
|
|
@@ -406,7 +405,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
406
405
|
* so we listen directly from DeltaManager instead.
|
|
407
406
|
*/
|
|
408
407
|
this.onOp = (op) => {
|
|
409
|
-
common_utils_1.assert(!this.paused, 0x128 /* "Container should not already be paused before applying stashed ops" */);
|
|
408
|
+
(0, common_utils_1.assert)(!this.paused, 0x128 /* "Container should not already be paused before applying stashed ops" */);
|
|
410
409
|
this.paused = true;
|
|
411
410
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
412
411
|
this.context.deltaManager.inbound.pause();
|
|
@@ -415,7 +414,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
415
414
|
this.paused = false;
|
|
416
415
|
this.context.deltaManager.inbound.resume();
|
|
417
416
|
}, (error) => {
|
|
418
|
-
this.closeFn(telemetry_utils_1.normalizeError(error));
|
|
417
|
+
this.closeFn((0, telemetry_utils_1.normalizeError)(error));
|
|
419
418
|
});
|
|
420
419
|
};
|
|
421
420
|
this.summarizeOnDemand = (...args) => {
|
|
@@ -447,36 +446,22 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
447
446
|
}
|
|
448
447
|
};
|
|
449
448
|
this.messageAtLastSummary = metadata === null || metadata === void 0 ? void 0 : metadata.message;
|
|
450
|
-
// If this is an existing container, we get values from metadata.
|
|
451
|
-
// otherwise, we initialize them.
|
|
452
|
-
if (existing) {
|
|
453
|
-
this.createContainerMetadata = {
|
|
454
|
-
createContainerRuntimeVersion: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerRuntimeVersion,
|
|
455
|
-
createContainerTimestamp: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerTimestamp,
|
|
456
|
-
};
|
|
457
|
-
this.summaryCount = metadata === null || metadata === void 0 ? void 0 : metadata.summaryCount;
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
this.createContainerMetadata = {
|
|
461
|
-
createContainerRuntimeVersion: packageVersion_1.pkgVersion,
|
|
462
|
-
createContainerTimestamp: Date.now(),
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
449
|
// Default to false (enabled).
|
|
466
450
|
this.disableIsolatedChannels = (_a = this.runtimeOptions.summaryOptions.disableIsolatedChannels) !== null && _a !== void 0 ? _a : false;
|
|
467
451
|
this._connected = this.context.connected;
|
|
468
452
|
this.chunkMap = new Map(chunks);
|
|
469
453
|
this.handleContext = new containerHandleContext_1.ContainerFluidHandleContext("", this);
|
|
470
|
-
this.mc = telemetry_utils_1.loggerToMonitoringContext(telemetry_utils_1.ChildLogger.create(this.logger, "ContainerRuntime"));
|
|
454
|
+
this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(this.logger, "ContainerRuntime"));
|
|
471
455
|
this._aliasingEnabled =
|
|
472
456
|
((_b = this.mc.config.getBoolean(useDataStoreAliasingKey)) !== null && _b !== void 0 ? _b : false) ||
|
|
473
457
|
((_c = runtimeOptions.useDataStoreAliasing) !== null && _c !== void 0 ? _c : false);
|
|
474
458
|
this._maxOpSizeInBytes = ((_d = this.mc.config.getNumber(maxOpSizeInBytesKey)) !== null && _d !== void 0 ? _d : defaultMaxOpSizeInBytes);
|
|
475
|
-
this.maxConsecutiveReconnects =
|
|
459
|
+
this.maxConsecutiveReconnects =
|
|
460
|
+
(_e = this.mc.config.getNumber(maxConsecutiveReconnectsKey)) !== null && _e !== void 0 ? _e : this.defaultMaxConsecutiveReconnects;
|
|
476
461
|
this._flushMode = runtimeOptions.flushMode;
|
|
477
|
-
this.garbageCollector = garbageCollection_1.GarbageCollector.create(this, this.runtimeOptions.gcOptions, (nodePath) => this.getGCNodePackagePath(nodePath), () => { var _a; return (_a = this.messageAtLastSummary) === null || _a === void 0 ? void 0 : _a.timestamp; }, context.baseSnapshot, async (id) => driver_utils_1.readAndParse(this.storage, id), this.mc.logger, existing, metadata);
|
|
462
|
+
this.garbageCollector = garbageCollection_1.GarbageCollector.create(this, this.runtimeOptions.gcOptions, (nodePath) => this.getGCNodePackagePath(nodePath), () => { var _a; return (_a = this.messageAtLastSummary) === null || _a === void 0 ? void 0 : _a.timestamp; }, context.baseSnapshot, async (id) => (0, driver_utils_1.readAndParse)(this.storage, id), this.mc.logger, existing, metadata);
|
|
478
463
|
const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
|
|
479
|
-
this.summarizerNode = runtime_utils_1.createRootSummarizerNodeWithGC(telemetry_utils_1.ChildLogger.create(this.logger, "SummarizerNode"),
|
|
464
|
+
this.summarizerNode = (0, runtime_utils_1.createRootSummarizerNodeWithGC)(telemetry_utils_1.ChildLogger.create(this.logger, "SummarizerNode"),
|
|
480
465
|
// Summarize function to call when summarize is called. Summarizer node always tracks summary state.
|
|
481
466
|
async (fullTree, trackState) => this.summarizeInternal(fullTree, trackState),
|
|
482
467
|
// Latest change sequence number, no changes since summary applied yet
|
|
@@ -495,7 +480,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
495
480
|
if (this.context.baseSnapshot) {
|
|
496
481
|
this.summarizerNode.loadBaseSummaryWithoutDifferential(this.context.baseSnapshot);
|
|
497
482
|
}
|
|
498
|
-
this.dataStores = new dataStores_1.DataStores(dataStores_1.getSummaryForDatastores(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getBaseGCDetailsFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, async () => this.garbageCollector.getBaseGCDetails(), (path, timestampMs, packagePath) => this.garbageCollector.nodeUpdated(path, "Changed", timestampMs, packagePath), new Map(dataStoreAliasMap), this.garbageCollector.writeDataAtRoot);
|
|
483
|
+
this.dataStores = new dataStores_1.DataStores((0, dataStores_1.getSummaryForDatastores)(context.baseSnapshot, metadata), this, (attachMsg) => this.submit(ContainerMessageType.Attach, attachMsg), (id, createParam) => (summarizeInternal, getGCDataFn, getBaseGCDetailsFn) => this.summarizerNode.createChild(summarizeInternal, id, createParam, undefined, getGCDataFn, getBaseGCDetailsFn), (id) => this.summarizerNode.deleteChild(id), this.mc.logger, async () => this.garbageCollector.getBaseGCDetails(), (path, timestampMs, packagePath) => this.garbageCollector.nodeUpdated(path, "Changed", timestampMs, packagePath), new Map(dataStoreAliasMap), this.garbageCollector.writeDataAtRoot);
|
|
499
484
|
this.blobManager = new blobManager_1.BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
500
485
|
this.scheduleManager = new ScheduleManager(context.deltaManager, this, telemetry_utils_1.ChildLogger.create(this.logger, "ScheduleManager"));
|
|
501
486
|
this.deltaSender = this.deltaManager;
|
|
@@ -549,7 +534,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
549
534
|
this.summaryCollection, this.logger, this.formRequestSummarizerFn(this.context.loader), new throttler_1.Throttler(60 * 1000, // 60 sec delay window
|
|
550
535
|
30 * 1000, // 30 sec max delay
|
|
551
536
|
// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
|
|
552
|
-
throttler_1.formExponentialFn({ coefficient: 20, initialDelay: 0 })), {
|
|
537
|
+
(0, throttler_1.formExponentialFn)({ coefficient: 20, initialDelay: 0 })), {
|
|
553
538
|
initialDelayMs: this.runtimeOptions.summaryOptions.initialSummarizerDelayMs,
|
|
554
539
|
}, this.runtimeOptions.summaryOptions.summarizerOptions);
|
|
555
540
|
this.summaryManager.start();
|
|
@@ -558,7 +543,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
558
543
|
this.deltaManager.on("readonly", (readonly) => {
|
|
559
544
|
// we accumulate ops while being in read-only state.
|
|
560
545
|
// once user gets write permissions and we have active connection, flush all pending ops.
|
|
561
|
-
common_utils_1.assert(readonly === this.deltaManager.readOnlyInfo.readonly, 0x124 /* "inconsistent readonly property/event state" */);
|
|
546
|
+
(0, common_utils_1.assert)(readonly === this.deltaManager.readOnlyInfo.readonly, 0x124 /* "inconsistent readonly property/event state" */);
|
|
562
547
|
// We need to be very careful with when we (re)send pending ops, to ensure that we only send ops
|
|
563
548
|
// when we either never send an op, or attempted to send it but we know for sure it was not
|
|
564
549
|
// sequenced by server and will never be sequenced (i.e. was lost)
|
|
@@ -571,7 +556,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
571
556
|
// can rely on same safety mechanism and resend ops only when we establish new connection.
|
|
572
557
|
// This is applicable for read-only permissions (event is raised before connection is properly registered),
|
|
573
558
|
// but it's an extra requirement for Container.forceReadonly() API
|
|
574
|
-
common_utils_1.assert(!readonly || !this.connected, 0x125 /* "Unsafe to transition to read-only state!" */);
|
|
559
|
+
(0, common_utils_1.assert)(!readonly || !this.connected, 0x125 /* "Unsafe to transition to read-only state!" */);
|
|
575
560
|
this.replayPendingStates();
|
|
576
561
|
});
|
|
577
562
|
if (context.pendingLocalState !== undefined) {
|
|
@@ -579,10 +564,29 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
579
564
|
}
|
|
580
565
|
// logging hardware telemetry
|
|
581
566
|
logger.sendTelemetryEvent(Object.assign({ eventName: "DeviceSpec" }, getDeviceSpec()));
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
567
|
+
let loadSummaryNumber;
|
|
568
|
+
// Get the container creation metadata. For new container, we initialize these. For existing containers,
|
|
569
|
+
// get the values from the metadata blob.
|
|
570
|
+
if (existing) {
|
|
571
|
+
this.createContainerMetadata = {
|
|
572
|
+
createContainerRuntimeVersion: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerRuntimeVersion,
|
|
573
|
+
createContainerTimestamp: metadata === null || metadata === void 0 ? void 0 : metadata.createContainerTimestamp,
|
|
574
|
+
};
|
|
575
|
+
// back-compat 0.59.3000 - Older document may either write summaryCount or not write it at all. If it does
|
|
576
|
+
// not write it, initialize summaryNumber to 0.
|
|
577
|
+
loadSummaryNumber = (_l = (_k = metadata === null || metadata === void 0 ? void 0 : metadata.summaryNumber) !== null && _k !== void 0 ? _k : metadata === null || metadata === void 0 ? void 0 : metadata.summaryCount) !== null && _l !== void 0 ? _l : 0;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
this.createContainerMetadata = {
|
|
581
|
+
createContainerRuntimeVersion: packageVersion_1.pkgVersion,
|
|
582
|
+
createContainerTimestamp: Date.now(),
|
|
583
|
+
};
|
|
584
|
+
loadSummaryNumber = 0;
|
|
585
|
+
}
|
|
586
|
+
this.nextSummaryNumber = loadSummaryNumber + 1;
|
|
587
|
+
this.logger.sendTelemetryEvent(Object.assign(Object.assign(Object.assign({ eventName: "ContainerLoadStats" }, this.createContainerMetadata), this.dataStores.containerLoadStats), { summaryNumber: loadSummaryNumber, summaryFormatVersion: metadata === null || metadata === void 0 ? void 0 : metadata.summaryFormatVersion, disableIsolatedChannels: metadata === null || metadata === void 0 ? void 0 : metadata.disableIsolatedChannels, gcVersion: metadata === null || metadata === void 0 ? void 0 : metadata.gcFeature }));
|
|
588
|
+
(0, connectionTelemetry_1.ReportOpPerfTelemetry)(this.context.clientId, this.deltaManager, this.logger);
|
|
589
|
+
(0, batchTracker_1.BindBatchTracker)(this, this.logger);
|
|
586
590
|
this.opTracker = new opTelemetry_1.OpTracker(this.deltaManager, this.mc.config.getBoolean(disableOpTrackingKey) === true);
|
|
587
591
|
}
|
|
588
592
|
get IContainerRuntime() { return this; }
|
|
@@ -607,28 +611,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
607
611
|
},
|
|
608
612
|
});
|
|
609
613
|
const { summaryOptions = {}, gcOptions = {}, loadSequenceNumberVerification = "close", useDataStoreAliasing = false, flushMode = defaultFlushMode, } = runtimeOptions;
|
|
610
|
-
|
|
611
|
-
// then there are no .channel layers, we pack at level 1, otherwise we pack at level 2
|
|
612
|
-
const packingLevel = summaryOptions.disableIsolatedChannels ? 1 : 2;
|
|
613
|
-
let storage = context.storage;
|
|
614
|
-
if (context.baseSnapshot) {
|
|
615
|
-
// This will patch snapshot in place!
|
|
616
|
-
// If storage is provided, it will wrap storage with BlobAggregationStorage that can
|
|
617
|
-
// pack & unpack aggregated blobs.
|
|
618
|
-
// Note that if storage is provided later by loader layer, we will wrap storage in this.storage getter.
|
|
619
|
-
// BlobAggregationStorage is smart enough for double-wrapping to be no-op
|
|
620
|
-
if (context.attachState === container_definitions_1.AttachState.Attached) {
|
|
621
|
-
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
622
|
-
// So once we release 0.40 container-defn package we can remove this check.
|
|
623
|
-
common_utils_1.assert(context.storage !== undefined, 0x1f4 /* "Attached state should have storage" */);
|
|
624
|
-
const aggrStorage = driver_utils_1.BlobAggregationStorage.wrap(context.storage, logger, undefined /* allowPacking */, packingLevel);
|
|
625
|
-
await aggrStorage.unpackSnapshot(context.baseSnapshot);
|
|
626
|
-
storage = aggrStorage;
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
await driver_utils_1.BlobAggregationStorage.unpackSnapshot(context.baseSnapshot);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
614
|
+
const storage = context.storage;
|
|
632
615
|
const registry = new dataStoreRegistry_1.FluidDataStoreRegistry(registryEntries);
|
|
633
616
|
const tryFetchBlob = async (blobName) => {
|
|
634
617
|
var _a;
|
|
@@ -636,8 +619,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
636
619
|
if (context.baseSnapshot && blobId) {
|
|
637
620
|
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
638
621
|
// So once we release 0.40 container-defn package we can remove this check.
|
|
639
|
-
common_utils_1.assert(storage !== undefined, 0x1f5 /* "Attached state should have storage" */);
|
|
640
|
-
return driver_utils_1.readAndParse(storage, blobId);
|
|
622
|
+
(0, common_utils_1.assert)(storage !== undefined, 0x1f5 /* "Attached state should have storage" */);
|
|
623
|
+
return (0, driver_utils_1.readAndParse)(storage, blobId);
|
|
641
624
|
}
|
|
642
625
|
};
|
|
643
626
|
const [chunks, metadata, electedSummarizerData, aliases] = await Promise.all([
|
|
@@ -651,8 +634,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
651
634
|
const blobManagerSnapshot = await blobManager_1.BlobManager.load((_b = context.baseSnapshot) === null || _b === void 0 ? void 0 : _b.trees[summaryFormat_1.blobsTreeName], async (id) => {
|
|
652
635
|
// IContainerContext storage api return type still has undefined in 0.39 package version.
|
|
653
636
|
// So once we release 0.40 container-defn package we can remove this check.
|
|
654
|
-
common_utils_1.assert(storage !== undefined, 0x256 /* "storage undefined in attached container" */);
|
|
655
|
-
return driver_utils_1.readAndParse(storage, id);
|
|
637
|
+
(0, common_utils_1.assert)(storage !== undefined, 0x256 /* "storage undefined in attached container" */);
|
|
638
|
+
return (0, driver_utils_1.readAndParse)(storage, id);
|
|
656
639
|
});
|
|
657
640
|
// Verify summary runtime sequence number matches protocol sequence number.
|
|
658
641
|
const runtimeSequenceNumber = (_c = metadata === null || metadata === void 0 ? void 0 : metadata.message) === null || _c === void 0 ? void 0 : _c.sequenceNumber;
|
|
@@ -678,7 +661,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
678
661
|
loadSequenceNumberVerification,
|
|
679
662
|
useDataStoreAliasing,
|
|
680
663
|
flushMode,
|
|
681
|
-
}, containerScope, logger, loadExisting, blobManagerSnapshot, requestHandler
|
|
664
|
+
}, containerScope, logger, loadExisting, blobManagerSnapshot, requestHandler);
|
|
682
665
|
return runtime;
|
|
683
666
|
}
|
|
684
667
|
get options() {
|
|
@@ -694,20 +677,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
694
677
|
return this.context.deltaManager;
|
|
695
678
|
}
|
|
696
679
|
get storage() {
|
|
697
|
-
|
|
698
|
-
// All callers should be fixed, as this API is called in detached state of container when we have
|
|
699
|
-
// no storage and it's passed down the stack without right typing.
|
|
700
|
-
// back-compat 0.40 NoStorageInDetachedMode. Also, IContainerContext storage api return type still
|
|
701
|
-
// has undefined in 0.39 package version.
|
|
702
|
-
// So once we release 0.40 container-defn package we can remove this check.
|
|
703
|
-
if (!this._storage && this.context.storage) {
|
|
704
|
-
// Note: BlobAggregationStorage is smart enough for double-wrapping to be no-op
|
|
705
|
-
// If isolated channels are disabled, then there are no .channel layers, we pack at level 1,
|
|
706
|
-
// otherwise we pack at level 2
|
|
707
|
-
this._storage = driver_utils_1.BlobAggregationStorage.wrap(this.context.storage, this.logger, undefined /* allowPacking */, this.disableIsolatedChannels ? 1 : 2);
|
|
708
|
-
}
|
|
709
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
710
|
-
return this._storage;
|
|
680
|
+
return this.context.storage;
|
|
711
681
|
}
|
|
712
682
|
get reSubmitFn() {
|
|
713
683
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
@@ -745,7 +715,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
745
715
|
}
|
|
746
716
|
get disposed() { return this._disposed; }
|
|
747
717
|
get summarizer() {
|
|
748
|
-
common_utils_1.assert(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
718
|
+
(0, common_utils_1.assert)(this._summarizer !== undefined, 0x257 /* "This is not summarizing container" */);
|
|
749
719
|
return this._summarizer;
|
|
750
720
|
}
|
|
751
721
|
get summariesDisabled() {
|
|
@@ -800,15 +770,15 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
800
770
|
value: this.summarizer,
|
|
801
771
|
};
|
|
802
772
|
}
|
|
803
|
-
return runtime_utils_1.create404Response(request);
|
|
773
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
804
774
|
}
|
|
805
775
|
if (this.requestHandler !== undefined) {
|
|
806
776
|
return this.requestHandler(parser, this);
|
|
807
777
|
}
|
|
808
|
-
return runtime_utils_1.create404Response(request);
|
|
778
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
809
779
|
}
|
|
810
780
|
catch (error) {
|
|
811
|
-
return runtime_utils_1.exceptionToResponse(error);
|
|
781
|
+
return (0, runtime_utils_1.exceptionToResponse)(error);
|
|
812
782
|
}
|
|
813
783
|
}
|
|
814
784
|
/**
|
|
@@ -832,7 +802,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
832
802
|
};
|
|
833
803
|
}
|
|
834
804
|
else {
|
|
835
|
-
return runtime_utils_1.create404Response(request);
|
|
805
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
836
806
|
}
|
|
837
807
|
}
|
|
838
808
|
else if (requestParser.pathParts.length > 0) {
|
|
@@ -840,19 +810,20 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
840
810
|
const subRequest = requestParser.createSubRequest(1);
|
|
841
811
|
// We always expect createSubRequest to include a leading slash, but asserting here to protect against
|
|
842
812
|
// unintentionally modifying the url if that changes.
|
|
843
|
-
common_utils_1.assert(subRequest.url.startsWith("/"), 0x126 /* "Expected createSubRequest url to include a leading slash" */);
|
|
813
|
+
(0, common_utils_1.assert)(subRequest.url.startsWith("/"), 0x126 /* "Expected createSubRequest url to include a leading slash" */);
|
|
844
814
|
return dataStore.IFluidRouter.request(subRequest);
|
|
845
815
|
}
|
|
846
|
-
return runtime_utils_1.create404Response(request);
|
|
816
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
847
817
|
}
|
|
848
818
|
catch (error) {
|
|
849
|
-
return runtime_utils_1.exceptionToResponse(error);
|
|
819
|
+
return (0, runtime_utils_1.exceptionToResponse)(error);
|
|
850
820
|
}
|
|
851
821
|
}
|
|
852
822
|
async getDataStoreFromRequest(id, request) {
|
|
853
823
|
var _a, _b, _c;
|
|
854
824
|
const wait = typeof ((_a = request.headers) === null || _a === void 0 ? void 0 : _a[RuntimeHeaders.wait]) === "boolean"
|
|
855
|
-
? (_b = request.headers) === null || _b === void 0 ? void 0 : _b[RuntimeHeaders.wait]
|
|
825
|
+
? (_b = request.headers) === null || _b === void 0 ? void 0 : _b[RuntimeHeaders.wait]
|
|
826
|
+
: true;
|
|
856
827
|
const dataStoreContext = await this.dataStores.getDataStore(id, wait);
|
|
857
828
|
/**
|
|
858
829
|
* If GC should run and this an external app request with "externalRequest" header, we need to return
|
|
@@ -867,45 +838,51 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
867
838
|
// Older documents may not have used routes in the summary. They are considered referenced.
|
|
868
839
|
const usedRoutes = (await dataStoreContext.getBaseGCDetails()).usedRoutes;
|
|
869
840
|
if (!(usedRoutes === undefined || usedRoutes.includes("") || usedRoutes.includes("/"))) {
|
|
870
|
-
throw runtime_utils_1.responseToException(runtime_utils_1.create404Response(request), request);
|
|
841
|
+
throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.create404Response)(request), request);
|
|
871
842
|
}
|
|
872
843
|
}
|
|
873
844
|
const dataStoreChannel = await dataStoreContext.realize();
|
|
874
845
|
this.garbageCollector.nodeUpdated(`/${id}`, "Loaded", undefined /* timestampMs */, dataStoreContext.packagePath, request === null || request === void 0 ? void 0 : request.headers);
|
|
875
846
|
return dataStoreChannel;
|
|
876
847
|
}
|
|
877
|
-
|
|
848
|
+
/** Adds the container's metadata to the given summary tree. */
|
|
849
|
+
addMetadataToSummary(summaryTree) {
|
|
878
850
|
var _a;
|
|
879
|
-
|
|
851
|
+
const metadata = Object.assign(Object.assign(Object.assign(Object.assign({}, this.createContainerMetadata), {
|
|
852
|
+
// back-compat 0.59.3000: This is renamed to summaryNumber. Can be removed when 0.59.3000 saturates.
|
|
853
|
+
summaryCount: this.nextSummaryNumber,
|
|
854
|
+
// Increment the summary number for the next summary that will be generated.
|
|
855
|
+
summaryNumber: this.nextSummaryNumber++, summaryFormatVersion: 1, disableIsolatedChannels: this.disableIsolatedChannels || undefined }), this.garbageCollector.getMetadata()), {
|
|
880
856
|
// The last message processed at the time of summary. If there are no new messages, use the message from the
|
|
881
857
|
// last summary.
|
|
882
|
-
message: (_a = summaryFormat_1.extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.messageAtLastSummary
|
|
858
|
+
message: (_a = (0, summaryFormat_1.extractSummaryMetadataMessage)(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.messageAtLastSummary });
|
|
859
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.metadataBlobName, JSON.stringify(metadata));
|
|
883
860
|
}
|
|
884
861
|
addContainerStateToSummary(summaryTree) {
|
|
885
862
|
var _a;
|
|
886
|
-
|
|
863
|
+
this.addMetadataToSummary(summaryTree);
|
|
887
864
|
if (this.chunkMap.size > 0) {
|
|
888
865
|
const content = JSON.stringify([...this.chunkMap]);
|
|
889
|
-
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.chunksBlobName, content);
|
|
866
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.chunksBlobName, content);
|
|
890
867
|
}
|
|
891
868
|
const dataStoreAliases = this.dataStores.aliases();
|
|
892
869
|
if (dataStoreAliases.size > 0) {
|
|
893
|
-
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.aliasBlobName, JSON.stringify([...dataStoreAliases]));
|
|
870
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.aliasBlobName, JSON.stringify([...dataStoreAliases]));
|
|
894
871
|
}
|
|
895
872
|
if (this.summarizerClientElection) {
|
|
896
873
|
const electedSummarizerContent = JSON.stringify((_a = this.summarizerClientElection) === null || _a === void 0 ? void 0 : _a.serialize());
|
|
897
|
-
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.electedSummarizerBlobName, electedSummarizerContent);
|
|
874
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.electedSummarizerBlobName, electedSummarizerContent);
|
|
898
875
|
}
|
|
899
|
-
const
|
|
876
|
+
const blobManagerSummary = this.blobManager.summarize();
|
|
900
877
|
// Some storage (like git) doesn't allow empty tree, so we can omit it.
|
|
901
878
|
// and the blob manager can handle the tree not existing when loading
|
|
902
|
-
if (Object.keys(
|
|
903
|
-
runtime_utils_1.addTreeToSummary(summaryTree, summaryFormat_1.blobsTreeName,
|
|
879
|
+
if (Object.keys(blobManagerSummary.summary.tree).length > 0) {
|
|
880
|
+
(0, runtime_utils_1.addTreeToSummary)(summaryTree, summaryFormat_1.blobsTreeName, blobManagerSummary);
|
|
904
881
|
}
|
|
905
882
|
if (this.garbageCollector.writeDataAtRoot) {
|
|
906
883
|
const gcSummary = this.garbageCollector.summarize();
|
|
907
884
|
if (gcSummary !== undefined) {
|
|
908
|
-
runtime_utils_1.addTreeToSummary(summaryTree, garbageCollection_1.gcTreeKey, gcSummary);
|
|
885
|
+
(0, runtime_utils_1.addTreeToSummary)(summaryTree, garbageCollection_1.gcTreeKey, gcSummary);
|
|
909
886
|
}
|
|
910
887
|
}
|
|
911
888
|
}
|
|
@@ -951,7 +928,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
951
928
|
// Save the old state, reset to false, disable event emit
|
|
952
929
|
const oldState = this.dirtyContainer;
|
|
953
930
|
this.dirtyContainer = false;
|
|
954
|
-
common_utils_1.assert(this.emitDirtyDocumentEvent, 0x127 /* "dirty document event not set on replay" */);
|
|
931
|
+
(0, common_utils_1.assert)(this.emitDirtyDocumentEvent, 0x127 /* "dirty document event not set on replay" */);
|
|
955
932
|
this.emitDirtyDocumentEvent = false;
|
|
956
933
|
let newState;
|
|
957
934
|
try {
|
|
@@ -981,7 +958,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
981
958
|
case ContainerMessageType.Rejoin:
|
|
982
959
|
throw new Error("rejoin not expected here");
|
|
983
960
|
default:
|
|
984
|
-
common_utils_1.unreachableCase(type, `Unknown ContainerMessageType: ${type}`);
|
|
961
|
+
(0, common_utils_1.unreachableCase)(type, `Unknown ContainerMessageType: ${type}`);
|
|
985
962
|
}
|
|
986
963
|
}
|
|
987
964
|
setConnectionState(connected, clientId) {
|
|
@@ -1002,7 +979,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1002
979
|
this.replayPendingStates();
|
|
1003
980
|
}
|
|
1004
981
|
this.dataStores.setConnectionState(connected, clientId);
|
|
1005
|
-
telemetry_utils_1.raiseConnectedEvent(this.mc.logger, this, connected, clientId);
|
|
982
|
+
(0, telemetry_utils_1.raiseConnectedEvent)(this.mc.logger, this, connected, clientId);
|
|
1006
983
|
}
|
|
1007
984
|
process(messageArg, local) {
|
|
1008
985
|
var _a;
|
|
@@ -1044,7 +1021,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1044
1021
|
this.dataStores.processFluidDataStoreOp(message, local || localAck, localOpMetadata);
|
|
1045
1022
|
break;
|
|
1046
1023
|
case ContainerMessageType.BlobAttach:
|
|
1047
|
-
common_utils_1.assert((_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.blobId, 0x12a /* "Missing blob id on metadata" */);
|
|
1024
|
+
(0, common_utils_1.assert)((_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.blobId, 0x12a /* "Missing blob id on metadata" */);
|
|
1048
1025
|
this.blobManager.processBlobAttachOp(message.metadata.blobId, local);
|
|
1049
1026
|
break;
|
|
1050
1027
|
default:
|
|
@@ -1082,7 +1059,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1082
1059
|
}
|
|
1083
1060
|
async getRootDataStore(id, wait = true) {
|
|
1084
1061
|
const context = await this.dataStores.getDataStore(id, wait);
|
|
1085
|
-
common_utils_1.assert(await context.isRoot(), 0x12b /* "did not get root data store" */);
|
|
1062
|
+
(0, common_utils_1.assert)(await context.isRoot(), 0x12b /* "did not get root data store" */);
|
|
1086
1063
|
return context.realize();
|
|
1087
1064
|
}
|
|
1088
1065
|
setFlushMode(mode) {
|
|
@@ -1103,7 +1080,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1103
1080
|
this.pendingStateManager.onFlushModeUpdated(mode);
|
|
1104
1081
|
}
|
|
1105
1082
|
flush() {
|
|
1106
|
-
common_utils_1.assert(this._orderSequentiallyCalls === 0, 0x24c /* "Cannot call `flush()` from `orderSequentially`'s callback" */);
|
|
1083
|
+
(0, common_utils_1.assert)(this._orderSequentiallyCalls === 0, 0x24c /* "Cannot call `flush()` from `orderSequentially`'s callback" */);
|
|
1107
1084
|
if (!this.deltaSender) {
|
|
1108
1085
|
return;
|
|
1109
1086
|
}
|
|
@@ -1155,8 +1132,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1155
1132
|
}
|
|
1156
1133
|
}
|
|
1157
1134
|
async createDataStore(pkg) {
|
|
1158
|
-
const internalId = uuid_1.v4();
|
|
1159
|
-
return dataStore_1.channelToDataStore(await this._createDataStore(pkg, false /* isRoot */, internalId), internalId, this, this.dataStores, this.mc.logger);
|
|
1135
|
+
const internalId = (0, uuid_1.v4)();
|
|
1136
|
+
return (0, dataStore_1.channelToDataStore)(await this._createDataStore(pkg, false /* isRoot */, internalId), internalId, this, this.dataStores, this.mc.logger);
|
|
1160
1137
|
}
|
|
1161
1138
|
/**
|
|
1162
1139
|
* Creates a root datastore directly with a user generated id and attaches it to storage.
|
|
@@ -1193,9 +1170,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1193
1170
|
* @returns - An aliased data store which can can be found / loaded by alias.
|
|
1194
1171
|
*/
|
|
1195
1172
|
async createAndAliasDataStore(pkg, alias, props) {
|
|
1196
|
-
const internalId = uuid_1.v4();
|
|
1173
|
+
const internalId = (0, uuid_1.v4)();
|
|
1197
1174
|
const dataStore = await this._createDataStore(pkg, false /* isRoot */, internalId, props);
|
|
1198
|
-
const aliasedDataStore = dataStore_1.channelToDataStore(dataStore, internalId, this, this.dataStores, this.mc.logger);
|
|
1175
|
+
const aliasedDataStore = (0, dataStore_1.channelToDataStore)(dataStore, internalId, this, this.dataStores, this.mc.logger);
|
|
1199
1176
|
const result = await aliasedDataStore.trySetAlias(alias);
|
|
1200
1177
|
if (result !== "Success") {
|
|
1201
1178
|
throw new container_utils_1.GenericError("dataStoreAliasFailure", undefined /* error */, {
|
|
@@ -1224,7 +1201,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1224
1201
|
*
|
|
1225
1202
|
* This method will be removed. See #6465.
|
|
1226
1203
|
*/
|
|
1227
|
-
async _createDataStoreWithPropsLegacy(pkg, props, id = uuid_1.v4(), isRoot = false) {
|
|
1204
|
+
async _createDataStoreWithPropsLegacy(pkg, props, id = (0, uuid_1.v4)(), isRoot = false) {
|
|
1228
1205
|
const fluidDataStore = await this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props).realize();
|
|
1229
1206
|
if (isRoot) {
|
|
1230
1207
|
// back-compat 0.59.1000 - makeVisibleAndAttachGraph was added in this version to IFluidDataStoreChannel.
|
|
@@ -1240,14 +1217,14 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1240
1217
|
hasProps: props !== undefined,
|
|
1241
1218
|
});
|
|
1242
1219
|
}
|
|
1243
|
-
return dataStore_1.channelToDataStore(fluidDataStore, id, this, this.dataStores, this.mc.logger);
|
|
1220
|
+
return (0, dataStore_1.channelToDataStore)(fluidDataStore, id, this, this.dataStores, this.mc.logger);
|
|
1244
1221
|
}
|
|
1245
|
-
async _createDataStoreWithProps(pkg, props, id = uuid_1.v4(), isRoot = false) {
|
|
1222
|
+
async _createDataStoreWithProps(pkg, props, id = (0, uuid_1.v4)(), isRoot = false) {
|
|
1246
1223
|
return this._aliasingEnabled === true && isRoot ?
|
|
1247
1224
|
this.createAndAliasDataStore(pkg, id, props) :
|
|
1248
1225
|
this._createDataStoreWithPropsLegacy(pkg, props, id, isRoot);
|
|
1249
1226
|
}
|
|
1250
|
-
async _createDataStore(pkg, isRoot, id = uuid_1.v4(), props) {
|
|
1227
|
+
async _createDataStore(pkg, isRoot, id = (0, uuid_1.v4)(), props) {
|
|
1251
1228
|
return this.dataStores
|
|
1252
1229
|
._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props)
|
|
1253
1230
|
.realize();
|
|
@@ -1302,10 +1279,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1302
1279
|
}
|
|
1303
1280
|
setAttachState(attachState) {
|
|
1304
1281
|
if (attachState === container_definitions_1.AttachState.Attaching) {
|
|
1305
|
-
common_utils_1.assert(this.attachState === container_definitions_1.AttachState.Attaching, 0x12d /* "Container Context should already be in attaching state" */);
|
|
1282
|
+
(0, common_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attaching, 0x12d /* "Container Context should already be in attaching state" */);
|
|
1306
1283
|
}
|
|
1307
1284
|
else {
|
|
1308
|
-
common_utils_1.assert(this.attachState === container_definitions_1.AttachState.Attached, 0x12e /* "Container Context should already be in attached state" */);
|
|
1285
|
+
(0, common_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x12e /* "Container Context should already be in attached state" */);
|
|
1309
1286
|
this.emit("attached");
|
|
1310
1287
|
}
|
|
1311
1288
|
if (attachState === container_definitions_1.AttachState.Attached && !this.pendingStateManager.hasPendingMessages()) {
|
|
@@ -1327,7 +1304,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1327
1304
|
const summarizeResult = this.dataStores.createSummary();
|
|
1328
1305
|
if (!this.disableIsolatedChannels) {
|
|
1329
1306
|
// Wrap data store summaries in .channels subtree.
|
|
1330
|
-
summaryFormat_1.wrapSummaryInChannelsTree(summarizeResult);
|
|
1307
|
+
(0, summaryFormat_1.wrapSummaryInChannelsTree)(summarizeResult);
|
|
1331
1308
|
}
|
|
1332
1309
|
this.addContainerStateToSummary(summarizeResult);
|
|
1333
1310
|
return summarizeResult.summary;
|
|
@@ -1346,7 +1323,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1346
1323
|
let pathPartsForChildren;
|
|
1347
1324
|
if (!this.disableIsolatedChannels) {
|
|
1348
1325
|
// Wrap data store summaries in .channels subtree.
|
|
1349
|
-
summaryFormat_1.wrapSummaryInChannelsTree(summarizeResult);
|
|
1326
|
+
(0, summaryFormat_1.wrapSummaryInChannelsTree)(summarizeResult);
|
|
1350
1327
|
pathPartsForChildren = [runtime_definitions_1.channelsTreeName];
|
|
1351
1328
|
}
|
|
1352
1329
|
this.addContainerStateToSummary(summarizeResult);
|
|
@@ -1363,7 +1340,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1363
1340
|
gcStats = await this.collectGarbage({ logger: summaryLogger, runSweep, fullGC });
|
|
1364
1341
|
}
|
|
1365
1342
|
const { stats, summary } = await this.summarizerNode.summarize(fullTree, trackState);
|
|
1366
|
-
common_utils_1.assert(summary.type === protocol_definitions_1.SummaryType.Tree, 0x12f /* "Container Runtime's summarize should always return a tree" */);
|
|
1343
|
+
(0, common_utils_1.assert)(summary.type === protocol_definitions_1.SummaryType.Tree, 0x12f /* "Container Runtime's summarize should always return a tree" */);
|
|
1367
1344
|
return { stats, summary, gcStats };
|
|
1368
1345
|
}
|
|
1369
1346
|
/**
|
|
@@ -1437,31 +1414,30 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1437
1414
|
return (_b = (_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.timestamp) !== null && _b !== void 0 ? _b : (_c = this.messageAtLastSummary) === null || _c === void 0 ? void 0 : _c.timestamp;
|
|
1438
1415
|
}
|
|
1439
1416
|
/**
|
|
1440
|
-
* Returns the type of the GC node. Currently, there are nodes that belong to
|
|
1441
|
-
*
|
|
1417
|
+
* Returns the type of the GC node. Currently, there are nodes that belong to the root ("/"), data stores or
|
|
1418
|
+
* blob manager.
|
|
1442
1419
|
*/
|
|
1443
1420
|
getNodeType(nodePath) {
|
|
1421
|
+
var _a;
|
|
1444
1422
|
if (this.isBlobPath(nodePath)) {
|
|
1445
1423
|
return garbageCollection_1.GCNodeType.Blob;
|
|
1446
1424
|
}
|
|
1447
|
-
|
|
1448
|
-
return garbageCollection_1.GCNodeType.DataStore;
|
|
1449
|
-
}
|
|
1450
|
-
// Root node ("/") and DDS nodes belong to "Other" node types.
|
|
1451
|
-
return garbageCollection_1.GCNodeType.Other;
|
|
1425
|
+
return (_a = this.dataStores.getGCNodeType(nodePath)) !== null && _a !== void 0 ? _a : garbageCollection_1.GCNodeType.Other;
|
|
1452
1426
|
}
|
|
1453
1427
|
/**
|
|
1454
1428
|
* Called by GC to retrieve the package path of the node with the given path. The node should belong to a
|
|
1455
1429
|
* data store or an attachment blob.
|
|
1456
1430
|
*/
|
|
1457
1431
|
getGCNodePackagePath(nodePath) {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1432
|
+
switch (this.getNodeType(nodePath)) {
|
|
1433
|
+
case garbageCollection_1.GCNodeType.Blob:
|
|
1434
|
+
return ["_blobs"];
|
|
1435
|
+
case garbageCollection_1.GCNodeType.DataStore:
|
|
1436
|
+
case garbageCollection_1.GCNodeType.SubDataStore:
|
|
1437
|
+
return this.dataStores.getDataStorePackagePath(nodePath);
|
|
1438
|
+
default:
|
|
1439
|
+
(0, common_utils_1.assert)(false, 0x2de /* "Package path requested for unsupported node type." */);
|
|
1461
1440
|
}
|
|
1462
|
-
const dataStorePkgPath = this.dataStores.getDataStorePackagePath(nodePath);
|
|
1463
|
-
common_utils_1.assert(dataStorePkgPath !== undefined, 0x2d6 /* "Package path requested for unknown node type." */);
|
|
1464
|
-
return dataStorePkgPath;
|
|
1465
1441
|
}
|
|
1466
1442
|
/**
|
|
1467
1443
|
* Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
|
|
@@ -1500,11 +1476,17 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1500
1476
|
async submitSummary(options) {
|
|
1501
1477
|
var _a, _b, _c;
|
|
1502
1478
|
const { fullTree, refreshLatestAck, summaryLogger } = options;
|
|
1479
|
+
// The summary number for this summary. This will be updated during the summary process, so get it now and
|
|
1480
|
+
// use it for all events logged during this summary.
|
|
1481
|
+
const summaryNumber = this.nextSummaryNumber;
|
|
1482
|
+
const summaryNumberLogger = telemetry_utils_1.ChildLogger.create(summaryLogger, undefined, {
|
|
1483
|
+
all: { summaryNumber },
|
|
1484
|
+
});
|
|
1503
1485
|
if (refreshLatestAck) {
|
|
1504
|
-
const latestSummaryRefSeq = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.ChildLogger.create(
|
|
1486
|
+
const latestSummaryRefSeq = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.ChildLogger.create(summaryNumberLogger, undefined, { all: { safeSummary: true } }));
|
|
1505
1487
|
if (latestSummaryRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
1506
1488
|
// We need to catch up to the latest summary's reference sequence number before pausing.
|
|
1507
|
-
await telemetry_utils_1.PerformanceEvent.timedExecAsync(
|
|
1489
|
+
await telemetry_utils_1.PerformanceEvent.timedExecAsync(summaryNumberLogger, {
|
|
1508
1490
|
eventName: "WaitingForSeq",
|
|
1509
1491
|
lastSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
1510
1492
|
targetSequenceNumber: latestSummaryRefSeq,
|
|
@@ -1520,12 +1502,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1520
1502
|
// We should be here is we haven't processed be here. If we are of if the last message's sequence number
|
|
1521
1503
|
// doesn't match the last processed sequence number, log an error.
|
|
1522
1504
|
if (summaryRefSeqNum !== ((_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.sequenceNumber)) {
|
|
1523
|
-
|
|
1505
|
+
summaryNumberLogger.sendErrorEvent({
|
|
1524
1506
|
eventName: "LastSequenceMismatch",
|
|
1525
1507
|
error: message,
|
|
1526
1508
|
});
|
|
1527
1509
|
}
|
|
1528
|
-
this.summarizerNode.startSummary(summaryRefSeqNum,
|
|
1510
|
+
this.summarizerNode.startSummary(summaryRefSeqNum, summaryNumberLogger);
|
|
1529
1511
|
// Helper function to check whether we should still continue between each async step.
|
|
1530
1512
|
const checkContinue = () => {
|
|
1531
1513
|
// Do not check for loss of connectivity directly! Instead leave it up to
|
|
@@ -1540,7 +1522,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1540
1522
|
// That said, we rely on submitSystemMessage() that today only works in connected state.
|
|
1541
1523
|
// So if we fail here, it either means that RunWhileConnectedCoordinator does not work correctly,
|
|
1542
1524
|
// OR that design changed and we need to remove this check and fix submitSystemMessage.
|
|
1543
|
-
common_utils_1.assert(this.connected, 0x258 /* "connected" */);
|
|
1525
|
+
(0, common_utils_1.assert)(this.connected, 0x258 /* "connected" */);
|
|
1544
1526
|
// Ensure that lastSequenceNumber has not changed after pausing.
|
|
1545
1527
|
// We need the summary op's reference sequence number to match our summary sequence number,
|
|
1546
1528
|
// otherwise we'll get the wrong sequence number stamped on the summary's .protocol attributes.
|
|
@@ -1562,13 +1544,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1562
1544
|
error: continueResult.error,
|
|
1563
1545
|
};
|
|
1564
1546
|
}
|
|
1565
|
-
// increment summary count
|
|
1566
|
-
if (this.summaryCount !== undefined) {
|
|
1567
|
-
this.summaryCount++;
|
|
1568
|
-
}
|
|
1569
|
-
else {
|
|
1570
|
-
this.summaryCount = 1;
|
|
1571
|
-
}
|
|
1572
1547
|
const trace = common_utils_1.Trace.start();
|
|
1573
1548
|
let summarizeResult;
|
|
1574
1549
|
// If the GC state needs to be reset, we need to force a full tree summary and update the unreferenced
|
|
@@ -1578,7 +1553,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1578
1553
|
summarizeResult = await this.summarize({
|
|
1579
1554
|
fullTree: fullTree || forcedFullTree,
|
|
1580
1555
|
trackState: true,
|
|
1581
|
-
summaryLogger,
|
|
1556
|
+
summaryLogger: summaryNumberLogger,
|
|
1582
1557
|
runGC: this.garbageCollector.shouldRunGC,
|
|
1583
1558
|
});
|
|
1584
1559
|
}
|
|
@@ -1597,12 +1572,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1597
1572
|
// Because handles are unchanged dataStores in the current logic,
|
|
1598
1573
|
// summarized dataStore count is total dataStore count minus handle count
|
|
1599
1574
|
const dataStoreTree = this.disableIsolatedChannels ? summaryTree : summaryTree.tree[runtime_definitions_1.channelsTreeName];
|
|
1600
|
-
common_utils_1.assert(dataStoreTree.type === protocol_definitions_1.SummaryType.Tree, 0x1fc /* "summary is not a tree" */);
|
|
1575
|
+
(0, common_utils_1.assert)(dataStoreTree.type === protocol_definitions_1.SummaryType.Tree, 0x1fc /* "summary is not a tree" */);
|
|
1601
1576
|
const handleCount = Object.values(dataStoreTree.tree).filter((value) => value.type === protocol_definitions_1.SummaryType.Handle).length;
|
|
1602
1577
|
const gcSummaryTreeStats = summaryTree.tree[garbageCollection_1.gcTreeKey]
|
|
1603
|
-
? runtime_utils_1.calculateStats(summaryTree.tree[garbageCollection_1.gcTreeKey])
|
|
1578
|
+
? (0, runtime_utils_1.calculateStats)(summaryTree.tree[garbageCollection_1.gcTreeKey])
|
|
1604
1579
|
: undefined;
|
|
1605
|
-
const summaryStats = Object.assign({ dataStoreCount: this.dataStores.size, summarizedDataStoreCount: this.dataStores.size - handleCount, gcStateUpdatedDataStoreCount: (_b = summarizeResult.gcStats) === null || _b === void 0 ? void 0 : _b.updatedDataStoreCount, gcBlobNodeCount: gcSummaryTreeStats === null || gcSummaryTreeStats === void 0 ? void 0 : gcSummaryTreeStats.blobNodeCount, gcTotalBlobsSize: gcSummaryTreeStats === null || gcSummaryTreeStats === void 0 ? void 0 : gcSummaryTreeStats.totalBlobSize, opsSizesSinceLastSummary: this.opTracker.opsSizeAccumulator, nonSystemOpsSinceLastSummary: this.opTracker.nonSystemOpCount }, partialStats);
|
|
1580
|
+
const summaryStats = Object.assign({ dataStoreCount: this.dataStores.size, summarizedDataStoreCount: this.dataStores.size - handleCount, gcStateUpdatedDataStoreCount: (_b = summarizeResult.gcStats) === null || _b === void 0 ? void 0 : _b.updatedDataStoreCount, gcBlobNodeCount: gcSummaryTreeStats === null || gcSummaryTreeStats === void 0 ? void 0 : gcSummaryTreeStats.blobNodeCount, gcTotalBlobsSize: gcSummaryTreeStats === null || gcSummaryTreeStats === void 0 ? void 0 : gcSummaryTreeStats.totalBlobSize, opsSizesSinceLastSummary: this.opTracker.opsSizeAccumulator, nonSystemOpsSinceLastSummary: this.opTracker.nonSystemOpCount, summaryNumber }, partialStats);
|
|
1606
1581
|
const generateSummaryData = {
|
|
1607
1582
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1608
1583
|
minimumSequenceNumber,
|
|
@@ -1690,7 +1665,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1690
1665
|
map = [];
|
|
1691
1666
|
this.chunkMap.set(clientId, map);
|
|
1692
1667
|
}
|
|
1693
|
-
common_utils_1.assert(chunkedContent.chunkId === map.length + 1, 0x131 /* "Mismatch between new chunkId and expected chunkMap" */); // 1-based indexing
|
|
1668
|
+
(0, common_utils_1.assert)(chunkedContent.chunkId === map.length + 1, 0x131 /* "Mismatch between new chunkId and expected chunkMap" */); // 1-based indexing
|
|
1694
1669
|
map.push(chunkedContent.contents);
|
|
1695
1670
|
}
|
|
1696
1671
|
clearPartialChunks(clientId) {
|
|
@@ -1717,7 +1692,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1717
1692
|
}
|
|
1718
1693
|
submitDataStoreAliasOp(contents, localOpMetadata) {
|
|
1719
1694
|
const aliasMessage = contents;
|
|
1720
|
-
if (!dataStore_1.isDataStoreAliasMessage(aliasMessage)) {
|
|
1695
|
+
if (!(0, dataStore_1.isDataStoreAliasMessage)(aliasMessage)) {
|
|
1721
1696
|
throw new container_utils_1.UsageError("malformedDataStoreAliasMessage");
|
|
1722
1697
|
}
|
|
1723
1698
|
this.submit(ContainerMessageType.Alias, contents, localOpMetadata);
|
|
@@ -1732,7 +1707,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1732
1707
|
this.closeFn(new container_utils_1.GenericError("containerRuntimeSubmitWithPendingLocalState"));
|
|
1733
1708
|
}
|
|
1734
1709
|
// There should be no ops in detached container state!
|
|
1735
|
-
common_utils_1.assert(this.attachState !== container_definitions_1.AttachState.Detached, 0x132 /* "sending ops in detached container" */);
|
|
1710
|
+
(0, common_utils_1.assert)(this.attachState !== container_definitions_1.AttachState.Detached, 0x132 /* "sending ops in detached container" */);
|
|
1736
1711
|
let clientSequenceNumber = -1;
|
|
1737
1712
|
let opMetadataInternal = opMetadata;
|
|
1738
1713
|
if (this.canSendOps()) {
|
|
@@ -1807,7 +1782,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1807
1782
|
}
|
|
1808
1783
|
submitSystemMessage(type, contents) {
|
|
1809
1784
|
this.verifyNotClosed();
|
|
1810
|
-
common_utils_1.assert(this.connected, 0x133 /* "Container disconnected when trying to submit system message" */);
|
|
1785
|
+
(0, common_utils_1.assert)(this.connected, 0x133 /* "Container disconnected when trying to submit system message" */);
|
|
1811
1786
|
// System message should not be sent in the middle of the batch.
|
|
1812
1787
|
// That said, we can preserve existing behavior by not flushing existing buffer.
|
|
1813
1788
|
// That might be not what caller hopes to get, but we can look deeper if telemetry tells us it's a problem.
|
|
@@ -1819,7 +1794,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1819
1794
|
}
|
|
1820
1795
|
submitRuntimeMessage(type, contents, batch, appData) {
|
|
1821
1796
|
this.verifyNotClosed();
|
|
1822
|
-
common_utils_1.assert(this.connected, 0x259 /* "Container disconnected when trying to submit system message" */);
|
|
1797
|
+
(0, common_utils_1.assert)(this.connected, 0x259 /* "Container disconnected when trying to submit system message" */);
|
|
1823
1798
|
const payload = { type, contents };
|
|
1824
1799
|
return this.context.submitFn(protocol_definitions_1.MessageType.Operation, payload, batch, appData);
|
|
1825
1800
|
}
|
|
@@ -1858,12 +1833,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1858
1833
|
this.submit(type, content);
|
|
1859
1834
|
break;
|
|
1860
1835
|
default:
|
|
1861
|
-
common_utils_1.unreachableCase(type, `Unknown ContainerMessageType: ${type}`);
|
|
1836
|
+
(0, common_utils_1.unreachableCase)(type, `Unknown ContainerMessageType: ${type}`);
|
|
1862
1837
|
}
|
|
1863
1838
|
}
|
|
1864
1839
|
/** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
|
|
1865
1840
|
async refreshLatestSummaryAck(proposalHandle, ackHandle, summaryRefSeq, summaryLogger) {
|
|
1866
|
-
const readAndParseBlob = async (id) => driver_utils_1.readAndParse(this.storage, id);
|
|
1841
|
+
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
1867
1842
|
const result = await this.summarizerNode.refreshLatestSummary(proposalHandle, summaryRefSeq, async () => this.fetchSnapshotFromStorage(ackHandle, summaryLogger, {
|
|
1868
1843
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1869
1844
|
ackHandle,
|
|
@@ -1884,8 +1859,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1884
1859
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1885
1860
|
fetchLatest: true,
|
|
1886
1861
|
});
|
|
1887
|
-
const readAndParseBlob = async (id) => driver_utils_1.readAndParse(this.storage, id);
|
|
1888
|
-
const snapshotRefSeq = await runtime_utils_1.seqFromTree(snapshot, readAndParseBlob);
|
|
1862
|
+
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
1863
|
+
const snapshotRefSeq = await (0, runtime_utils_1.seqFromTree)(snapshot, readAndParseBlob);
|
|
1889
1864
|
const result = await this.summarizerNode.refreshLatestSummary(undefined, snapshotRefSeq, async () => snapshot, readAndParseBlob, summaryLogger);
|
|
1890
1865
|
// Notify the garbage collector so it can update its latest summary state.
|
|
1891
1866
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
@@ -1896,10 +1871,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1896
1871
|
const stats = {};
|
|
1897
1872
|
const trace = common_utils_1.Trace.start();
|
|
1898
1873
|
const versions = await this.storage.getVersions(versionId, 1);
|
|
1899
|
-
common_utils_1.assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
1874
|
+
(0, common_utils_1.assert)(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
1900
1875
|
stats.getVersionDuration = trace.trace().duration;
|
|
1901
1876
|
const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
|
|
1902
|
-
common_utils_1.assert(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
1877
|
+
(0, common_utils_1.assert)(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
1903
1878
|
stats.getSnapshotDuration = trace.trace().duration;
|
|
1904
1879
|
perfEvent.end(stats);
|
|
1905
1880
|
return maybeSnapshot;
|
|
@@ -1926,7 +1901,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1926
1901
|
},
|
|
1927
1902
|
url: "/_summarizer",
|
|
1928
1903
|
};
|
|
1929
|
-
const fluidObject = await runtime_utils_1.requestFluidObject(loaderRouter, request);
|
|
1904
|
+
const fluidObject = await (0, runtime_utils_1.requestFluidObject)(loaderRouter, request);
|
|
1930
1905
|
const summarizer = fluidObject.ISummarizer;
|
|
1931
1906
|
if (!summarizer) {
|
|
1932
1907
|
throw new container_utils_1.UsageError("Fluid object does not implement ISummarizer");
|