@fluidframework/datastore 2.70.0 → 2.72.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 +8 -21
- package/api-report/datastore.legacy.beta.api.md +2 -0
- package/dist/dataStoreLayerCompatState.js +1 -1
- package/dist/dataStoreLayerCompatState.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +33 -1
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +85 -50
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.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/dataStoreLayerCompatState.js +1 -1
- package/lib/dataStoreLayerCompatState.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +33 -1
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +85 -50
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.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 +21 -24
- package/src/dataStoreLayerCompatState.ts +1 -1
- package/src/dataStoreRuntime.ts +102 -56
- package/src/index.ts +1 -0
- package/src/packageVersion.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fluidframework/datastore
|
|
2
2
|
|
|
3
|
+
## 2.72.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.71.0
|
|
8
|
+
|
|
9
|
+
Dependency updates only.
|
|
10
|
+
|
|
3
11
|
## 2.70.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -27,7 +35,6 @@ Dependency updates only.
|
|
|
27
35
|
DDSes may optionally consume this value and use it to determine which sets of feature flags should be enabled.
|
|
28
36
|
|
|
29
37
|
#### Public type changes
|
|
30
|
-
|
|
31
38
|
- **@fluidframework/datastore: `FluidDataStoreRuntime`** - Exposes `minVersionForCollab`.
|
|
32
39
|
- **@fluidframework/runtime-definitions: `IFluidDataStoreContext`** - Exposes optional member `minVersionForCollab`.
|
|
33
40
|
See `FluidDataStoreContext` for an example implementation.
|
|
@@ -124,7 +131,6 @@ Dependency updates only.
|
|
|
124
131
|
- The process and processDocumentSchemaOp functions have been removed ([#24018](https://github.com/microsoft/FluidFramework/pull/24018)) [bc35d543d5](https://github.com/microsoft/FluidFramework/commit/bc35d543d58c7e4bf28944b09d645cc26bf28a29)
|
|
125
132
|
|
|
126
133
|
`process` has been replaced by `processMessages` from the following:
|
|
127
|
-
|
|
128
134
|
- `FluidDataStoreRuntime`
|
|
129
135
|
- `IDeltaHandler`
|
|
130
136
|
- `IFluidDataStoreChannel`
|
|
@@ -166,7 +172,6 @@ Dependency updates only.
|
|
|
166
172
|
parameter.
|
|
167
173
|
|
|
168
174
|
These changes were originally announced in version 0.25.0. See the following issues for more details:
|
|
169
|
-
|
|
170
175
|
- [#1537](https://github.com/microsoft/FluidFramework/issues/1537)
|
|
171
176
|
- [#2931](https://github.com/microsoft/FluidFramework/pull/2931)
|
|
172
177
|
|
|
@@ -195,7 +200,6 @@ Dependency updates only.
|
|
|
195
200
|
Similarly, `IDeltaManager.outbound` contained functionality that could break core runtime features such as generation of batches and chunking. Data loss or corruption could occur when `IDeltaManger.inbound.pause()` or `IDeltaManager.inbound.resume()` were called.
|
|
196
201
|
|
|
197
202
|
#### Alternatives
|
|
198
|
-
|
|
199
203
|
- Alternatives to `IDeltaManager.inbound.on("op", ...)` are `IDeltaManager.on("op", ...)`
|
|
200
204
|
- Alternatives to calling `IDeltaManager.inbound.pause`, `IDeltaManager.outbound.pause` for `IContainer` disconnect use `IContainer.disconnect`.
|
|
201
205
|
- Alternatives to calling `IDeltaManager.inbound.resume`, `IDeltaManager.outbound.resume` for `IContainer` reconnect use `IContainer.connect`.
|
|
@@ -236,7 +240,6 @@ Dependency updates only.
|
|
|
236
240
|
|
|
237
241
|
Make IFluidDataStoreRuntime.deltaManager have an opaque type.
|
|
238
242
|
Marks the following types which were reachable from it as alpha:
|
|
239
|
-
|
|
240
243
|
- IConnectionDetails
|
|
241
244
|
- IDeltaSender
|
|
242
245
|
- IDeltaManagerEvents
|
|
@@ -260,7 +263,6 @@ Dependency updates only.
|
|
|
260
263
|
TypeScript types and implementation code.
|
|
261
264
|
|
|
262
265
|
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
263
|
-
|
|
264
266
|
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
265
267
|
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
266
268
|
|
|
@@ -279,26 +281,21 @@ Dependency updates only.
|
|
|
279
281
|
- container-runtime: New feature: ID compression for DataStores & DDSs ([#19859](https://github.com/microsoft/FluidFramework/issues/19859)) [51f0d3db73](https://github.com/microsoft/FluidFramework/commits/51f0d3db737800e1c30ea5e3952d38ff30ffc7da)
|
|
280
282
|
|
|
281
283
|
### Key changes
|
|
282
|
-
|
|
283
284
|
1. A new API IContainerRuntimeBase.generateDocumentUniqueId() is exposed. This API will opportunistically generate IDs in short format (non-negative numbers). If it can't achieve that, it will return UUID strings. UUIDs generated will have low entropy in groups and will compress well. It can be leveraged anywhere in container where container unique IDs are required. I.e. any place that uses uuid() and stores data in container is likely candidate to start leveraging this API.
|
|
284
285
|
2. Data store internal IDs (IDs that are auto generated by FF system) will opportunistically be generated in shorter form. Data stores created in detached container will always have short IDs, data stores created in attached container will opportunistically be short (by using newly added IContainerRuntimeBase.generateDocumentUniqueId() capability)
|
|
285
286
|
3. Similar DDS names will be opportunistically short (same considerations for detached DDS vs. attached DDS)
|
|
286
287
|
|
|
287
288
|
### Implementation details
|
|
288
|
-
|
|
289
289
|
1. Container level ID Compressor can now be enabled with delay. With such setting, only new IContainerRuntimeBase.generateDocumentUniqueId() is exposed (ID Compressor is not exposed in such case, as leveraging any of its other capabilities requires future container sessions to load ID Compressor on container load, for correctness reasons). Once Container establishes connection and any changes are made in container, newly added API will start generating more compact IDs (in most cases).
|
|
290
290
|
|
|
291
291
|
### Breaking changes
|
|
292
|
-
|
|
293
292
|
1. DDS names can no longer start with "\_" symbol - this is reserved for FF needs. I've validated that's not an issue for AzureClient (it only creates root object by name, everything else is referred by handle). Our main internal partners almost never use named DDSs (I can find only 4 instances in Loop).
|
|
294
293
|
|
|
295
294
|
### Backward compatibility considerations
|
|
296
|
-
|
|
297
295
|
1. Data store internal IDs could collide with earlier used names data stores. Earlier versions of FF framework (before DataStore aliasing feature was added) allowed customers to supply IDs for data stores. And thus, files created with earlier versions of framework could have data store IDs that will be similar to names FF will use for newly created data stores ("A", ... "Z", "a"..."z", "AA", etc.). While such collision is possible, it's very unlikely (almost impossible) if user-provided names were at least 4-5 characters long.
|
|
298
296
|
2. If application runs to these problems, or wants to reduce risks, consider disabling ID compressor via IContainerRuntimeOptions.enableRuntimeIdCompressor = "off".
|
|
299
297
|
|
|
300
298
|
### Minor changes
|
|
301
|
-
|
|
302
299
|
1. IContainerRuntime.createDetachedRootDataStore() is removed. Please use IContainerRuntime.createDetachedDataStore and IDataStore.trySetAlias() instead
|
|
303
300
|
2. IContainerRuntimeOptions.enableRuntimeIdCompressor has been changes from boolean to tri-state.
|
|
304
301
|
|
|
@@ -321,7 +318,6 @@ Dependency updates only.
|
|
|
321
318
|
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
322
319
|
|
|
323
320
|
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
324
|
-
|
|
325
321
|
- @fluidframework/gitresources
|
|
326
322
|
- @fluidframework/server-kafka-orderer
|
|
327
323
|
- @fluidframework/server-lambdas
|
|
@@ -395,7 +391,6 @@ Dependency updates only.
|
|
|
395
391
|
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
396
392
|
|
|
397
393
|
This included the following changes from the protocol-definitions release:
|
|
398
|
-
|
|
399
394
|
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
400
395
|
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
401
396
|
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
@@ -411,7 +406,6 @@ Dependency updates only.
|
|
|
411
406
|
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
412
407
|
|
|
413
408
|
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
414
|
-
|
|
415
409
|
- @fluidframework/gitresources: 2.0.1
|
|
416
410
|
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
417
411
|
- @fluidframework/server-lambdas: 2.0.1
|
|
@@ -436,7 +430,6 @@ Dependency updates only.
|
|
|
436
430
|
- test-utils: provideEntryPoint is required [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
437
431
|
|
|
438
432
|
The optional `provideEntryPoint` method has become required on a number of constructors. A value will need to be provided to the following classes:
|
|
439
|
-
|
|
440
433
|
- `BaseContainerRuntimeFactory`
|
|
441
434
|
- `RuntimeFactory`
|
|
442
435
|
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
@@ -473,7 +466,6 @@ Dependency updates only.
|
|
|
473
466
|
|
|
474
467
|
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
475
468
|
imported from the **@fluidframework/core-interfaces** package:
|
|
476
|
-
|
|
477
469
|
- interface IDisposable
|
|
478
470
|
- interface IErrorEvent
|
|
479
471
|
- interface IErrorEvent
|
|
@@ -507,7 +499,6 @@ Dependency updates only.
|
|
|
507
499
|
- Request APIs deprecated from many places [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
508
500
|
|
|
509
501
|
The `request` API (associated with the `IFluidRouter` interface) has been deprecated on a number of classes and interfaces. The following are impacted:
|
|
510
|
-
|
|
511
502
|
- `IRuntime` and `ContainerRuntime`
|
|
512
503
|
- `IFluidDataStoreRuntime` and `FluidDataStoreRuntime`
|
|
513
504
|
- `IFluidDataStoreChannel`
|
|
@@ -523,7 +514,6 @@ Dependency updates only.
|
|
|
523
514
|
- `initializeEntryPoint` will become required [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
524
515
|
|
|
525
516
|
The optional `initializeEntryPoint` method has been added to a number of constructors. **This method argument will become required in an upcoming release** and a value will need to be provided to the following classes:
|
|
526
|
-
|
|
527
517
|
- `BaseContainerRuntimeFactory`
|
|
528
518
|
- `ContainerRuntimeFactoryWithDefaultDataStore`
|
|
529
519
|
- `RuntimeFactory`
|
|
@@ -568,7 +558,6 @@ Dependency updates only.
|
|
|
568
558
|
|
|
569
559
|
- The `@fluidframework/garbage-collector` package was deprecated in version 2.0.0-internal.4.1.0. [8b242fdc79](https://github.com/microsoft/FluidFramework/commits/8b242fdc796714cf1da9ad3f90d02efb122af0c2)
|
|
570
560
|
It has now been removed with the following functions, interfaces, and types in it.
|
|
571
|
-
|
|
572
561
|
- `cloneGCData`
|
|
573
562
|
- `concatGarbageCollectionData`
|
|
574
563
|
- `concatGarbageCollectionStates`
|
|
@@ -594,7 +583,6 @@ Dependency updates only.
|
|
|
594
583
|
- GC interfaces removed from runtime-definitions ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
|
|
595
584
|
|
|
596
585
|
The following interfaces available in `@fluidframework/runtime-definitions` are internal implementation details and have been deprecated for public use. They will be removed in an upcoming release.
|
|
597
|
-
|
|
598
586
|
- `IGarbageCollectionNodeData`
|
|
599
587
|
- `IGarbageCollectionState`
|
|
600
588
|
- `IGarbageCollectionSnapshotData`
|
|
@@ -605,7 +593,6 @@ Dependency updates only.
|
|
|
605
593
|
The `@fluidframework/garbage-collector` package is deprecated with the following functions, interfaces, and types in it.
|
|
606
594
|
These are internal implementation details and have been deprecated for public use. They will be removed in an upcoming
|
|
607
595
|
release.
|
|
608
|
-
|
|
609
596
|
- `cloneGCData`
|
|
610
597
|
- `concatGarbageCollectionData`
|
|
611
598
|
- `concatGarbageCollectionStates`
|
|
@@ -17,6 +17,8 @@ export class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRunt
|
|
|
17
17
|
constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>, policies?: Partial<IFluidDataStorePolicies>);
|
|
18
18
|
// (undocumented)
|
|
19
19
|
get absolutePath(): string;
|
|
20
|
+
// (undocumented)
|
|
21
|
+
get activeLocalOperationActivity(): "applyStashed" | "rollback" | undefined;
|
|
20
22
|
addChannel(channel: IChannel): void;
|
|
21
23
|
// (undocumented)
|
|
22
24
|
applyStashedOp(content: any): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreLayerCompatState.js","sourceRoot":"","sources":["../src/dataStoreLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,uEAGkD;AAElD,2DAAiD;AAEjD;;;GAGG;AACU,QAAA,0BAA0B,GAAG;IACzC;;OAEG;IACH,UAAU,EAAV,8BAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;CACb,CAAC;AAEF;;;GAGG;AACU,QAAA,gCAAgC,GAAwB;IACpE,GAAG,kCAA0B;IAC7B;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC;AAEF;;;GAGG;AACU,QAAA,sCAAsC,GAAoC;IACtF;;;OAGG;IACH,sBAAsB,EAAE,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,EAAE;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,4BAA4B,CAC3C,yBAA0D,EAC1D,SAAqB,EACrB,MAA2B;IAE3B,IAAA,qCAA0B,EACzB,WAAW,EACX,SAAS,EACT,wCAAgC,EAChC,8CAAsC,EACtC,yBAAyB,EACzB,SAAS,EACT,MAAM,CACN,CAAC;AACH,CAAC;AAdD,oEAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tILayerCompatDetails,\n\tILayerCompatSupportRequirements,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tvalidateLayerCompatibility,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * The core compatibility details of the DataStore layer that is the same across all layer boundaries.\n * @internal\n */\nexport const dataStoreCoreCompatDetails = {\n\t/**\n\t * The package version of the Runtime layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the Runtime layer.\n\t */\n\tgeneration:
|
|
1
|
+
{"version":3,"file":"dataStoreLayerCompatState.js","sourceRoot":"","sources":["../src/dataStoreLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,uEAGkD;AAElD,2DAAiD;AAEjD;;;GAGG;AACU,QAAA,0BAA0B,GAAG;IACzC;;OAEG;IACH,UAAU,EAAV,8BAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;CACb,CAAC;AAEF;;;GAGG;AACU,QAAA,gCAAgC,GAAwB;IACpE,GAAG,kCAA0B;IAC7B;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC;AAEF;;;GAGG;AACU,QAAA,sCAAsC,GAAoC;IACtF;;;OAGG;IACH,sBAAsB,EAAE,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,EAAE;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,4BAA4B,CAC3C,yBAA0D,EAC1D,SAAqB,EACrB,MAA2B;IAE3B,IAAA,qCAA0B,EACzB,WAAW,EACX,SAAS,EACT,wCAAgC,EAChC,8CAAsC,EACtC,yBAAyB,EACzB,SAAS,EACT,MAAM,CACN,CAAC;AACH,CAAC;AAdD,oEAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tILayerCompatDetails,\n\tILayerCompatSupportRequirements,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tvalidateLayerCompatibility,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * The core compatibility details of the DataStore layer that is the same across all layer boundaries.\n * @internal\n */\nexport const dataStoreCoreCompatDetails = {\n\t/**\n\t * The package version of the Runtime layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the Runtime layer.\n\t */\n\tgeneration: 2,\n};\n\n/**\n * DataStore's compatibility details that is exposed to the Runtime layer.\n * @internal\n */\nexport const dataStoreCompatDetailsForRuntime: ILayerCompatDetails = {\n\t...dataStoreCoreCompatDetails,\n\t/**\n\t * The features supported by the DataStore layer across the DataStore / Runtime boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\n};\n\n/**\n * The requirements that the Runtime layer must meet to be compatible with this DataStore.\n * @internal\n */\nexport const runtimeSupportRequirementsForDataStore: ILayerCompatSupportRequirements = {\n\t/**\n\t * Minimum generation that Runtime must be at to be compatible with DataStore. Note that 0 is used here so\n\t * that Runtime layers before the introduction of the layer compatibility enforcement are compatible.\n\t */\n\tminSupportedGeneration: 0,\n\t/**\n\t * The features that the Runtime must support to be compatible with DataStore.\n\t */\n\trequiredFeatures: [],\n};\n\n/**\n * Validates that the Runtime layer is compatible with this DataStore.\n * @internal\n */\nexport function validateRuntimeCompatibility(\n\tmaybeRuntimeCompatDetails: ILayerCompatDetails | undefined,\n\tdisposeFn: () => void,\n\tlogger: ITelemetryLoggerExt,\n): void {\n\tvalidateLayerCompatibility(\n\t\t\"dataStore\",\n\t\t\"runtime\",\n\t\tdataStoreCompatDetailsForRuntime,\n\t\truntimeSupportRequirementsForDataStore,\n\t\tmaybeRuntimeCompatDetails,\n\t\tdisposeFn,\n\t\tlogger,\n\t);\n}\n"]}
|
|
@@ -11,7 +11,7 @@ import type { IChannel, IChannelFactory, IFluidDataStoreRuntime, IFluidDataStore
|
|
|
11
11
|
import { type IClientDetails, type IQuorumClients } from "@fluidframework/driver-definitions";
|
|
12
12
|
import type { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
13
13
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
14
|
-
import { type ISummaryTreeWithStats, type ITelemetryContext, type IGarbageCollectionData, type IFluidDataStoreChannel, type IFluidDataStoreContext, VisibilityState, type IInboundSignalMessage, type IRuntimeMessageCollection, type IFluidDataStorePolicies, type MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
14
|
+
import { type ISummaryTreeWithStats, type ITelemetryContext, type IGarbageCollectionData, type IAttachMessage, type IEnvelope, type IFluidDataStoreChannel, type IFluidDataStoreContext, VisibilityState, type IInboundSignalMessage, type IRuntimeMessageCollection, type IFluidDataStorePolicies, type MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
15
15
|
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
16
16
|
/**
|
|
17
17
|
* @legacy @beta
|
|
@@ -20,6 +20,20 @@ export declare enum DataStoreMessageType {
|
|
|
20
20
|
Attach = "attach",
|
|
21
21
|
ChannelOp = "op"
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Outgoing {@link FluidDataStoreRuntime} message structures.
|
|
25
|
+
* @internal
|
|
26
|
+
*
|
|
27
|
+
* @privateRemarks
|
|
28
|
+
* The types here are required to satisfy {@link @fluidframework/runtime-definitions#FluidDataStoreMessage} interface.
|
|
29
|
+
*/
|
|
30
|
+
export type LocalFluidDataStoreRuntimeMessage = {
|
|
31
|
+
type: DataStoreMessageType.ChannelOp;
|
|
32
|
+
content: IEnvelope;
|
|
33
|
+
} | {
|
|
34
|
+
type: DataStoreMessageType.Attach;
|
|
35
|
+
content: IAttachMessage;
|
|
36
|
+
};
|
|
23
37
|
/**
|
|
24
38
|
* @legacy @beta
|
|
25
39
|
*/
|
|
@@ -54,6 +68,8 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
54
68
|
get rootRoutingContext(): this;
|
|
55
69
|
get channelsRoutingContext(): this;
|
|
56
70
|
get objectsRoutingContext(): this;
|
|
71
|
+
private localOpActivity;
|
|
72
|
+
get activeLocalOperationActivity(): "applyStashed" | "rollback" | undefined;
|
|
57
73
|
private _disposed;
|
|
58
74
|
get disposed(): boolean;
|
|
59
75
|
private readonly contexts;
|
|
@@ -275,12 +291,28 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
275
291
|
* This typically happens when we reconnect and there are unacked messages.
|
|
276
292
|
* @param content - The content of the original message.
|
|
277
293
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
294
|
+
*
|
|
295
|
+
* @privateRemarks
|
|
296
|
+
* `type` parameter's type of `DataStoreMessageType` is a covariance exception
|
|
297
|
+
* over `string` that `IFluidDataStoreChannel` specifies. So long as local
|
|
298
|
+
* submissions conform to this type all is well. (`unreachableCase` might be
|
|
299
|
+
* reachable over time without better typing in this area if a mistake is made.)
|
|
300
|
+
* See {@link @fluidframework/runtime-definitions#FluidDataStoreMessage} comment
|
|
301
|
+
* for opportunity to resolve this.
|
|
278
302
|
*/
|
|
279
303
|
reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown, squash?: boolean): void;
|
|
280
304
|
/**
|
|
281
305
|
* Revert a local op.
|
|
282
306
|
* @param content - The content of the original message.
|
|
283
307
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
308
|
+
*
|
|
309
|
+
* @privateRemarks
|
|
310
|
+
* `type` parameter's type of `DataStoreMessageType` is a covariance exception
|
|
311
|
+
* over `string` that `IFluidDataStoreChannel` specifies. So long as local
|
|
312
|
+
* submissions conform to this type all is well. (`unreachableCase` might be
|
|
313
|
+
* reachable over time without better typing in this area if a mistake is made.)
|
|
314
|
+
* See {@link @fluidframework/runtime-definitions#FluidDataStoreMessage} comment
|
|
315
|
+
* for opportunity to resolve this.
|
|
284
316
|
*/
|
|
285
317
|
rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;
|
|
286
318
|
applyStashedOp(content: any): Promise<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EACX,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,0CAA0C,CAAC;AAQlD,OAAO,KAAK,EACX,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,EAEnB,MAAM,gDAAgD,CAA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@ -94,6 +94,9 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
94
94
|
get objectsRoutingContext() {
|
|
95
95
|
return this;
|
|
96
96
|
}
|
|
97
|
+
get activeLocalOperationActivity() {
|
|
98
|
+
return this.localOpActivity;
|
|
99
|
+
}
|
|
97
100
|
get disposed() {
|
|
98
101
|
return this._disposed;
|
|
99
102
|
}
|
|
@@ -119,6 +122,7 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
119
122
|
* {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.isReadOnly}
|
|
120
123
|
*/
|
|
121
124
|
this.isReadOnly = () => this._readonly;
|
|
125
|
+
this.localOpActivity = undefined;
|
|
122
126
|
this._disposed = false;
|
|
123
127
|
this.contexts = new Map();
|
|
124
128
|
this.pendingAttach = new Set();
|
|
@@ -810,17 +814,17 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
810
814
|
type: channel.attributes.type,
|
|
811
815
|
};
|
|
812
816
|
this.pendingAttach.add(channel.id);
|
|
813
|
-
this.submit(DataStoreMessageType.Attach, message);
|
|
817
|
+
this.submit({ type: DataStoreMessageType.Attach, content: message });
|
|
814
818
|
const context = this.contexts.get(channel.id);
|
|
815
819
|
context.makeVisible();
|
|
816
820
|
}
|
|
817
821
|
submitChannelOp(address, contents, localOpMetadata) {
|
|
818
822
|
const envelope = { address, contents };
|
|
819
|
-
this.submit(DataStoreMessageType.ChannelOp, envelope, localOpMetadata);
|
|
820
|
-
}
|
|
821
|
-
submit(type, content, localOpMetadata = undefined) {
|
|
822
823
|
this.verifyNotClosed();
|
|
823
|
-
this.
|
|
824
|
+
this.submit({ type: DataStoreMessageType.ChannelOp, content: envelope }, localOpMetadata);
|
|
825
|
+
}
|
|
826
|
+
submit(message, localOpMetadata = undefined) {
|
|
827
|
+
this.dataStoreContext.submitMessage(message.type, message.content, localOpMetadata);
|
|
824
828
|
++this.pendingOpCount.value;
|
|
825
829
|
}
|
|
826
830
|
/**
|
|
@@ -829,6 +833,14 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
829
833
|
* This typically happens when we reconnect and there are unacked messages.
|
|
830
834
|
* @param content - The content of the original message.
|
|
831
835
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
836
|
+
*
|
|
837
|
+
* @privateRemarks
|
|
838
|
+
* `type` parameter's type of `DataStoreMessageType` is a covariance exception
|
|
839
|
+
* over `string` that `IFluidDataStoreChannel` specifies. So long as local
|
|
840
|
+
* submissions conform to this type all is well. (`unreachableCase` might be
|
|
841
|
+
* reachable over time without better typing in this area if a mistake is made.)
|
|
842
|
+
* See {@link @fluidframework/runtime-definitions#FluidDataStoreMessage} comment
|
|
843
|
+
* for opportunity to resolve this.
|
|
832
844
|
*/
|
|
833
845
|
reSubmit(type,
|
|
834
846
|
// TODO: use something other than `any` here (breaking change)
|
|
@@ -849,7 +861,8 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
849
861
|
}
|
|
850
862
|
case DataStoreMessageType.Attach: {
|
|
851
863
|
// For Attach messages, just submit them again.
|
|
852
|
-
|
|
864
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- `content` needs typed better than `any`
|
|
865
|
+
this.submit({ type, content }, localOpMetadata);
|
|
853
866
|
break;
|
|
854
867
|
}
|
|
855
868
|
default: {
|
|
@@ -861,66 +874,88 @@ class FluidDataStoreRuntime extends client_utils_1.TypedEventEmitter {
|
|
|
861
874
|
* Revert a local op.
|
|
862
875
|
* @param content - The content of the original message.
|
|
863
876
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
877
|
+
*
|
|
878
|
+
* @privateRemarks
|
|
879
|
+
* `type` parameter's type of `DataStoreMessageType` is a covariance exception
|
|
880
|
+
* over `string` that `IFluidDataStoreChannel` specifies. So long as local
|
|
881
|
+
* submissions conform to this type all is well. (`unreachableCase` might be
|
|
882
|
+
* reachable over time without better typing in this area if a mistake is made.)
|
|
883
|
+
* See {@link @fluidframework/runtime-definitions#FluidDataStoreMessage} comment
|
|
884
|
+
* for opportunity to resolve this.
|
|
864
885
|
*/
|
|
865
886
|
rollback(type,
|
|
866
887
|
// TODO: use something other than `any` here (breaking change)
|
|
867
888
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
868
889
|
content, localOpMetadata) {
|
|
869
890
|
this.verifyNotClosed();
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
891
|
+
(0, internal_1.assert)(!this.localOpActivity, "localOpActivity must be undefined when entering rollback");
|
|
892
|
+
this.localOpActivity = "rollback";
|
|
893
|
+
try {
|
|
894
|
+
// The op being rolled back was not/will not be submitted, so decrement the count.
|
|
895
|
+
--this.pendingOpCount.value;
|
|
896
|
+
switch (type) {
|
|
897
|
+
case DataStoreMessageType.ChannelOp: {
|
|
898
|
+
// For Operations, find the right channel and trigger resubmission on it.
|
|
899
|
+
const envelope = content;
|
|
900
|
+
const channelContext = this.contexts.get(envelope.address);
|
|
901
|
+
(0, internal_1.assert)(!!channelContext, 0x2ed /* "There should be a channel context for the op" */);
|
|
902
|
+
channelContext.rollback(envelope.contents, localOpMetadata);
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
default: {
|
|
906
|
+
throw new internal_5.LoggingError(`Can't rollback ${type} message`);
|
|
907
|
+
}
|
|
883
908
|
}
|
|
884
909
|
}
|
|
910
|
+
finally {
|
|
911
|
+
this.localOpActivity = undefined;
|
|
912
|
+
}
|
|
885
913
|
}
|
|
886
914
|
// TODO: use something other than `any` here
|
|
887
915
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
888
916
|
async applyStashedOp(content) {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
917
|
+
(0, internal_1.assert)(!this.localOpActivity, "localOpActivity must be undefined when entering applyStashedOp");
|
|
918
|
+
this.localOpActivity = "applyStashed";
|
|
919
|
+
try {
|
|
920
|
+
// The op being applied may have been submitted in a previous session, so we increment the count here.
|
|
921
|
+
// Either the ack will arrive and be processed, or that previous session's connection will end, at which point the op will be resubmitted.
|
|
922
|
+
++this.pendingOpCount.value;
|
|
923
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
924
|
+
const type = content?.type;
|
|
925
|
+
switch (type) {
|
|
926
|
+
case DataStoreMessageType.Attach: {
|
|
927
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
928
|
+
const attachMessage = content.content;
|
|
929
|
+
const flatBlobs = new Map();
|
|
930
|
+
const snapshotTree = (0, internal_2.buildSnapshotTree)(attachMessage.snapshot.entries, flatBlobs);
|
|
931
|
+
const channelContext = this.createRehydratedLocalChannelContext(attachMessage.id, snapshotTree, flatBlobs);
|
|
932
|
+
await channelContext.getChannel();
|
|
933
|
+
this.contexts.set(attachMessage.id, channelContext);
|
|
934
|
+
if (this.attachState === container_definitions_1.AttachState.Detached) {
|
|
935
|
+
this.localChannelContextQueue.set(attachMessage.id, channelContext);
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
channelContext.makeVisible();
|
|
939
|
+
this.pendingAttach.add(attachMessage.id);
|
|
940
|
+
}
|
|
941
|
+
return;
|
|
905
942
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
943
|
+
case DataStoreMessageType.ChannelOp: {
|
|
944
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
945
|
+
const envelope = content.content;
|
|
946
|
+
const channelContext = this.contexts.get(envelope.address);
|
|
947
|
+
(0, internal_1.assert)(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
|
|
948
|
+
await channelContext.getChannel();
|
|
949
|
+
return channelContext.applyStashedOp(envelope.contents);
|
|
950
|
+
}
|
|
951
|
+
default: {
|
|
952
|
+
(0, internal_1.unreachableCase)(type);
|
|
909
953
|
}
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
case DataStoreMessageType.ChannelOp: {
|
|
913
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
914
|
-
const envelope = content.content;
|
|
915
|
-
const channelContext = this.contexts.get(envelope.address);
|
|
916
|
-
(0, internal_1.assert)(!!channelContext, 0x184 /* "There should be a channel context for the op" */);
|
|
917
|
-
await channelContext.getChannel();
|
|
918
|
-
return channelContext.applyStashedOp(envelope.contents);
|
|
919
|
-
}
|
|
920
|
-
default: {
|
|
921
|
-
(0, internal_1.unreachableCase)(type);
|
|
922
954
|
}
|
|
923
955
|
}
|
|
956
|
+
finally {
|
|
957
|
+
this.localOpActivity = undefined;
|
|
958
|
+
}
|
|
924
959
|
}
|
|
925
960
|
/**
|
|
926
961
|
* Indicates the given channel is dirty from Summarizer's point of view,
|