@fluidframework/container-loader 2.0.0-internal.6.3.3 → 2.0.0-internal.7.0.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 +112 -0
- package/dist/catchUpMonitor.d.ts +2 -2
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/connectionManager.d.ts +1 -15
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +90 -82
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.js +1 -1
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.js +9 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +21 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +222 -208
- package/dist/container.js.map +1 -1
- package/dist/containerContext.js +16 -16
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +6 -8
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +2 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +5 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +87 -90
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +14 -14
- package/dist/deltaQueue.js.map +1 -1
- package/dist/loader.d.ts +3 -6
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +19 -84
- 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 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -5
- package/dist/protocol.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/catchUpMonitor.d.ts +2 -2
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +1 -15
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +93 -83
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +9 -9
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +21 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +223 -209
- package/lib/container.js.map +1 -1
- package/lib/containerContext.js +16 -16
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +6 -8
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +2 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +5 -4
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +87 -90
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +14 -14
- package/lib/deltaQueue.js.map +1 -1
- package/lib/loader.d.ts +3 -6
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +19 -84
- 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 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -3
- package/lib/protocol.js.map +1 -1
- package/package.json +25 -19
- package/src/connectionManager.ts +38 -20
- package/src/container.ts +30 -16
- package/src/containerStorageAdapter.ts +0 -6
- package/src/contracts.ts +5 -1
- package/src/debugLogger.ts +1 -0
- package/src/deltaManager.ts +7 -9
- package/src/loader.ts +24 -92
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
# @fluidframework/container-loader
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- odsp-driver: Load container in readonly mode when driver throws DriverErrorType.outOfStorage [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
8
|
+
|
|
9
|
+
Handle DriverErrorType.outOfStorage error from driver and load the container in readonly mode. Currently there is no
|
|
10
|
+
handling and when the join session throws this error, the container will get closed. With this we use NoDeltaStream
|
|
11
|
+
object as connection and load the container in read mode, so that it loads properly. We also notify the that the
|
|
12
|
+
container is "readonly" through the event on delta manager so that apps can listen to this and show any UX etc. The app
|
|
13
|
+
can listen to the event like this:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
container.deltaManager.on(
|
|
17
|
+
"readonly",
|
|
18
|
+
(readonly?: boolean, readonlyConnectionReason?: { text: string; error?: IErrorBase }) => {
|
|
19
|
+
// error?.errorType will be equal to DriverErrorType.outOfStorage in this case
|
|
20
|
+
// App logic
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
26
|
+
|
|
27
|
+
This included the following changes from the protocol-definitions release:
|
|
28
|
+
|
|
29
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
30
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
31
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
32
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
33
|
+
ISignalMessageBase interface that contains common members.
|
|
34
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
35
|
+
|
|
36
|
+
- DEPRECATED: container-loader: Various request related APIs have been deprecated [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
37
|
+
|
|
38
|
+
Please remove all calls to the following functions and instead use the new `entryPoint` pattern:
|
|
39
|
+
|
|
40
|
+
- `requestFluidObject`
|
|
41
|
+
- `requestResolvedObjectFromContainer`
|
|
42
|
+
- `getDefaultObjectFromContainer`
|
|
43
|
+
- `getObjectWithIdFromContainer`
|
|
44
|
+
- `getObjectFromContainer`
|
|
45
|
+
|
|
46
|
+
See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more details.
|
|
47
|
+
|
|
48
|
+
- container-definitions: IContainer's and IDataStore's IFluidRouter capabilities are deprecated [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
49
|
+
|
|
50
|
+
`IFluidRouter` and `request({ url: "/" })` on `IContainer` and `IDataStore` are deprecated and will be removed in a future major release. Please migrate all usage to the appropriate `getEntryPoint()` or `entryPoint` APIs.
|
|
51
|
+
|
|
52
|
+
See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more details.
|
|
53
|
+
|
|
54
|
+
- routerlicious-driver: remove dead blob aggregation concepts and code [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
55
|
+
|
|
56
|
+
Dead concepts blob aggregation like `aggregateBlobsSmallerThanBytes` and `minBlobSize` have been removed.
|
|
57
|
+
|
|
58
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
59
|
+
|
|
60
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
61
|
+
|
|
62
|
+
- @fluidframework/gitresources: 2.0.1
|
|
63
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
64
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
65
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
66
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
67
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
68
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
69
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
70
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
71
|
+
- @fluidframework/server-services: 2.0.1
|
|
72
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
73
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
74
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
75
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
76
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
77
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
78
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
79
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
80
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
81
|
+
- tinylicious: 2.0.1
|
|
82
|
+
|
|
83
|
+
- test-utils: provideEntryPoint is required [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
84
|
+
|
|
85
|
+
The optional `provideEntryPoint` method has become required on a number of constructors. A value will need to be provided to the following classes:
|
|
86
|
+
|
|
87
|
+
- `BaseContainerRuntimeFactory`
|
|
88
|
+
- `RuntimeFactory`
|
|
89
|
+
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
90
|
+
- `FluidDataStoreRuntime`
|
|
91
|
+
|
|
92
|
+
See [testContainerRuntimeFactoryWithDefaultDataStore.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/test/test-utils/src/testContainerRuntimeFactoryWithDefaultDataStore.ts) for an example implemtation of `provideEntryPoint` for ContainerRuntime.
|
|
93
|
+
See [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L83) for an example implementation of `provideEntryPoint` for DataStoreRuntime.
|
|
94
|
+
|
|
95
|
+
Subsequently, various `entryPoint` and `getEntryPoint()` endpoints have become required. Please see [containerRuntime.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/runtime/container-runtime/src/containerRuntime.ts) for example implementations of these APIs.
|
|
96
|
+
|
|
97
|
+
For more details, see [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md)
|
|
98
|
+
|
|
99
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
100
|
+
|
|
101
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
102
|
+
|
|
103
|
+
- container-loader: Containers will connect in read-mode by default [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
104
|
+
|
|
105
|
+
When a container is loaded, it will connect in read-mode unless it is loaded with a pending state containing stashed ops.
|
|
106
|
+
|
|
107
|
+
- container-loader: Container caching in the Loader is removed [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
108
|
+
|
|
109
|
+
Container caching in the Loader has been removed. Do not to rely on caching and inform the FluidFramework team ASAP if you cannot do so.
|
|
110
|
+
|
|
111
|
+
## 2.0.0-internal.6.4.0
|
|
112
|
+
|
|
113
|
+
Dependency updates only.
|
|
114
|
+
|
|
3
115
|
## 2.0.0-internal.6.3.0
|
|
4
116
|
|
|
5
117
|
Dependency updates only.
|
package/dist/catchUpMonitor.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IDeltaManager } from "@fluidframework/container-definitions";
|
|
7
7
|
/** @see CatchUpMonitor for usage */
|
|
8
|
-
|
|
8
|
+
type CaughtUpListener = () => void;
|
|
9
9
|
/** Monitor that emits an event when a Container has caught up to a given point in the op stream */
|
|
10
|
-
export
|
|
10
|
+
export type ICatchUpMonitor = IDisposable;
|
|
11
11
|
/**
|
|
12
12
|
* Monitors a Container's DeltaManager, notifying listeners when all ops have been processed
|
|
13
13
|
* that were known at the time the monitor was created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAGtE,oCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"catchUpMonitor.d.ts","sourceRoot":"","sources":["../src/catchUpMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAGtE,oCAAoC;AACpC,KAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,mGAAmG;AACnG,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAepD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAf1B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAkB;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAKxB;IAEF;;OAEG;gBAEe,YAAY,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EACrC,QAAQ,EAAE,gBAAgB;IAerC,QAAQ,EAAE,OAAO,CAAS;IAC1B,OAAO;CAQd"}
|
|
@@ -93,21 +93,7 @@ export declare class ConnectionManager implements IConnectionManager {
|
|
|
93
93
|
*/
|
|
94
94
|
setAutoReconnect(mode: ReconnectMode, reason: IConnectionStateChangeReason): void;
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
98
|
-
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
99
|
-
* (server can return "write" mode even when asked for "read")
|
|
100
|
-
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
101
|
-
* as in read-only permissions.
|
|
102
|
-
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
103
|
-
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
104
|
-
*
|
|
105
|
-
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
106
|
-
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
107
|
-
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
108
|
-
* cleared.
|
|
109
|
-
*
|
|
110
|
-
* @param readonly - set or clear force readonly.
|
|
96
|
+
* {@inheritDoc Container.forceReadonly}
|
|
111
97
|
*/
|
|
112
98
|
forceReadonly(readonly: boolean): void;
|
|
113
99
|
private set_readonlyPermissions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGpF,OAAO,EACN,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"connectionManager.d.ts","sourceRoot":"","sources":["../src/connectionManager.ts"],"names":[],"mappings":"AAA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,OAAO,CAAC,MAAM,EAAE,4BAA4B,EAAE,cAAc,CAAC,EAAE,cAAc;YAOtE,WAAW;IA8LzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IActB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAwCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAoJpC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;;;OAMG;YACW,SAAS;IA8DhB,oBAAoB,CAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,GACrD,gBAAgB,GAAG,SAAS;IAuCxB,YAAY,CAAC,OAAO,EAAE,GAAG;IAQzB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE;IA+BzC,0BAA0B,CAAC,OAAO,EAAE,yBAAyB;IAgDpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;IAGF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAkB1B;IAGF,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAIxC;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;CACF"}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.ConnectionManager = void 0;
|
|
8
8
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
9
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
|
+
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
10
11
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
11
12
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
12
13
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
@@ -36,9 +37,15 @@ const clientNoDeltaStream = {
|
|
|
36
37
|
};
|
|
37
38
|
const clientIdNoDeltaStream = "storage-only client";
|
|
38
39
|
class NoDeltaStream extends client_utils_1.TypedEventEmitter {
|
|
39
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Connection which is not connected to socket.
|
|
42
|
+
* @param storageOnlyReason - Reason on why the connection to delta stream is not allowed.
|
|
43
|
+
* @param readonlyConnectionReason - reason/error if any which lead to using NoDeltaStream.
|
|
44
|
+
*/
|
|
45
|
+
constructor(storageOnlyReason, readonlyConnectionReason) {
|
|
40
46
|
super();
|
|
41
47
|
this.storageOnlyReason = storageOnlyReason;
|
|
48
|
+
this.readonlyConnectionReason = readonlyConnectionReason;
|
|
42
49
|
this.clientId = clientIdNoDeltaStream;
|
|
43
50
|
this.claims = {
|
|
44
51
|
scopes: [protocol_definitions_1.ScopeType.DocRead],
|
|
@@ -101,67 +108,6 @@ const waitForOnline = async () => {
|
|
|
101
108
|
* Exposes various controls to influence this process, including manual reconnects, forced read-only mode, etc.
|
|
102
109
|
*/
|
|
103
110
|
class ConnectionManager {
|
|
104
|
-
constructor(serviceProvider, containerDirty, client, reconnectAllowed, logger, props) {
|
|
105
|
-
this.serviceProvider = serviceProvider;
|
|
106
|
-
this.containerDirty = containerDirty;
|
|
107
|
-
this.client = client;
|
|
108
|
-
this.logger = logger;
|
|
109
|
-
this.props = props;
|
|
110
|
-
/** tracks host requiring read-only mode. */
|
|
111
|
-
this._forceReadonly = false;
|
|
112
|
-
/** True if there is pending (async) reconnection from "read" to "write" */
|
|
113
|
-
this.pendingReconnect = false;
|
|
114
|
-
this.clientSequenceNumber = 0;
|
|
115
|
-
this.clientSequenceNumberObserved = 0;
|
|
116
|
-
/** Counts the number of non-runtime ops sent by the client which may not be acked. */
|
|
117
|
-
this.localOpsToIgnore = 0;
|
|
118
|
-
this.connectFirstConnection = true;
|
|
119
|
-
this._connectionVerboseProps = {};
|
|
120
|
-
this._connectionProps = {};
|
|
121
|
-
this._disposed = false;
|
|
122
|
-
this.opHandler = (documentId, messagesArg) => {
|
|
123
|
-
const messages = Array.isArray(messagesArg) ? messagesArg : [messagesArg];
|
|
124
|
-
this.props.incomingOpHandler(messages, "opHandler");
|
|
125
|
-
};
|
|
126
|
-
// Always connect in write mode after getting nacked.
|
|
127
|
-
this.nackHandler = (documentId, messages) => {
|
|
128
|
-
const message = messages[0];
|
|
129
|
-
if (this._readonlyPermissions === true) {
|
|
130
|
-
this.props.closeHandler((0, driver_utils_1.createWriteError)("writeOnReadOnlyDocument", { driverVersion: undefined }));
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const reconnectInfo = getNackReconnectInfo(message.content);
|
|
134
|
-
// If the nack indicates we cannot retry, then close the container outright
|
|
135
|
-
if (!reconnectInfo.canRetry) {
|
|
136
|
-
this.props.closeHandler(reconnectInfo);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
this.reconnectOnError("write", reconnectInfo);
|
|
140
|
-
};
|
|
141
|
-
// Connection mode is always read on disconnect/error unless the system mode was write.
|
|
142
|
-
this.disconnectHandlerInternal = (disconnectReason) => {
|
|
143
|
-
// Note: we might get multiple disconnect calls on same socket, as early disconnect notification
|
|
144
|
-
// ("server_disconnect", ODSP-specific) is mapped to "disconnect"
|
|
145
|
-
this.reconnectOnError(this.defaultReconnectionMode, disconnectReason);
|
|
146
|
-
};
|
|
147
|
-
this.errorHandler = (error) => {
|
|
148
|
-
this.reconnectOnError(this.defaultReconnectionMode, error);
|
|
149
|
-
};
|
|
150
|
-
this.clientDetails = this.client.details;
|
|
151
|
-
this.defaultReconnectionMode = this.client.mode;
|
|
152
|
-
this._reconnectMode = reconnectAllowed ? contracts_1.ReconnectMode.Enabled : contracts_1.ReconnectMode.Never;
|
|
153
|
-
// Outbound message queue. The outbound queue is represented as a queue of an array of ops. Ops contained
|
|
154
|
-
// within an array *must* fit within the maxMessageSize and are guaranteed to be ordered sequentially.
|
|
155
|
-
this._outbound = new deltaQueue_1.DeltaQueue((messages) => {
|
|
156
|
-
if (this.connection === undefined) {
|
|
157
|
-
throw new Error("Attempted to submit an outbound message without connection");
|
|
158
|
-
}
|
|
159
|
-
this.connection.submit(messages);
|
|
160
|
-
});
|
|
161
|
-
this._outbound.on("error", (error) => {
|
|
162
|
-
this.props.closeHandler((0, telemetry_utils_1.normalizeError)(error));
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
111
|
get connectionVerboseProps() {
|
|
166
112
|
return this._connectionVerboseProps;
|
|
167
113
|
}
|
|
@@ -275,6 +221,67 @@ class ConnectionManager {
|
|
|
275
221
|
reason,
|
|
276
222
|
};
|
|
277
223
|
}
|
|
224
|
+
constructor(serviceProvider, containerDirty, client, reconnectAllowed, logger, props) {
|
|
225
|
+
this.serviceProvider = serviceProvider;
|
|
226
|
+
this.containerDirty = containerDirty;
|
|
227
|
+
this.client = client;
|
|
228
|
+
this.logger = logger;
|
|
229
|
+
this.props = props;
|
|
230
|
+
/** tracks host requiring read-only mode. */
|
|
231
|
+
this._forceReadonly = false;
|
|
232
|
+
/** True if there is pending (async) reconnection from "read" to "write" */
|
|
233
|
+
this.pendingReconnect = false;
|
|
234
|
+
this.clientSequenceNumber = 0;
|
|
235
|
+
this.clientSequenceNumberObserved = 0;
|
|
236
|
+
/** Counts the number of non-runtime ops sent by the client which may not be acked. */
|
|
237
|
+
this.localOpsToIgnore = 0;
|
|
238
|
+
this.connectFirstConnection = true;
|
|
239
|
+
this._connectionVerboseProps = {};
|
|
240
|
+
this._connectionProps = {};
|
|
241
|
+
this._disposed = false;
|
|
242
|
+
this.opHandler = (documentId, messagesArg) => {
|
|
243
|
+
const messages = Array.isArray(messagesArg) ? messagesArg : [messagesArg];
|
|
244
|
+
this.props.incomingOpHandler(messages, "opHandler");
|
|
245
|
+
};
|
|
246
|
+
// Always connect in write mode after getting nacked.
|
|
247
|
+
this.nackHandler = (documentId, messages) => {
|
|
248
|
+
const message = messages[0];
|
|
249
|
+
if (this._readonlyPermissions === true) {
|
|
250
|
+
this.props.closeHandler((0, driver_utils_1.createWriteError)("writeOnReadOnlyDocument", { driverVersion: undefined }));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const reconnectInfo = getNackReconnectInfo(message.content);
|
|
254
|
+
// If the nack indicates we cannot retry, then close the container outright
|
|
255
|
+
if (!reconnectInfo.canRetry) {
|
|
256
|
+
this.props.closeHandler(reconnectInfo);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
this.reconnectOnError("write", reconnectInfo);
|
|
260
|
+
};
|
|
261
|
+
// Connection mode is always read on disconnect/error unless the system mode was write.
|
|
262
|
+
this.disconnectHandlerInternal = (disconnectReason) => {
|
|
263
|
+
// Note: we might get multiple disconnect calls on same socket, as early disconnect notification
|
|
264
|
+
// ("server_disconnect", ODSP-specific) is mapped to "disconnect"
|
|
265
|
+
this.reconnectOnError(this.defaultReconnectionMode, disconnectReason);
|
|
266
|
+
};
|
|
267
|
+
this.errorHandler = (error) => {
|
|
268
|
+
this.reconnectOnError(this.defaultReconnectionMode, error);
|
|
269
|
+
};
|
|
270
|
+
this.clientDetails = this.client.details;
|
|
271
|
+
this.defaultReconnectionMode = this.client.mode;
|
|
272
|
+
this._reconnectMode = reconnectAllowed ? contracts_1.ReconnectMode.Enabled : contracts_1.ReconnectMode.Never;
|
|
273
|
+
// Outbound message queue. The outbound queue is represented as a queue of an array of ops. Ops contained
|
|
274
|
+
// within an array *must* fit within the maxMessageSize and are guaranteed to be ordered sequentially.
|
|
275
|
+
this._outbound = new deltaQueue_1.DeltaQueue((messages) => {
|
|
276
|
+
if (this.connection === undefined) {
|
|
277
|
+
throw new Error("Attempted to submit an outbound message without connection");
|
|
278
|
+
}
|
|
279
|
+
this.connection.submit(messages);
|
|
280
|
+
});
|
|
281
|
+
this._outbound.on("error", (error) => {
|
|
282
|
+
this.props.closeHandler((0, telemetry_utils_1.normalizeError)(error));
|
|
283
|
+
});
|
|
284
|
+
}
|
|
278
285
|
dispose(error, switchToReadonly = true) {
|
|
279
286
|
if (this._disposed) {
|
|
280
287
|
return;
|
|
@@ -294,7 +301,7 @@ class ConnectionManager {
|
|
|
294
301
|
// Notify everyone we are in read-only state.
|
|
295
302
|
// Useful for data stores in case we hit some critical error,
|
|
296
303
|
// to switch to a mode where user edits are not accepted
|
|
297
|
-
this.set_readonlyPermissions(true, oldReadonlyValue);
|
|
304
|
+
this.set_readonlyPermissions(true, oldReadonlyValue, disconnectReason);
|
|
298
305
|
}
|
|
299
306
|
}
|
|
300
307
|
/**
|
|
@@ -310,21 +317,7 @@ class ConnectionManager {
|
|
|
310
317
|
}
|
|
311
318
|
}
|
|
312
319
|
/**
|
|
313
|
-
*
|
|
314
|
-
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
315
|
-
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
316
|
-
* (server can return "write" mode even when asked for "read")
|
|
317
|
-
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
318
|
-
* as in read-only permissions.
|
|
319
|
-
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
320
|
-
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
321
|
-
*
|
|
322
|
-
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
323
|
-
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
324
|
-
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
325
|
-
* cleared.
|
|
326
|
-
*
|
|
327
|
-
* @param readonly - set or clear force readonly.
|
|
320
|
+
* {@inheritDoc Container.forceReadonly}
|
|
328
321
|
*/
|
|
329
322
|
forceReadonly(readonly) {
|
|
330
323
|
if (readonly !== this._forceReadonly) {
|
|
@@ -358,10 +351,10 @@ class ConnectionManager {
|
|
|
358
351
|
}
|
|
359
352
|
}
|
|
360
353
|
}
|
|
361
|
-
set_readonlyPermissions(newReadonlyValue, oldReadonlyValue) {
|
|
354
|
+
set_readonlyPermissions(newReadonlyValue, oldReadonlyValue, readonlyConnectionReason) {
|
|
362
355
|
this._readonlyPermissions = newReadonlyValue;
|
|
363
356
|
if (oldReadonlyValue !== this.readonly) {
|
|
364
|
-
this.props.readonlyChangeHandler(this.readonly);
|
|
357
|
+
this.props.readonlyChangeHandler(this.readonly, readonlyConnectionReason);
|
|
365
358
|
}
|
|
366
359
|
}
|
|
367
360
|
connect(reason, connectionMode) {
|
|
@@ -442,7 +435,22 @@ class ConnectionManager {
|
|
|
442
435
|
}
|
|
443
436
|
catch (origError) {
|
|
444
437
|
if ((0, utils_1.isDeltaStreamConnectionForbiddenError)(origError)) {
|
|
445
|
-
connection = new NoDeltaStream(origError.storageOnlyReason
|
|
438
|
+
connection = new NoDeltaStream(origError.storageOnlyReason, {
|
|
439
|
+
text: origError.message,
|
|
440
|
+
error: origError,
|
|
441
|
+
});
|
|
442
|
+
requestedMode = "read";
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
else if ((0, telemetry_utils_1.isFluidError)(origError) &&
|
|
446
|
+
// eslint-disable-next-line import/no-deprecated
|
|
447
|
+
origError.errorType === driver_definitions_1.DriverErrorType.outOfStorageError) {
|
|
448
|
+
// If we get out of storage error from calling joinsession, then use the NoDeltaStream object so
|
|
449
|
+
// that user can at least load the container.
|
|
450
|
+
connection = new NoDeltaStream(undefined, {
|
|
451
|
+
text: origError.message,
|
|
452
|
+
error: origError,
|
|
453
|
+
});
|
|
446
454
|
requestedMode = "read";
|
|
447
455
|
break;
|
|
448
456
|
}
|
|
@@ -603,7 +611,7 @@ class ConnectionManager {
|
|
|
603
611
|
// removed after those packages have released and become ubiquitous.
|
|
604
612
|
(0, core_utils_1.assert)(requestedMode === "read" || readonly === (this.connectionMode === "read"), 0x0e7 /* "claims/connectionMode mismatch" */);
|
|
605
613
|
(0, core_utils_1.assert)(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */);
|
|
606
|
-
this.set_readonlyPermissions(readonly, oldReadonlyValue);
|
|
614
|
+
this.set_readonlyPermissions(readonly, oldReadonlyValue, isNoDeltaStreamConnection(connection) ? connection.readonlyConnectionReason : undefined);
|
|
607
615
|
if (this._disposed) {
|
|
608
616
|
// Raise proper events, Log telemetry event and close connection.
|
|
609
617
|
this.disconnectFromDeltaStream({ text: "ConnectionManager already closed" });
|