@fluidframework/container-loader 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189
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 +59 -0
- package/README.md +27 -3
- package/dist/catchUpMonitor.d.ts +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +3 -2
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +32 -13
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +18 -3
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +34 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +99 -70
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +260 -218
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +24 -67
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +28 -217
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +3 -3
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +29 -6
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +9 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts +22 -9
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +42 -31
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts +2 -3
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js +2 -3
- package/dist/deltaQueue.js.map +1 -1
- package/dist/disposal.d.ts +13 -0
- package/dist/disposal.d.ts.map +1 -0
- package/dist/disposal.js +25 -0
- package/dist/disposal.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +9 -8
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +47 -61
- package/dist/loader.js.map +1 -1
- package/dist/noopHeuristic.d.ts +23 -0
- package/dist/noopHeuristic.d.ts.map +1 -0
- package/dist/{collabWindowTracker.js → noopHeuristic.js} +30 -42
- package/dist/noopHeuristic.js.map +1 -0
- 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 +7 -12
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +17 -19
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -17
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js +1 -17
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +3 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -1
- package/dist/utils.js.map +1 -1
- package/lib/catchUpMonitor.d.ts +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +3 -2
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +33 -14
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +18 -3
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +35 -10
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +99 -70
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +264 -222
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +24 -67
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +28 -217
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +3 -3
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +29 -6
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +9 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts +22 -9
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +44 -33
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts +2 -3
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js +2 -3
- package/lib/deltaQueue.js.map +1 -1
- package/lib/disposal.d.ts +13 -0
- package/lib/disposal.d.ts.map +1 -0
- package/lib/disposal.js +21 -0
- package/lib/disposal.js.map +1 -0
- package/lib/index.d.ts +1 -2
- 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 +9 -8
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +47 -61
- package/lib/loader.js.map +1 -1
- package/lib/noopHeuristic.d.ts +23 -0
- package/lib/noopHeuristic.d.ts.map +1 -0
- package/lib/{collabWindowTracker.js → noopHeuristic.js} +30 -42
- package/lib/noopHeuristic.js.map +1 -0
- 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 +7 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +15 -18
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -17
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js +1 -16
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +3 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +7 -1
- package/lib/utils.js.map +1 -1
- package/package.json +22 -20
- package/src/catchUpMonitor.ts +1 -1
- package/src/connectionManager.ts +40 -22
- package/src/connectionStateHandler.ts +66 -17
- package/src/container.ts +464 -292
- package/src/containerContext.ts +33 -341
- package/src/containerStorageAdapter.ts +40 -10
- package/src/contracts.ts +11 -3
- package/src/deltaManager.ts +74 -45
- package/src/deltaQueue.ts +2 -3
- package/src/disposal.ts +25 -0
- package/src/index.ts +1 -8
- package/src/loader.ts +85 -83
- package/src/{collabWindowTracker.ts → noopHeuristic.ts} +37 -47
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +18 -39
- package/src/protocolTreeDocumentStorageService.ts +1 -1
- package/src/quorum.ts +2 -31
- package/src/retriableDocumentStorageService.ts +4 -2
- package/src/utils.ts +15 -1
- package/dist/collabWindowTracker.d.ts +0 -19
- package/dist/collabWindowTracker.d.ts.map +0 -1
- package/dist/collabWindowTracker.js.map +0 -1
- package/dist/deltaManagerProxy.d.ts +0 -42
- package/dist/deltaManagerProxy.d.ts.map +0 -1
- package/dist/deltaManagerProxy.js +0 -79
- package/dist/deltaManagerProxy.js.map +0 -1
- package/lib/collabWindowTracker.d.ts +0 -19
- package/lib/collabWindowTracker.d.ts.map +0 -1
- package/lib/collabWindowTracker.js.map +0 -1
- package/lib/deltaManagerProxy.d.ts +0 -42
- package/lib/deltaManagerProxy.d.ts.map +0 -1
- package/lib/deltaManagerProxy.js +0 -74
- package/lib/deltaManagerProxy.js.map +0 -1
- package/src/deltaManagerProxy.ts +0 -109
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
ITelemetryLogger,
|
|
8
|
-
ITelemetryProperties,
|
|
9
|
-
TelemetryEventCategory,
|
|
10
|
-
} from "@fluidframework/common-definitions";
|
|
6
|
+
import { ITelemetryProperties, TelemetryEventCategory } from "@fluidframework/core-interfaces";
|
|
11
7
|
import { assert, Timer } from "@fluidframework/common-utils";
|
|
12
8
|
import { IConnectionDetailsInternal, IDeltaManager } from "@fluidframework/container-definitions";
|
|
13
9
|
import { IAnyDriverError } from "@fluidframework/driver-definitions";
|
|
14
10
|
import { ISequencedClient, IClient } from "@fluidframework/protocol-definitions";
|
|
15
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ITelemetryLoggerExt,
|
|
13
|
+
PerformanceEvent,
|
|
14
|
+
loggerToMonitoringContext,
|
|
15
|
+
} from "@fluidframework/telemetry-utils";
|
|
16
16
|
import { ConnectionState } from "./connectionState";
|
|
17
17
|
import { CatchUpMonitor, ICatchUpMonitor } from "./catchUpMonitor";
|
|
18
|
-
import {
|
|
18
|
+
import { IProtocolHandler } from "./protocol";
|
|
19
19
|
|
|
20
20
|
// Based on recent data, it looks like majority of cases where we get stuck are due to really slow or
|
|
21
21
|
// timing out ops fetches. So attempt recovery infrequently. Also fetch uses 30 second timeout, so
|
|
@@ -27,7 +27,7 @@ const JoinSignalTimeoutMs = 5000;
|
|
|
27
27
|
|
|
28
28
|
/** Constructor parameter type for passing in dependencies needed by the ConnectionStateHandler */
|
|
29
29
|
export interface IConnectionStateHandlerInputs {
|
|
30
|
-
logger:
|
|
30
|
+
logger: ITelemetryLoggerExt;
|
|
31
31
|
/** Log to telemetry any change in state, included to Connecting */
|
|
32
32
|
connectionStateChanged: (
|
|
33
33
|
value: ConnectionState,
|
|
@@ -45,6 +45,8 @@ export interface IConnectionStateHandlerInputs {
|
|
|
45
45
|
category: TelemetryEventCategory,
|
|
46
46
|
details?: ITelemetryProperties,
|
|
47
47
|
) => void;
|
|
48
|
+
/** Callback to note that an old local client ID is still present in the Quorum that should have left and should now be considered invalid */
|
|
49
|
+
clientShouldHaveLeft: (clientId: string) => void;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/**
|
|
@@ -59,6 +61,13 @@ export interface IConnectionStateHandler {
|
|
|
59
61
|
initProtocol(protocol: IProtocolHandler): void;
|
|
60
62
|
receivedConnectEvent(details: IConnectionDetailsInternal): void;
|
|
61
63
|
receivedDisconnectEvent(reason: string, error?: IAnyDriverError): void;
|
|
64
|
+
establishingConnection(reason: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Switches state to disconnected when we are still establishing connection during container.load(),
|
|
67
|
+
* container connect() or reconnect and the container gets closed or disposed or disconnect happens.
|
|
68
|
+
* @param reason - reason for cancelling the connection.
|
|
69
|
+
*/
|
|
70
|
+
cancelEstablishingConnection(reason: string): void;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
export function createConnectionStateHandler(
|
|
@@ -144,6 +153,14 @@ class ConnectionStateHandlerPassThrough
|
|
|
144
153
|
return this.pimpl.receivedDisconnectEvent(reason, error);
|
|
145
154
|
}
|
|
146
155
|
|
|
156
|
+
public establishingConnection(reason: string) {
|
|
157
|
+
return this.pimpl.establishingConnection(reason);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public cancelEstablishingConnection(reason: string) {
|
|
161
|
+
return this.pimpl.cancelEstablishingConnection(reason);
|
|
162
|
+
}
|
|
163
|
+
|
|
147
164
|
public receivedConnectEvent(details: IConnectionDetailsInternal) {
|
|
148
165
|
return this.pimpl.receivedConnectEvent(details);
|
|
149
166
|
}
|
|
@@ -176,6 +193,9 @@ class ConnectionStateHandlerPassThrough
|
|
|
176
193
|
) {
|
|
177
194
|
return this.inputs.logConnectionIssue(eventName, category, details);
|
|
178
195
|
}
|
|
196
|
+
public clientShouldHaveLeft(clientId: string) {
|
|
197
|
+
return this.inputs.clientShouldHaveLeft(clientId);
|
|
198
|
+
}
|
|
179
199
|
}
|
|
180
200
|
|
|
181
201
|
/**
|
|
@@ -230,9 +250,17 @@ class ConnectionStateCatchup extends ConnectionStateHandlerPassThrough {
|
|
|
230
250
|
this.catchUpMonitor?.dispose();
|
|
231
251
|
this.catchUpMonitor = undefined;
|
|
232
252
|
break;
|
|
233
|
-
|
|
253
|
+
// ConnectionState.EstablishingConnection state would be set when we start establishing connection
|
|
254
|
+
// during container.connect() or reconnect because of an error.
|
|
255
|
+
case ConnectionState.EstablishingConnection:
|
|
234
256
|
assert(
|
|
235
257
|
this._connectionState === ConnectionState.Disconnected,
|
|
258
|
+
0x6d2 /* connectivity transition to establishing connection */,
|
|
259
|
+
);
|
|
260
|
+
break;
|
|
261
|
+
case ConnectionState.CatchingUp:
|
|
262
|
+
assert(
|
|
263
|
+
this._connectionState === ConnectionState.EstablishingConnection,
|
|
236
264
|
0x3e3 /* connectivity transitions */,
|
|
237
265
|
);
|
|
238
266
|
break;
|
|
@@ -471,6 +499,27 @@ class ConnectionStateHandler implements IConnectionStateHandler {
|
|
|
471
499
|
this.setConnectionState(ConnectionState.Disconnected, reason, error);
|
|
472
500
|
}
|
|
473
501
|
|
|
502
|
+
public cancelEstablishingConnection(reason: string) {
|
|
503
|
+
assert(
|
|
504
|
+
this._connectionState === ConnectionState.EstablishingConnection,
|
|
505
|
+
0x6d3 /* Connection state should be EstablishingConnection */,
|
|
506
|
+
);
|
|
507
|
+
assert(this.connection === undefined, 0x6d4 /* No connetion should be present */);
|
|
508
|
+
const oldState = this._connectionState;
|
|
509
|
+
this._connectionState = ConnectionState.Disconnected;
|
|
510
|
+
this.handler.connectionStateChanged(ConnectionState.Disconnected, oldState, reason);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
public establishingConnection(reason: string) {
|
|
514
|
+
const oldState = this._connectionState;
|
|
515
|
+
this._connectionState = ConnectionState.EstablishingConnection;
|
|
516
|
+
this.handler.connectionStateChanged(
|
|
517
|
+
ConnectionState.EstablishingConnection,
|
|
518
|
+
oldState,
|
|
519
|
+
`Establishing Connection due to ${reason}`,
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
474
523
|
private shouldWaitForJoinSignal() {
|
|
475
524
|
assert(
|
|
476
525
|
this.connection !== undefined,
|
|
@@ -554,18 +603,18 @@ class ConnectionStateHandler implements IConnectionStateHandler {
|
|
|
554
603
|
// This is the only place in code that deals with quorum. The rest works with audience
|
|
555
604
|
// The code below ensures that we do not send ops until we know that old "write" client's disconnect
|
|
556
605
|
// produced (and sequenced) leave op
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
606
|
+
const currentClientInQuorum =
|
|
607
|
+
this._clientId !== undefined &&
|
|
608
|
+
this.protocol?.quorum?.getMember(this._clientId) !== undefined;
|
|
561
609
|
if (value === ConnectionState.Connected) {
|
|
562
610
|
assert(
|
|
563
611
|
oldState === ConnectionState.CatchingUp,
|
|
564
612
|
0x1d8 /* "Should only transition from Connecting state" */,
|
|
565
613
|
);
|
|
566
614
|
// Mark our old client should have left in the quorum if it's still there
|
|
567
|
-
if (
|
|
568
|
-
|
|
615
|
+
if (currentClientInQuorum) {
|
|
616
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
617
|
+
this.handler.clientShouldHaveLeft(this._clientId!);
|
|
569
618
|
}
|
|
570
619
|
this._clientId = this.pendingClientId;
|
|
571
620
|
} else if (value === ConnectionState.Disconnected) {
|
|
@@ -581,7 +630,7 @@ class ConnectionStateHandler implements IConnectionStateHandler {
|
|
|
581
630
|
// we could receive "Disconnected" event multiple times without getting connected and in that case we
|
|
582
631
|
// don't want to reset the timer as we still want to wait on original client which started this timer.
|
|
583
632
|
if (
|
|
584
|
-
|
|
633
|
+
currentClientInQuorum &&
|
|
585
634
|
this.handler.shouldClientJoinWrite() &&
|
|
586
635
|
!this.waitingForLeaveOp // same as !this.prevClientLeftTimer.hasTimer
|
|
587
636
|
) {
|
|
@@ -592,7 +641,7 @@ class ConnectionStateHandler implements IConnectionStateHandler {
|
|
|
592
641
|
eventName: "noWaitOnDisconnected",
|
|
593
642
|
details: JSON.stringify({
|
|
594
643
|
clientId: this._clientId,
|
|
595
|
-
inQuorum:
|
|
644
|
+
inQuorum: currentClientInQuorum,
|
|
596
645
|
waitingForLeaveOp: this.waitingForLeaveOp,
|
|
597
646
|
hadOutstandingOps: this.handler.shouldClientJoinWrite(),
|
|
598
647
|
}),
|