@fluidframework/container-loader 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
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 +18 -21
- package/.mocharc.js +2 -2
- package/README.md +45 -43
- package/api-extractor.json +2 -2
- package/closeAndGetPendingLocalState.md +51 -0
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/collabWindowTracker.d.ts.map +1 -1
- package/dist/collabWindowTracker.js.map +1 -1
- package/dist/connectionManager.d.ts +2 -2
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +51 -24
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.d.ts.map +1 -1
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +35 -16
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +1 -10
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +89 -44
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +6 -2
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +2 -4
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts +3 -3
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +56 -27
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaManagerProxy.d.ts.map +1 -1
- package/dist/deltaManagerProxy.js.map +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +4 -2
- package/dist/deltaQueue.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +3 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +18 -15
- package/dist/loader.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/protocol.d.ts.map +1 -1
- package/dist/protocol.js +2 -1
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +6 -2
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/collabWindowTracker.d.ts.map +1 -1
- package/lib/collabWindowTracker.js.map +1 -1
- package/lib/connectionManager.d.ts +2 -2
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +53 -26
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionState.d.ts.map +1 -1
- package/lib/connectionState.js.map +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +35 -16
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +1 -10
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +93 -48
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +6 -2
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +2 -4
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts +3 -3
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +58 -29
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaManagerProxy.d.ts.map +1 -1
- package/lib/deltaManagerProxy.js.map +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +4 -2
- package/lib/deltaQueue.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts +3 -3
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +18 -15
- package/lib/loader.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/protocol.d.ts.map +1 -1
- package/lib/protocol.js +2 -1
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +6 -2
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +6 -4
- package/lib/utils.js.map +1 -1
- package/package.json +115 -114
- package/prettier.config.cjs +1 -1
- package/src/audience.ts +51 -46
- package/src/catchUpMonitor.ts +39 -37
- package/src/collabWindowTracker.ts +75 -70
- package/src/connectionManager.ts +1006 -944
- package/src/connectionState.ts +19 -19
- package/src/connectionStateHandler.ts +544 -465
- package/src/container.ts +2056 -1909
- package/src/containerContext.ts +350 -340
- package/src/containerStorageAdapter.ts +163 -153
- package/src/contracts.ts +155 -153
- package/src/deltaManager.ts +1069 -992
- package/src/deltaManagerProxy.ts +143 -137
- package/src/deltaQueue.ts +155 -151
- package/src/index.ts +14 -17
- package/src/loader.ts +428 -430
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +93 -87
- package/src/protocolTreeDocumentStorageService.ts +30 -33
- package/src/quorum.ts +34 -34
- package/src/retriableDocumentStorageService.ts +118 -102
- package/src/utils.ts +89 -82
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
package/dist/container.js
CHANGED
|
@@ -71,8 +71,8 @@ async function waitContainerToCatchUp(container) {
|
|
|
71
71
|
// Waiting for "connected" state in either case gets us at least to our own Join op
|
|
72
72
|
// which is a reasonable approximation of "caught up"
|
|
73
73
|
const waitForOps = () => {
|
|
74
|
-
(0, common_utils_1.assert)(container.connectionState === connectionState_1.ConnectionState.CatchingUp
|
|
75
|
-
|
|
74
|
+
(0, common_utils_1.assert)(container.connectionState === connectionState_1.ConnectionState.CatchingUp ||
|
|
75
|
+
container.connectionState === connectionState_1.ConnectionState.Connected, 0x0cd /* "Container disconnected while waiting for ops!" */);
|
|
76
76
|
const hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;
|
|
77
77
|
const connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;
|
|
78
78
|
(0, common_utils_1.assert)(deltaManager.lastSequenceNumber <= connectionOpSeqNumber, 0x266 /* "lastKnownSeqNumber should never be below last processed sequence number" */);
|
|
@@ -168,7 +168,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
168
168
|
this.setAutoReconnectTime = common_utils_1.performance.now();
|
|
169
169
|
this._disposed = false;
|
|
170
170
|
this.clientDetailsOverride = config.clientDetailsOverride;
|
|
171
|
-
this._scopeOverride = config.scopeOverride;
|
|
172
171
|
this._resolvedUrl = config.resolvedUrl;
|
|
173
172
|
if (config.canReconnect !== undefined) {
|
|
174
173
|
this._canReconnect = config.canReconnect;
|
|
@@ -206,6 +205,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
206
205
|
dmLastMsqSeqNumber: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.sequenceNumber; },
|
|
207
206
|
dmLastMsqSeqTimestamp: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.timestamp; },
|
|
208
207
|
dmLastMsqSeqClientId: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.clientId; },
|
|
208
|
+
dmLastMsgClientSeq: () => { var _a, _b; return (_b = (_a = this.deltaManager) === null || _a === void 0 ? void 0 : _a.lastMessage) === null || _b === void 0 ? void 0 : _b.clientSequenceNumber; },
|
|
209
209
|
connectionStateDuration: () => common_utils_1.performance.now() - this.connectionTransitionTimes[this.connectionState],
|
|
210
210
|
},
|
|
211
211
|
});
|
|
@@ -223,7 +223,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
223
223
|
}
|
|
224
224
|
this.logConnectionStateChangeTelemetry(value, oldState, reason);
|
|
225
225
|
if (this._lifecycleState === "loaded") {
|
|
226
|
-
this.propagateConnectionState(false /* initial transition */, value === connectionState_1.ConnectionState.Disconnected
|
|
226
|
+
this.propagateConnectionState(false /* initial transition */, value === connectionState_1.ConnectionState.Disconnected
|
|
227
|
+
? reason
|
|
228
|
+
: undefined /* disconnectedReason */);
|
|
227
229
|
}
|
|
228
230
|
},
|
|
229
231
|
shouldClientJoinWrite: () => this._deltaManager.connectionManager.shouldJoinWrite(),
|
|
@@ -236,7 +238,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
236
238
|
// so we always time-out processing of join op in cases where fetching snapshot takes a minute.
|
|
237
239
|
// It's not a problem with op processing itself - such issues should be tracked as part of boot perf monitoring instead.
|
|
238
240
|
this._deltaManager.logConnectionIssue(Object.assign({ eventName,
|
|
239
|
-
mode, category:
|
|
241
|
+
mode, category: this._lifecycleState === "loading" ? "generic" : category, duration: common_utils_1.performance.now() -
|
|
242
|
+
this.connectionTransitionTimes[connectionState_1.ConnectionState.CatchingUp] }, (details === undefined ? {} : { details: JSON.stringify(details) })));
|
|
240
243
|
// If this is "write" connection, it took too long to receive join op. But in most cases that's due
|
|
241
244
|
// to very slow op fetches and we will eventually get there.
|
|
242
245
|
// For "read" connections, we get here due to self join signal not arriving on time. We will need to
|
|
@@ -270,7 +273,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
270
273
|
}
|
|
271
274
|
else {
|
|
272
275
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
273
|
-
setTimeout(() => {
|
|
276
|
+
setTimeout(() => {
|
|
277
|
+
this.lastVisible = undefined;
|
|
278
|
+
}, 0);
|
|
274
279
|
}
|
|
275
280
|
};
|
|
276
281
|
document.addEventListener("visibilitychange", this.visibilityEventHandler);
|
|
@@ -281,7 +286,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
281
286
|
// if we are in connecting stage.
|
|
282
287
|
this.on("newListener", (event, listener) => {
|
|
283
288
|
// Fire events on the end of JS turn, giving a chance for caller to be in consistent state.
|
|
284
|
-
Promise.resolve()
|
|
289
|
+
Promise.resolve()
|
|
290
|
+
.then(() => {
|
|
285
291
|
switch (event) {
|
|
286
292
|
case dirtyContainerEvent:
|
|
287
293
|
if (this._dirtyContainer) {
|
|
@@ -305,7 +311,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
305
311
|
break;
|
|
306
312
|
default:
|
|
307
313
|
}
|
|
308
|
-
})
|
|
314
|
+
})
|
|
315
|
+
.catch((error) => {
|
|
309
316
|
this.mc.logger.sendErrorEvent({ eventName: "RaiseConnectedEventError" }, error);
|
|
310
317
|
});
|
|
311
318
|
});
|
|
@@ -320,7 +327,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
320
327
|
canReconnect: loadOptions.canReconnect,
|
|
321
328
|
serializedContainerState: pendingLocalState,
|
|
322
329
|
baseLogger: loadOptions.baseLogger,
|
|
323
|
-
scopeOverride: loadOptions.scopeOverride,
|
|
324
330
|
}, protocolHandlerBuilder);
|
|
325
331
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
|
|
326
332
|
var _a, _b;
|
|
@@ -335,7 +341,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
335
341
|
reject(err !== null && err !== void 0 ? err : new container_utils_1.GenericError("Container closed without error during load"));
|
|
336
342
|
};
|
|
337
343
|
container.on("closed", onClosed);
|
|
338
|
-
container
|
|
344
|
+
container
|
|
345
|
+
.load(version, mode, pendingLocalState)
|
|
339
346
|
.finally(() => {
|
|
340
347
|
container.removeListener("closed", onClosed);
|
|
341
348
|
})
|
|
@@ -384,8 +391,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
384
391
|
}
|
|
385
392
|
}
|
|
386
393
|
get closed() {
|
|
387
|
-
return (this._lifecycleState === "closing" ||
|
|
388
|
-
|
|
394
|
+
return (this._lifecycleState === "closing" ||
|
|
395
|
+
this._lifecycleState === "closed" ||
|
|
396
|
+
this._lifecycleState === "disposing" ||
|
|
397
|
+
this._lifecycleState === "disposed");
|
|
389
398
|
}
|
|
390
399
|
get storage() {
|
|
391
400
|
return this.storageService;
|
|
@@ -402,8 +411,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
402
411
|
}
|
|
403
412
|
return this._protocolHandler;
|
|
404
413
|
}
|
|
405
|
-
get connectionMode() {
|
|
406
|
-
|
|
414
|
+
get connectionMode() {
|
|
415
|
+
return this._deltaManager.connectionManager.connectionMode;
|
|
416
|
+
}
|
|
417
|
+
get IFluidRouter() {
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
407
420
|
get resolvedUrl() {
|
|
408
421
|
return this._resolvedUrl;
|
|
409
422
|
}
|
|
@@ -485,10 +498,18 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
485
498
|
get isDirty() {
|
|
486
499
|
return this._dirtyContainer;
|
|
487
500
|
}
|
|
488
|
-
get serviceFactory() {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
get
|
|
501
|
+
get serviceFactory() {
|
|
502
|
+
return this.loader.services.documentServiceFactory;
|
|
503
|
+
}
|
|
504
|
+
get urlResolver() {
|
|
505
|
+
return this.loader.services.urlResolver;
|
|
506
|
+
}
|
|
507
|
+
get scope() {
|
|
508
|
+
return this.loader.services.scope;
|
|
509
|
+
}
|
|
510
|
+
get codeLoader() {
|
|
511
|
+
return this.loader.services.codeLoader;
|
|
512
|
+
}
|
|
492
513
|
/**
|
|
493
514
|
* Retrieves the quorum associated with the document
|
|
494
515
|
*/
|
|
@@ -556,7 +577,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
556
577
|
// This gives us a chance to know what errors happened on open vs. on fully loaded container.
|
|
557
578
|
this.mc.logger.sendTelemetryEvent({
|
|
558
579
|
eventName: "ContainerDispose",
|
|
559
|
-
category:
|
|
580
|
+
category: "generic",
|
|
560
581
|
}, error);
|
|
561
582
|
// ! Progressing from "closed" to "disposing" is not allowed
|
|
562
583
|
if (this._lifecycleState !== "closed") {
|
|
@@ -612,8 +633,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
612
633
|
const appSummary = this.context.createSummary();
|
|
613
634
|
const protocolSummary = this.captureProtocolSummary();
|
|
614
635
|
const combinedSummary = (0, driver_utils_1.combineAppAndProtocolSummary)(appSummary, protocolSummary);
|
|
615
|
-
if (this.loader.services.detachedBlobStorage &&
|
|
616
|
-
|
|
636
|
+
if (this.loader.services.detachedBlobStorage &&
|
|
637
|
+
this.loader.services.detachedBlobStorage.size > 0) {
|
|
638
|
+
combinedSummary.tree[".hasAttachmentBlobs"] = {
|
|
639
|
+
type: protocol_definitions_1.SummaryType.Blob,
|
|
640
|
+
content: "true",
|
|
641
|
+
};
|
|
617
642
|
}
|
|
618
643
|
return JSON.stringify(combinedSummary);
|
|
619
644
|
}
|
|
@@ -628,8 +653,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
628
653
|
(0, common_utils_1.assert)(this._attachState === container_definitions_1.AttachState.Detached && !this.attachStarted, 0x205 /* "attach() called more than once" */);
|
|
629
654
|
this.attachStarted = true;
|
|
630
655
|
// If attachment blobs were uploaded in detached state we will go through a different attach flow
|
|
631
|
-
const hasAttachmentBlobs = this.loader.services.detachedBlobStorage !== undefined
|
|
632
|
-
|
|
656
|
+
const hasAttachmentBlobs = this.loader.services.detachedBlobStorage !== undefined &&
|
|
657
|
+
this.loader.services.detachedBlobStorage.size > 0;
|
|
633
658
|
try {
|
|
634
659
|
(0, common_utils_1.assert)(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
|
|
635
660
|
let summary;
|
|
@@ -667,7 +692,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
667
692
|
const redirectTable = new Map();
|
|
668
693
|
// if new blobs are added while uploading, upload them too
|
|
669
694
|
while (redirectTable.size < this.loader.services.detachedBlobStorage.size) {
|
|
670
|
-
const newIds = this.loader.services.detachedBlobStorage
|
|
695
|
+
const newIds = this.loader.services.detachedBlobStorage
|
|
696
|
+
.getBlobIds()
|
|
697
|
+
.filter((id) => !redirectTable.has(id));
|
|
671
698
|
for (const id of newIds) {
|
|
672
699
|
const blob = await this.loader.services.detachedBlobStorage.readBlob(id);
|
|
673
700
|
const response = await this.storageService.createBlob(blob);
|
|
@@ -689,7 +716,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
689
716
|
this._attachState = container_definitions_1.AttachState.Attached;
|
|
690
717
|
this.emit("attached");
|
|
691
718
|
if (!this.closed) {
|
|
692
|
-
this.resumeInternal({
|
|
719
|
+
this.resumeInternal({
|
|
720
|
+
fetchOpsFromStorage: false,
|
|
721
|
+
reason: "createDetached",
|
|
722
|
+
});
|
|
693
723
|
}
|
|
694
724
|
}
|
|
695
725
|
catch (error) {
|
|
@@ -789,7 +819,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
789
819
|
throw new Error("Proposed code details should be greater than the current");
|
|
790
820
|
}
|
|
791
821
|
}
|
|
792
|
-
return this.protocolHandler.quorum
|
|
822
|
+
return this.protocolHandler.quorum
|
|
823
|
+
.propose("code", codeDetails)
|
|
793
824
|
.then(() => true)
|
|
794
825
|
.catch(() => false);
|
|
795
826
|
}
|
|
@@ -798,9 +829,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
798
829
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
799
830
|
await Promise.all([
|
|
800
831
|
this.deltaManager.inbound.pause(),
|
|
801
|
-
this.deltaManager.inboundSignal.pause()
|
|
832
|
+
this.deltaManager.inboundSignal.pause(),
|
|
802
833
|
]);
|
|
803
|
-
if ((await this.context.satisfies(codeDetails) === true)
|
|
834
|
+
if ((await this.context.satisfies(codeDetails)) === true) {
|
|
804
835
|
this.deltaManager.inbound.resume();
|
|
805
836
|
this.deltaManager.inboundSignal.resume();
|
|
806
837
|
return;
|
|
@@ -846,7 +877,11 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
846
877
|
// connections to same file) in two ways:
|
|
847
878
|
// A) creation flow breaks (as one of the clients "sees" file as existing, and hits #2 above)
|
|
848
879
|
// B) Once file is created, transition from view-only connection to write does not work - some bugs to be fixed.
|
|
849
|
-
const connectionArgs = {
|
|
880
|
+
const connectionArgs = {
|
|
881
|
+
reason: "DocumentOpen",
|
|
882
|
+
mode: "write",
|
|
883
|
+
fetchOpsFromStorage: false,
|
|
884
|
+
};
|
|
850
885
|
// Start websocket connection as soon as possible. Note that there is no op handler attached yet, but the
|
|
851
886
|
// DeltaManager is resilient to this and will wait to start processing ops until after it is attached.
|
|
852
887
|
if (loadMode.deltaConnection === undefined) {
|
|
@@ -970,7 +1005,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
970
1005
|
}
|
|
971
1006
|
async rehydrateDetachedFromSnapshot(detachedContainerSnapshot) {
|
|
972
1007
|
if (detachedContainerSnapshot.tree[".hasAttachmentBlobs"] !== undefined) {
|
|
973
|
-
(0, common_utils_1.assert)(!!this.loader.services.detachedBlobStorage &&
|
|
1008
|
+
(0, common_utils_1.assert)(!!this.loader.services.detachedBlobStorage &&
|
|
1009
|
+
this.loader.services.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
|
|
974
1010
|
delete detachedContainerSnapshot.tree[".hasAttachmentBlobs"];
|
|
975
1011
|
}
|
|
976
1012
|
const snapshotTree = (0, utils_1.getSnapshotTreeFromSerializedContainer)(detachedContainerSnapshot);
|
|
@@ -1017,11 +1053,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1017
1053
|
};
|
|
1018
1054
|
if (snapshot !== undefined) {
|
|
1019
1055
|
const baseTree = (0, utils_1.getProtocolSnapshotTree)(snapshot);
|
|
1020
|
-
[quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1056
|
+
[quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =
|
|
1057
|
+
await Promise.all([
|
|
1058
|
+
(0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumMembers),
|
|
1059
|
+
(0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumProposals),
|
|
1060
|
+
(0, driver_utils_1.readAndParse)(storage, baseTree.blobs.quorumValues),
|
|
1061
|
+
]);
|
|
1025
1062
|
}
|
|
1026
1063
|
this.initializeProtocolState(attributes, quorumSnapshot);
|
|
1027
1064
|
}
|
|
@@ -1108,7 +1145,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1108
1145
|
if (this.clientDetailsOverride !== undefined) {
|
|
1109
1146
|
(0, merge_1.default)(client.details, this.clientDetailsOverride);
|
|
1110
1147
|
}
|
|
1111
|
-
client.details.environment = [
|
|
1148
|
+
client.details.environment = [
|
|
1149
|
+
client.details.environment,
|
|
1150
|
+
` loaderVersion:${packageVersion_1.pkgVersion}`,
|
|
1151
|
+
].join(";");
|
|
1112
1152
|
return client;
|
|
1113
1153
|
}
|
|
1114
1154
|
/**
|
|
@@ -1118,8 +1158,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1118
1158
|
* If it's not true, runtime is not in position to send ops.
|
|
1119
1159
|
*/
|
|
1120
1160
|
activeConnection() {
|
|
1121
|
-
return this.connectionState === connectionState_1.ConnectionState.Connected &&
|
|
1122
|
-
this.connectionMode === "write";
|
|
1161
|
+
return (this.connectionState === connectionState_1.ConnectionState.Connected && this.connectionMode === "write");
|
|
1123
1162
|
}
|
|
1124
1163
|
createDeltaManager() {
|
|
1125
1164
|
const serviceProvider = () => this.service;
|
|
@@ -1186,7 +1225,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1186
1225
|
}
|
|
1187
1226
|
else {
|
|
1188
1227
|
if (value === connectionState_1.ConnectionState.Connected) {
|
|
1189
|
-
durationFromDisconnected =
|
|
1228
|
+
durationFromDisconnected =
|
|
1229
|
+
time - this.connectionTransitionTimes[connectionState_1.ConnectionState.Disconnected];
|
|
1190
1230
|
durationFromDisconnected = telemetry_utils_1.TelemetryLogger.formatTick(durationFromDisconnected);
|
|
1191
1231
|
}
|
|
1192
1232
|
else {
|
|
@@ -1229,7 +1269,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1229
1269
|
this.protocolHandler.setConnectionState(state, this.clientId);
|
|
1230
1270
|
(0, telemetry_utils_1.raiseConnectedEvent)(this.mc.logger, this, state, this.clientId, disconnectedReason);
|
|
1231
1271
|
if (logOpsOnReconnect) {
|
|
1232
|
-
this.mc.logger.sendTelemetryEvent({
|
|
1272
|
+
this.mc.logger.sendTelemetryEvent({
|
|
1273
|
+
eventName: "OpsSentOnReconnect",
|
|
1274
|
+
count: this.messageCountAfterDisconnection,
|
|
1275
|
+
});
|
|
1233
1276
|
}
|
|
1234
1277
|
}
|
|
1235
1278
|
// back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()
|
|
@@ -1266,8 +1309,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1266
1309
|
if (summary.details === undefined) {
|
|
1267
1310
|
summary.details = {};
|
|
1268
1311
|
}
|
|
1269
|
-
summary.details.includesProtocolTree =
|
|
1270
|
-
this.options.summarizeProtocolTree === true;
|
|
1312
|
+
summary.details.includesProtocolTree = this.options.summarizeProtocolTree === true;
|
|
1271
1313
|
return this.submitMessage(protocol_definitions_1.MessageType.Summarize, JSON.stringify(summary), false /* batch */);
|
|
1272
1314
|
}
|
|
1273
1315
|
submitMessage(type, contents, batch, metadata, compression) {
|
|
@@ -1326,10 +1368,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1326
1368
|
const version = await this.getVersion(specifiedVersion !== null && specifiedVersion !== void 0 ? specifiedVersion : null);
|
|
1327
1369
|
if (version === undefined && specifiedVersion !== undefined) {
|
|
1328
1370
|
// We should have a defined version to load from if specified version requested
|
|
1329
|
-
this.mc.logger.sendErrorEvent({
|
|
1371
|
+
this.mc.logger.sendErrorEvent({
|
|
1372
|
+
eventName: "NoVersionFoundWhenSpecified",
|
|
1373
|
+
id: specifiedVersion,
|
|
1374
|
+
});
|
|
1330
1375
|
}
|
|
1331
1376
|
this._loadedFromVersion = version;
|
|
1332
|
-
const snapshot = (_a = await this.storageService.getSnapshotTree(version)) !== null && _a !== void 0 ? _a : undefined;
|
|
1377
|
+
const snapshot = (_a = (await this.storageService.getSnapshotTree(version))) !== null && _a !== void 0 ? _a : undefined;
|
|
1333
1378
|
if (snapshot === undefined && version !== undefined) {
|
|
1334
1379
|
this.mc.logger.sendErrorEvent({ eventName: "getSnapshotTreeFailed", id: version.id });
|
|
1335
1380
|
}
|