@fluidframework/container-loader 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.253463
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/api-report/container-loader.api.md +11 -11
- package/dist/attachment.d.ts +2 -2
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +3 -3
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts +1 -1
- package/dist/audience.d.ts.map +1 -1
- 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 +1 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +41 -41
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +27 -27
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +11 -11
- package/dist/container-loader-beta.d.ts +11 -11
- package/dist/container-loader-public.d.ts +11 -11
- package/dist/container-loader-untrimmed.d.ts +11 -11
- package/dist/container.d.ts +5 -3
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +74 -73
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +5 -3
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +2 -2
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +6 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +3 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +2 -2
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts +2 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +4 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +3 -2
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +44 -44
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +5 -5
- package/dist/deltaQueue.js.map +1 -1
- package/dist/error.d.ts +3 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -5
- package/dist/error.js.map +1 -1
- package/dist/loader.d.ts +2 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +21 -21
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/dist/noopHeuristic.js +6 -6
- 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/protocol.d.ts +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +4 -4
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +1 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +7 -7
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +40 -8
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +113 -20
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -14
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +2 -2
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js +1 -1
- package/lib/attachment.js.map +1 -1
- package/lib/audience.d.ts +1 -1
- package/lib/audience.d.ts.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 +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +4 -4
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +2 -2
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container-loader-alpha.d.ts +11 -11
- package/lib/container-loader-beta.d.ts +11 -11
- package/lib/container-loader-public.d.ts +11 -11
- package/lib/container-loader-untrimmed.d.ts +11 -11
- package/lib/container.d.ts +5 -3
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +5 -4
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +5 -3
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +2 -2
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +2 -2
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +3 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts +2 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +1 -1
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +3 -2
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +4 -4
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +1 -1
- package/lib/deltaQueue.js.map +1 -1
- package/lib/error.d.ts +3 -2
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +2 -2
- package/lib/error.js.map +1 -1
- package/lib/loader.d.ts +2 -2
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +2 -2
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +2 -2
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/lib/noopHeuristic.js +2 -2
- 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/protocol.d.ts +1 -1
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -1
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +4 -4
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +1 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +3 -3
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +40 -8
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +107 -15
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/utils.d.ts +2 -2
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +3 -3
- package/lib/utils.js.map +1 -1
- package/package.json +13 -25
- package/src/attachment.ts +4 -3
- package/src/audience.ts +2 -2
- package/src/catchUpMonitor.ts +1 -1
- package/src/connectionManager.ts +7 -7
- package/src/connectionStateHandler.ts +4 -4
- package/src/container.ts +14 -12
- package/src/containerContext.ts +8 -5
- package/src/containerStorageAdapter.ts +5 -4
- package/src/contracts.ts +2 -3
- package/src/debugLogger.ts +2 -3
- package/src/deltaManager.ts +14 -8
- package/src/deltaQueue.ts +1 -1
- package/src/error.ts +5 -4
- package/src/loader.ts +5 -4
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +3 -3
- package/src/noopHeuristic.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -2
- package/src/protocolTreeDocumentStorageService.ts +4 -1
- package/src/quorum.ts +1 -1
- package/src/retriableDocumentStorageService.ts +5 -4
- package/src/serializedStateManager.ts +167 -18
- package/src/utils.ts +6 -4
- package/lib/test/attachment.spec.js +0 -380
- package/lib/test/attachment.spec.js.map +0 -1
- package/lib/test/catchUpMonitor.spec.js +0 -88
- package/lib/test/catchUpMonitor.spec.js.map +0 -1
- package/lib/test/connectionManager.spec.js +0 -201
- package/lib/test/connectionManager.spec.js.map +0 -1
- package/lib/test/connectionStateHandler.spec.js +0 -555
- package/lib/test/connectionStateHandler.spec.js.map +0 -1
- package/lib/test/container.spec.js +0 -64
- package/lib/test/container.spec.js.map +0 -1
- package/lib/test/deltaManager.spec.js +0 -405
- package/lib/test/deltaManager.spec.js.map +0 -1
- package/lib/test/loader.spec.js +0 -212
- package/lib/test/loader.spec.js.map +0 -1
- package/lib/test/locationRedirectionTests.spec.js +0 -44
- package/lib/test/locationRedirectionTests.spec.js.map +0 -1
- package/lib/test/serializedStateManager.spec.js +0 -151
- package/lib/test/serializedStateManager.spec.js.map +0 -1
- package/lib/test/snapshotConversionTest.spec.js +0 -79
- package/lib/test/snapshotConversionTest.spec.js.map +0 -1
- package/lib/test/types/validateContainerLoaderPrevious.generated.js +0 -38
- package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +0 -1
- package/lib/test/utils.spec.js +0 -96
- package/lib/test/utils.spec.js.map +0 -1
package/dist/container.js
CHANGED
|
@@ -10,11 +10,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.Container = exports.ReportIfTooLong = exports.waitContainerToCatchUp = void 0;
|
|
11
11
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
12
12
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
13
|
+
const internal_1 = require("@fluidframework/container-definitions/internal");
|
|
13
14
|
const core_interfaces_1 = require("@fluidframework/core-interfaces");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
16
|
+
const internal_3 = require("@fluidframework/driver-utils/internal");
|
|
16
17
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
17
|
-
const
|
|
18
|
+
const internal_4 = require("@fluidframework/telemetry-utils/internal");
|
|
18
19
|
const structured_clone_1 = __importDefault(require("@ungap/structured-clone"));
|
|
19
20
|
const uuid_1 = require("uuid");
|
|
20
21
|
const attachment_js_1 = require("./attachment.js");
|
|
@@ -57,7 +58,7 @@ const packageNotFactoryError = "Code package does not implement IRuntimeFactory"
|
|
|
57
58
|
async function waitContainerToCatchUp(container) {
|
|
58
59
|
// Make sure we stop waiting if container is closed.
|
|
59
60
|
if (container.closed) {
|
|
60
|
-
throw new
|
|
61
|
+
throw new internal_4.UsageError("waitContainerToCatchUp: Container closed");
|
|
61
62
|
}
|
|
62
63
|
return new Promise((resolve, reject) => {
|
|
63
64
|
const deltaManager = container.deltaManager;
|
|
@@ -65,8 +66,8 @@ async function waitContainerToCatchUp(container) {
|
|
|
65
66
|
container.off("closed", closedCallback);
|
|
66
67
|
const baseMessage = "Container closed while waiting to catch up";
|
|
67
68
|
reject(err !== undefined
|
|
68
|
-
? (0,
|
|
69
|
-
: new
|
|
69
|
+
? (0, internal_4.wrapError)(err, (innerMessage) => new internal_4.GenericError(`${baseMessage}: ${innerMessage}`))
|
|
70
|
+
: new internal_4.GenericError(baseMessage));
|
|
70
71
|
};
|
|
71
72
|
container.on("closed", closedCallback);
|
|
72
73
|
// Depending on config, transition to "connected" state may include the guarantee
|
|
@@ -74,11 +75,11 @@ async function waitContainerToCatchUp(container) {
|
|
|
74
75
|
// Waiting for "connected" state in either case gets us at least to our own Join op
|
|
75
76
|
// which is a reasonable approximation of "caught up"
|
|
76
77
|
const waitForOps = () => {
|
|
77
|
-
(0,
|
|
78
|
+
(0, internal_2.assert)(container.connectionState === connectionState_js_1.ConnectionState.CatchingUp ||
|
|
78
79
|
container.connectionState === connectionState_js_1.ConnectionState.Connected, 0x0cd /* "Container disconnected while waiting for ops!" */);
|
|
79
80
|
const hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber;
|
|
80
81
|
const connectionOpSeqNumber = deltaManager.lastKnownSeqNumber;
|
|
81
|
-
(0,
|
|
82
|
+
(0, internal_2.assert)(deltaManager.lastSequenceNumber <= connectionOpSeqNumber, 0x266 /* "lastKnownSeqNumber should never be below last processed sequence number" */);
|
|
82
83
|
if (deltaManager.lastSequenceNumber === connectionOpSeqNumber) {
|
|
83
84
|
container.off("closed", closedCallback);
|
|
84
85
|
resolve(hasCheckpointSequenceNumber);
|
|
@@ -102,10 +103,10 @@ async function waitContainerToCatchUp(container) {
|
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
const callback = () => {
|
|
105
|
-
container.off(
|
|
106
|
+
container.off(internal_4.connectedEventName, callback);
|
|
106
107
|
waitForOps();
|
|
107
108
|
};
|
|
108
|
-
container.on(
|
|
109
|
+
container.on(internal_4.connectedEventName, callback);
|
|
109
110
|
if (container.connectionState === connectionState_js_1.ConnectionState.Disconnected) {
|
|
110
111
|
container.connect();
|
|
111
112
|
}
|
|
@@ -120,7 +121,7 @@ const getCodeProposal = (quorum) => quorum.get("code") ?? quorum.get("code2");
|
|
|
120
121
|
* @param action - functor to call and measure
|
|
121
122
|
*/
|
|
122
123
|
async function ReportIfTooLong(logger, eventName, action) {
|
|
123
|
-
const event =
|
|
124
|
+
const event = internal_4.PerformanceEvent.start(logger, { eventName });
|
|
124
125
|
const props = await action();
|
|
125
126
|
if (event.duration > 200) {
|
|
126
127
|
event.end(props);
|
|
@@ -128,7 +129,7 @@ async function ReportIfTooLong(logger, eventName, action) {
|
|
|
128
129
|
}
|
|
129
130
|
exports.ReportIfTooLong = ReportIfTooLong;
|
|
130
131
|
const summarizerClientType = "summarizer";
|
|
131
|
-
class Container extends
|
|
132
|
+
class Container extends internal_4.EventEmitterWithErrorHandling {
|
|
132
133
|
/**
|
|
133
134
|
* Load an existing container.
|
|
134
135
|
*/
|
|
@@ -136,7 +137,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
136
137
|
const { version, pendingLocalState, loadMode, resolvedUrl, loadToSequenceNumber } = loadProps;
|
|
137
138
|
const container = new Container(createProps, loadProps);
|
|
138
139
|
const disableRecordHeapSize = container.mc.config.getBoolean("Fluid.Loader.DisableRecordHeapSize");
|
|
139
|
-
return
|
|
140
|
+
return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "Load" }, async (event) => new Promise((resolve, reject) => {
|
|
140
141
|
const defaultMode = { opsBeforeReturn: "cached" };
|
|
141
142
|
// if we have pendingLocalState, anything we cached is not useful and we shouldn't wait for connection
|
|
142
143
|
// to return container, so ignore this value and use undefined for opsBeforeReturn
|
|
@@ -145,7 +146,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
145
146
|
: loadMode ?? defaultMode;
|
|
146
147
|
const onClosed = (err) => {
|
|
147
148
|
// pre-0.58 error message: containerClosedWithoutErrorDuringLoad
|
|
148
|
-
reject(err ?? new
|
|
149
|
+
reject(err ?? new internal_4.GenericError("Container closed without error during load"));
|
|
149
150
|
};
|
|
150
151
|
container.on("closed", onClosed);
|
|
151
152
|
container
|
|
@@ -157,7 +158,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
157
158
|
event.end({ ...props, ...loadMode });
|
|
158
159
|
resolve(container);
|
|
159
160
|
}, (error) => {
|
|
160
|
-
const err = (0,
|
|
161
|
+
const err = (0, internal_4.normalizeError)(error);
|
|
161
162
|
// Depending where error happens, we can be attempting to connect to web socket
|
|
162
163
|
// and continuously retrying (consider offline mode)
|
|
163
164
|
// Host has no container to close, so it's prudent to do it here
|
|
@@ -175,7 +176,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
175
176
|
*/
|
|
176
177
|
static async createDetached(createProps, codeDetails) {
|
|
177
178
|
const container = new Container(createProps);
|
|
178
|
-
return
|
|
179
|
+
return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "CreateDetached" }, async (_event) => {
|
|
179
180
|
await container.createDetached(codeDetails);
|
|
180
181
|
return container;
|
|
181
182
|
}, { start: true, end: true, cancel: "generic" });
|
|
@@ -186,7 +187,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
186
187
|
*/
|
|
187
188
|
static async rehydrateDetachedFromSnapshot(createProps, snapshot) {
|
|
188
189
|
const container = new Container(createProps);
|
|
189
|
-
return
|
|
190
|
+
return internal_4.PerformanceEvent.timedExecAsync(container.mc.logger, { eventName: "RehydrateDetachedFromSnapshot" }, async (_event) => {
|
|
190
191
|
const detachedContainerState = (0, utils_js_1.getDetachedContainerStateFromSerializedContainer)(snapshot);
|
|
191
192
|
await container.rehydrateDetachedFromSnapshot(detachedContainerState);
|
|
192
193
|
return container;
|
|
@@ -315,14 +316,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
315
316
|
*/
|
|
316
317
|
async getEntryPoint() {
|
|
317
318
|
if (this._disposed) {
|
|
318
|
-
throw new
|
|
319
|
+
throw new internal_4.UsageError("The context is already disposed");
|
|
319
320
|
}
|
|
320
321
|
if (this._runtime !== undefined) {
|
|
321
322
|
return this._runtime.getEntryPoint?.();
|
|
322
323
|
}
|
|
323
324
|
return new Promise((resolve, reject) => {
|
|
324
325
|
const runtimeInstantiatedHandler = () => {
|
|
325
|
-
(0,
|
|
326
|
+
(0, internal_2.assert)(this._runtime !== undefined, 0x5a3 /* runtimeInstantiated fired but runtime is still undefined */);
|
|
326
327
|
resolve(this._runtime.getEntryPoint?.());
|
|
327
328
|
this._lifecycleEvents.off("disposed", disposedHandler);
|
|
328
329
|
};
|
|
@@ -369,14 +370,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
369
370
|
this._lifecycleEvents = new client_utils_1.TypedEventEmitter();
|
|
370
371
|
this._disposed = false;
|
|
371
372
|
this.attach = (0, utils_js_1.runSingle)(async (request, attachProps) => {
|
|
372
|
-
await
|
|
373
|
+
await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Attach" }, async () => {
|
|
373
374
|
if (this._lifecycleState !== "loaded" ||
|
|
374
375
|
this.attachmentData.state === container_definitions_1.AttachState.Attached) {
|
|
375
376
|
// pre-0.58 error message: containerNotValidForAttach
|
|
376
|
-
throw new
|
|
377
|
+
throw new internal_4.UsageError(`The Container is not in a valid state for attach [${this._lifecycleState}] and [${this.attachState}]`);
|
|
377
378
|
}
|
|
378
379
|
const normalizeErrorAndClose = (error) => {
|
|
379
|
-
const newError = (0,
|
|
380
|
+
const newError = (0, internal_4.normalizeError)(error);
|
|
380
381
|
this.close(newError);
|
|
381
382
|
// add resolved URL on error object so that host has the ability to find this document and delete it
|
|
382
383
|
newError.addTelemetryProperties({
|
|
@@ -400,7 +401,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
400
401
|
};
|
|
401
402
|
const createAttachmentSummary = (redirectTable) => {
|
|
402
403
|
try {
|
|
403
|
-
(0,
|
|
404
|
+
(0, internal_2.assert)(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */);
|
|
404
405
|
return (0, utils_js_1.combineAppAndProtocolSummary)(this.runtime.createSummary(redirectTable), this.captureProtocolSummary());
|
|
405
406
|
}
|
|
406
407
|
catch (error) {
|
|
@@ -411,9 +412,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
411
412
|
// Actually go and create the resolved document
|
|
412
413
|
if (this.service === undefined) {
|
|
413
414
|
const createNewResolvedUrl = await this.urlResolver.resolve(request);
|
|
414
|
-
(0,
|
|
415
|
+
(0, internal_2.assert)(this.client.details.type !== summarizerClientType &&
|
|
415
416
|
createNewResolvedUrl !== undefined, 0x2c4 /* "client should not be summarizer before container is created" */);
|
|
416
|
-
this.service = await (0,
|
|
417
|
+
this.service = await (0, internal_3.runWithRetry)(async () => this.serviceFactory.createContainer(summary, createNewResolvedUrl, this.subLogger, false), "containerAttach", this.mc.logger, {
|
|
417
418
|
cancel: this._deltaManager.closeAbortController.signal,
|
|
418
419
|
});
|
|
419
420
|
}
|
|
@@ -493,7 +494,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
493
494
|
const clientType = `${interactive ? "interactive" : "noninteractive"}${type !== undefined && type !== "" ? `/${type}` : ""}`;
|
|
494
495
|
// Need to use the property getter for docId because for detached flow we don't have the docId initially.
|
|
495
496
|
// We assign the id later so property getter is used.
|
|
496
|
-
this.subLogger = (0,
|
|
497
|
+
this.subLogger = (0, internal_4.createChildLogger)({
|
|
497
498
|
logger: subLogger,
|
|
498
499
|
properties: {
|
|
499
500
|
all: {
|
|
@@ -528,7 +529,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
528
529
|
},
|
|
529
530
|
});
|
|
530
531
|
// Prefix all events in this file with container-loader
|
|
531
|
-
this.mc = (0,
|
|
532
|
+
this.mc = (0, internal_4.createChildMonitoringContext)({ logger: this.subLogger, namespace: "Container" });
|
|
532
533
|
this._deltaManager = this.createDeltaManager();
|
|
533
534
|
this.connectionStateHandler = (0, connectionStateHandler_js_1.createConnectionStateHandler)({
|
|
534
535
|
logger: this.mc.logger,
|
|
@@ -584,7 +585,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
584
585
|
// We expose our storage publicly, so it's possible others may call uploadSummaryWithContext() with a
|
|
585
586
|
// non-combined summary tree (in particular, ContainerRuntime.submitSummary). We'll intercept those calls
|
|
586
587
|
// using this callback and fix them up.
|
|
587
|
-
const addProtocolSummaryIfMissing = (summaryTree) => (0,
|
|
588
|
+
const addProtocolSummaryIfMissing = (summaryTree) => (0, internal_3.isCombinedAppAndProtocolSummary)(summaryTree) === true
|
|
588
589
|
? summaryTree
|
|
589
590
|
: (0, utils_js_1.combineAppAndProtocolSummary)(summaryTree, this.captureProtocolSummary());
|
|
590
591
|
// Whether the combined summary tree has been forced on by either the loader option or the monitoring context.
|
|
@@ -636,11 +637,11 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
636
637
|
this.verifyClosed();
|
|
637
638
|
}
|
|
638
639
|
verifyClosed() {
|
|
639
|
-
(0,
|
|
640
|
-
(0,
|
|
640
|
+
(0, internal_2.assert)(this.connectionState === connectionState_js_1.ConnectionState.Disconnected, 0x0cf /* "disconnect event was not raised!" */);
|
|
641
|
+
(0, internal_2.assert)(this._lifecycleState === "closed" || this._lifecycleState === "disposed", 0x314 /* Container properly closed */);
|
|
641
642
|
}
|
|
642
643
|
closeCore(error) {
|
|
643
|
-
(0,
|
|
644
|
+
(0, internal_2.assert)(!this.closed, 0x315 /* re-entrancy */);
|
|
644
645
|
try {
|
|
645
646
|
// Ensure that we raise all key events even if one of these throws
|
|
646
647
|
try {
|
|
@@ -679,7 +680,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
679
680
|
}
|
|
680
681
|
}
|
|
681
682
|
disposeCore(error) {
|
|
682
|
-
(0,
|
|
683
|
+
(0, internal_2.assert)(!this._disposed, 0x54c /* Container already disposed */);
|
|
683
684
|
this._disposed = true;
|
|
684
685
|
try {
|
|
685
686
|
// Ensure that we raise all key events even if one of these throws
|
|
@@ -735,10 +736,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
735
736
|
}
|
|
736
737
|
async getPendingLocalStateCore(props) {
|
|
737
738
|
if (this.closed || this._disposed) {
|
|
738
|
-
throw new
|
|
739
|
+
throw new internal_4.UsageError("Pending state cannot be retried if the container is closed or disposed");
|
|
739
740
|
}
|
|
740
|
-
(0,
|
|
741
|
-
(0,
|
|
741
|
+
(0, internal_2.assert)(this.attachmentData.state === container_definitions_1.AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
|
|
742
|
+
(0, internal_2.assert)(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
|
|
742
743
|
const pendingState = await this.serializedStateManager.getPendingLocalStateCore(props, this.clientId, this.runtime, this.resolvedUrl);
|
|
743
744
|
return pendingState;
|
|
744
745
|
}
|
|
@@ -747,14 +748,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
747
748
|
}
|
|
748
749
|
serialize() {
|
|
749
750
|
if (this.attachmentData.state === container_definitions_1.AttachState.Attached || this.closed) {
|
|
750
|
-
throw new
|
|
751
|
+
throw new internal_4.UsageError("Container must not be attached or closed.");
|
|
751
752
|
}
|
|
752
753
|
const attachingData = this.attachmentData.state === container_definitions_1.AttachState.Attaching ? this.attachmentData : undefined;
|
|
753
754
|
const combinedSummary = attachingData?.summary ??
|
|
754
755
|
(0, utils_js_1.combineAppAndProtocolSummary)(this.runtime.createSummary(), this.captureProtocolSummary());
|
|
755
756
|
const { baseSnapshot, snapshotBlobs } = (0, utils_js_1.getSnapshotTreeAndBlobsFromSerializedContainer)(combinedSummary);
|
|
756
757
|
const pendingRuntimeState = attachingData !== undefined ? this.runtime.getPendingLocalState() : undefined;
|
|
757
|
-
(0,
|
|
758
|
+
(0, internal_2.assert)(!(0, internal_2.isPromiseLike)(pendingRuntimeState), 0x8e3 /* should not be a promise */);
|
|
758
759
|
const detachedContainerState = {
|
|
759
760
|
attached: false,
|
|
760
761
|
baseSnapshot,
|
|
@@ -782,10 +783,10 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
782
783
|
}
|
|
783
784
|
connect() {
|
|
784
785
|
if (this.closed) {
|
|
785
|
-
throw new
|
|
786
|
+
throw new internal_4.UsageError(`The Container is closed and cannot be connected`);
|
|
786
787
|
}
|
|
787
788
|
else if (this.attachState !== container_definitions_1.AttachState.Attached) {
|
|
788
|
-
throw new
|
|
789
|
+
throw new internal_4.UsageError(`The Container is not attached and cannot be connected`);
|
|
789
790
|
}
|
|
790
791
|
else if (!this.connected) {
|
|
791
792
|
// Note: no need to fetch ops as we do it preemptively as part of DeltaManager.attachOpHandler().
|
|
@@ -798,8 +799,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
798
799
|
}
|
|
799
800
|
}
|
|
800
801
|
connectInternal(args) {
|
|
801
|
-
(0,
|
|
802
|
-
(0,
|
|
802
|
+
(0, internal_2.assert)(!this.closed, 0x2c5 /* "Attempting to connect() a closed Container" */);
|
|
803
|
+
(0, internal_2.assert)(this.attachState === container_definitions_1.AttachState.Attached, 0x2c6 /* "Attempting to connect() a container that is not attached" */);
|
|
803
804
|
// Resume processing ops and connect to delta stream
|
|
804
805
|
this.resumeInternal(args);
|
|
805
806
|
// Set Auto Reconnect Mode
|
|
@@ -808,20 +809,20 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
808
809
|
}
|
|
809
810
|
disconnect() {
|
|
810
811
|
if (this.closed) {
|
|
811
|
-
throw new
|
|
812
|
+
throw new internal_4.UsageError(`The Container is closed and cannot be disconnected`);
|
|
812
813
|
}
|
|
813
814
|
else {
|
|
814
815
|
this.disconnectInternal({ text: "DocumentDisconnect" });
|
|
815
816
|
}
|
|
816
817
|
}
|
|
817
818
|
disconnectInternal(reason) {
|
|
818
|
-
(0,
|
|
819
|
+
(0, internal_2.assert)(!this.closed, 0x2c7 /* "Attempting to disconnect() a closed Container" */);
|
|
819
820
|
// Set Auto Reconnect Mode
|
|
820
821
|
const mode = contracts_js_1.ReconnectMode.Disabled;
|
|
821
822
|
this.setAutoReconnectInternal(mode, reason);
|
|
822
823
|
}
|
|
823
824
|
resumeInternal(args) {
|
|
824
|
-
(0,
|
|
825
|
+
(0, internal_2.assert)(!this.closed, 0x0d9 /* "Attempting to connect() a closed DeltaManager" */);
|
|
825
826
|
// Resume processing ops
|
|
826
827
|
if (this.inboundQueuePausedFromInit) {
|
|
827
828
|
this.inboundQueuePausedFromInit = false;
|
|
@@ -832,7 +833,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
832
833
|
this.connectToDeltaStream(args);
|
|
833
834
|
}
|
|
834
835
|
async proposeCodeDetails(codeDetails) {
|
|
835
|
-
if (!(0,
|
|
836
|
+
if (!(0, internal_1.isFluidCodeDetails)(codeDetails)) {
|
|
836
837
|
throw new Error("Provided codeDetails are not IFluidCodeDetails");
|
|
837
838
|
}
|
|
838
839
|
if (this.codeLoader.IFluidCodeDetailsComparer) {
|
|
@@ -858,7 +859,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
858
859
|
return;
|
|
859
860
|
}
|
|
860
861
|
// pre-0.58 error message: existingContextDoesNotSatisfyIncomingProposal
|
|
861
|
-
const error = new
|
|
862
|
+
const error = new internal_4.GenericError("Existing context does not satisfy incoming proposal");
|
|
862
863
|
this.close(error);
|
|
863
864
|
}
|
|
864
865
|
/**
|
|
@@ -948,7 +949,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
948
949
|
if (loadMode.pauseAfterLoad === true) {
|
|
949
950
|
// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.
|
|
950
951
|
if (loadMode.opsBeforeReturn === "sequenceNumber") {
|
|
951
|
-
(0,
|
|
952
|
+
(0, internal_2.assert)(loadToSequenceNumber !== undefined, 0x727 /* sequenceNumber should be defined */);
|
|
952
953
|
// Note: It is possible that we think the latest snapshot is newer than the specified sequence number
|
|
953
954
|
// due to saved ops that may be replayed after the snapshot.
|
|
954
955
|
// https://dev.azure.com/fluidframework/internal/_workitems/edit/5055
|
|
@@ -1001,7 +1002,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1001
1002
|
opsBeforeReturnP = this.attachDeltaManagerOpHandler(dmAttributes, loadMode.opsBeforeReturn);
|
|
1002
1003
|
break;
|
|
1003
1004
|
default:
|
|
1004
|
-
(0,
|
|
1005
|
+
(0, internal_2.unreachableCase)(loadMode.opsBeforeReturn);
|
|
1005
1006
|
}
|
|
1006
1007
|
// ...load in the existing quorum
|
|
1007
1008
|
// Initialize the protocol handler
|
|
@@ -1010,7 +1011,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1010
1011
|
const codeDetails = this.getCodeDetailsFromQuorum();
|
|
1011
1012
|
await this.instantiateRuntime(codeDetails, baseSnapshot,
|
|
1012
1013
|
// give runtime a dummy value so it knows we're loading from a stash blob
|
|
1013
|
-
pendingLocalState ? pendingLocalState?.pendingRuntimeState ?? {} : undefined, (0,
|
|
1014
|
+
pendingLocalState ? pendingLocalState?.pendingRuntimeState ?? {} : undefined, (0, internal_3.isInstanceOfISnapshot)(baseSnapshot) ? baseSnapshot : undefined);
|
|
1014
1015
|
// replay saved ops
|
|
1015
1016
|
if (pendingLocalState) {
|
|
1016
1017
|
for (const message of pendingLocalState.savedOps) {
|
|
@@ -1028,8 +1029,8 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1028
1029
|
if (!this.closed) {
|
|
1029
1030
|
if (opsBeforeReturnP !== undefined) {
|
|
1030
1031
|
this._deltaManager.inbound.resume();
|
|
1031
|
-
await
|
|
1032
|
-
await
|
|
1032
|
+
await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOps" }, async () => opsBeforeReturnP);
|
|
1033
|
+
await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "WaitOpProcessing" }, async () => this._deltaManager.inbound.waitTillProcessingDone());
|
|
1033
1034
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1034
1035
|
this._deltaManager.inbound.pause();
|
|
1035
1036
|
}
|
|
@@ -1088,7 +1089,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1088
1089
|
}
|
|
1089
1090
|
async rehydrateDetachedFromSnapshot({ baseSnapshot, snapshotBlobs, hasAttachmentBlobs, pendingRuntimeState, }) {
|
|
1090
1091
|
if (hasAttachmentBlobs) {
|
|
1091
|
-
(0,
|
|
1092
|
+
(0, internal_2.assert)(!!this.detachedBlobStorage && this.detachedBlobStorage.size > 0, 0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */);
|
|
1092
1093
|
}
|
|
1093
1094
|
const snapshotTreeWithBlobContents = (0, utils_js_1.combineSnapshotTreeAndSnapshotBlobs)(baseSnapshot, snapshotBlobs);
|
|
1094
1095
|
this.storageAdapter.loadSnapshotFromSnapshotBlobs(snapshotBlobs);
|
|
@@ -1096,7 +1097,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1096
1097
|
await this.attachDeltaManagerOpHandler(attributes);
|
|
1097
1098
|
// Initialize the protocol handler
|
|
1098
1099
|
const baseTree = (0, utils_js_1.getProtocolSnapshotTree)(snapshotTreeWithBlobContents);
|
|
1099
|
-
const qValues = await (0,
|
|
1100
|
+
const qValues = await (0, internal_3.readAndParse)(this.storageAdapter, baseTree.blobs.quorumValues);
|
|
1100
1101
|
this.initializeProtocolState(attributes, {
|
|
1101
1102
|
members: [],
|
|
1102
1103
|
proposals: [],
|
|
@@ -1116,16 +1117,16 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1116
1117
|
const baseTree = (0, utils_js_1.getProtocolSnapshotTree)(snapshot);
|
|
1117
1118
|
[quorumSnapshot.members, quorumSnapshot.proposals, quorumSnapshot.values] =
|
|
1118
1119
|
await Promise.all([
|
|
1119
|
-
(0,
|
|
1120
|
-
(0,
|
|
1121
|
-
(0,
|
|
1120
|
+
(0, internal_3.readAndParse)(storage, baseTree.blobs.quorumMembers),
|
|
1121
|
+
(0, internal_3.readAndParse)(storage, baseTree.blobs.quorumProposals),
|
|
1122
|
+
(0, internal_3.readAndParse)(storage, baseTree.blobs.quorumValues),
|
|
1122
1123
|
]);
|
|
1123
1124
|
}
|
|
1124
1125
|
this.initializeProtocolState(attributes, quorumSnapshot);
|
|
1125
1126
|
}
|
|
1126
1127
|
initializeProtocolState(attributes, quorumSnapshot) {
|
|
1127
1128
|
const protocol = this.protocolHandlerBuilder(attributes, quorumSnapshot, (key, value) => this.submitMessage(protocol_definitions_1.MessageType.Propose, JSON.stringify({ key, value })));
|
|
1128
|
-
const protocolLogger = (0,
|
|
1129
|
+
const protocolLogger = (0, internal_4.createChildLogger)({
|
|
1129
1130
|
logger: this.subLogger,
|
|
1130
1131
|
namespace: "ProtocolHandler",
|
|
1131
1132
|
});
|
|
@@ -1141,13 +1142,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1141
1142
|
});
|
|
1142
1143
|
protocol.quorum.on("approveProposal", (sequenceNumber, key, value) => {
|
|
1143
1144
|
if (key === "code" || key === "code2") {
|
|
1144
|
-
if (!(0,
|
|
1145
|
+
if (!(0, internal_1.isFluidCodeDetails)(value)) {
|
|
1145
1146
|
this.mc.logger.sendErrorEvent({
|
|
1146
1147
|
eventName: "CodeProposalNotIFluidCodeDetails",
|
|
1147
1148
|
});
|
|
1148
1149
|
}
|
|
1149
1150
|
this.processCodeProposal().catch((error) => {
|
|
1150
|
-
const normalizedError = (0,
|
|
1151
|
+
const normalizedError = (0, internal_4.normalizeError)(error);
|
|
1151
1152
|
this.close(normalizedError);
|
|
1152
1153
|
throw error;
|
|
1153
1154
|
});
|
|
@@ -1229,14 +1230,14 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1229
1230
|
}
|
|
1230
1231
|
createDeltaManager() {
|
|
1231
1232
|
const serviceProvider = () => this.service;
|
|
1232
|
-
const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0,
|
|
1233
|
+
const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0, internal_4.createChildLogger)({ logger: this.subLogger, namespace: "DeltaManager" }), () => this.activeConnection(), (props) => new connectionManager_js_1.ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, (0, internal_4.createChildLogger)({ logger: this.subLogger, namespace: "ConnectionManager" }), props));
|
|
1233
1234
|
// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
|
|
1234
1235
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1235
1236
|
deltaManager.inbound.pause();
|
|
1236
1237
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1237
1238
|
deltaManager.inboundSignal.pause();
|
|
1238
1239
|
deltaManager.on("connect", (details, _opsBehind) => {
|
|
1239
|
-
(0,
|
|
1240
|
+
(0, internal_2.assert)(this.connectionMode === details.mode, 0x4b7 /* mismatch */);
|
|
1240
1241
|
this.connectionStateHandler.receivedConnectEvent(details);
|
|
1241
1242
|
});
|
|
1242
1243
|
deltaManager.on("establishingConnection", (reason) => {
|
|
@@ -1297,7 +1298,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1297
1298
|
if (value === connectionState_js_1.ConnectionState.Connected) {
|
|
1298
1299
|
durationFromDisconnected =
|
|
1299
1300
|
time - this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected];
|
|
1300
|
-
durationFromDisconnected = (0,
|
|
1301
|
+
durationFromDisconnected = (0, internal_4.formatTick)(durationFromDisconnected);
|
|
1301
1302
|
}
|
|
1302
1303
|
else if (value === connectionState_js_1.ConnectionState.CatchingUp) {
|
|
1303
1304
|
// This info is of most interesting while Catching Up.
|
|
@@ -1321,7 +1322,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1321
1322
|
clientId: this.clientId,
|
|
1322
1323
|
autoReconnect,
|
|
1323
1324
|
opsBehind,
|
|
1324
|
-
online:
|
|
1325
|
+
online: internal_3.OnlineStatus[(0, internal_3.isOnline)()],
|
|
1325
1326
|
lastVisible: this.lastVisible !== undefined
|
|
1326
1327
|
? client_utils_1.performance.now() - this.lastVisible
|
|
1327
1328
|
: undefined,
|
|
@@ -1347,7 +1348,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1347
1348
|
// Both protocol and context should not be undefined if we got so far.
|
|
1348
1349
|
this.setContextConnectedState(state, this.readOnlyInfo.readonly ?? false);
|
|
1349
1350
|
this.protocolHandler.setConnectionState(state, this.clientId);
|
|
1350
|
-
(0,
|
|
1351
|
+
(0, internal_4.raiseConnectedEvent)(this.mc.logger, this, state, this.clientId, disconnectedReason?.text);
|
|
1351
1352
|
}
|
|
1352
1353
|
// back-compat: ADO #1385: Remove in the future, summary op should come through submitSummaryMessage()
|
|
1353
1354
|
submitContainerMessage(type, contents, batch, metadata) {
|
|
@@ -1357,7 +1358,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1357
1358
|
case protocol_definitions_1.MessageType.Summarize:
|
|
1358
1359
|
return this.submitSummaryMessage(contents);
|
|
1359
1360
|
default: {
|
|
1360
|
-
const newError = new
|
|
1361
|
+
const newError = new internal_4.GenericError("invalidContainerSubmitOpType", undefined /* error */, { messageType: type });
|
|
1361
1362
|
this.close(newError);
|
|
1362
1363
|
return -1;
|
|
1363
1364
|
}
|
|
@@ -1407,13 +1408,13 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1407
1408
|
// That means that if relay service changes settings, such changes will impact only newly booted
|
|
1408
1409
|
// clients.
|
|
1409
1410
|
// All existing will continue to use settings they got earlier.
|
|
1410
|
-
(0,
|
|
1411
|
+
(0, internal_2.assert)(serviceConfiguration !== undefined, 0x2e4 /* "there should be service config for active connection" */);
|
|
1411
1412
|
this.noopHeuristic = new noopHeuristic_js_1.NoopHeuristic(serviceConfiguration.noopTimeFrequency, serviceConfiguration.noopCountFrequency);
|
|
1412
1413
|
this.noopHeuristic.on("wantsNoop", () => {
|
|
1413
1414
|
// On disconnect we notify the heuristic which should prevent it from wanting a noop.
|
|
1414
1415
|
// Hitting this assert would imply we lost activeConnection between notifying the heuristic of a processed message and
|
|
1415
1416
|
// running the microtask that the heuristic queued in response.
|
|
1416
|
-
(0,
|
|
1417
|
+
(0, internal_2.assert)(this.activeConnection(), 0x241 /* "Trying to send noop without active connection" */);
|
|
1417
1418
|
this.submitMessage(protocol_definitions_1.MessageType.NoOp);
|
|
1418
1419
|
});
|
|
1419
1420
|
}
|
|
@@ -1421,7 +1422,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1421
1422
|
// The contract with the protocolHandler is that returning "immediateNoOp" is equivalent to "please immediately accept the proposal I just processed".
|
|
1422
1423
|
if (result.immediateNoOp === true) {
|
|
1423
1424
|
// ADO:1385: Remove cast and use MessageType once definition changes propagate
|
|
1424
|
-
this.submitMessage(
|
|
1425
|
+
this.submitMessage(internal_3.MessageType2.Accept);
|
|
1425
1426
|
}
|
|
1426
1427
|
}
|
|
1427
1428
|
this.emit("op", message);
|
|
@@ -1441,12 +1442,12 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1441
1442
|
}
|
|
1442
1443
|
}
|
|
1443
1444
|
async instantiateRuntime(codeDetails, snapshotTree, pendingLocalState, snapshot) {
|
|
1444
|
-
(0,
|
|
1445
|
+
(0, internal_2.assert)(this._runtime?.disposed !== false, 0x0dd /* "Existing runtime not disposed" */);
|
|
1445
1446
|
// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
|
|
1446
1447
|
// are set. Global requests will still go directly to the loader
|
|
1447
1448
|
const maybeLoader = this.scope;
|
|
1448
1449
|
const loader = new loader_js_1.RelativeLoader(this, maybeLoader.ILoader);
|
|
1449
|
-
const loadCodeResult = await
|
|
1450
|
+
const loadCodeResult = await internal_4.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "CodeLoad" }, async () => this.codeLoader.load(codeDetails));
|
|
1450
1451
|
this._loadedModule = {
|
|
1451
1452
|
module: loadCodeResult.module,
|
|
1452
1453
|
// An older interface ICodeLoader could return an IFluidModule which didn't have details.
|
|
@@ -1461,7 +1462,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1461
1462
|
}
|
|
1462
1463
|
const existing = snapshotTree !== undefined;
|
|
1463
1464
|
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);
|
|
1464
|
-
this._runtime = await
|
|
1465
|
+
this._runtime = await internal_4.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
|
|
1465
1466
|
this._lifecycleEvents.emit("runtimeInstantiated");
|
|
1466
1467
|
this._loadedCodeDetails = codeDetails;
|
|
1467
1468
|
}
|
|
@@ -1491,7 +1492,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1491
1492
|
}
|
|
1492
1493
|
// intentional fallthrough
|
|
1493
1494
|
case "delayed":
|
|
1494
|
-
(0,
|
|
1495
|
+
(0, internal_2.assert)(this.inboundQueuePausedFromInit, 0x346 /* inboundQueuePausedFromInit should be true */);
|
|
1495
1496
|
this.inboundQueuePausedFromInit = false;
|
|
1496
1497
|
this._deltaManager.inbound.resume();
|
|
1497
1498
|
this._deltaManager.inboundSignal.resume();
|
|
@@ -1499,7 +1500,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1499
1500
|
case "none":
|
|
1500
1501
|
break;
|
|
1501
1502
|
default:
|
|
1502
|
-
(0,
|
|
1503
|
+
(0, internal_2.unreachableCase)(deltaConnectionArg);
|
|
1503
1504
|
}
|
|
1504
1505
|
}
|
|
1505
1506
|
}
|