@fluidframework/register-collection 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +5 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +117 -0
- package/README.md +29 -8
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/register-collection.api.md +90 -0
- package/dist/{consensusRegisterCollection.js → consensusRegisterCollection.cjs} +31 -29
- package/dist/consensusRegisterCollection.cjs.map +1 -0
- package/dist/consensusRegisterCollection.d.ts +2 -1
- package/dist/consensusRegisterCollection.d.ts.map +1 -1
- package/dist/{consensusRegisterCollectionFactory.js → consensusRegisterCollectionFactory.cjs} +5 -4
- package/dist/consensusRegisterCollectionFactory.cjs.map +1 -0
- package/dist/consensusRegisterCollectionFactory.d.ts +2 -1
- package/dist/consensusRegisterCollectionFactory.d.ts.map +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/{interfaces.js → interfaces.cjs} +3 -2
- package/dist/interfaces.cjs.map +1 -0
- package/dist/interfaces.d.ts +9 -5
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/register-collection-alpha.d.ts +163 -0
- package/dist/register-collection-beta.d.ts +25 -0
- package/dist/register-collection-public.d.ts +25 -0
- package/dist/register-collection-untrimmed.d.ts +163 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/{consensusRegisterCollection.d.ts → consensusRegisterCollection.d.mts} +4 -3
- package/lib/consensusRegisterCollection.d.mts.map +1 -0
- package/lib/{consensusRegisterCollection.js → consensusRegisterCollection.mjs} +27 -25
- package/lib/consensusRegisterCollection.mjs.map +1 -0
- package/lib/{consensusRegisterCollectionFactory.d.ts → consensusRegisterCollectionFactory.d.mts} +3 -2
- package/lib/consensusRegisterCollectionFactory.d.mts.map +1 -0
- package/lib/{consensusRegisterCollectionFactory.js → consensusRegisterCollectionFactory.mjs} +5 -4
- package/lib/consensusRegisterCollectionFactory.mjs.map +1 -0
- package/lib/index.d.mts +8 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +8 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{interfaces.d.ts → interfaces.d.mts} +9 -5
- package/lib/interfaces.d.mts.map +1 -0
- package/lib/{interfaces.js → interfaces.mjs} +2 -1
- package/lib/interfaces.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/register-collection-alpha.d.mts +163 -0
- package/lib/register-collection-beta.d.mts +25 -0
- package/lib/register-collection-public.d.mts +25 -0
- package/lib/register-collection-untrimmed.d.mts +163 -0
- package/package.json +97 -62
- package/prettier.config.cjs +8 -0
- package/src/consensusRegisterCollection.ts +307 -284
- package/src/consensusRegisterCollectionFactory.ts +39 -33
- package/src/index.ts +8 -3
- package/src/interfaces.ts +52 -43
- package/src/packageVersion.ts +1 -1
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/dist/consensusRegisterCollection.js.map +0 -1
- package/dist/consensusRegisterCollectionFactory.js.map +0 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/interfaces.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/lib/consensusRegisterCollection.d.ts.map +0 -1
- package/lib/consensusRegisterCollection.js.map +0 -1
- package/lib/consensusRegisterCollectionFactory.d.ts.map +0 -1
- package/lib/consensusRegisterCollectionFactory.js.map +0 -1
- package/lib/index.d.ts +0 -8
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/interfaces.d.ts.map +0 -1
- package/lib/interfaces.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
package/.eslintrc.js
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
}
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
};
|
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @fluidframework/register-collection
|
|
2
|
+
|
|
3
|
+
## 2.0.0-internal.8.0.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.7.4.0
|
|
8
|
+
|
|
9
|
+
Dependency updates only.
|
|
10
|
+
|
|
11
|
+
## 2.0.0-internal.7.3.0
|
|
12
|
+
|
|
13
|
+
Dependency updates only.
|
|
14
|
+
|
|
15
|
+
## 2.0.0-internal.7.2.0
|
|
16
|
+
|
|
17
|
+
Dependency updates only.
|
|
18
|
+
|
|
19
|
+
## 2.0.0-internal.7.1.0
|
|
20
|
+
|
|
21
|
+
Dependency updates only.
|
|
22
|
+
|
|
23
|
+
## 2.0.0-internal.7.0.0
|
|
24
|
+
|
|
25
|
+
### Major Changes
|
|
26
|
+
|
|
27
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
28
|
+
|
|
29
|
+
This included the following changes from the protocol-definitions release:
|
|
30
|
+
|
|
31
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
32
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
33
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
34
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
35
|
+
ISignalMessageBase interface that contains common members.
|
|
36
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
37
|
+
|
|
38
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
39
|
+
|
|
40
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
41
|
+
|
|
42
|
+
- @fluidframework/gitresources: 2.0.1
|
|
43
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
44
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
45
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
46
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
47
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
48
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
49
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
50
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
51
|
+
- @fluidframework/server-services: 2.0.1
|
|
52
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
53
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
54
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
55
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
56
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
57
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
58
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
59
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
60
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
61
|
+
- tinylicious: 2.0.1
|
|
62
|
+
|
|
63
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
64
|
+
|
|
65
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
66
|
+
|
|
67
|
+
## 2.0.0-internal.6.4.0
|
|
68
|
+
|
|
69
|
+
Dependency updates only.
|
|
70
|
+
|
|
71
|
+
## 2.0.0-internal.6.3.0
|
|
72
|
+
|
|
73
|
+
Dependency updates only.
|
|
74
|
+
|
|
75
|
+
## 2.0.0-internal.6.2.0
|
|
76
|
+
|
|
77
|
+
Dependency updates only.
|
|
78
|
+
|
|
79
|
+
## 2.0.0-internal.6.1.0
|
|
80
|
+
|
|
81
|
+
Dependency updates only.
|
|
82
|
+
|
|
83
|
+
## 2.0.0-internal.6.0.0
|
|
84
|
+
|
|
85
|
+
### Major Changes
|
|
86
|
+
|
|
87
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
88
|
+
|
|
89
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
90
|
+
|
|
91
|
+
## 2.0.0-internal.5.4.0
|
|
92
|
+
|
|
93
|
+
Dependency updates only.
|
|
94
|
+
|
|
95
|
+
## 2.0.0-internal.5.3.0
|
|
96
|
+
|
|
97
|
+
Dependency updates only.
|
|
98
|
+
|
|
99
|
+
## 2.0.0-internal.5.2.0
|
|
100
|
+
|
|
101
|
+
Dependency updates only.
|
|
102
|
+
|
|
103
|
+
## 2.0.0-internal.5.1.0
|
|
104
|
+
|
|
105
|
+
Dependency updates only.
|
|
106
|
+
|
|
107
|
+
## 2.0.0-internal.5.0.0
|
|
108
|
+
|
|
109
|
+
Dependency updates only.
|
|
110
|
+
|
|
111
|
+
## 2.0.0-internal.4.4.0
|
|
112
|
+
|
|
113
|
+
Dependency updates only.
|
|
114
|
+
|
|
115
|
+
## 2.0.0-internal.4.1.0
|
|
116
|
+
|
|
117
|
+
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
# @fluidframework/register-collection
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A consensus register collection is a distributed data structure (DDS), which holds a set of registers and their versions generated during concurrent updates. In the simplest definition, two updates on a single register are concurrent if there is no causal relationship between them (i.e., neither knows about the other). On such cases of concurrent updates, a register internally stores all possible versions of a value.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<!-- prettier-ignore-start -->
|
|
8
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Using Fluid Framework libraries
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
13
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
|
+
library consumers should always prefer `^`.
|
|
15
|
+
|
|
16
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
20
|
+
package for more information including tools to convert between version schemes.
|
|
21
|
+
|
|
22
|
+
<!-- prettier-ignore-end -->
|
|
23
|
+
|
|
24
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
25
|
+
|
|
26
|
+
### Detecting concurrency in Fluid
|
|
27
|
+
|
|
28
|
+
In distributed systems literaure, detecting conucurrency requires some form of logical/phsical clock. A popular technique used in replicated databases such as dynamodb is called version vectors where each key stores a collection of `[time, value]` tuples. `time` is essentially a reference clock used to decide concurrency amongst updates. Each update to a key includes the `time`, essentially to indicate how `caught up` the replica was during that update.
|
|
29
|
+
|
|
30
|
+
In Fluid, each operation contains a referenceSequenceNumber (`refSeq`), which essenially refers to how caught up the client was (in terms of sequence number) during that update. We can use this property to implement a similar concurreny model. Mathematically, if an update has a `refSeq N`, it can overwrite/discard any other prior values with `sequenceNumber (seq) <= N`. It is safe to do so because the client must have seen all those updates before posting it's own update. Hence this update is not concurrent with those overwritten updates. However, the update is still concurrent with any other update with `seq > N`. Therefore those versions are still kept.
|
|
31
|
+
|
|
32
|
+
### Conflict resolution policies
|
|
12
33
|
|
|
13
34
|
Below are the policies that the DDS implements:
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
- Versions: Returns all stored concurrent versions. App is responsible for conflict resolution. Amazon's shopping cart policy based on dynamodb is a popular example of this policy.
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
- LWW: The last write to a key always overwrites any prior writes (aka last write win policy). This is exactly same as Fluid's Shared Map policy.
|
|
18
39
|
|
|
19
|
-
|
|
40
|
+
- Atomic: The policy follows the same semantics of a shared distributed lock. Amongst all concurrent updates, only the first writer wins. In distributed systems literature, the register update policy is called `Atomic`. This behavior requires a linearizable register. A linearizable register behaves as if there is only a single copy of the data, and that every operation appears to take effect atomically at one point in time. This definition implies that operations are executed in an well-defined order. On a concurrent update, we perform a `compare-and-set` operation, where we compare a register's stored `seq` with the incoming `refSeq`. The earliest operation overwriting the stored `seq` wins since every client reaches to an agreement on the value. Hence we can safely return the first value.
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
4
4
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/register-collection"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
8
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
9
|
+
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
10
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
11
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
12
|
+
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
13
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
+
import { ISharedObject } from '@fluidframework/shared-object-base';
|
|
15
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
16
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
18
|
+
|
|
19
|
+
// @alpha
|
|
20
|
+
export class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
|
|
21
|
+
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
22
|
+
// (undocumented)
|
|
23
|
+
protected applyStashedOp(): () => void;
|
|
24
|
+
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
|
|
25
|
+
static getFactory(): ConsensusRegisterCollectionFactory;
|
|
26
|
+
// (undocumented)
|
|
27
|
+
keys(): string[];
|
|
28
|
+
// (undocumented)
|
|
29
|
+
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
30
|
+
// (undocumented)
|
|
31
|
+
protected onDisconnect(): void;
|
|
32
|
+
// (undocumented)
|
|
33
|
+
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
34
|
+
read(key: string, readPolicy?: ReadPolicy): T | undefined;
|
|
35
|
+
// (undocumented)
|
|
36
|
+
readVersions(key: string): T[] | undefined;
|
|
37
|
+
// (undocumented)
|
|
38
|
+
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
39
|
+
write(key: string, value: T): Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// @alpha
|
|
43
|
+
export class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
|
|
44
|
+
// (undocumented)
|
|
45
|
+
static readonly Attributes: IChannelAttributes;
|
|
46
|
+
// (undocumented)
|
|
47
|
+
get attributes(): IChannelAttributes;
|
|
48
|
+
// (undocumented)
|
|
49
|
+
create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
|
|
50
|
+
// (undocumented)
|
|
51
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
|
|
52
|
+
// (undocumented)
|
|
53
|
+
static Type: string;
|
|
54
|
+
// (undocumented)
|
|
55
|
+
get type(): string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// @alpha
|
|
59
|
+
export interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
|
|
60
|
+
keys(): string[];
|
|
61
|
+
read(key: string, policy?: ReadPolicy): T | undefined;
|
|
62
|
+
readVersions(key: string): T[] | undefined;
|
|
63
|
+
write(key: string, value: T): Promise<boolean>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// @alpha
|
|
67
|
+
export interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
|
|
68
|
+
// (undocumented)
|
|
69
|
+
(event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// @alpha
|
|
73
|
+
export interface IConsensusRegisterCollectionFactory extends IChannelFactory {
|
|
74
|
+
// (undocumented)
|
|
75
|
+
create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
|
|
76
|
+
// (undocumented)
|
|
77
|
+
load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// @alpha
|
|
81
|
+
export enum ReadPolicy {
|
|
82
|
+
// (undocumented)
|
|
83
|
+
Atomic = 0,
|
|
84
|
+
// (undocumented)
|
|
85
|
+
LWW = 1
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// (No @packageDocumentation comment for this package)
|
|
89
|
+
|
|
90
|
+
```
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ConsensusRegisterCollection = void 0;
|
|
8
|
-
const
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
10
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
10
11
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
11
|
-
const consensusRegisterCollectionFactory_1 = require("./consensusRegisterCollectionFactory");
|
|
12
|
-
const interfaces_1 = require("./interfaces");
|
|
12
|
+
const consensusRegisterCollectionFactory_1 = require("./consensusRegisterCollectionFactory.cjs");
|
|
13
|
+
const interfaces_1 = require("./interfaces.cjs");
|
|
13
14
|
const newLocalRegister = (sequenceNumber, value) => ({
|
|
14
15
|
sequenceNumber,
|
|
15
16
|
value: {
|
|
@@ -21,17 +22,10 @@ const newLocalRegister = (sequenceNumber, value) => ({
|
|
|
21
22
|
const incomingOpMatchesCurrentFormat = (op) => "serializedValue" in op;
|
|
22
23
|
const snapshotFileName = "header";
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* {@inheritDoc IConsensusRegisterCollection}
|
|
26
|
+
* @alpha
|
|
25
27
|
*/
|
|
26
28
|
class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
27
|
-
/**
|
|
28
|
-
* Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
|
|
29
|
-
* be provided
|
|
30
|
-
*/
|
|
31
|
-
constructor(id, runtime, attributes) {
|
|
32
|
-
super(id, runtime, attributes, "fluid_consensusRegisterCollection_");
|
|
33
|
-
this.data = new Map();
|
|
34
|
-
}
|
|
35
29
|
/**
|
|
36
30
|
* Create a new consensus register collection
|
|
37
31
|
*
|
|
@@ -39,7 +33,6 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
39
33
|
* @param id - optional name of the consensus register collection
|
|
40
34
|
* @returns newly create consensus register collection (but not attached yet)
|
|
41
35
|
*/
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
43
36
|
static create(runtime, id) {
|
|
44
37
|
return runtime.createChannel(id, consensusRegisterCollectionFactory_1.ConsensusRegisterCollectionFactory.Type);
|
|
45
38
|
}
|
|
@@ -51,6 +44,14 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
51
44
|
static getFactory() {
|
|
52
45
|
return new consensusRegisterCollectionFactory_1.ConsensusRegisterCollectionFactory();
|
|
53
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
|
|
49
|
+
* be provided
|
|
50
|
+
*/
|
|
51
|
+
constructor(id, runtime, attributes) {
|
|
52
|
+
super(id, runtime, attributes, "fluid_consensusRegisterCollection_");
|
|
53
|
+
this.data = new Map();
|
|
54
|
+
}
|
|
54
55
|
/**
|
|
55
56
|
* Creates a new register or writes a new value.
|
|
56
57
|
* Returns a promise that will resolve when the write is acked.
|
|
@@ -89,34 +90,33 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
89
90
|
const versions = this.readVersions(key);
|
|
90
91
|
if (versions !== undefined) {
|
|
91
92
|
// We don't support deletion. So there should be at least one value.
|
|
92
|
-
(0,
|
|
93
|
+
(0, core_utils_1.assert)(versions.length > 0, 0x06c /* "Value should be undefined or non-empty" */);
|
|
93
94
|
return versions[versions.length - 1];
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
readVersions(key) {
|
|
97
98
|
const data = this.data.get(key);
|
|
98
|
-
return data
|
|
99
|
+
return data?.versions.map((element) => element.value.value);
|
|
99
100
|
}
|
|
100
101
|
keys() {
|
|
101
102
|
return [...this.data.keys()];
|
|
102
103
|
}
|
|
103
104
|
summarizeCore(serializer) {
|
|
104
105
|
const dataObj = {};
|
|
105
|
-
this.data.forEach((v, k) => {
|
|
106
|
+
this.data.forEach((v, k) => {
|
|
107
|
+
dataObj[k] = v;
|
|
108
|
+
});
|
|
106
109
|
return (0, shared_object_base_1.createSingleBlobSummary)(snapshotFileName, this.stringify(dataObj, serializer));
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
109
112
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
110
113
|
*/
|
|
111
114
|
async loadCore(storage) {
|
|
112
|
-
var _a;
|
|
113
115
|
const blob = await storage.readBlob(snapshotFileName);
|
|
114
|
-
const header = (0,
|
|
116
|
+
const header = (0, client_utils_1.bufferToString)(blob, "utf8");
|
|
115
117
|
const dataObj = this.parse(header, this.serializer);
|
|
116
118
|
for (const key of Object.keys(dataObj)) {
|
|
117
|
-
(0,
|
|
118
|
-
// eslint-disable-next-line max-len
|
|
119
|
-
0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
|
|
119
|
+
(0, core_utils_1.assert)(dataObj[key].atomic?.value.type !== "Shared", 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
|
|
120
120
|
this.data.set(key, dataObj[key]);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -134,7 +134,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
134
134
|
// Message can be delivered with delay - e.g. resubmitted on reconnect.
|
|
135
135
|
// Use the refSeq from when the op was created, not when it was transmitted
|
|
136
136
|
const refSeqWhenCreated = op.refSeq;
|
|
137
|
-
(0,
|
|
137
|
+
(0, core_utils_1.assert)(refSeqWhenCreated <= message.referenceSequenceNumber, 0x06e /* "Message's reference sequence number < op's reference sequence number!" */);
|
|
138
138
|
const value = incomingOpMatchesCurrentFormat(op)
|
|
139
139
|
? this.parse(op.serializedValue, this.serializer)
|
|
140
140
|
: op.value.value;
|
|
@@ -146,13 +146,14 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
default:
|
|
149
|
+
default:
|
|
150
|
+
(0, core_utils_1.unreachableCase)(op.type);
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
readAtomic(key) {
|
|
154
155
|
const data = this.data.get(key);
|
|
155
|
-
return data
|
|
156
|
+
return data?.atomic.value.value;
|
|
156
157
|
}
|
|
157
158
|
/**
|
|
158
159
|
* Process an inbound write op
|
|
@@ -181,7 +182,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
else {
|
|
184
|
-
(0,
|
|
185
|
+
(0, core_utils_1.assert)(!!data, 0x06f /* "data missing for non-atomic inbound update!" */);
|
|
185
186
|
}
|
|
186
187
|
// Remove versions that were known to the remote client at the time of write
|
|
187
188
|
while (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {
|
|
@@ -190,10 +191,12 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
190
191
|
const versionUpdate = newLocalRegister(sequenceNumber, value);
|
|
191
192
|
// Asserts for data integrity
|
|
192
193
|
if (!this.isAttached()) {
|
|
193
|
-
(0,
|
|
194
|
+
(0, core_utils_1.assert)(refSeq === 0 && sequenceNumber === 0, 0x070 /* "sequence numbers are expected to be 0 when unattached" */);
|
|
194
195
|
}
|
|
195
196
|
else if (data.versions.length > 0) {
|
|
196
|
-
(0,
|
|
197
|
+
(0, core_utils_1.assert)(
|
|
198
|
+
// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)
|
|
199
|
+
sequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber, 0x071 /* "Versions should naturally be ordered by sequenceNumber" */);
|
|
197
200
|
}
|
|
198
201
|
// Push the new element.
|
|
199
202
|
data.versions.push(versionUpdate);
|
|
@@ -208,7 +211,6 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
208
211
|
return serializer.stringify(value, this.handle);
|
|
209
212
|
}
|
|
210
213
|
parse(content, serializer) {
|
|
211
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
212
214
|
return serializer.parse(content);
|
|
213
215
|
}
|
|
214
216
|
applyStashedOp() {
|
|
@@ -217,4 +219,4 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
|
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
exports.ConsensusRegisterCollection = ConsensusRegisterCollection;
|
|
220
|
-
//# sourceMappingURL=consensusRegisterCollection.
|
|
222
|
+
//# sourceMappingURL=consensusRegisterCollection.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollection.cjs","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,2DAAqE;AACrE,+EAA8F;AAO9F,2EAI4C;AAC5C,iGAA0F;AAC1F,iDAIsB;AAqBtB,MAAM,gBAAgB,GAAG,CAAI,cAAsB,EAAE,KAAQ,EAAqB,EAAE,CAAC,CAAC;IACrF,cAAc;IACd,KAAK,EAAE;QACN,IAAI,EAAE,OAAO;QACb,KAAK;KACL;CACD,CAAC,CAAC;AAiCH,0EAA0E;AAC1E,MAAM,8BAA8B,GAAG,CAAC,EAAE,EAA4B,EAAE,CAAC,iBAAiB,IAAI,EAAE,CAAC;AAKjG,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,2BACZ,SAAQ,iCAAgD;IAGxD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAI,OAA+B,EAAE,EAAW;QACnE,OAAO,OAAO,CAAC,aAAa,CAC3B,EAAE,EACF,uEAAkC,CAAC,IAAI,CACL,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,uEAAkC,EAAE,CAAC;IACjD,CAAC;IAID;;;OAGG;IACH,YACC,EAAU,EACV,OAA+B,EAC/B,UAA8B;QAE9B,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,oCAAoC,CAAC,CAAC;QAXrD,SAAI,GAAG,IAAI,GAAG,EAAyB,CAAC;IAYzD,CAAC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QAC7B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;YACvB,IAAA,mBAAM,EACL,MAAM,KAAK,CAAC,IAAI,cAAc,KAAK,CAAC,EACpC,KAAK,CAAC,6DAA6D,CACnE,CAAC;SACF;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACpC,IAAA,mBAAM;YACL,uGAAuG;YACvG,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,EACxE,KAAK,CAAC,8DAA8D,CACpE,CAAC;SACF;QAED,wBAAwB;QACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAElC,sDAAsD;QACtD,IAAI,MAAM,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC9C;QACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,SAAS,CAAC,KAAU,EAAE,UAA4B;QACzD,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,UAA4B;QAC1D,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAES,cAAc;QACvB,uBAAuB;QACvB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACjB,CAAC;CACD;AAlQD,kEAkQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n\tcreateSingleBlobSummary,\n\tIFluidSerializer,\n\tSharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory\";\nimport {\n\tIConsensusRegisterCollection,\n\tReadPolicy,\n\tIConsensusRegisterCollectionEvents,\n} from \"./interfaces\";\n\ninterface ILocalData<T> {\n\t// Atomic version\n\tatomic: ILocalRegister<T>;\n\n\t// All concurrent versions awaiting consensus\n\tversions: ILocalRegister<T>[];\n}\n\ninterface ILocalRegister<T> {\n\t// Register value, wrapped for backwards compatibility with < 0.17\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// The sequence number when last consensus was reached\n\tsequenceNumber: number;\n}\n\nconst newLocalRegister = <T>(sequenceNumber: number, value: T): ILocalRegister<T> => ({\n\tsequenceNumber,\n\tvalue: {\n\t\ttype: \"Plain\",\n\t\tvalue,\n\t},\n});\n\n/**\n * An operation for consensus register collection\n */\ninterface IRegisterOperation {\n\tkey: string;\n\ttype: \"write\";\n\tserializedValue: string;\n\n\t// Message can be delivered with delay - resubmitted on reconnect.\n\t// As such, refSeq needs to reference seq # at the time op was created,\n\t// not when op was actually sent over wire (ISequencedDocumentMessage.referenceSequenceNumber),\n\t// as client can ingest ops in between.\n\trefSeq: number | undefined;\n}\n\n/**\n * IRegisterOperation format in versions \\< 0.17\n */\ninterface IRegisterOperationOld<T> {\n\tkey: string;\n\ttype: \"write\";\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\trefSeq: number;\n}\n\n/** Incoming ops could match any of these types */\ntype IIncomingRegisterOperation<T> = IRegisterOperation | IRegisterOperationOld<T>;\n\n/** Distinguish between incoming op formats so we know which type it is */\nconst incomingOpMatchesCurrentFormat = (op): op is IRegisterOperation => \"serializedValue\" in op;\n\n/** The type of the resolve function to call after the local operation is ack'd */\ntype PendingResolve = (winner: boolean) => void;\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc IConsensusRegisterCollection}\n * @alpha\n */\nexport class ConsensusRegisterCollection<T>\n\textends SharedObject<IConsensusRegisterCollectionEvents>\n\timplements IConsensusRegisterCollection<T>\n{\n\t/**\n\t * Create a new consensus register collection\n\t *\n\t * @param runtime - data store runtime the new consensus register collection belongs to\n\t * @param id - optional name of the consensus register collection\n\t * @returns newly create consensus register collection (but not attached yet)\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tConsensusRegisterCollectionFactory.Type,\n\t\t) as ConsensusRegisterCollection<T>;\n\t}\n\n\t/**\n\t * Get a factory for ConsensusRegisterCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load ConsensusRegisterCollection\n\t */\n\tpublic static getFactory() {\n\t\treturn new ConsensusRegisterCollectionFactory();\n\t}\n\n\tprivate readonly data = new Map<string, ILocalData<T>>();\n\n\t/**\n\t * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_consensusRegisterCollection_\");\n\t}\n\n\t/**\n\t * Creates a new register or writes a new value.\n\t * Returns a promise that will resolve when the write is acked.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\tpublic async write(key: string, value: T): Promise<boolean> {\n\t\tconst serializedValue = this.stringify(value, this.serializer);\n\n\t\tif (!this.isAttached()) {\n\t\t\t// JSON-roundtrip value for local writes to match the behavior of going through the wire\n\t\t\tthis.processInboundWrite(key, this.parse(serializedValue, this.serializer), 0, 0, true);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst message: IRegisterOperation = {\n\t\t\tkey,\n\t\t\ttype: \"write\",\n\t\t\tserializedValue,\n\t\t\trefSeq: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\treturn this.newAckBasedPromise<boolean>((resolve) => {\n\t\t\t// Send the resolve function as the localOpMetadata. This will be provided back to us when the\n\t\t\t// op is ack'd.\n\t\t\tthis.submitLocalMessage(message, resolve);\n\t\t\t// If we fail due to runtime being disposed, it's better to return false then unhandled exception.\n\t\t}).catch((error) => false);\n\t}\n\n\t/**\n\t * Returns the most recent local value of a register.\n\t * @param key - The key to read\n\t * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.\n\t */\n\tpublic read(key: string, readPolicy: ReadPolicy = ReadPolicy.Atomic): T | undefined {\n\t\tif (readPolicy === ReadPolicy.Atomic) {\n\t\t\treturn this.readAtomic(key);\n\t\t}\n\n\t\tconst versions = this.readVersions(key);\n\n\t\tif (versions !== undefined) {\n\t\t\t// We don't support deletion. So there should be at least one value.\n\t\t\tassert(versions.length > 0, 0x06c /* \"Value should be undefined or non-empty\" */);\n\n\t\t\treturn versions[versions.length - 1];\n\t\t}\n\t}\n\n\tpublic readVersions(key: string): T[] | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.versions.map((element: ILocalRegister<T>) => element.value.value);\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [...this.data.keys()];\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst dataObj: { [key: string]: ILocalData<T> } = {};\n\t\tthis.data.forEach((v, k) => {\n\t\t\tdataObj[k] = v;\n\t\t});\n\n\t\treturn createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tconst dataObj = this.parse(header, this.serializer);\n\n\t\tfor (const key of Object.keys(dataObj)) {\n\t\t\tassert(\n\t\t\t\tdataObj[key].atomic?.value.type !== \"Shared\",\n\t\t\t\t0x06d /* \"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17\" */,\n\t\t\t);\n\n\t\t\tthis.data.set(key, dataObj[key]);\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as IIncomingRegisterOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"write\": {\n\t\t\t\t\t// backward compatibility: File at rest written with runtime <= 0.13 do not have refSeq\n\t\t\t\t\t// when the refSeq property didn't exist\n\t\t\t\t\tif (op.refSeq === undefined) {\n\t\t\t\t\t\top.refSeq = message.referenceSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// Message can be delivered with delay - e.g. resubmitted on reconnect.\n\t\t\t\t\t// Use the refSeq from when the op was created, not when it was transmitted\n\t\t\t\t\tconst refSeqWhenCreated = op.refSeq;\n\t\t\t\t\tassert(\n\t\t\t\t\t\trefSeqWhenCreated <= message.referenceSequenceNumber,\n\t\t\t\t\t\t0x06e /* \"Message's reference sequence number < op's reference sequence number!\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst value = incomingOpMatchesCurrentFormat(op)\n\t\t\t\t\t\t? (this.parse(op.serializedValue, this.serializer) as T)\n\t\t\t\t\t\t: op.value.value;\n\t\t\t\t\tconst winner = this.processInboundWrite(\n\t\t\t\t\t\top.key,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trefSeqWhenCreated,\n\t\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Resolve the pending promise for this operation now that we have received an ack for it.\n\t\t\t\t\t\tconst resolve = localOpMetadata as PendingResolve;\n\t\t\t\t\t\tresolve(winner);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(op.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readAtomic(key: string): T | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.atomic.value.value;\n\t}\n\n\t/**\n\t * Process an inbound write op\n\t * @param key - Key that was written to\n\t * @param value - Incoming value\n\t * @param refSeq - RefSeq at the time of write on the remote client\n\t * @param sequenceNumber - Sequence Number of this write op\n\t * @param local - Did this write originate on this client\n\t */\n\tprivate processInboundWrite(\n\t\tkey: string,\n\t\tvalue: T,\n\t\trefSeq: number,\n\t\tsequenceNumber: number,\n\t\tlocal: boolean,\n\t): boolean {\n\t\tlet data = this.data.get(key);\n\t\t// Atomic update if it's a new register or the write was not concurrent,\n\t\t// meaning our state was known to the remote client at the time of write\n\t\tconst winner = data === undefined || refSeq >= data.atomic.sequenceNumber;\n\t\tif (winner) {\n\t\t\tconst atomicUpdate = newLocalRegister<T>(sequenceNumber, value);\n\t\t\tif (data === undefined) {\n\t\t\t\tdata = {\n\t\t\t\t\tatomic: atomicUpdate,\n\t\t\t\t\tversions: [], // we'll update versions next, leave it empty for now\n\t\t\t\t};\n\t\t\t\tthis.data.set(key, data);\n\t\t\t} else {\n\t\t\t\tdata.atomic = atomicUpdate;\n\t\t\t}\n\t\t} else {\n\t\t\tassert(!!data, 0x06f /* \"data missing for non-atomic inbound update!\" */);\n\t\t}\n\n\t\t// Remove versions that were known to the remote client at the time of write\n\t\twhile (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {\n\t\t\tdata.versions.shift();\n\t\t}\n\n\t\tconst versionUpdate = newLocalRegister<T>(sequenceNumber, value);\n\n\t\t// Asserts for data integrity\n\t\tif (!this.isAttached()) {\n\t\t\tassert(\n\t\t\t\trefSeq === 0 && sequenceNumber === 0,\n\t\t\t\t0x070 /* \"sequence numbers are expected to be 0 when unattached\" */,\n\t\t\t);\n\t\t} else if (data.versions.length > 0) {\n\t\t\tassert(\n\t\t\t\t// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)\n\t\t\t\tsequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber,\n\t\t\t\t0x071 /* \"Versions should naturally be ordered by sequenceNumber\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Push the new element.\n\t\tdata.versions.push(versionUpdate);\n\n\t\t// Raise events at the end, to avoid reentrancy issues\n\t\tif (winner) {\n\t\t\tthis.emit(\"atomicChanged\", key, value, local);\n\t\t}\n\t\tthis.emit(\"versionChanged\", key, value, local);\n\n\t\treturn winner;\n\t}\n\n\tprivate stringify(value: any, serializer: IFluidSerializer): string {\n\t\treturn serializer.stringify(value, this.handle);\n\t}\n\n\tprivate parse(content: string, serializer: IFluidSerializer): any {\n\t\treturn serializer.parse(content);\n\t}\n\n\tprotected applyStashedOp() {\n\t\t// empty implementation\n\t\treturn () => {};\n\t}\n}\n"]}
|
|
@@ -9,7 +9,8 @@ import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-ba
|
|
|
9
9
|
import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory";
|
|
10
10
|
import { IConsensusRegisterCollection, ReadPolicy, IConsensusRegisterCollectionEvents } from "./interfaces";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* {@inheritDoc IConsensusRegisterCollection}
|
|
13
|
+
* @alpha
|
|
13
14
|
*/
|
|
14
15
|
export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
|
|
15
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollection.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG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AE,gBAAgB,GAAG,qBAAqB;IAS5E;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAexE,SAAS,CAAC,YAAY;IAEtB,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IA0CzB,OAAO,CAAC,UAAU;IAKlB;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA2D3B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,KAAK;IAIb,SAAS,CAAC,cAAc;CAIxB"}
|
package/dist/{consensusRegisterCollectionFactory.js → consensusRegisterCollectionFactory.cjs}
RENAMED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ConsensusRegisterCollectionFactory = void 0;
|
|
8
|
-
const consensusRegisterCollection_1 = require("./consensusRegisterCollection");
|
|
9
|
-
const packageVersion_1 = require("./packageVersion");
|
|
8
|
+
const consensusRegisterCollection_1 = require("./consensusRegisterCollection.cjs");
|
|
9
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
10
10
|
/**
|
|
11
|
-
* The factory that defines the consensus queue
|
|
11
|
+
* The factory that defines the consensus queue.
|
|
12
|
+
* @alpha
|
|
12
13
|
*/
|
|
13
14
|
class ConsensusRegisterCollectionFactory {
|
|
14
15
|
get type() {
|
|
@@ -38,4 +39,4 @@ ConsensusRegisterCollectionFactory.Attributes = {
|
|
|
38
39
|
snapshotFormatVersion: "0.1",
|
|
39
40
|
packageVersion: packageVersion_1.pkgVersion,
|
|
40
41
|
};
|
|
41
|
-
//# sourceMappingURL=consensusRegisterCollectionFactory.
|
|
42
|
+
//# sourceMappingURL=consensusRegisterCollectionFactory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.cjs","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,mFAA4E;AAE5E,yDAA8C;AAE9C;;;GAGG;AACH,MAAa,kCAAkC;IAS9C,IAAW,IAAI;QACd,OAAO,kCAAkC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,kCAAkC,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,UAAU,GAAG,IAAI,yDAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,UAAU,GAAG,IAAI,yDAA2B,CACjD,EAAE,EACF,QAAQ,EACR,kCAAkC,CAAC,UAAU,CAC7C,CAAC;QACF,UAAU,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACnB,CAAC;;AAvCF,gFAwCC;AAvCc,uCAAI,GAAG,iEAAiE,CAAC;AAEhE,6CAAU,GAAuB;IACvD,IAAI,EAAE,kCAAkC,CAAC,IAAI;IAC7C,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ConsensusRegisterCollection } from \"./consensusRegisterCollection\";\nimport { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from \"./interfaces\";\nimport { pkgVersion } from \"./packageVersion\";\n\n/**\n * The factory that defines the consensus queue.\n * @alpha\n */\nexport class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {\n\tpublic static Type = \"https://graph.microsoft.com/types/consensus-register-collection\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: ConsensusRegisterCollectionFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type() {\n\t\treturn ConsensusRegisterCollectionFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn ConsensusRegisterCollectionFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IConsensusRegisterCollection> {\n\t\tconst collection = new ConsensusRegisterCollection(id, runtime, attributes);\n\t\tawait collection.load(services);\n\t\treturn collection;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection {\n\t\tconst collection = new ConsensusRegisterCollection(\n\t\t\tid,\n\t\t\tdocument,\n\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t);\n\t\tcollection.initializeLocal();\n\t\treturn collection;\n\t}\n}\n"]}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from "./interfaces";
|
|
7
7
|
/**
|
|
8
|
-
* The factory that defines the consensus queue
|
|
8
|
+
* The factory that defines the consensus queue.
|
|
9
|
+
* @alpha
|
|
9
10
|
*/
|
|
10
11
|
export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
|
|
11
12
|
static Type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,cAAc,CAAC;AAGjG;;;GAGG;AACH,qBAAa,kCAAmC,YAAW,mCAAmC;IAC7F,OAAc,IAAI,SAAqE;IAEvF,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAMjC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,4BAA4B;CASzF"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ReadPolicy = exports.ConsensusRegisterCollectionFactory = exports.ConsensusRegisterCollection = void 0;
|
|
8
|
+
var consensusRegisterCollection_1 = require("./consensusRegisterCollection.cjs");
|
|
9
|
+
Object.defineProperty(exports, "ConsensusRegisterCollection", { enumerable: true, get: function () { return consensusRegisterCollection_1.ConsensusRegisterCollection; } });
|
|
10
|
+
var consensusRegisterCollectionFactory_1 = require("./consensusRegisterCollectionFactory.cjs");
|
|
11
|
+
Object.defineProperty(exports, "ConsensusRegisterCollectionFactory", { enumerable: true, get: function () { return consensusRegisterCollectionFactory_1.ConsensusRegisterCollectionFactory; } });
|
|
12
|
+
var interfaces_1 = require("./interfaces.cjs");
|
|
13
|
+
Object.defineProperty(exports, "ReadPolicy", { enumerable: true, get: function () { return interfaces_1.ReadPolicy; } });
|
|
14
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,+FAA0F;AAAjF,wJAAA,kCAAkC,OAAA;AAC3C,+CAKsB;AADrB,wGAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConsensusRegisterCollection } from \"./consensusRegisterCollection\";\nexport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory\";\nexport {\n\tIConsensusRegisterCollection,\n\tIConsensusRegisterCollectionEvents,\n\tIConsensusRegisterCollectionFactory,\n\tReadPolicy,\n} from \"./interfaces\";\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export { ConsensusRegisterCollection } from "./consensusRegisterCollection";
|
|
6
|
+
export { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory";
|
|
7
|
+
export { IConsensusRegisterCollection, IConsensusRegisterCollectionEvents, IConsensusRegisterCollectionFactory, ReadPolicy, } from "./interfaces";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EACN,4BAA4B,EAC5B,kCAAkC,EAClC,mCAAmC,EACnC,UAAU,GACV,MAAM,cAAc,CAAC"}
|