@fluidframework/container-runtime 0.59.2001 → 0.59.3000
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.d.ts +8 -1
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +27 -17
- 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 +152 -176
- 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 +6 -4
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +50 -37
- 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.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.d.ts +8 -1
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +19 -9
- 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 +71 -95
- 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 +6 -4
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +27 -14
- 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.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 +23 -11
- package/src/containerRuntime.ts +111 -139
- package/src/dataStoreContext.ts +8 -11
- package/src/dataStoreContexts.ts +5 -5
- package/src/dataStores.ts +35 -17
- 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,8 +480,8 @@ 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);
|
|
499
|
-
this.blobManager = new blobManager_1.BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), this, this.logger);
|
|
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);
|
|
484
|
+
this.blobManager = new blobManager_1.BlobManager(this.handleContext, blobManagerSnapshot, () => this.storage, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), (blobPath) => this.garbageCollector.nodeUpdated(blobPath, "Loaded"), 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;
|
|
502
487
|
this.pendingStateManager = new pendingStateManager_1.PendingStateManager(this, async (type, content) => this.applyStashedOp(type, content), this._flushMode, context.pendingLocalState);
|
|
@@ -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() {
|
|
@@ -776,7 +746,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
776
746
|
this.removeAllListeners();
|
|
777
747
|
}
|
|
778
748
|
get IFluidTokenProvider() {
|
|
779
|
-
|
|
749
|
+
var _a;
|
|
750
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.intelligence) {
|
|
780
751
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
781
752
|
return {
|
|
782
753
|
intelligence: this.options.intelligence,
|
|
@@ -800,15 +771,15 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
800
771
|
value: this.summarizer,
|
|
801
772
|
};
|
|
802
773
|
}
|
|
803
|
-
return runtime_utils_1.create404Response(request);
|
|
774
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
804
775
|
}
|
|
805
776
|
if (this.requestHandler !== undefined) {
|
|
806
777
|
return this.requestHandler(parser, this);
|
|
807
778
|
}
|
|
808
|
-
return runtime_utils_1.create404Response(request);
|
|
779
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
809
780
|
}
|
|
810
781
|
catch (error) {
|
|
811
|
-
return runtime_utils_1.exceptionToResponse(error);
|
|
782
|
+
return (0, runtime_utils_1.exceptionToResponse)(error);
|
|
812
783
|
}
|
|
813
784
|
}
|
|
814
785
|
/**
|
|
@@ -832,7 +803,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
832
803
|
};
|
|
833
804
|
}
|
|
834
805
|
else {
|
|
835
|
-
return runtime_utils_1.create404Response(request);
|
|
806
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
836
807
|
}
|
|
837
808
|
}
|
|
838
809
|
else if (requestParser.pathParts.length > 0) {
|
|
@@ -840,19 +811,20 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
840
811
|
const subRequest = requestParser.createSubRequest(1);
|
|
841
812
|
// We always expect createSubRequest to include a leading slash, but asserting here to protect against
|
|
842
813
|
// unintentionally modifying the url if that changes.
|
|
843
|
-
common_utils_1.assert(subRequest.url.startsWith("/"), 0x126 /* "Expected createSubRequest url to include a leading slash" */);
|
|
814
|
+
(0, common_utils_1.assert)(subRequest.url.startsWith("/"), 0x126 /* "Expected createSubRequest url to include a leading slash" */);
|
|
844
815
|
return dataStore.IFluidRouter.request(subRequest);
|
|
845
816
|
}
|
|
846
|
-
return runtime_utils_1.create404Response(request);
|
|
817
|
+
return (0, runtime_utils_1.create404Response)(request);
|
|
847
818
|
}
|
|
848
819
|
catch (error) {
|
|
849
|
-
return runtime_utils_1.exceptionToResponse(error);
|
|
820
|
+
return (0, runtime_utils_1.exceptionToResponse)(error);
|
|
850
821
|
}
|
|
851
822
|
}
|
|
852
823
|
async getDataStoreFromRequest(id, request) {
|
|
853
824
|
var _a, _b, _c;
|
|
854
825
|
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]
|
|
826
|
+
? (_b = request.headers) === null || _b === void 0 ? void 0 : _b[RuntimeHeaders.wait]
|
|
827
|
+
: true;
|
|
856
828
|
const dataStoreContext = await this.dataStores.getDataStore(id, wait);
|
|
857
829
|
/**
|
|
858
830
|
* If GC should run and this an external app request with "externalRequest" header, we need to return
|
|
@@ -867,45 +839,51 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
867
839
|
// Older documents may not have used routes in the summary. They are considered referenced.
|
|
868
840
|
const usedRoutes = (await dataStoreContext.getBaseGCDetails()).usedRoutes;
|
|
869
841
|
if (!(usedRoutes === undefined || usedRoutes.includes("") || usedRoutes.includes("/"))) {
|
|
870
|
-
throw runtime_utils_1.responseToException(runtime_utils_1.create404Response(request), request);
|
|
842
|
+
throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.create404Response)(request), request);
|
|
871
843
|
}
|
|
872
844
|
}
|
|
873
845
|
const dataStoreChannel = await dataStoreContext.realize();
|
|
874
846
|
this.garbageCollector.nodeUpdated(`/${id}`, "Loaded", undefined /* timestampMs */, dataStoreContext.packagePath, request === null || request === void 0 ? void 0 : request.headers);
|
|
875
847
|
return dataStoreChannel;
|
|
876
848
|
}
|
|
877
|
-
|
|
849
|
+
/** Adds the container's metadata to the given summary tree. */
|
|
850
|
+
addMetadataToSummary(summaryTree) {
|
|
878
851
|
var _a;
|
|
879
|
-
|
|
852
|
+
const metadata = Object.assign(Object.assign(Object.assign(Object.assign({}, this.createContainerMetadata), {
|
|
853
|
+
// back-compat 0.59.3000: This is renamed to summaryNumber. Can be removed when 0.59.3000 saturates.
|
|
854
|
+
summaryCount: this.nextSummaryNumber,
|
|
855
|
+
// Increment the summary number for the next summary that will be generated.
|
|
856
|
+
summaryNumber: this.nextSummaryNumber++, summaryFormatVersion: 1, disableIsolatedChannels: this.disableIsolatedChannels || undefined }), this.garbageCollector.getMetadata()), {
|
|
880
857
|
// The last message processed at the time of summary. If there are no new messages, use the message from the
|
|
881
858
|
// last summary.
|
|
882
|
-
message: (_a = summaryFormat_1.extractSummaryMetadataMessage(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.messageAtLastSummary
|
|
859
|
+
message: (_a = (0, summaryFormat_1.extractSummaryMetadataMessage)(this.deltaManager.lastMessage)) !== null && _a !== void 0 ? _a : this.messageAtLastSummary });
|
|
860
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.metadataBlobName, JSON.stringify(metadata));
|
|
883
861
|
}
|
|
884
862
|
addContainerStateToSummary(summaryTree) {
|
|
885
863
|
var _a;
|
|
886
|
-
|
|
864
|
+
this.addMetadataToSummary(summaryTree);
|
|
887
865
|
if (this.chunkMap.size > 0) {
|
|
888
866
|
const content = JSON.stringify([...this.chunkMap]);
|
|
889
|
-
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.chunksBlobName, content);
|
|
867
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.chunksBlobName, content);
|
|
890
868
|
}
|
|
891
869
|
const dataStoreAliases = this.dataStores.aliases();
|
|
892
870
|
if (dataStoreAliases.size > 0) {
|
|
893
|
-
runtime_utils_1.addBlobToSummary(summaryTree, summaryFormat_1.aliasBlobName, JSON.stringify([...dataStoreAliases]));
|
|
871
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.aliasBlobName, JSON.stringify([...dataStoreAliases]));
|
|
894
872
|
}
|
|
895
873
|
if (this.summarizerClientElection) {
|
|
896
874
|
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);
|
|
875
|
+
(0, runtime_utils_1.addBlobToSummary)(summaryTree, summaryFormat_1.electedSummarizerBlobName, electedSummarizerContent);
|
|
898
876
|
}
|
|
899
|
-
const
|
|
877
|
+
const blobManagerSummary = this.blobManager.summarize();
|
|
900
878
|
// Some storage (like git) doesn't allow empty tree, so we can omit it.
|
|
901
879
|
// 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,
|
|
880
|
+
if (Object.keys(blobManagerSummary.summary.tree).length > 0) {
|
|
881
|
+
(0, runtime_utils_1.addTreeToSummary)(summaryTree, summaryFormat_1.blobsTreeName, blobManagerSummary);
|
|
904
882
|
}
|
|
905
883
|
if (this.garbageCollector.writeDataAtRoot) {
|
|
906
884
|
const gcSummary = this.garbageCollector.summarize();
|
|
907
885
|
if (gcSummary !== undefined) {
|
|
908
|
-
runtime_utils_1.addTreeToSummary(summaryTree, garbageCollection_1.gcTreeKey, gcSummary);
|
|
886
|
+
(0, runtime_utils_1.addTreeToSummary)(summaryTree, garbageCollection_1.gcTreeKey, gcSummary);
|
|
909
887
|
}
|
|
910
888
|
}
|
|
911
889
|
}
|
|
@@ -951,7 +929,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
951
929
|
// Save the old state, reset to false, disable event emit
|
|
952
930
|
const oldState = this.dirtyContainer;
|
|
953
931
|
this.dirtyContainer = false;
|
|
954
|
-
common_utils_1.assert(this.emitDirtyDocumentEvent, 0x127 /* "dirty document event not set on replay" */);
|
|
932
|
+
(0, common_utils_1.assert)(this.emitDirtyDocumentEvent, 0x127 /* "dirty document event not set on replay" */);
|
|
955
933
|
this.emitDirtyDocumentEvent = false;
|
|
956
934
|
let newState;
|
|
957
935
|
try {
|
|
@@ -981,7 +959,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
981
959
|
case ContainerMessageType.Rejoin:
|
|
982
960
|
throw new Error("rejoin not expected here");
|
|
983
961
|
default:
|
|
984
|
-
common_utils_1.unreachableCase(type, `Unknown ContainerMessageType: ${type}`);
|
|
962
|
+
(0, common_utils_1.unreachableCase)(type, `Unknown ContainerMessageType: ${type}`);
|
|
985
963
|
}
|
|
986
964
|
}
|
|
987
965
|
setConnectionState(connected, clientId) {
|
|
@@ -1002,7 +980,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1002
980
|
this.replayPendingStates();
|
|
1003
981
|
}
|
|
1004
982
|
this.dataStores.setConnectionState(connected, clientId);
|
|
1005
|
-
telemetry_utils_1.raiseConnectedEvent(this.mc.logger, this, connected, clientId);
|
|
983
|
+
(0, telemetry_utils_1.raiseConnectedEvent)(this.mc.logger, this, connected, clientId);
|
|
1006
984
|
}
|
|
1007
985
|
process(messageArg, local) {
|
|
1008
986
|
var _a;
|
|
@@ -1044,7 +1022,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1044
1022
|
this.dataStores.processFluidDataStoreOp(message, local || localAck, localOpMetadata);
|
|
1045
1023
|
break;
|
|
1046
1024
|
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" */);
|
|
1025
|
+
(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
1026
|
this.blobManager.processBlobAttachOp(message.metadata.blobId, local);
|
|
1049
1027
|
break;
|
|
1050
1028
|
default:
|
|
@@ -1082,7 +1060,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1082
1060
|
}
|
|
1083
1061
|
async getRootDataStore(id, wait = true) {
|
|
1084
1062
|
const context = await this.dataStores.getDataStore(id, wait);
|
|
1085
|
-
common_utils_1.assert(await context.isRoot(), 0x12b /* "did not get root data store" */);
|
|
1063
|
+
(0, common_utils_1.assert)(await context.isRoot(), 0x12b /* "did not get root data store" */);
|
|
1086
1064
|
return context.realize();
|
|
1087
1065
|
}
|
|
1088
1066
|
setFlushMode(mode) {
|
|
@@ -1103,7 +1081,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1103
1081
|
this.pendingStateManager.onFlushModeUpdated(mode);
|
|
1104
1082
|
}
|
|
1105
1083
|
flush() {
|
|
1106
|
-
common_utils_1.assert(this._orderSequentiallyCalls === 0, 0x24c /* "Cannot call `flush()` from `orderSequentially`'s callback" */);
|
|
1084
|
+
(0, common_utils_1.assert)(this._orderSequentiallyCalls === 0, 0x24c /* "Cannot call `flush()` from `orderSequentially`'s callback" */);
|
|
1107
1085
|
if (!this.deltaSender) {
|
|
1108
1086
|
return;
|
|
1109
1087
|
}
|
|
@@ -1155,8 +1133,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1155
1133
|
}
|
|
1156
1134
|
}
|
|
1157
1135
|
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);
|
|
1136
|
+
const internalId = (0, uuid_1.v4)();
|
|
1137
|
+
return (0, dataStore_1.channelToDataStore)(await this._createDataStore(pkg, false /* isRoot */, internalId), internalId, this, this.dataStores, this.mc.logger);
|
|
1160
1138
|
}
|
|
1161
1139
|
/**
|
|
1162
1140
|
* Creates a root datastore directly with a user generated id and attaches it to storage.
|
|
@@ -1193,9 +1171,9 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1193
1171
|
* @returns - An aliased data store which can can be found / loaded by alias.
|
|
1194
1172
|
*/
|
|
1195
1173
|
async createAndAliasDataStore(pkg, alias, props) {
|
|
1196
|
-
const internalId = uuid_1.v4();
|
|
1174
|
+
const internalId = (0, uuid_1.v4)();
|
|
1197
1175
|
const dataStore = await this._createDataStore(pkg, false /* isRoot */, internalId, props);
|
|
1198
|
-
const aliasedDataStore = dataStore_1.channelToDataStore(dataStore, internalId, this, this.dataStores, this.mc.logger);
|
|
1176
|
+
const aliasedDataStore = (0, dataStore_1.channelToDataStore)(dataStore, internalId, this, this.dataStores, this.mc.logger);
|
|
1199
1177
|
const result = await aliasedDataStore.trySetAlias(alias);
|
|
1200
1178
|
if (result !== "Success") {
|
|
1201
1179
|
throw new container_utils_1.GenericError("dataStoreAliasFailure", undefined /* error */, {
|
|
@@ -1224,7 +1202,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1224
1202
|
*
|
|
1225
1203
|
* This method will be removed. See #6465.
|
|
1226
1204
|
*/
|
|
1227
|
-
async _createDataStoreWithPropsLegacy(pkg, props, id = uuid_1.v4(), isRoot = false) {
|
|
1205
|
+
async _createDataStoreWithPropsLegacy(pkg, props, id = (0, uuid_1.v4)(), isRoot = false) {
|
|
1228
1206
|
const fluidDataStore = await this.dataStores._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props).realize();
|
|
1229
1207
|
if (isRoot) {
|
|
1230
1208
|
// back-compat 0.59.1000 - makeVisibleAndAttachGraph was added in this version to IFluidDataStoreChannel.
|
|
@@ -1240,14 +1218,14 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1240
1218
|
hasProps: props !== undefined,
|
|
1241
1219
|
});
|
|
1242
1220
|
}
|
|
1243
|
-
return dataStore_1.channelToDataStore(fluidDataStore, id, this, this.dataStores, this.mc.logger);
|
|
1221
|
+
return (0, dataStore_1.channelToDataStore)(fluidDataStore, id, this, this.dataStores, this.mc.logger);
|
|
1244
1222
|
}
|
|
1245
|
-
async _createDataStoreWithProps(pkg, props, id = uuid_1.v4(), isRoot = false) {
|
|
1223
|
+
async _createDataStoreWithProps(pkg, props, id = (0, uuid_1.v4)(), isRoot = false) {
|
|
1246
1224
|
return this._aliasingEnabled === true && isRoot ?
|
|
1247
1225
|
this.createAndAliasDataStore(pkg, id, props) :
|
|
1248
1226
|
this._createDataStoreWithPropsLegacy(pkg, props, id, isRoot);
|
|
1249
1227
|
}
|
|
1250
|
-
async _createDataStore(pkg, isRoot, id = uuid_1.v4(), props) {
|
|
1228
|
+
async _createDataStore(pkg, isRoot, id = (0, uuid_1.v4)(), props) {
|
|
1251
1229
|
return this.dataStores
|
|
1252
1230
|
._createFluidDataStoreContext(Array.isArray(pkg) ? pkg : [pkg], id, isRoot, props)
|
|
1253
1231
|
.realize();
|
|
@@ -1302,10 +1280,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1302
1280
|
}
|
|
1303
1281
|
setAttachState(attachState) {
|
|
1304
1282
|
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" */);
|
|
1283
|
+
(0, common_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attaching, 0x12d /* "Container Context should already be in attaching state" */);
|
|
1306
1284
|
}
|
|
1307
1285
|
else {
|
|
1308
|
-
common_utils_1.assert(this.attachState === container_definitions_1.AttachState.Attached, 0x12e /* "Container Context should already be in attached state" */);
|
|
1286
|
+
(0, common_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x12e /* "Container Context should already be in attached state" */);
|
|
1309
1287
|
this.emit("attached");
|
|
1310
1288
|
}
|
|
1311
1289
|
if (attachState === container_definitions_1.AttachState.Attached && !this.pendingStateManager.hasPendingMessages()) {
|
|
@@ -1327,7 +1305,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1327
1305
|
const summarizeResult = this.dataStores.createSummary();
|
|
1328
1306
|
if (!this.disableIsolatedChannels) {
|
|
1329
1307
|
// Wrap data store summaries in .channels subtree.
|
|
1330
|
-
summaryFormat_1.wrapSummaryInChannelsTree(summarizeResult);
|
|
1308
|
+
(0, summaryFormat_1.wrapSummaryInChannelsTree)(summarizeResult);
|
|
1331
1309
|
}
|
|
1332
1310
|
this.addContainerStateToSummary(summarizeResult);
|
|
1333
1311
|
return summarizeResult.summary;
|
|
@@ -1346,7 +1324,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1346
1324
|
let pathPartsForChildren;
|
|
1347
1325
|
if (!this.disableIsolatedChannels) {
|
|
1348
1326
|
// Wrap data store summaries in .channels subtree.
|
|
1349
|
-
summaryFormat_1.wrapSummaryInChannelsTree(summarizeResult);
|
|
1327
|
+
(0, summaryFormat_1.wrapSummaryInChannelsTree)(summarizeResult);
|
|
1350
1328
|
pathPartsForChildren = [runtime_definitions_1.channelsTreeName];
|
|
1351
1329
|
}
|
|
1352
1330
|
this.addContainerStateToSummary(summarizeResult);
|
|
@@ -1363,7 +1341,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1363
1341
|
gcStats = await this.collectGarbage({ logger: summaryLogger, runSweep, fullGC });
|
|
1364
1342
|
}
|
|
1365
1343
|
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" */);
|
|
1344
|
+
(0, common_utils_1.assert)(summary.type === protocol_definitions_1.SummaryType.Tree, 0x12f /* "Container Runtime's summarize should always return a tree" */);
|
|
1367
1345
|
return { stats, summary, gcStats };
|
|
1368
1346
|
}
|
|
1369
1347
|
/**
|
|
@@ -1437,31 +1415,30 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1437
1415
|
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
1416
|
}
|
|
1439
1417
|
/**
|
|
1440
|
-
* Returns the type of the GC node. Currently, there are nodes that belong to
|
|
1441
|
-
*
|
|
1418
|
+
* Returns the type of the GC node. Currently, there are nodes that belong to the root ("/"), data stores or
|
|
1419
|
+
* blob manager.
|
|
1442
1420
|
*/
|
|
1443
1421
|
getNodeType(nodePath) {
|
|
1422
|
+
var _a;
|
|
1444
1423
|
if (this.isBlobPath(nodePath)) {
|
|
1445
1424
|
return garbageCollection_1.GCNodeType.Blob;
|
|
1446
1425
|
}
|
|
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;
|
|
1426
|
+
return (_a = this.dataStores.getGCNodeType(nodePath)) !== null && _a !== void 0 ? _a : garbageCollection_1.GCNodeType.Other;
|
|
1452
1427
|
}
|
|
1453
1428
|
/**
|
|
1454
1429
|
* Called by GC to retrieve the package path of the node with the given path. The node should belong to a
|
|
1455
1430
|
* data store or an attachment blob.
|
|
1456
1431
|
*/
|
|
1457
1432
|
getGCNodePackagePath(nodePath) {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1433
|
+
switch (this.getNodeType(nodePath)) {
|
|
1434
|
+
case garbageCollection_1.GCNodeType.Blob:
|
|
1435
|
+
return ["_blobs"];
|
|
1436
|
+
case garbageCollection_1.GCNodeType.DataStore:
|
|
1437
|
+
case garbageCollection_1.GCNodeType.SubDataStore:
|
|
1438
|
+
return this.dataStores.getDataStorePackagePath(nodePath);
|
|
1439
|
+
default:
|
|
1440
|
+
(0, common_utils_1.assert)(false, 0x2de /* "Package path requested for unsupported node type." */);
|
|
1461
1441
|
}
|
|
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
1442
|
}
|
|
1466
1443
|
/**
|
|
1467
1444
|
* Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
|
|
@@ -1500,11 +1477,17 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1500
1477
|
async submitSummary(options) {
|
|
1501
1478
|
var _a, _b, _c;
|
|
1502
1479
|
const { fullTree, refreshLatestAck, summaryLogger } = options;
|
|
1480
|
+
// The summary number for this summary. This will be updated during the summary process, so get it now and
|
|
1481
|
+
// use it for all events logged during this summary.
|
|
1482
|
+
const summaryNumber = this.nextSummaryNumber;
|
|
1483
|
+
const summaryNumberLogger = telemetry_utils_1.ChildLogger.create(summaryLogger, undefined, {
|
|
1484
|
+
all: { summaryNumber },
|
|
1485
|
+
});
|
|
1503
1486
|
if (refreshLatestAck) {
|
|
1504
|
-
const latestSummaryRefSeq = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.ChildLogger.create(
|
|
1487
|
+
const latestSummaryRefSeq = await this.refreshLatestSummaryAckFromServer(telemetry_utils_1.ChildLogger.create(summaryNumberLogger, undefined, { all: { safeSummary: true } }));
|
|
1505
1488
|
if (latestSummaryRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
1506
1489
|
// We need to catch up to the latest summary's reference sequence number before pausing.
|
|
1507
|
-
await telemetry_utils_1.PerformanceEvent.timedExecAsync(
|
|
1490
|
+
await telemetry_utils_1.PerformanceEvent.timedExecAsync(summaryNumberLogger, {
|
|
1508
1491
|
eventName: "WaitingForSeq",
|
|
1509
1492
|
lastSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
1510
1493
|
targetSequenceNumber: latestSummaryRefSeq,
|
|
@@ -1520,12 +1503,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1520
1503
|
// We should be here is we haven't processed be here. If we are of if the last message's sequence number
|
|
1521
1504
|
// doesn't match the last processed sequence number, log an error.
|
|
1522
1505
|
if (summaryRefSeqNum !== ((_a = this.deltaManager.lastMessage) === null || _a === void 0 ? void 0 : _a.sequenceNumber)) {
|
|
1523
|
-
|
|
1506
|
+
summaryNumberLogger.sendErrorEvent({
|
|
1524
1507
|
eventName: "LastSequenceMismatch",
|
|
1525
1508
|
error: message,
|
|
1526
1509
|
});
|
|
1527
1510
|
}
|
|
1528
|
-
this.summarizerNode.startSummary(summaryRefSeqNum,
|
|
1511
|
+
this.summarizerNode.startSummary(summaryRefSeqNum, summaryNumberLogger);
|
|
1529
1512
|
// Helper function to check whether we should still continue between each async step.
|
|
1530
1513
|
const checkContinue = () => {
|
|
1531
1514
|
// Do not check for loss of connectivity directly! Instead leave it up to
|
|
@@ -1540,7 +1523,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1540
1523
|
// That said, we rely on submitSystemMessage() that today only works in connected state.
|
|
1541
1524
|
// So if we fail here, it either means that RunWhileConnectedCoordinator does not work correctly,
|
|
1542
1525
|
// OR that design changed and we need to remove this check and fix submitSystemMessage.
|
|
1543
|
-
common_utils_1.assert(this.connected, 0x258 /* "connected" */);
|
|
1526
|
+
(0, common_utils_1.assert)(this.connected, 0x258 /* "connected" */);
|
|
1544
1527
|
// Ensure that lastSequenceNumber has not changed after pausing.
|
|
1545
1528
|
// We need the summary op's reference sequence number to match our summary sequence number,
|
|
1546
1529
|
// otherwise we'll get the wrong sequence number stamped on the summary's .protocol attributes.
|
|
@@ -1562,13 +1545,6 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1562
1545
|
error: continueResult.error,
|
|
1563
1546
|
};
|
|
1564
1547
|
}
|
|
1565
|
-
// increment summary count
|
|
1566
|
-
if (this.summaryCount !== undefined) {
|
|
1567
|
-
this.summaryCount++;
|
|
1568
|
-
}
|
|
1569
|
-
else {
|
|
1570
|
-
this.summaryCount = 1;
|
|
1571
|
-
}
|
|
1572
1548
|
const trace = common_utils_1.Trace.start();
|
|
1573
1549
|
let summarizeResult;
|
|
1574
1550
|
// If the GC state needs to be reset, we need to force a full tree summary and update the unreferenced
|
|
@@ -1578,7 +1554,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1578
1554
|
summarizeResult = await this.summarize({
|
|
1579
1555
|
fullTree: fullTree || forcedFullTree,
|
|
1580
1556
|
trackState: true,
|
|
1581
|
-
summaryLogger,
|
|
1557
|
+
summaryLogger: summaryNumberLogger,
|
|
1582
1558
|
runGC: this.garbageCollector.shouldRunGC,
|
|
1583
1559
|
});
|
|
1584
1560
|
}
|
|
@@ -1597,12 +1573,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1597
1573
|
// Because handles are unchanged dataStores in the current logic,
|
|
1598
1574
|
// summarized dataStore count is total dataStore count minus handle count
|
|
1599
1575
|
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" */);
|
|
1576
|
+
(0, common_utils_1.assert)(dataStoreTree.type === protocol_definitions_1.SummaryType.Tree, 0x1fc /* "summary is not a tree" */);
|
|
1601
1577
|
const handleCount = Object.values(dataStoreTree.tree).filter((value) => value.type === protocol_definitions_1.SummaryType.Handle).length;
|
|
1602
1578
|
const gcSummaryTreeStats = summaryTree.tree[garbageCollection_1.gcTreeKey]
|
|
1603
|
-
? runtime_utils_1.calculateStats(summaryTree.tree[garbageCollection_1.gcTreeKey])
|
|
1579
|
+
? (0, runtime_utils_1.calculateStats)(summaryTree.tree[garbageCollection_1.gcTreeKey])
|
|
1604
1580
|
: 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);
|
|
1581
|
+
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
1582
|
const generateSummaryData = {
|
|
1607
1583
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1608
1584
|
minimumSequenceNumber,
|
|
@@ -1690,7 +1666,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1690
1666
|
map = [];
|
|
1691
1667
|
this.chunkMap.set(clientId, map);
|
|
1692
1668
|
}
|
|
1693
|
-
common_utils_1.assert(chunkedContent.chunkId === map.length + 1, 0x131 /* "Mismatch between new chunkId and expected chunkMap" */); // 1-based indexing
|
|
1669
|
+
(0, common_utils_1.assert)(chunkedContent.chunkId === map.length + 1, 0x131 /* "Mismatch between new chunkId and expected chunkMap" */); // 1-based indexing
|
|
1694
1670
|
map.push(chunkedContent.contents);
|
|
1695
1671
|
}
|
|
1696
1672
|
clearPartialChunks(clientId) {
|
|
@@ -1717,7 +1693,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1717
1693
|
}
|
|
1718
1694
|
submitDataStoreAliasOp(contents, localOpMetadata) {
|
|
1719
1695
|
const aliasMessage = contents;
|
|
1720
|
-
if (!dataStore_1.isDataStoreAliasMessage(aliasMessage)) {
|
|
1696
|
+
if (!(0, dataStore_1.isDataStoreAliasMessage)(aliasMessage)) {
|
|
1721
1697
|
throw new container_utils_1.UsageError("malformedDataStoreAliasMessage");
|
|
1722
1698
|
}
|
|
1723
1699
|
this.submit(ContainerMessageType.Alias, contents, localOpMetadata);
|
|
@@ -1732,7 +1708,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1732
1708
|
this.closeFn(new container_utils_1.GenericError("containerRuntimeSubmitWithPendingLocalState"));
|
|
1733
1709
|
}
|
|
1734
1710
|
// 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" */);
|
|
1711
|
+
(0, common_utils_1.assert)(this.attachState !== container_definitions_1.AttachState.Detached, 0x132 /* "sending ops in detached container" */);
|
|
1736
1712
|
let clientSequenceNumber = -1;
|
|
1737
1713
|
let opMetadataInternal = opMetadata;
|
|
1738
1714
|
if (this.canSendOps()) {
|
|
@@ -1807,7 +1783,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1807
1783
|
}
|
|
1808
1784
|
submitSystemMessage(type, contents) {
|
|
1809
1785
|
this.verifyNotClosed();
|
|
1810
|
-
common_utils_1.assert(this.connected, 0x133 /* "Container disconnected when trying to submit system message" */);
|
|
1786
|
+
(0, common_utils_1.assert)(this.connected, 0x133 /* "Container disconnected when trying to submit system message" */);
|
|
1811
1787
|
// System message should not be sent in the middle of the batch.
|
|
1812
1788
|
// That said, we can preserve existing behavior by not flushing existing buffer.
|
|
1813
1789
|
// That might be not what caller hopes to get, but we can look deeper if telemetry tells us it's a problem.
|
|
@@ -1819,7 +1795,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1819
1795
|
}
|
|
1820
1796
|
submitRuntimeMessage(type, contents, batch, appData) {
|
|
1821
1797
|
this.verifyNotClosed();
|
|
1822
|
-
common_utils_1.assert(this.connected, 0x259 /* "Container disconnected when trying to submit system message" */);
|
|
1798
|
+
(0, common_utils_1.assert)(this.connected, 0x259 /* "Container disconnected when trying to submit system message" */);
|
|
1823
1799
|
const payload = { type, contents };
|
|
1824
1800
|
return this.context.submitFn(protocol_definitions_1.MessageType.Operation, payload, batch, appData);
|
|
1825
1801
|
}
|
|
@@ -1858,12 +1834,12 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1858
1834
|
this.submit(type, content);
|
|
1859
1835
|
break;
|
|
1860
1836
|
default:
|
|
1861
|
-
common_utils_1.unreachableCase(type, `Unknown ContainerMessageType: ${type}`);
|
|
1837
|
+
(0, common_utils_1.unreachableCase)(type, `Unknown ContainerMessageType: ${type}`);
|
|
1862
1838
|
}
|
|
1863
1839
|
}
|
|
1864
1840
|
/** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
|
|
1865
1841
|
async refreshLatestSummaryAck(proposalHandle, ackHandle, summaryRefSeq, summaryLogger) {
|
|
1866
|
-
const readAndParseBlob = async (id) => driver_utils_1.readAndParse(this.storage, id);
|
|
1842
|
+
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
1867
1843
|
const result = await this.summarizerNode.refreshLatestSummary(proposalHandle, summaryRefSeq, async () => this.fetchSnapshotFromStorage(ackHandle, summaryLogger, {
|
|
1868
1844
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1869
1845
|
ackHandle,
|
|
@@ -1884,8 +1860,8 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1884
1860
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
1885
1861
|
fetchLatest: true,
|
|
1886
1862
|
});
|
|
1887
|
-
const readAndParseBlob = async (id) => driver_utils_1.readAndParse(this.storage, id);
|
|
1888
|
-
const snapshotRefSeq = await runtime_utils_1.seqFromTree(snapshot, readAndParseBlob);
|
|
1863
|
+
const readAndParseBlob = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
|
|
1864
|
+
const snapshotRefSeq = await (0, runtime_utils_1.seqFromTree)(snapshot, readAndParseBlob);
|
|
1889
1865
|
const result = await this.summarizerNode.refreshLatestSummary(undefined, snapshotRefSeq, async () => snapshot, readAndParseBlob, summaryLogger);
|
|
1890
1866
|
// Notify the garbage collector so it can update its latest summary state.
|
|
1891
1867
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
@@ -1896,10 +1872,10 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1896
1872
|
const stats = {};
|
|
1897
1873
|
const trace = common_utils_1.Trace.start();
|
|
1898
1874
|
const versions = await this.storage.getVersions(versionId, 1);
|
|
1899
|
-
common_utils_1.assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
1875
|
+
(0, common_utils_1.assert)(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
|
|
1900
1876
|
stats.getVersionDuration = trace.trace().duration;
|
|
1901
1877
|
const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
|
|
1902
|
-
common_utils_1.assert(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
1878
|
+
(0, common_utils_1.assert)(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
1903
1879
|
stats.getSnapshotDuration = trace.trace().duration;
|
|
1904
1880
|
perfEvent.end(stats);
|
|
1905
1881
|
return maybeSnapshot;
|
|
@@ -1926,7 +1902,7 @@ class ContainerRuntime extends common_utils_1.TypedEventEmitter {
|
|
|
1926
1902
|
},
|
|
1927
1903
|
url: "/_summarizer",
|
|
1928
1904
|
};
|
|
1929
|
-
const fluidObject = await runtime_utils_1.requestFluidObject(loaderRouter, request);
|
|
1905
|
+
const fluidObject = await (0, runtime_utils_1.requestFluidObject)(loaderRouter, request);
|
|
1930
1906
|
const summarizer = fluidObject.ISummarizer;
|
|
1931
1907
|
if (!summarizer) {
|
|
1932
1908
|
throw new container_utils_1.UsageError("Fluid object does not implement ISummarizer");
|