@fluidframework/container-loader 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.cjs +3 -0
- package/CHANGELOG.md +8 -0
- package/README.md +1 -0
- package/dist/connectionManager.js +7 -7
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts +2 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +21 -18
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +6 -1
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +7 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/debugLogger.js +1 -1
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +2 -2
- package/dist/deltaQueue.js.map +1 -1
- package/dist/layerCompatState.d.ts +19 -0
- package/dist/layerCompatState.d.ts.map +1 -0
- package/dist/layerCompatState.js +64 -0
- package/dist/layerCompatState.js.map +1 -0
- package/dist/loader.js +1 -1
- 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/quorum.d.ts +0 -10
- package/dist/protocol/quorum.d.ts.map +1 -1
- package/dist/protocol/quorum.js +4 -18
- package/dist/protocol/quorum.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -4
- package/dist/utils.js.map +1 -1
- package/lib/connectionManager.js +8 -8
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts +2 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +22 -19
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +6 -1
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +7 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/debugLogger.js +2 -2
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +3 -3
- package/lib/deltaQueue.js.map +1 -1
- package/lib/layerCompatState.d.ts +19 -0
- package/lib/layerCompatState.d.ts.map +1 -0
- package/lib/layerCompatState.js +60 -0
- package/lib/layerCompatState.js.map +1 -0
- package/lib/loader.js +1 -1
- 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/quorum.d.ts +0 -10
- package/lib/protocol/quorum.d.ts.map +1 -1
- package/lib/protocol/quorum.js +4 -18
- package/lib/protocol/quorum.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +2 -4
- package/lib/utils.js.map +1 -1
- package/package.json +16 -16
- package/src/connectionManager.ts +8 -8
- package/src/container.ts +37 -23
- package/src/containerContext.ts +14 -1
- package/src/debugLogger.ts +2 -2
- package/src/deltaQueue.ts +3 -3
- package/src/layerCompatState.ts +75 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol/quorum.ts +0 -16
- package/src/utils.ts +2 -5
package/dist/container.js
CHANGED
|
@@ -29,7 +29,7 @@ const containerContext_js_1 = require("./containerContext.js");
|
|
|
29
29
|
const containerStorageAdapter_js_1 = require("./containerStorageAdapter.js");
|
|
30
30
|
const contracts_js_1 = require("./contracts.js");
|
|
31
31
|
const deltaManager_js_1 = require("./deltaManager.js");
|
|
32
|
-
|
|
32
|
+
const layerCompatState_js_1 = require("./layerCompatState.js");
|
|
33
33
|
const loader_js_1 = require("./loader.js");
|
|
34
34
|
const memoryBlobStorage_js_1 = require("./memoryBlobStorage.js");
|
|
35
35
|
const noopHeuristic_js_1 = require("./noopHeuristic.js");
|
|
@@ -415,7 +415,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
415
415
|
this.attachmentData = { state: container_definitions_1.AttachState.Detached };
|
|
416
416
|
this.clientsWhoShouldHaveLeft = new Set();
|
|
417
417
|
this._containerMetadata = {};
|
|
418
|
-
this.setAutoReconnectTime = client_utils_1.
|
|
418
|
+
this.setAutoReconnectTime = (0, client_utils_1.performanceNow)();
|
|
419
419
|
this._lifecycleEvents = new client_utils_1.TypedEventEmitter();
|
|
420
420
|
this.verifyClosedAfterCalls = 0;
|
|
421
421
|
this._disposed = false;
|
|
@@ -515,7 +515,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
515
515
|
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
516
516
|
};
|
|
517
517
|
const { canReconnect, clientDetailsOverride, urlResolver, documentServiceFactory, codeLoader, options, scope, subLogger, detachedBlobStorage, protocolHandlerBuilder, } = createProps;
|
|
518
|
-
this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected] = client_utils_1.
|
|
518
|
+
this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected] = (0, client_utils_1.performanceNow)();
|
|
519
519
|
const pendingLocalState = loadProps?.pendingLocalState;
|
|
520
520
|
this._canReconnect = canReconnect ?? true;
|
|
521
521
|
this.clientDetailsOverride = clientDetailsOverride;
|
|
@@ -575,7 +575,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
575
575
|
? "null"
|
|
576
576
|
: this.deltaManager?.lastMessage?.clientId,
|
|
577
577
|
dmLastMsgClientSeq: () => this.deltaManager?.lastMessage?.clientSequenceNumber,
|
|
578
|
-
connectionStateDuration: () => client_utils_1.
|
|
578
|
+
connectionStateDuration: () => (0, client_utils_1.performanceNow)() - this.connectionTransitionTimes[this.connectionState],
|
|
579
579
|
},
|
|
580
580
|
},
|
|
581
581
|
});
|
|
@@ -608,7 +608,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
608
608
|
eventName,
|
|
609
609
|
mode,
|
|
610
610
|
category: this._lifecycleState === "loading" ? "generic" : category,
|
|
611
|
-
duration: client_utils_1.
|
|
611
|
+
duration: (0, client_utils_1.performanceNow)() - this.connectionTransitionTimes[connectionState_js_1.ConnectionState.CatchingUp],
|
|
612
612
|
...(details === undefined ? {} : { details: JSON.stringify(details) }),
|
|
613
613
|
});
|
|
614
614
|
// This assert is important for many reasons:
|
|
@@ -648,9 +648,9 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
648
648
|
const addProtocolSummaryIfMissing = (summaryTree) => (0, internal_4.isCombinedAppAndProtocolSummary)(summaryTree) === true
|
|
649
649
|
? summaryTree
|
|
650
650
|
: (0, utils_js_1.combineAppAndProtocolSummary)(summaryTree, this.captureProtocolSummary());
|
|
651
|
-
//
|
|
652
|
-
|
|
653
|
-
|
|
651
|
+
// Feature gate to enable single-commit summaries. The expected enablement is through driver layer's policies,
|
|
652
|
+
// but here we also specify config setting to use for testing purposes.
|
|
653
|
+
const enableSummarizeProtocolTree = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree2");
|
|
654
654
|
this.detachedBlobStorage =
|
|
655
655
|
detachedBlobStorage ??
|
|
656
656
|
(this.mc.config.getBoolean("Fluid.Container.MemoryBlobStorageEnabled") === true
|
|
@@ -667,10 +667,10 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
667
667
|
document.addEventListener !== null;
|
|
668
668
|
// keep track of last time page was visible for telemetry (on interactive clients only)
|
|
669
669
|
if (isDomAvailable && interactive) {
|
|
670
|
-
this.lastVisible = document.hidden ? client_utils_1.
|
|
670
|
+
this.lastVisible = document.hidden ? (0, client_utils_1.performanceNow)() : undefined;
|
|
671
671
|
this.visibilityEventHandler = () => {
|
|
672
672
|
if (document.hidden) {
|
|
673
|
-
this.lastVisible = client_utils_1.
|
|
673
|
+
this.lastVisible = (0, client_utils_1.performanceNow)();
|
|
674
674
|
}
|
|
675
675
|
else {
|
|
676
676
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
@@ -852,7 +852,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
852
852
|
if (currentMode === mode) {
|
|
853
853
|
return;
|
|
854
854
|
}
|
|
855
|
-
const now = client_utils_1.
|
|
855
|
+
const now = (0, client_utils_1.performanceNow)();
|
|
856
856
|
const duration = now - this.setAutoReconnectTime;
|
|
857
857
|
this.setAutoReconnectTime = now;
|
|
858
858
|
this.mc.logger.sendTelemetryEvent({
|
|
@@ -1001,7 +1001,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1001
1001
|
* @param specifiedVersion - Version SHA to load snapshot. If not specified, will fetch the latest snapshot.
|
|
1002
1002
|
*/
|
|
1003
1003
|
async load(specifiedVersion, loadMode, resolvedUrl, pendingLocalState) {
|
|
1004
|
-
const timings = { phase1: client_utils_1.
|
|
1004
|
+
const timings = { phase1: (0, client_utils_1.performanceNow)() };
|
|
1005
1005
|
this.service = await this.createDocumentService(async () => this.serviceFactory.createDocumentService(resolvedUrl, this.subLogger, this.client.details.type === summarizerClientType));
|
|
1006
1006
|
// Except in cases where it has stashed ops or requested by feature gate, the container will connect in "read" mode
|
|
1007
1007
|
const mode = this.mc.config.getBoolean("Fluid.Container.ForceWriteConnection") === true ||
|
|
@@ -1022,7 +1022,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1022
1022
|
this.attachmentData = {
|
|
1023
1023
|
state: container_definitions_1.AttachState.Attached,
|
|
1024
1024
|
};
|
|
1025
|
-
timings.phase2 = client_utils_1.
|
|
1025
|
+
timings.phase2 = (0, client_utils_1.performanceNow)();
|
|
1026
1026
|
// Fetch specified snapshot.
|
|
1027
1027
|
const { baseSnapshot, version } = await this.serializedStateManager.fetchSnapshot(specifiedVersion);
|
|
1028
1028
|
const baseSnapshotTree = (0, internal_4.getSnapshotTree)(baseSnapshot);
|
|
@@ -1059,7 +1059,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1059
1059
|
if (pendingLocalState?.clientId !== undefined) {
|
|
1060
1060
|
this.protocolHandler.audience.setCurrentClientId(pendingLocalState?.clientId);
|
|
1061
1061
|
}
|
|
1062
|
-
timings.phase3 = client_utils_1.
|
|
1062
|
+
timings.phase3 = (0, client_utils_1.performanceNow)();
|
|
1063
1063
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
1064
1064
|
await this.instantiateRuntime(codeDetails, baseSnapshotTree,
|
|
1065
1065
|
// give runtime a dummy value so it knows we're loading from a stash blob
|
|
@@ -1101,7 +1101,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1101
1101
|
if (this.closed) {
|
|
1102
1102
|
throw new Error("Container was closed while load()");
|
|
1103
1103
|
}
|
|
1104
|
-
timings.end = client_utils_1.
|
|
1104
|
+
timings.end = (0, client_utils_1.performanceNow)();
|
|
1105
1105
|
this.subLogger.sendTelemetryEvent({
|
|
1106
1106
|
eventName: "LoadStagesTimings",
|
|
1107
1107
|
details: JSON.stringify(timings),
|
|
@@ -1350,7 +1350,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
logConnectionStateChangeTelemetry(value, oldState, reason) {
|
|
1352
1352
|
// Log actual event
|
|
1353
|
-
const time = client_utils_1.
|
|
1353
|
+
const time = (0, client_utils_1.performanceNow)();
|
|
1354
1354
|
this.connectionTransitionTimes[value] = time;
|
|
1355
1355
|
const duration = time - this.connectionTransitionTimes[oldState];
|
|
1356
1356
|
let durationFromDisconnected;
|
|
@@ -1387,7 +1387,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1387
1387
|
autoReconnect,
|
|
1388
1388
|
opsBehind,
|
|
1389
1389
|
online: internal_4.OnlineStatus[(0, internal_4.isOnline)()],
|
|
1390
|
-
lastVisible: this.lastVisible === undefined ? undefined : client_utils_1.
|
|
1390
|
+
lastVisible: this.lastVisible === undefined ? undefined : (0, client_utils_1.performanceNow)() - this.lastVisible,
|
|
1391
1391
|
checkpointSequenceNumber,
|
|
1392
1392
|
quorumSize: this._protocolHandler?.quorum.getMembers().size,
|
|
1393
1393
|
audienceSize: this._protocolHandler?.audience.getMembers().size,
|
|
@@ -1535,7 +1535,10 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
const existing = snapshotTree !== undefined;
|
|
1537
1537
|
const context = new containerContext_js_1.ContainerContext(this.options, this.scope, snapshotTree, this._loadedFromVersion, this._deltaManager, this.storageAdapter, this.protocolHandler.quorum, this.protocolHandler.audience, loader, (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata), (summaryOp, referenceSequenceNumber) => this.submitSummaryMessage(summaryOp, referenceSequenceNumber), (batch, referenceSequenceNumber) => this.submitBatch(batch, referenceSequenceNumber), (content, targetClientId) => this.submitSignal(content, targetClientId), (error) => this.dispose(error), (error) => this.close(error), this.updateDirtyContainerState, this.getAbsoluteUrl, () => this.resolvedUrl?.id, () => this.clientId, () => this.attachState, () => this.connected, this._deltaManager.clientDetails, existing, this.subLogger, pendingLocalState, snapshot);
|
|
1538
|
-
|
|
1538
|
+
const runtime = await internal_5.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
|
|
1539
|
+
const maybeRuntimeCompatDetails = runtime;
|
|
1540
|
+
(0, layerCompatState_js_1.validateRuntimeCompatibility)(maybeRuntimeCompatDetails.ILayerCompatDetails, (error) => this.dispose(error));
|
|
1541
|
+
this._runtime = runtime;
|
|
1539
1542
|
this._lifecycleEvents.emit("runtimeInstantiated");
|
|
1540
1543
|
this._loadedCodeDetails = codeDetails;
|
|
1541
1544
|
}
|