@fluidframework/container-loader 2.0.0-internal.6.2.0 → 2.0.0-internal.6.3.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/CHANGELOG.md +4 -0
- package/dist/audience.js +2 -2
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.js +2 -2
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +36 -34
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.js +24 -24
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +73 -65
- package/dist/container.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +10 -9
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/debugLogger.js +2 -2
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +28 -27
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +9 -8
- package/dist/deltaQueue.js.map +1 -1
- package/dist/noopHeuristic.d.ts +1 -1
- package/dist/noopHeuristic.d.ts.map +1 -1
- package/dist/noopHeuristic.js +6 -5
- package/dist/noopHeuristic.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/retriableDocumentStorageService.js +2 -2
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +9 -8
- package/dist/utils.js.map +1 -1
- package/lib/audience.js +1 -1
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.js +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +9 -7
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +1 -1
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +33 -25
- package/lib/container.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +2 -1
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/debugLogger.js +1 -1
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +4 -3
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +2 -1
- package/lib/deltaQueue.js.map +1 -1
- package/lib/noopHeuristic.d.ts +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -1
- package/lib/noopHeuristic.js +2 -1
- package/lib/noopHeuristic.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/retriableDocumentStorageService.js +1 -1
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +4 -3
- package/lib/utils.js.map +1 -1
- package/package.json +19 -19
- package/src/audience.ts +1 -1
- package/src/catchUpMonitor.ts +1 -1
- package/src/connectionManager.ts +12 -7
- package/src/connectionStateHandler.ts +1 -1
- package/src/container.ts +45 -38
- package/src/containerStorageAdapter.ts +2 -1
- package/src/debugLogger.ts +1 -1
- package/src/deltaManager.ts +4 -3
- package/src/deltaQueue.ts +2 -1
- package/src/noopHeuristic.ts +2 -1
- package/src/packageVersion.ts +1 -1
- package/src/retriableDocumentStorageService.ts +1 -1
- package/src/utils.ts +4 -8
package/dist/container.js
CHANGED
|
@@ -11,7 +11,9 @@ exports.Container = exports.ReportIfTooLong = exports.waitContainerToCatchUp = v
|
|
|
11
11
|
// eslint-disable-next-line import/no-internal-modules
|
|
12
12
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
13
13
|
const uuid_1 = require("uuid");
|
|
14
|
-
const
|
|
14
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
15
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
16
|
+
const core_interfaces_1 = require("@fluidframework/core-interfaces");
|
|
15
17
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
16
18
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
17
19
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
@@ -70,11 +72,11 @@ async function waitContainerToCatchUp(container) {
|
|
|
70
72
|
// Waiting for "connected" state in either case gets us at least to our own Join op
|
|
71
73
|
// which is a reasonable approximation of "caught up"
|
|
72
74
|
const waitForOps = () => {
|
|
73
|
-
(0,
|
|
75
|
+
(0, core_utils_1.assert)(container.connectionState === connectionState_1.ConnectionState.CatchingUp ||
|
|
74
76
|
container.connectionState === connectionState_1.ConnectionState.Connected, 0x0cd /* "Container disconnected while waiting for ops!" */);
|
|
75
77
|
const hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;
|
|
76
78
|
const connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;
|
|
77
|
-
(0,
|
|
79
|
+
(0, core_utils_1.assert)(deltaManager.lastSequenceNumber <= connectionOpSeqNumber, 0x266 /* "lastKnownSeqNumber should never be below last processed sequence number" */);
|
|
78
80
|
if (deltaManager.lastSequenceNumber === connectionOpSeqNumber) {
|
|
79
81
|
container.off("closed", closedCallback);
|
|
80
82
|
resolve(hasCheckpointSequenceNumber);
|
|
@@ -162,8 +164,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
162
164
|
this._dirtyContainer = false;
|
|
163
165
|
this.savedOps = [];
|
|
164
166
|
this.clientsWhoShouldHaveLeft = new Set();
|
|
165
|
-
this.setAutoReconnectTime =
|
|
166
|
-
this._lifecycleEvents = new
|
|
167
|
+
this.setAutoReconnectTime = client_utils_1.performance.now();
|
|
168
|
+
this._lifecycleEvents = new client_utils_1.TypedEventEmitter();
|
|
167
169
|
this._disposed = false;
|
|
168
170
|
this.getAbsoluteUrl = async (relativeUrl) => {
|
|
169
171
|
if (this.resolvedUrl === undefined) {
|
|
@@ -179,7 +181,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
179
181
|
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
180
182
|
};
|
|
181
183
|
const { canReconnect, clientDetailsOverride, urlResolver, documentServiceFactory, codeLoader, options, scope, subLogger, detachedBlobStorage, protocolHandlerBuilder, } = createProps;
|
|
182
|
-
this.connectionTransitionTimes[connectionState_1.ConnectionState.Disconnected] =
|
|
184
|
+
this.connectionTransitionTimes[connectionState_1.ConnectionState.Disconnected] = client_utils_1.performance.now();
|
|
183
185
|
const pendingLocalState = loadProps?.pendingLocalState;
|
|
184
186
|
this._clientId = pendingLocalState?.clientId;
|
|
185
187
|
this._canReconnect = canReconnect ?? true;
|
|
@@ -239,7 +241,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
239
241
|
? "null"
|
|
240
242
|
: this.deltaManager?.lastMessage?.clientId,
|
|
241
243
|
dmLastMsgClientSeq: () => this.deltaManager?.lastMessage?.clientSequenceNumber,
|
|
242
|
-
connectionStateDuration: () =>
|
|
244
|
+
connectionStateDuration: () => client_utils_1.performance.now() - this.connectionTransitionTimes[this.connectionState],
|
|
243
245
|
},
|
|
244
246
|
},
|
|
245
247
|
});
|
|
@@ -272,7 +274,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
272
274
|
eventName,
|
|
273
275
|
mode,
|
|
274
276
|
category: this._lifecycleState === "loading" ? "generic" : category,
|
|
275
|
-
duration:
|
|
277
|
+
duration: client_utils_1.performance.now() -
|
|
276
278
|
this.connectionTransitionTimes[connectionState_1.ConnectionState.CatchingUp],
|
|
277
279
|
...(details === undefined ? {} : { details: JSON.stringify(details) }),
|
|
278
280
|
});
|
|
@@ -314,10 +316,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
314
316
|
document.addEventListener !== null;
|
|
315
317
|
// keep track of last time page was visible for telemetry (on interactive clients only)
|
|
316
318
|
if (isDomAvailable && interactive) {
|
|
317
|
-
this.lastVisible = document.hidden ?
|
|
319
|
+
this.lastVisible = document.hidden ? client_utils_1.performance.now() : undefined;
|
|
318
320
|
this.visibilityEventHandler = () => {
|
|
319
321
|
if (document.hidden) {
|
|
320
|
-
this.lastVisible =
|
|
322
|
+
this.lastVisible = client_utils_1.performance.now();
|
|
321
323
|
}
|
|
322
324
|
else {
|
|
323
325
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
@@ -512,7 +514,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
512
514
|
}
|
|
513
515
|
return new Promise((resolve, reject) => {
|
|
514
516
|
const runtimeInstantiatedHandler = () => {
|
|
515
|
-
(0,
|
|
517
|
+
(0, core_utils_1.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
516
518
|
resolve(this._runtime.getEntryPoint?.());
|
|
517
519
|
this._lifecycleEvents.off("disposed", disposedHandler);
|
|
518
520
|
};
|
|
@@ -543,11 +545,11 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
543
545
|
this.verifyClosed();
|
|
544
546
|
}
|
|
545
547
|
verifyClosed() {
|
|
546
|
-
(0,
|
|
547
|
-
(0,
|
|
548
|
+
(0, core_utils_1.assert)(this.connectionState === connectionState_1.ConnectionState.Disconnected, 0x0cf /* "disconnect event was not raised!" */);
|
|
549
|
+
(0, core_utils_1.assert)(this._lifecycleState === "closed" || this._lifecycleState === "disposed", 0x314 /* Container properly closed */);
|
|
548
550
|
}
|
|
549
551
|
closeCore(error) {
|
|
550
|
-
(0,
|
|
552
|
+
(0, core_utils_1.assert)(!this.closed, 0x315 /* re-entrancy */);
|
|
551
553
|
try {
|
|
552
554
|
// Ensure that we raise all key events even if one of these throws
|
|
553
555
|
try {
|
|
@@ -582,7 +584,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
586
|
disposeCore(error) {
|
|
585
|
-
(0,
|
|
587
|
+
(0, core_utils_1.assert)(!this._disposed, 0x54c /* Container already disposed */);
|
|
586
588
|
this._disposed = true;
|
|
587
589
|
try {
|
|
588
590
|
// Ensure that we raise all key events even if one of these throws
|
|
@@ -635,35 +637,41 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
635
637
|
return this.getPendingLocalStateCore({ notifyImminentClosure: false });
|
|
636
638
|
}
|
|
637
639
|
async getPendingLocalStateCore(props) {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
640
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, {
|
|
641
|
+
eventName: "getPendingLocalState",
|
|
642
|
+
notifyImminentClosure: props.notifyImminentClosure,
|
|
643
|
+
savedOpsSize: this.savedOps.length,
|
|
644
|
+
clientId: this.clientId,
|
|
645
|
+
}, async () => {
|
|
646
|
+
if (!this.offlineLoadEnabled) {
|
|
647
|
+
throw new telemetry_utils_1.UsageError("Can't get pending local state unless offline load is enabled");
|
|
648
|
+
}
|
|
649
|
+
if (this.closed || this._disposed) {
|
|
650
|
+
throw new telemetry_utils_1.UsageError("Pending state cannot be retried if the container is closed or disposed");
|
|
651
|
+
}
|
|
652
|
+
(0, core_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
|
|
653
|
+
(0, core_utils_1.assert)(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
|
|
654
|
+
(0, core_utils_1.assert)(!!this.baseSnapshot, 0x5d4 /* no base snapshot */);
|
|
655
|
+
(0, core_utils_1.assert)(!!this.baseSnapshotBlobs, 0x5d5 /* no snapshot blobs */);
|
|
656
|
+
const pendingRuntimeState = await this.runtime.getPendingLocalState(props);
|
|
657
|
+
const pendingState = {
|
|
658
|
+
pendingRuntimeState,
|
|
659
|
+
baseSnapshot: this.baseSnapshot,
|
|
660
|
+
snapshotBlobs: this.baseSnapshotBlobs,
|
|
661
|
+
savedOps: this.savedOps,
|
|
662
|
+
url: this.resolvedUrl.url,
|
|
663
|
+
term: protocol_1.OnlyValidTermValue,
|
|
664
|
+
// no need to save this if there is no pending runtime state
|
|
665
|
+
clientId: pendingRuntimeState !== undefined ? this.clientId : undefined,
|
|
666
|
+
};
|
|
667
|
+
return JSON.stringify(pendingState);
|
|
668
|
+
});
|
|
661
669
|
}
|
|
662
670
|
get attachState() {
|
|
663
671
|
return this._attachState;
|
|
664
672
|
}
|
|
665
673
|
serialize() {
|
|
666
|
-
(0,
|
|
674
|
+
(0, core_utils_1.assert)(this.attachState === container_definitions_1.AttachState.Detached, 0x0d3 /* "Should only be called in detached container" */);
|
|
667
675
|
const appSummary = this.runtime.createSummary();
|
|
668
676
|
const protocolSummary = this.captureProtocolSummary();
|
|
669
677
|
const combinedSummary = (0, utils_1.combineAppAndProtocolSummary)(appSummary, protocolSummary);
|
|
@@ -682,12 +690,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
682
690
|
throw new telemetry_utils_1.UsageError(`The Container is not in a valid state for attach [${this._lifecycleState}]`);
|
|
683
691
|
}
|
|
684
692
|
// If container is already attached or attach is in progress, throw an error.
|
|
685
|
-
(0,
|
|
693
|
+
(0, core_utils_1.assert)(this._attachState === container_definitions_1.AttachState.Detached && !this.attachStarted, 0x205 /* "attach() called more than once" */);
|
|
686
694
|
this.attachStarted = true;
|
|
687
695
|
// If attachment blobs were uploaded in detached state we will go through a different attach flow
|
|
688
696
|
const hasAttachmentBlobs = this.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0;
|
|
689
697
|
try {
|
|
690
|
-
(0,
|
|
698
|
+
(0, core_utils_1.assert)(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
|
|
691
699
|
let summary;
|
|
692
700
|
if (!hasAttachmentBlobs) {
|
|
693
701
|
// Get the document state post attach - possibly can just call attach but we need to change the
|
|
@@ -712,7 +720,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
712
720
|
// Actually go and create the resolved document
|
|
713
721
|
if (this.service === undefined) {
|
|
714
722
|
const createNewResolvedUrl = await this.urlResolver.resolve(request);
|
|
715
|
-
(0,
|
|
723
|
+
(0, core_utils_1.assert)(this.client.details.type !== summarizerClientType &&
|
|
716
724
|
createNewResolvedUrl !== undefined, 0x2c4 /* "client should not be summarizer before container is created" */);
|
|
717
725
|
this.service = await (0, driver_utils_1.runWithRetry)(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger, false), "containerAttach", this.mc.logger, {
|
|
718
726
|
cancel: this._deltaManager.closeAbortController.signal,
|
|
@@ -721,7 +729,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
721
729
|
await this.storageAdapter.connectToService(this.service);
|
|
722
730
|
if (hasAttachmentBlobs) {
|
|
723
731
|
// upload blobs to storage
|
|
724
|
-
(0,
|
|
732
|
+
(0, core_utils_1.assert)(!!this.detachedBlobStorage, 0x24e /* "assertion for type narrowing" */);
|
|
725
733
|
// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to
|
|
726
734
|
// support blob handles that only know about the local IDs
|
|
727
735
|
const redirectTable = new Map();
|
|
@@ -782,7 +790,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
782
790
|
if (currentMode === mode) {
|
|
783
791
|
return;
|
|
784
792
|
}
|
|
785
|
-
const now =
|
|
793
|
+
const now = client_utils_1.performance.now();
|
|
786
794
|
const duration = now - this.setAutoReconnectTime;
|
|
787
795
|
this.setAutoReconnectTime = now;
|
|
788
796
|
this.mc.logger.sendTelemetryEvent({
|
|
@@ -811,8 +819,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
811
819
|
}
|
|
812
820
|
}
|
|
813
821
|
connectInternal(args) {
|
|
814
|
-
(0,
|
|
815
|
-
(0,
|
|
822
|
+
(0, core_utils_1.assert)(!this.closed, 0x2c5 /* "Attempting to connect() a closed Container" */);
|
|
823
|
+
(0, core_utils_1.assert)(this._attachState === container_definitions_1.AttachState.Attached, 0x2c6 /* "Attempting to connect() a container that is not attached" */);
|
|
816
824
|
// Resume processing ops and connect to delta stream
|
|
817
825
|
this.resumeInternal(args);
|
|
818
826
|
// Set Auto Reconnect Mode
|
|
@@ -828,13 +836,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
828
836
|
}
|
|
829
837
|
}
|
|
830
838
|
disconnectInternal(reason) {
|
|
831
|
-
(0,
|
|
839
|
+
(0, core_utils_1.assert)(!this.closed, 0x2c7 /* "Attempting to disconnect() a closed Container" */);
|
|
832
840
|
// Set Auto Reconnect Mode
|
|
833
841
|
const mode = contracts_1.ReconnectMode.Disabled;
|
|
834
842
|
this.setAutoReconnectInternal(mode, reason);
|
|
835
843
|
}
|
|
836
844
|
resumeInternal(args) {
|
|
837
|
-
(0,
|
|
845
|
+
(0, core_utils_1.assert)(!this.closed, 0x0d9 /* "Attempting to connect() a closed DeltaManager" */);
|
|
838
846
|
// Resume processing ops
|
|
839
847
|
if (this.inboundQueuePausedFromInit) {
|
|
840
848
|
this.inboundQueuePausedFromInit = false;
|
|
@@ -922,7 +930,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
922
930
|
* @param specifiedVersion - Version SHA to load snapshot. If not specified, will fetch the latest snapshot.
|
|
923
931
|
*/
|
|
924
932
|
async load(specifiedVersion, loadMode, resolvedUrl, pendingLocalState, loadToSequenceNumber) {
|
|
925
|
-
const timings = { phase1:
|
|
933
|
+
const timings = { phase1: client_utils_1.performance.now() };
|
|
926
934
|
this.service = await this.serviceFactory.createDocumentService(resolvedUrl, this.subLogger, this.client.details.type === summarizerClientType);
|
|
927
935
|
// Ideally we always connect as "read" by default.
|
|
928
936
|
// Currently that works with SPO & r11s, because we get "write" connection when connecting to non-existing file.
|
|
@@ -953,7 +961,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
953
961
|
});
|
|
954
962
|
}
|
|
955
963
|
this._attachState = container_definitions_1.AttachState.Attached;
|
|
956
|
-
timings.phase2 =
|
|
964
|
+
timings.phase2 = client_utils_1.performance.now();
|
|
957
965
|
// Fetch specified snapshot.
|
|
958
966
|
const { snapshot, versionId } = pendingLocalState === undefined
|
|
959
967
|
? await this.fetchSnapshotTree(specifiedVersion)
|
|
@@ -963,7 +971,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
963
971
|
this.baseSnapshotBlobs = pendingLocalState.snapshotBlobs;
|
|
964
972
|
}
|
|
965
973
|
else {
|
|
966
|
-
(0,
|
|
974
|
+
(0, core_utils_1.assert)(snapshot !== undefined, 0x237 /* "Snapshot should exist" */);
|
|
967
975
|
if (this.offlineLoadEnabled) {
|
|
968
976
|
this.baseSnapshot = snapshot;
|
|
969
977
|
// Save contents of snapshot now, otherwise closeAndGetPendingLocalState() must be async
|
|
@@ -978,7 +986,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
978
986
|
if (loadMode.pauseAfterLoad === true) {
|
|
979
987
|
// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.
|
|
980
988
|
if (loadMode.opsBeforeReturn === "sequenceNumber") {
|
|
981
|
-
(0,
|
|
989
|
+
(0, core_utils_1.assert)(loadToSequenceNumber !== undefined, 0x727 /* sequenceNumber should be defined */);
|
|
982
990
|
// Note: It is possible that we think the latest snapshot is newer than the specified sequence number
|
|
983
991
|
// due to saved ops that may be replayed after the snapshot.
|
|
984
992
|
// https://dev.azure.com/fluidframework/internal/_workitems/edit/5055
|
|
@@ -1031,12 +1039,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1031
1039
|
opsBeforeReturnP = this.attachDeltaManagerOpHandler(dmAttributes, loadMode.opsBeforeReturn);
|
|
1032
1040
|
break;
|
|
1033
1041
|
default:
|
|
1034
|
-
(0,
|
|
1042
|
+
(0, core_utils_1.unreachableCase)(loadMode.opsBeforeReturn);
|
|
1035
1043
|
}
|
|
1036
1044
|
// ...load in the existing quorum
|
|
1037
1045
|
// Initialize the protocol handler
|
|
1038
1046
|
await this.initializeProtocolStateFromSnapshot(attributes, this.storageAdapter, snapshot);
|
|
1039
|
-
timings.phase3 =
|
|
1047
|
+
timings.phase3 = client_utils_1.performance.now();
|
|
1040
1048
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
1041
1049
|
await this.instantiateRuntime(codeDetails, snapshot,
|
|
1042
1050
|
// give runtime a dummy value so it knows we're loading from a stash blob
|
|
@@ -1085,11 +1093,11 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1085
1093
|
}
|
|
1086
1094
|
// Internal context is fully loaded at this point
|
|
1087
1095
|
this.setLoaded();
|
|
1088
|
-
timings.end =
|
|
1096
|
+
timings.end = client_utils_1.performance.now();
|
|
1089
1097
|
this.subLogger.sendTelemetryEvent({
|
|
1090
1098
|
eventName: "LoadStagesTimings",
|
|
1091
1099
|
details: JSON.stringify(timings),
|
|
1092
|
-
}, undefined,
|
|
1100
|
+
}, undefined, core_interfaces_1.LogLevel.verbose);
|
|
1093
1101
|
return {
|
|
1094
1102
|
sequenceNumber: attributes.sequenceNumber,
|
|
1095
1103
|
version: versionId,
|
|
@@ -1116,7 +1124,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1116
1124
|
}
|
|
1117
1125
|
async rehydrateDetachedFromSnapshot(detachedContainerSnapshot) {
|
|
1118
1126
|
if (detachedContainerSnapshot.tree[".hasAttachmentBlobs"] !== undefined) {
|
|
1119
|
-
(0,
|
|
1127
|
+
(0, core_utils_1.assert)(!!this.detachedBlobStorage && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
|
|
1120
1128
|
delete detachedContainerSnapshot.tree[".hasAttachmentBlobs"];
|
|
1121
1129
|
}
|
|
1122
1130
|
const snapshotTree = (0, utils_1.getSnapshotTreeFromSerializedContainer)(detachedContainerSnapshot);
|
|
@@ -1272,7 +1280,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1272
1280
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1273
1281
|
deltaManager.inboundSignal.pause();
|
|
1274
1282
|
deltaManager.on("connect", (details, _opsBehind) => {
|
|
1275
|
-
(0,
|
|
1283
|
+
(0, core_utils_1.assert)(this.connectionMode === details.mode, 0x4b7 /* mismatch */);
|
|
1276
1284
|
this.connectionStateHandler.receivedConnectEvent(details);
|
|
1277
1285
|
});
|
|
1278
1286
|
deltaManager.on("establishingConnection", (reason) => {
|
|
@@ -1318,7 +1326,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1318
1326
|
}
|
|
1319
1327
|
logConnectionStateChangeTelemetry(value, oldState, reason) {
|
|
1320
1328
|
// Log actual event
|
|
1321
|
-
const time =
|
|
1329
|
+
const time = client_utils_1.performance.now();
|
|
1322
1330
|
this.connectionTransitionTimes[value] = time;
|
|
1323
1331
|
const duration = time - this.connectionTransitionTimes[oldState];
|
|
1324
1332
|
let durationFromDisconnected;
|
|
@@ -1359,7 +1367,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1359
1367
|
opsBehind,
|
|
1360
1368
|
online: driver_utils_1.OnlineStatus[(0, driver_utils_1.isOnline)()],
|
|
1361
1369
|
lastVisible: this.lastVisible !== undefined
|
|
1362
|
-
?
|
|
1370
|
+
? client_utils_1.performance.now() - this.lastVisible
|
|
1363
1371
|
: undefined,
|
|
1364
1372
|
checkpointSequenceNumber,
|
|
1365
1373
|
quorumSize: this._protocolHandler?.quorum.getMembers().size,
|
|
@@ -1445,13 +1453,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1445
1453
|
// That means that if relay service changes settings, such changes will impact only newly booted
|
|
1446
1454
|
// clients.
|
|
1447
1455
|
// All existing will continue to use settings they got earlier.
|
|
1448
|
-
(0,
|
|
1456
|
+
(0, core_utils_1.assert)(serviceConfiguration !== undefined, 0x2e4 /* "there should be service config for active connection" */);
|
|
1449
1457
|
this.noopHeuristic = new noopHeuristic_1.NoopHeuristic(serviceConfiguration.noopTimeFrequency, serviceConfiguration.noopCountFrequency);
|
|
1450
1458
|
this.noopHeuristic.on("wantsNoop", () => {
|
|
1451
1459
|
// On disconnect we notify the heuristic which should prevent it from wanting a noop.
|
|
1452
1460
|
// Hitting this assert would imply we lost activeConnection between notifying the heuristic of a processed message and
|
|
1453
1461
|
// running the microtask that the heuristic queued in response.
|
|
1454
|
-
(0,
|
|
1462
|
+
(0, core_utils_1.assert)(this.activeConnection(), 0x241 /* "Trying to send noop without active connection" */);
|
|
1455
1463
|
this.submitMessage(protocol_definitions_1.MessageType.NoOp);
|
|
1456
1464
|
});
|
|
1457
1465
|
}
|
|
@@ -1499,7 +1507,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1499
1507
|
return { snapshot, versionId: version?.id };
|
|
1500
1508
|
}
|
|
1501
1509
|
async instantiateRuntime(codeDetails, snapshot, pendingLocalState) {
|
|
1502
|
-
(0,
|
|
1510
|
+
(0, core_utils_1.assert)(this._runtime?.disposed !== false, 0x0dd /* "Existing runtime not disposed" */);
|
|
1503
1511
|
// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
|
|
1504
1512
|
// are set. Global requests will still go directly to the loader
|
|
1505
1513
|
const maybeLoader = this.scope;
|
|
@@ -1551,7 +1559,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1551
1559
|
}
|
|
1552
1560
|
// intentional fallthrough
|
|
1553
1561
|
case "delayed":
|
|
1554
|
-
(0,
|
|
1562
|
+
(0, core_utils_1.assert)(this.inboundQueuePausedFromInit, 0x346 /* inboundQueuePausedFromInit should be true */);
|
|
1555
1563
|
this.inboundQueuePausedFromInit = false;
|
|
1556
1564
|
this._deltaManager.inbound.resume();
|
|
1557
1565
|
this._deltaManager.inboundSignal.resume();
|
|
@@ -1559,7 +1567,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1559
1567
|
case "none":
|
|
1560
1568
|
break;
|
|
1561
1569
|
default:
|
|
1562
|
-
(0,
|
|
1570
|
+
(0, core_utils_1.unreachableCase)(deltaConnectionArg);
|
|
1563
1571
|
}
|
|
1564
1572
|
}
|
|
1565
1573
|
}
|