@fluidframework/container-loader 2.0.0-dev.4.1.0.148229 → 2.0.0-dev.4.3.0.157531
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 +14 -0
- package/README.md +38 -0
- package/dist/connectionManager.d.ts +2 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +16 -6
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.js +2 -2
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +12 -15
- package/dist/container.js.map +1 -1
- package/dist/deltaManager.d.ts +1 -3
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +4 -9
- package/dist/deltaManager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +4 -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.d.ts +1 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +4 -2
- package/dist/protocol.js.map +1 -1
- package/lib/connectionManager.d.ts +2 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +16 -6
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +2 -2
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +13 -16
- package/lib/container.js.map +1 -1
- package/lib/deltaManager.d.ts +1 -3
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +4 -9
- package/lib/deltaManager.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +4 -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.d.ts +1 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +3 -1
- package/lib/protocol.js.map +1 -1
- package/package.json +13 -22
- package/src/connectionManager.ts +17 -7
- package/src/connectionStateHandler.ts +2 -2
- package/src/container.ts +18 -21
- package/src/deltaManager.ts +4 -11
- package/src/index.ts +1 -0
- package/src/loader.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +4 -1
package/lib/container.js
CHANGED
|
@@ -25,7 +25,7 @@ import { initQuorumValuesFromCodeDetails, getCodeDetailsFromQuorumValues, Quorum
|
|
|
25
25
|
import { CollabWindowTracker } from "./collabWindowTracker";
|
|
26
26
|
import { ConnectionManager } from "./connectionManager";
|
|
27
27
|
import { ConnectionState } from "./connectionState";
|
|
28
|
-
import { ProtocolHandler } from "./protocol";
|
|
28
|
+
import { OnlyValidTermValue, ProtocolHandler, } from "./protocol";
|
|
29
29
|
const detachedContainerRefSeqNumber = 0;
|
|
30
30
|
const dirtyContainerEvent = "dirty";
|
|
31
31
|
const savedContainerEvent = "saved";
|
|
@@ -208,6 +208,9 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
208
208
|
});
|
|
209
209
|
// Prefix all events in this file with container-loader
|
|
210
210
|
this.mc = loggerToMonitoringContext(ChildLogger.create(this.subLogger, "Container"));
|
|
211
|
+
// Warning: this is only a shallow clone. Mutation of any individual loader option will mutate it for
|
|
212
|
+
// all clients that were loaded from the same loader (including summarizer clients).
|
|
213
|
+
// Tracking alternative ways to handle this in AB#4129.
|
|
211
214
|
this.options = Object.assign({}, this.loader.services.options);
|
|
212
215
|
this._deltaManager = this.createDeltaManager();
|
|
213
216
|
this.connectionStateHandler = createConnectionStateHandler({
|
|
@@ -623,16 +626,15 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
623
626
|
assert(this.attachState === AttachState.Attached, 0x0d1 /* "Container should be attached before close" */);
|
|
624
627
|
assert(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", 0x0d2 /* "resolved url should be valid Fluid url" */);
|
|
625
628
|
assert(!!this._protocolHandler, 0x2e3 /* "Must have a valid protocol handler instance" */);
|
|
626
|
-
assert(this.
|
|
627
|
-
assert(!!this.
|
|
628
|
-
assert(!!this.baseSnapshotBlobs, "no snapshot blobs");
|
|
629
|
+
assert(!!this.baseSnapshot, 0x5d4 /* no base snapshot */);
|
|
630
|
+
assert(!!this.baseSnapshotBlobs, 0x5d5 /* no snapshot blobs */);
|
|
629
631
|
const pendingState = {
|
|
630
632
|
pendingRuntimeState: this.context.getPendingLocalState(),
|
|
631
633
|
baseSnapshot: this.baseSnapshot,
|
|
632
634
|
snapshotBlobs: this.baseSnapshotBlobs,
|
|
633
635
|
savedOps: this.savedOps,
|
|
634
636
|
url: this.resolvedUrl.url,
|
|
635
|
-
term:
|
|
637
|
+
term: OnlyValidTermValue,
|
|
636
638
|
clientId: this.clientId,
|
|
637
639
|
};
|
|
638
640
|
this.mc.logger.sendTelemetryEvent({ eventName: "CloseAndGetPendingLocalState" });
|
|
@@ -980,7 +982,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
980
982
|
}
|
|
981
983
|
pendingLocalState.savedOps = [];
|
|
982
984
|
// now set clientId to stashed clientId so live ops are correctly processed as local
|
|
983
|
-
assert(this.clientId === undefined,
|
|
985
|
+
assert(this.clientId === undefined, 0x5d6 /* Unexpected clientId when setting stashed clientId */);
|
|
984
986
|
this._clientId = pendingLocalState === null || pendingLocalState === void 0 ? void 0 : pendingLocalState.clientId;
|
|
985
987
|
}
|
|
986
988
|
// We might have hit some failure that did not manifest itself in exception in this flow,
|
|
@@ -1032,7 +1034,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1032
1034
|
async createDetached(source) {
|
|
1033
1035
|
const attributes = {
|
|
1034
1036
|
sequenceNumber: detachedContainerRefSeqNumber,
|
|
1035
|
-
term:
|
|
1037
|
+
term: OnlyValidTermValue,
|
|
1036
1038
|
minimumSequenceNumber: 0,
|
|
1037
1039
|
};
|
|
1038
1040
|
await this.attachDeltaManagerOpHandler(attributes);
|
|
@@ -1075,7 +1077,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1075
1077
|
return {
|
|
1076
1078
|
minimumSequenceNumber: 0,
|
|
1077
1079
|
sequenceNumber: 0,
|
|
1078
|
-
term:
|
|
1080
|
+
term: OnlyValidTermValue,
|
|
1079
1081
|
};
|
|
1080
1082
|
}
|
|
1081
1083
|
// Backward compatibility: old docs would have ".attributes" instead of "attributes"
|
|
@@ -1083,10 +1085,6 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1083
1085
|
? tree.trees[".protocol"].blobs.attributes
|
|
1084
1086
|
: tree.blobs[".attributes"];
|
|
1085
1087
|
const attributes = await readAndParse(storage, attributesHash);
|
|
1086
|
-
// Backward compatibility for older summaries with no term
|
|
1087
|
-
if (attributes.term === undefined) {
|
|
1088
|
-
attributes.term = 1;
|
|
1089
|
-
}
|
|
1090
1088
|
return attributes;
|
|
1091
1089
|
}
|
|
1092
1090
|
async initializeProtocolStateFromSnapshot(attributes, storage, snapshot) {
|
|
@@ -1206,7 +1204,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1206
1204
|
}
|
|
1207
1205
|
createDeltaManager() {
|
|
1208
1206
|
const serviceProvider = () => this.service;
|
|
1209
|
-
const deltaManager = new DeltaManager(serviceProvider, ChildLogger.create(this.subLogger, "DeltaManager"), () => this.activeConnection(), (props) => new ConnectionManager(serviceProvider, this.client, this._canReconnect, ChildLogger.create(this.subLogger, "ConnectionManager"), props));
|
|
1207
|
+
const deltaManager = new DeltaManager(serviceProvider, ChildLogger.create(this.subLogger, "DeltaManager"), () => this.activeConnection(), (props) => new ConnectionManager(serviceProvider, () => this.isDirty, this.client, this._canReconnect, ChildLogger.create(this.subLogger, "ConnectionManager"), props));
|
|
1210
1208
|
// Disable inbound queues as Container is not ready to accept any ops until we are fully loaded!
|
|
1211
1209
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1212
1210
|
deltaManager.inbound.pause();
|
|
@@ -1245,8 +1243,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1245
1243
|
return deltaManager;
|
|
1246
1244
|
}
|
|
1247
1245
|
async attachDeltaManagerOpHandler(attributes, prefetchType) {
|
|
1248
|
-
|
|
1249
|
-
return this._deltaManager.attachOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, (_a = attributes.term) !== null && _a !== void 0 ? _a : 1, {
|
|
1246
|
+
return this._deltaManager.attachOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, {
|
|
1250
1247
|
process: (message) => this.processRemoteMessage(message),
|
|
1251
1248
|
processSignal: (message) => {
|
|
1252
1249
|
this.processSignal(message);
|
|
@@ -1309,7 +1306,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1309
1306
|
this.messageCountAfterDisconnection = 0;
|
|
1310
1307
|
}
|
|
1311
1308
|
// Both protocol and context should not be undefined if we got so far.
|
|
1312
|
-
this.setContextConnectedState(state, (_a = this.
|
|
1309
|
+
this.setContextConnectedState(state, (_a = this.readOnlyInfo.readonly) !== null && _a !== void 0 ? _a : false);
|
|
1313
1310
|
this.protocolHandler.setConnectionState(state, this.clientId);
|
|
1314
1311
|
raiseConnectedEvent(this.mc.logger, this, state, this.clientId, disconnectedReason);
|
|
1315
1312
|
if (logOpsOnReconnect) {
|