@fluidframework/container-loader 0.59.3003 → 0.59.4000-71128
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/dist/collabWindowTracker.d.ts +1 -2
- package/dist/collabWindowTracker.d.ts.map +1 -1
- package/dist/collabWindowTracker.js +22 -23
- package/dist/collabWindowTracker.js.map +1 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.d.ts +19 -0
- package/dist/connectionState.d.ts.map +1 -0
- package/dist/connectionState.js +23 -0
- package/dist/connectionState.js.map +1 -0
- package/dist/connectionStateHandler.d.ts +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +12 -12
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +9 -15
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +58 -39
- package/dist/container.js.map +1 -1
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +2 -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.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/collabWindowTracker.d.ts +1 -2
- package/lib/collabWindowTracker.d.ts.map +1 -1
- package/lib/collabWindowTracker.js +22 -23
- package/lib/collabWindowTracker.js.map +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionState.d.ts +19 -0
- package/lib/connectionState.d.ts.map +1 -0
- package/lib/connectionState.js +20 -0
- package/lib/connectionState.js.map +1 -0
- package/lib/connectionStateHandler.d.ts +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +1 -1
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +9 -15
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +40 -21
- package/lib/container.js.map +1 -1
- package/lib/contracts.d.ts +1 -0
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +16 -14
- package/src/collabWindowTracker.ts +27 -27
- package/src/connectionManager.ts +1 -1
- package/src/connectionState.ts +21 -0
- package/src/connectionStateHandler.ts +1 -1
- package/src/container.ts +47 -26
- package/src/contracts.ts +2 -0
- package/src/index.ts +1 -1
- package/src/loader.ts +1 -1
- package/src/packageVersion.ts +1 -1
package/lib/container.js
CHANGED
|
@@ -27,24 +27,10 @@ import { getProtocolSnapshotTree, getSnapshotTreeFromSerializedContainer } from
|
|
|
27
27
|
import { initQuorumValuesFromCodeDetails, getCodeDetailsFromQuorumValues, QuorumProxy } from "./quorum";
|
|
28
28
|
import { CollabWindowTracker } from "./collabWindowTracker";
|
|
29
29
|
import { ConnectionManager } from "./connectionManager";
|
|
30
|
+
import { ConnectionState } from "./connectionState";
|
|
30
31
|
const detachedContainerRefSeqNumber = 0;
|
|
31
32
|
const dirtyContainerEvent = "dirty";
|
|
32
33
|
const savedContainerEvent = "saved";
|
|
33
|
-
export var ConnectionState;
|
|
34
|
-
(function (ConnectionState) {
|
|
35
|
-
/**
|
|
36
|
-
* The document is no longer connected to the delta server
|
|
37
|
-
*/
|
|
38
|
-
ConnectionState[ConnectionState["Disconnected"] = 0] = "Disconnected";
|
|
39
|
-
/**
|
|
40
|
-
* The document has an inbound connection but is still pending for outbound deltas
|
|
41
|
-
*/
|
|
42
|
-
ConnectionState[ConnectionState["Connecting"] = 1] = "Connecting";
|
|
43
|
-
/**
|
|
44
|
-
* The document is fully connected
|
|
45
|
-
*/
|
|
46
|
-
ConnectionState[ConnectionState["Connected"] = 2] = "Connected";
|
|
47
|
-
})(ConnectionState || (ConnectionState = {}));
|
|
48
34
|
/**
|
|
49
35
|
* Waits until container connects to delta storage and gets up-to-date
|
|
50
36
|
* Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
|
|
@@ -114,7 +100,7 @@ const getCodeProposal =
|
|
|
114
100
|
const summarizerClientType = "summarizer";
|
|
115
101
|
export class Container extends EventEmitterWithErrorHandling {
|
|
116
102
|
constructor(loader, config) {
|
|
117
|
-
var _a
|
|
103
|
+
var _a;
|
|
118
104
|
super((name, error) => {
|
|
119
105
|
this.mc.logger.sendErrorEvent({
|
|
120
106
|
eventName: "ContainerEventHandlerException",
|
|
@@ -134,7 +120,6 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
134
120
|
this.attachStarted = false;
|
|
135
121
|
this._dirtyContainer = false;
|
|
136
122
|
this.setAutoReconnectTime = performance.now();
|
|
137
|
-
this.collabWindowTracker = new CollabWindowTracker((type, contents) => this.submitMessage(type, contents), () => this.activeConnection(), (_a = this.loader.services.options) === null || _a === void 0 ? void 0 : _a.noopTimeFrequency, (_b = this.loader.services.options) === null || _b === void 0 ? void 0 : _b.noopCountFrequency);
|
|
138
123
|
this._audience = new Audience();
|
|
139
124
|
this.clientDetailsOverride = config.clientDetailsOverride;
|
|
140
125
|
this._resolvedUrl = config.resolvedUrl;
|
|
@@ -175,7 +160,7 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
175
160
|
});
|
|
176
161
|
// Prefix all events in this file with container-loader
|
|
177
162
|
this.mc = loggerToMonitoringContext(ChildLogger.create(this.subLogger, "Container"));
|
|
178
|
-
const summarizeProtocolTree = (
|
|
163
|
+
const summarizeProtocolTree = (_a = this.mc.config.getBoolean("Fluid.Container.summarizeProtocolTree")) !== null && _a !== void 0 ? _a : this.loader.services.options.summarizeProtocolTree;
|
|
179
164
|
this.options = Object.assign(Object.assign({}, this.loader.services.options), { summarizeProtocolTree });
|
|
180
165
|
this.connectionStateHandler = new ConnectionStateHandler({
|
|
181
166
|
quorumClients: () => { var _a; return (_a = this._protocolHandler) === null || _a === void 0 ? void 0 : _a.quorum; },
|
|
@@ -1069,7 +1054,8 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1069
1054
|
this.connectionStateHandler.receivedConnectEvent(this.connectionMode, details);
|
|
1070
1055
|
});
|
|
1071
1056
|
deltaManager.on("disconnect", (reason) => {
|
|
1072
|
-
|
|
1057
|
+
var _a;
|
|
1058
|
+
(_a = this.collabWindowTracker) === null || _a === void 0 ? void 0 : _a.stopSequenceNumberUpdate();
|
|
1073
1059
|
this.connectionStateHandler.receivedDisconnectEvent(reason);
|
|
1074
1060
|
});
|
|
1075
1061
|
deltaManager.on("throttled", (warning) => {
|
|
@@ -1183,12 +1169,13 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1183
1169
|
return this.submitMessage(type, contents, batch, metadata);
|
|
1184
1170
|
}
|
|
1185
1171
|
submitMessage(type, contents, batch, metadata) {
|
|
1172
|
+
var _a;
|
|
1186
1173
|
if (this.connectionState !== ConnectionState.Connected) {
|
|
1187
1174
|
this.mc.logger.sendErrorEvent({ eventName: "SubmitMessageWithNoConnection", type });
|
|
1188
1175
|
return -1;
|
|
1189
1176
|
}
|
|
1190
1177
|
this.messageCountAfterDisconnection += 1;
|
|
1191
|
-
this.collabWindowTracker.stopSequenceNumberUpdate();
|
|
1178
|
+
(_a = this.collabWindowTracker) === null || _a === void 0 ? void 0 : _a.stopSequenceNumberUpdate();
|
|
1192
1179
|
return this._deltaManager.submit(type, contents, batch, metadata);
|
|
1193
1180
|
}
|
|
1194
1181
|
processRemoteMessage(message) {
|
|
@@ -1217,10 +1204,42 @@ export class Container extends EventEmitterWithErrorHandling {
|
|
|
1217
1204
|
}
|
|
1218
1205
|
// Allow the protocol handler to process the message
|
|
1219
1206
|
const result = this.protocolHandler.processMessage(message, local);
|
|
1220
|
-
|
|
1207
|
+
// Inactive (not in quorum or not writers) clients don't take part in the minimum sequence number calculation.
|
|
1208
|
+
if (this.activeConnection()) {
|
|
1209
|
+
if (this.collabWindowTracker === undefined) {
|
|
1210
|
+
// Note that config from first connection will be used for this container's lifetime.
|
|
1211
|
+
// That means that if relay service changes settings, such changes will impact only newly booted
|
|
1212
|
+
// clients.
|
|
1213
|
+
// All existing will continue to use settings they got earlier.
|
|
1214
|
+
const [noopTimeFrequency, noopCountFrequency] = this.getNoopConfig();
|
|
1215
|
+
this.collabWindowTracker = new CollabWindowTracker((type, contents) => {
|
|
1216
|
+
assert(this.activeConnection(), 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
|
|
1217
|
+
this.submitMessage(type, contents);
|
|
1218
|
+
}, noopTimeFrequency, noopCountFrequency);
|
|
1219
|
+
}
|
|
1220
|
+
this.collabWindowTracker.scheduleSequenceNumberUpdate(message, result.immediateNoOp === true);
|
|
1221
|
+
}
|
|
1221
1222
|
this.emit("op", message);
|
|
1222
1223
|
return result;
|
|
1223
1224
|
}
|
|
1225
|
+
/**
|
|
1226
|
+
* #260 (ADO)
|
|
1227
|
+
* back-compat: noopTimeFrequency & noopCountFrequency properties were added to
|
|
1228
|
+
* IClientConfiguration in 0.59.3000. During the integration, we must read the
|
|
1229
|
+
* available configuration from the loader options.
|
|
1230
|
+
*/
|
|
1231
|
+
getNoopConfig() {
|
|
1232
|
+
var _a, _b;
|
|
1233
|
+
assert(this.serviceConfiguration !== undefined, 0x2e2);
|
|
1234
|
+
if (this.serviceConfiguration.noopTimeFrequency !== undefined ||
|
|
1235
|
+
this.serviceConfiguration.noopCountFrequency !== undefined) {
|
|
1236
|
+
return [
|
|
1237
|
+
this.serviceConfiguration.noopTimeFrequency,
|
|
1238
|
+
this.serviceConfiguration.noopCountFrequency,
|
|
1239
|
+
];
|
|
1240
|
+
}
|
|
1241
|
+
return [(_a = this.loader.services.options) === null || _a === void 0 ? void 0 : _a.noopTimeFrequency, (_b = this.loader.services.options) === null || _b === void 0 ? void 0 : _b.noopCountFrequency];
|
|
1242
|
+
}
|
|
1224
1243
|
submitSignal(message) {
|
|
1225
1244
|
this._deltaManager.submitSignal(JSON.stringify(message));
|
|
1226
1245
|
}
|