@fluidframework/container-loader 2.51.0 → 2.52.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/CHANGELOG.md +4 -0
- package/dist/connectionManager.d.ts +7 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +28 -1
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts +11 -8
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +37 -22
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +49 -25
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +29 -38
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +10 -3
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +12 -3
- package/dist/containerStorageAdapter.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/serializedStateManager.d.ts +2 -2
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +5 -5
- package/dist/serializedStateManager.js.map +1 -1
- package/lib/connectionManager.d.ts +7 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +28 -1
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts +11 -8
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +37 -22
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +49 -25
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +29 -38
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +10 -3
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +12 -3
- package/lib/containerStorageAdapter.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/serializedStateManager.d.ts +2 -2
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +5 -5
- package/lib/serializedStateManager.js.map +1 -1
- package/package.json +14 -14
- package/src/connectionManager.ts +38 -0
- package/src/container.ts +50 -59
- package/src/containerContext.ts +128 -52
- package/src/containerStorageAdapter.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/serializedStateManager.ts +5 -9
package/dist/container.js
CHANGED
|
@@ -508,10 +508,14 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
508
508
|
this._dirtyContainer = dirty;
|
|
509
509
|
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
510
510
|
};
|
|
511
|
-
const { canReconnect, clientDetailsOverride, urlResolver, documentServiceFactory, codeLoader, options, scope, subLogger, protocolHandlerBuilder, } = createProps;
|
|
511
|
+
const { canReconnect, clientDetailsOverride, urlResolver, documentServiceFactory, codeLoader, options, scope, subLogger, protocolHandlerBuilder, retryConnectionTimeoutMs, } = createProps;
|
|
512
|
+
// Validate that the Driver is compatible with this Loader.
|
|
513
|
+
const maybeDriverCompatDetails = documentServiceFactory;
|
|
514
|
+
(0, loaderLayerCompatState_js_1.validateDriverCompatibility)(maybeDriverCompatDetails.ILayerCompatDetails, (error) => { } /* disposeFn */);
|
|
512
515
|
this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected] = (0, client_utils_1.performanceNow)();
|
|
513
516
|
const pendingLocalState = loadProps?.pendingLocalState;
|
|
514
517
|
this._canReconnect = canReconnect ?? true;
|
|
518
|
+
this._retryConnectionTimeoutMs = retryConnectionTimeoutMs;
|
|
515
519
|
this.clientDetailsOverride = clientDetailsOverride;
|
|
516
520
|
this.urlResolver = urlResolver;
|
|
517
521
|
this.serviceFactory = documentServiceFactory;
|
|
@@ -783,32 +787,18 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
783
787
|
this._lifecycleEvents.emit("disposed");
|
|
784
788
|
}
|
|
785
789
|
}
|
|
786
|
-
async closeAndGetPendingLocalState(stopBlobAttachingSignal) {
|
|
787
|
-
// runtime matches pending ops to successful ones by clientId and client seq num, so we need to close the
|
|
788
|
-
// container at the same time we get pending state, otherwise this container could reconnect and resubmit with
|
|
789
|
-
// a new clientId and a future container using stale pending state without the new clientId would resubmit them
|
|
790
|
-
const pendingState = await this.getPendingLocalStateCore({
|
|
791
|
-
notifyImminentClosure: true,
|
|
792
|
-
stopBlobAttachingSignal,
|
|
793
|
-
});
|
|
794
|
-
this.close();
|
|
795
|
-
return pendingState;
|
|
796
|
-
}
|
|
797
790
|
/**
|
|
798
791
|
* Serialize current container state required to rehydrate to the same position without dataloss.
|
|
799
792
|
* Note: The container must already be attached. For detached containers use {@link serialize}
|
|
800
793
|
* @returns stringified {@link IPendingContainerState} for the container
|
|
801
794
|
*/
|
|
802
795
|
async getPendingLocalState() {
|
|
803
|
-
return this.getPendingLocalStateCore({ notifyImminentClosure: false });
|
|
804
|
-
}
|
|
805
|
-
async getPendingLocalStateCore(props) {
|
|
806
796
|
if (this.closed || this._disposed) {
|
|
807
797
|
throw new internal_5.UsageError("Pending state cannot be retried if the container is closed or disposed");
|
|
808
798
|
}
|
|
809
799
|
(0, internal_2.assert)(this.attachmentData.state === container_definitions_1.AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
|
|
810
800
|
(0, internal_2.assert)(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
|
|
811
|
-
const pendingState = await this.serializedStateManager.getPendingLocalState(
|
|
801
|
+
const pendingState = await this.serializedStateManager.getPendingLocalState(this.clientId, this.runtime, this.resolvedUrl);
|
|
812
802
|
return pendingState;
|
|
813
803
|
}
|
|
814
804
|
get attachState() {
|
|
@@ -817,7 +807,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
817
807
|
/**
|
|
818
808
|
* Serialize current container state required to rehydrate to the same position without dataloss.
|
|
819
809
|
* Note: The container must be detached and not closed. For attached containers use
|
|
820
|
-
* {@link getPendingLocalState}
|
|
810
|
+
* {@link getPendingLocalState}
|
|
821
811
|
* @returns stringified {@link IPendingDetachedContainerState} for the container
|
|
822
812
|
*/
|
|
823
813
|
serialize() {
|
|
@@ -1001,9 +991,6 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1001
991
|
cancel: this._deltaManager.closeAbortController.signal,
|
|
1002
992
|
});
|
|
1003
993
|
}
|
|
1004
|
-
// Validate that the Driver is compatible with this Loader.
|
|
1005
|
-
const maybeDriverCompatDetails = service;
|
|
1006
|
-
(0, loaderLayerCompatState_js_1.validateDriverCompatibility)(maybeDriverCompatDetails.ILayerCompatDetails, (error) => this.dispose(error));
|
|
1007
994
|
return service;
|
|
1008
995
|
}
|
|
1009
996
|
/**
|
|
@@ -1287,7 +1274,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1287
1274
|
}
|
|
1288
1275
|
createDeltaManager() {
|
|
1289
1276
|
const serviceProvider = () => this.service;
|
|
1290
|
-
const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0, internal_5.createChildLogger)({ logger: this.subLogger, namespace: "DeltaManager" }), () => this.activeConnection(), (props) => new connectionManager_js_1.ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, (0, internal_5.createChildLogger)({ logger: this.subLogger, namespace: "ConnectionManager" }), props));
|
|
1277
|
+
const deltaManager = new deltaManager_js_1.DeltaManager(serviceProvider, (0, internal_5.createChildLogger)({ logger: this.subLogger, namespace: "DeltaManager" }), () => this.activeConnection(), (props) => new connectionManager_js_1.ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, (0, internal_5.createChildLogger)({ logger: this.subLogger, namespace: "ConnectionManager" }), props, this._retryConnectionTimeoutMs));
|
|
1291
1278
|
// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
|
|
1292
1279
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1293
1280
|
deltaManager.inbound.pause();
|
|
@@ -1547,7 +1534,35 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1547
1534
|
throw new Error(packageNotFactoryError);
|
|
1548
1535
|
}
|
|
1549
1536
|
const existing = snapshotTree !== undefined;
|
|
1550
|
-
const context = new containerContext_js_1.ContainerContext(
|
|
1537
|
+
const context = new containerContext_js_1.ContainerContext({
|
|
1538
|
+
options: this.options,
|
|
1539
|
+
scope: this.scope,
|
|
1540
|
+
baseSnapshot: snapshotTree,
|
|
1541
|
+
version: this._loadedFromVersion,
|
|
1542
|
+
deltaManager: this._deltaManager,
|
|
1543
|
+
storage: this.storageAdapter,
|
|
1544
|
+
quorum: this.protocolHandler.quorum,
|
|
1545
|
+
audience: this.protocolHandler.audience,
|
|
1546
|
+
loader,
|
|
1547
|
+
submitFn: (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata),
|
|
1548
|
+
submitSummaryFn: (summaryOp, referenceSequenceNumber) => this.submitSummaryMessage(summaryOp, referenceSequenceNumber),
|
|
1549
|
+
submitBatchFn: (batch, referenceSequenceNumber) => this.submitBatch(batch, referenceSequenceNumber),
|
|
1550
|
+
submitSignalFn: (content, targetClientId) => this.submitSignal(content, targetClientId),
|
|
1551
|
+
disposeFn: (error) => this.dispose(error),
|
|
1552
|
+
closeFn: (error) => this.close(error),
|
|
1553
|
+
updateDirtyContainerState: this.updateDirtyContainerState,
|
|
1554
|
+
getAbsoluteUrl: this.getAbsoluteUrl,
|
|
1555
|
+
getContainerDiagnosticId: () => this.resolvedUrl?.id,
|
|
1556
|
+
getClientId: () => this.clientId,
|
|
1557
|
+
getAttachState: () => this.attachState,
|
|
1558
|
+
getConnected: () => this.connected,
|
|
1559
|
+
getConnectionState: () => this.connectionState,
|
|
1560
|
+
clientDetails: this._deltaManager.clientDetails,
|
|
1561
|
+
existing,
|
|
1562
|
+
taggedLogger: this.subLogger,
|
|
1563
|
+
pendingLocalState,
|
|
1564
|
+
snapshotWithContents: snapshot,
|
|
1565
|
+
});
|
|
1551
1566
|
const runtime = await internal_5.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
|
|
1552
1567
|
// Validate that the Runtime is compatible with this Loader.
|
|
1553
1568
|
const maybeRuntimeCompatDetails = runtime;
|