@fluidframework/container-loader 0.56.7 → 0.57.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/README.md +3 -3
- package/dist/connectionManager.d.ts +2 -2
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +28 -20
- package/dist/connectionManager.js.map +1 -1
- package/dist/container.d.ts +1 -3
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +12 -97
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +2 -7
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +0 -12
- package/dist/containerContext.js.map +1 -1
- package/dist/contracts.d.ts +2 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +3 -14
- package/dist/deltaManager.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/lib/connectionManager.d.ts +2 -2
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +28 -20
- package/lib/connectionManager.js.map +1 -1
- package/lib/container.d.ts +1 -3
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +13 -98
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +2 -7
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +0 -12
- package/lib/containerContext.js.map +1 -1
- package/lib/contracts.d.ts +2 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +4 -15
- package/lib/deltaManager.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/package.json +8 -8
- package/src/connectionManager.ts +54 -45
- package/src/container.ts +15 -117
- package/src/containerContext.ts +0 -16
- package/src/contracts.ts +2 -1
- package/src/deltaManager.ts +4 -16
- package/src/packageVersion.ts +1 -1
package/dist/container.js
CHANGED
|
@@ -222,7 +222,7 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
224
|
// settimeout so this will hopefully fire after disconnect event if being hidden caused it
|
|
225
|
-
setTimeout(() => this.lastVisible = undefined, 0);
|
|
225
|
+
setTimeout(() => { this.lastVisible = undefined; }, 0);
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
228
|
document.addEventListener("visibilitychange", this.visibilityEventHandler);
|
|
@@ -601,25 +601,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
601
601
|
async request(path) {
|
|
602
602
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "Request" }, async () => this.context.request(path), { end: true, cancel: "error" });
|
|
603
603
|
}
|
|
604
|
-
async snapshot(tagMessage, fullTree = false) {
|
|
605
|
-
// Only snapshot once a code quorum has been established
|
|
606
|
-
if (!this.protocolHandler.quorum.has("code") && !this.protocolHandler.quorum.has("code2")) {
|
|
607
|
-
this.mc.logger.sendTelemetryEvent({ eventName: "SkipSnapshot" });
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
// Stop inbound message processing while we complete the snapshot
|
|
611
|
-
try {
|
|
612
|
-
await this.deltaManager.inbound.pause();
|
|
613
|
-
await this.snapshotCore(tagMessage, fullTree);
|
|
614
|
-
}
|
|
615
|
-
catch (ex) {
|
|
616
|
-
this.mc.logger.sendErrorEvent({ eventName: "SnapshotExceptionError" }, ex);
|
|
617
|
-
throw ex;
|
|
618
|
-
}
|
|
619
|
-
finally {
|
|
620
|
-
this.deltaManager.inbound.resume();
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
604
|
setAutoReconnect(reconnect) {
|
|
624
605
|
if (this.closed) {
|
|
625
606
|
throw new Error("Attempting to setAutoReconnect() a closed Container");
|
|
@@ -717,74 +698,6 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
717
698
|
}
|
|
718
699
|
this.close(new container_utils_1.GenericError("existingContextDoesNotSatisfyIncomingProposal"));
|
|
719
700
|
}
|
|
720
|
-
async snapshotCore(tagMessage, fullTree = false) {
|
|
721
|
-
// Snapshots base document state and currently running context
|
|
722
|
-
const root = this.snapshotBase();
|
|
723
|
-
const dataStoreEntries = await this.context.snapshot(tagMessage, fullTree);
|
|
724
|
-
// And then combine
|
|
725
|
-
if (dataStoreEntries !== null) {
|
|
726
|
-
root.entries.push(...dataStoreEntries.entries);
|
|
727
|
-
}
|
|
728
|
-
// Generate base snapshot message
|
|
729
|
-
const deltaDetails = `${this._deltaManager.lastSequenceNumber}:${this._deltaManager.minimumSequenceNumber}`;
|
|
730
|
-
const message = `Commit @${deltaDetails} ${tagMessage}`;
|
|
731
|
-
// Pull in the prior version and snapshot tree to store against
|
|
732
|
-
const lastVersion = await this.getVersion(null);
|
|
733
|
-
const parents = lastVersion !== undefined ? [lastVersion.id] : [];
|
|
734
|
-
// Write the full snapshot
|
|
735
|
-
return this.storageService.write(root, parents, message, "");
|
|
736
|
-
}
|
|
737
|
-
snapshotBase() {
|
|
738
|
-
const entries = [];
|
|
739
|
-
const quorumSnapshot = this.protocolHandler.quorum.snapshot();
|
|
740
|
-
entries.push({
|
|
741
|
-
mode: protocol_definitions_1.FileMode.File,
|
|
742
|
-
path: "quorumMembers",
|
|
743
|
-
type: protocol_definitions_1.TreeEntry.Blob,
|
|
744
|
-
value: {
|
|
745
|
-
contents: JSON.stringify(quorumSnapshot.members),
|
|
746
|
-
encoding: "utf-8",
|
|
747
|
-
},
|
|
748
|
-
});
|
|
749
|
-
entries.push({
|
|
750
|
-
mode: protocol_definitions_1.FileMode.File,
|
|
751
|
-
path: "quorumProposals",
|
|
752
|
-
type: protocol_definitions_1.TreeEntry.Blob,
|
|
753
|
-
value: {
|
|
754
|
-
contents: JSON.stringify(quorumSnapshot.proposals),
|
|
755
|
-
encoding: "utf-8",
|
|
756
|
-
},
|
|
757
|
-
});
|
|
758
|
-
entries.push({
|
|
759
|
-
mode: protocol_definitions_1.FileMode.File,
|
|
760
|
-
path: "quorumValues",
|
|
761
|
-
type: protocol_definitions_1.TreeEntry.Blob,
|
|
762
|
-
value: {
|
|
763
|
-
contents: JSON.stringify(quorumSnapshot.values),
|
|
764
|
-
encoding: "utf-8",
|
|
765
|
-
},
|
|
766
|
-
});
|
|
767
|
-
// Save attributes for the document
|
|
768
|
-
const documentAttributes = {
|
|
769
|
-
minimumSequenceNumber: this._deltaManager.minimumSequenceNumber,
|
|
770
|
-
sequenceNumber: this._deltaManager.lastSequenceNumber,
|
|
771
|
-
term: this._deltaManager.referenceTerm,
|
|
772
|
-
};
|
|
773
|
-
entries.push({
|
|
774
|
-
mode: protocol_definitions_1.FileMode.File,
|
|
775
|
-
path: ".attributes",
|
|
776
|
-
type: protocol_definitions_1.TreeEntry.Blob,
|
|
777
|
-
value: {
|
|
778
|
-
contents: JSON.stringify(documentAttributes),
|
|
779
|
-
encoding: "utf-8",
|
|
780
|
-
},
|
|
781
|
-
});
|
|
782
|
-
// Output the tree
|
|
783
|
-
const root = {
|
|
784
|
-
entries,
|
|
785
|
-
};
|
|
786
|
-
return root;
|
|
787
|
-
}
|
|
788
701
|
async getVersion(version) {
|
|
789
702
|
const versions = await this.storageService.getVersions(version, 1);
|
|
790
703
|
return versions[0];
|
|
@@ -998,7 +911,9 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
998
911
|
return protocolHandler;
|
|
999
912
|
}
|
|
1000
913
|
async initializeProtocolState(attributes, members, proposals, values) {
|
|
1001
|
-
const protocol = new protocol_base_1.ProtocolOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, attributes.term, members, proposals, values, (key, value) => this.submitMessage(protocol_definitions_1.MessageType.Propose, { key, value }),
|
|
914
|
+
const protocol = new protocol_base_1.ProtocolOpHandler(attributes.minimumSequenceNumber, attributes.sequenceNumber, attributes.term, members, proposals, values, (key, value) => this.submitMessage(protocol_definitions_1.MessageType.Propose, { key, value }),
|
|
915
|
+
// Quorum proposal rejection removed, delete when protocol-base 0.1035 is integrated.
|
|
916
|
+
() => { });
|
|
1002
917
|
const protocolLogger = telemetry_utils_1.ChildLogger.create(this.subLogger, "ProtocolHandler");
|
|
1003
918
|
protocol.quorum.on("error", (error) => {
|
|
1004
919
|
protocolLogger.sendErrorEvent(error);
|
|
@@ -1312,19 +1227,19 @@ class Container extends telemetry_utils_1.EventEmitterWithErrorHandling {
|
|
|
1312
1227
|
async instantiateContext(existing, codeDetails, snapshot, pendingLocalState) {
|
|
1313
1228
|
var _a;
|
|
1314
1229
|
common_utils_1.assert(((_a = this._context) === null || _a === void 0 ? void 0 : _a.disposed) !== false, 0x0dd /* "Existing context not disposed" */);
|
|
1315
|
-
// If this assert fires, our state tracking is likely not synchronized between COntainer & runtime.
|
|
1316
|
-
if (this._dirtyContainer) {
|
|
1317
|
-
this.mc.logger.sendErrorEvent({ eventName: "DirtyContainerReloadContainer" });
|
|
1318
|
-
}
|
|
1319
1230
|
// The relative loader will proxy requests to '/' to the loader itself assuming no non-cache flags
|
|
1320
1231
|
// are set. Global requests will still go directly to the loader
|
|
1321
1232
|
const loader = new loader_1.RelativeLoader(this, this.loader);
|
|
1322
|
-
this._context = await containerContext_1.ContainerContext.createOrLoad(this, this.scope, this.codeLoader, codeDetails, snapshot, new deltaManagerProxy_1.DeltaManagerProxy(this._deltaManager), new quorum_1.QuorumProxy(this.protocolHandler.quorum), loader, (warning) => this.raiseContainerWarning(warning), (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata), (message) => this.submitSignal(message), (error) => this.close(error), Container.version, (dirty) =>
|
|
1323
|
-
this._dirtyContainer = dirty;
|
|
1324
|
-
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
1325
|
-
}, existing, pendingLocalState);
|
|
1233
|
+
this._context = await containerContext_1.ContainerContext.createOrLoad(this, this.scope, this.codeLoader, codeDetails, snapshot, new deltaManagerProxy_1.DeltaManagerProxy(this._deltaManager), new quorum_1.QuorumProxy(this.protocolHandler.quorum), loader, (warning) => this.raiseContainerWarning(warning), (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata), (message) => this.submitSignal(message), (error) => this.close(error), Container.version, (dirty) => this.updateDirtyContainerState(dirty), existing, pendingLocalState);
|
|
1326
1234
|
this.emit("contextChanged", codeDetails);
|
|
1327
1235
|
}
|
|
1236
|
+
updateDirtyContainerState(dirty) {
|
|
1237
|
+
if (this._dirtyContainer === dirty) {
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
this._dirtyContainer = dirty;
|
|
1241
|
+
this.emit(dirty ? dirtyContainerEvent : savedContainerEvent);
|
|
1242
|
+
}
|
|
1328
1243
|
logContainerError(warning) {
|
|
1329
1244
|
this.mc.logger.sendErrorEvent({ eventName: "ContainerWarning" }, warning);
|
|
1330
1245
|
}
|