@fluidframework/register-collection 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/api-extractor.json +1 -1
  3. package/api-report/register-collection.api.md +90 -0
  4. package/dist/consensusRegisterCollection.d.ts +3 -1
  5. package/dist/consensusRegisterCollection.d.ts.map +1 -1
  6. package/dist/consensusRegisterCollection.js +14 -10
  7. package/dist/consensusRegisterCollection.js.map +1 -1
  8. package/dist/consensusRegisterCollectionFactory.d.ts +3 -1
  9. package/dist/consensusRegisterCollectionFactory.d.ts.map +1 -1
  10. package/dist/consensusRegisterCollectionFactory.js +3 -1
  11. package/dist/consensusRegisterCollectionFactory.js.map +1 -1
  12. package/dist/interfaces.d.ts +12 -4
  13. package/dist/interfaces.d.ts.map +1 -1
  14. package/dist/interfaces.js +3 -1
  15. package/dist/interfaces.js.map +1 -1
  16. package/dist/packageVersion.d.ts +1 -1
  17. package/dist/packageVersion.js +1 -1
  18. package/dist/packageVersion.js.map +1 -1
  19. package/dist/register-collection-alpha.d.ts +169 -0
  20. package/dist/register-collection-beta.d.ts +169 -0
  21. package/dist/register-collection-public.d.ts +169 -0
  22. package/dist/register-collection-untrimmed.d.ts +169 -0
  23. package/dist/tsdoc-metadata.json +1 -1
  24. package/lib/consensusRegisterCollection.d.ts +3 -1
  25. package/lib/consensusRegisterCollection.d.ts.map +1 -1
  26. package/lib/consensusRegisterCollection.js +14 -10
  27. package/lib/consensusRegisterCollection.js.map +1 -1
  28. package/lib/consensusRegisterCollectionFactory.d.ts +3 -1
  29. package/lib/consensusRegisterCollectionFactory.d.ts.map +1 -1
  30. package/lib/consensusRegisterCollectionFactory.js +3 -1
  31. package/lib/consensusRegisterCollectionFactory.js.map +1 -1
  32. package/lib/interfaces.d.ts +12 -4
  33. package/lib/interfaces.d.ts.map +1 -1
  34. package/lib/interfaces.js +2 -0
  35. package/lib/interfaces.js.map +1 -1
  36. package/lib/packageVersion.d.ts +1 -1
  37. package/lib/packageVersion.js +1 -1
  38. package/lib/packageVersion.js.map +1 -1
  39. package/package.json +23 -24
  40. package/src/consensusRegisterCollection.ts +5 -2
  41. package/src/consensusRegisterCollectionFactory.ts +3 -1
  42. package/src/interfaces.ts +12 -4
  43. package/src/packageVersion.ts +1 -1
@@ -0,0 +1,169 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
13
+ /**
14
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ *
16
+ * @public
17
+ */
18
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
19
+ /**
20
+ * Create a new consensus register collection
21
+ *
22
+ * @param runtime - data store runtime the new consensus register collection belongs to
23
+ * @param id - optional name of the consensus register collection
24
+ * @returns newly create consensus register collection (but not attached yet)
25
+ */
26
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
27
+ /**
28
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
29
+ *
30
+ * @returns a factory that creates and load ConsensusRegisterCollection
31
+ */
32
+ static getFactory(): ConsensusRegisterCollectionFactory;
33
+ private readonly data;
34
+ /**
35
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
36
+ * be provided
37
+ */
38
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
39
+ /**
40
+ * Creates a new register or writes a new value.
41
+ * Returns a promise that will resolve when the write is acked.
42
+ *
43
+ * @returns Promise<true> if write was non-concurrent
44
+ */
45
+ write(key: string, value: T): Promise<boolean>;
46
+ /**
47
+ * Returns the most recent local value of a register.
48
+ * @param key - The key to read
49
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
50
+ */
51
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
52
+ readVersions(key: string): T[] | undefined;
53
+ keys(): string[];
54
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
55
+ /**
56
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
57
+ */
58
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
59
+ protected onDisconnect(): void;
60
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
61
+ private readAtomic;
62
+ /**
63
+ * Process an inbound write op
64
+ * @param key - Key that was written to
65
+ * @param value - Incoming value
66
+ * @param refSeq - RefSeq at the time of write on the remote client
67
+ * @param sequenceNumber - Sequence Number of this write op
68
+ * @param local - Did this write originate on this client
69
+ */
70
+ private processInboundWrite;
71
+ private stringify;
72
+ private parse;
73
+ protected applyStashedOp(): () => void;
74
+ }
75
+
76
+ /**
77
+ * The factory that defines the consensus queue.
78
+ *
79
+ * @public
80
+ */
81
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
82
+ static Type: string;
83
+ static readonly Attributes: IChannelAttributes;
84
+ get type(): string;
85
+ get attributes(): IChannelAttributes;
86
+ /**
87
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
88
+ */
89
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
90
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
91
+ }
92
+
93
+ /**
94
+ * A distributed data structure that holds a set of registers with update
95
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
96
+ * sequence number of the incoming update.
97
+ *
98
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
99
+ * we support:
100
+ *
101
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
102
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
103
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
104
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
105
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
106
+ * the value. So we can safely return the first value.
107
+ *
108
+ * LWW: The last write to a key always wins.
109
+ *
110
+ * @public
111
+ */
112
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
113
+ /**
114
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
115
+ * For a non existent register, it will attempt to create a new register with the specified value.
116
+ *
117
+ * @returns Promise<true> if write was non-concurrent
118
+ */
119
+ write(key: string, value: T): Promise<boolean>;
120
+ /**
121
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
122
+ */
123
+ read(key: string, policy?: ReadPolicy): T | undefined;
124
+ /**
125
+ * Retrives all concurrent versions. Undefined if not present.
126
+ */
127
+ readVersions(key: string): T[] | undefined;
128
+ /**
129
+ * Returns the keys.
130
+ */
131
+ keys(): string[];
132
+ }
133
+
134
+ /**
135
+ * Events emitted by {@link IConsensusRegisterCollection}.
136
+ *
137
+ * @public
138
+ */
139
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
140
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
141
+ }
142
+
143
+ /**
144
+ * Consensus Register Collection channel factory interface
145
+ *
146
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
147
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
148
+ *
149
+ * @public
150
+ */
151
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
152
+ /**
153
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
154
+ */
155
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
156
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
157
+ }
158
+
159
+ /**
160
+ * Read policies used when reading the map value.
161
+ *
162
+ * @public
163
+ */
164
+ export declare enum ReadPolicy {
165
+ Atomic = 0,
166
+ LWW = 1
167
+ }
168
+
169
+ export { }
@@ -0,0 +1,169 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
13
+ /**
14
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ *
16
+ * @public
17
+ */
18
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
19
+ /**
20
+ * Create a new consensus register collection
21
+ *
22
+ * @param runtime - data store runtime the new consensus register collection belongs to
23
+ * @param id - optional name of the consensus register collection
24
+ * @returns newly create consensus register collection (but not attached yet)
25
+ */
26
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
27
+ /**
28
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
29
+ *
30
+ * @returns a factory that creates and load ConsensusRegisterCollection
31
+ */
32
+ static getFactory(): ConsensusRegisterCollectionFactory;
33
+ private readonly data;
34
+ /**
35
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
36
+ * be provided
37
+ */
38
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
39
+ /**
40
+ * Creates a new register or writes a new value.
41
+ * Returns a promise that will resolve when the write is acked.
42
+ *
43
+ * @returns Promise<true> if write was non-concurrent
44
+ */
45
+ write(key: string, value: T): Promise<boolean>;
46
+ /**
47
+ * Returns the most recent local value of a register.
48
+ * @param key - The key to read
49
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
50
+ */
51
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
52
+ readVersions(key: string): T[] | undefined;
53
+ keys(): string[];
54
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
55
+ /**
56
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
57
+ */
58
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
59
+ protected onDisconnect(): void;
60
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
61
+ private readAtomic;
62
+ /**
63
+ * Process an inbound write op
64
+ * @param key - Key that was written to
65
+ * @param value - Incoming value
66
+ * @param refSeq - RefSeq at the time of write on the remote client
67
+ * @param sequenceNumber - Sequence Number of this write op
68
+ * @param local - Did this write originate on this client
69
+ */
70
+ private processInboundWrite;
71
+ private stringify;
72
+ private parse;
73
+ protected applyStashedOp(): () => void;
74
+ }
75
+
76
+ /**
77
+ * The factory that defines the consensus queue.
78
+ *
79
+ * @public
80
+ */
81
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
82
+ static Type: string;
83
+ static readonly Attributes: IChannelAttributes;
84
+ get type(): string;
85
+ get attributes(): IChannelAttributes;
86
+ /**
87
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
88
+ */
89
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
90
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
91
+ }
92
+
93
+ /**
94
+ * A distributed data structure that holds a set of registers with update
95
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
96
+ * sequence number of the incoming update.
97
+ *
98
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
99
+ * we support:
100
+ *
101
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
102
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
103
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
104
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
105
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
106
+ * the value. So we can safely return the first value.
107
+ *
108
+ * LWW: The last write to a key always wins.
109
+ *
110
+ * @public
111
+ */
112
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
113
+ /**
114
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
115
+ * For a non existent register, it will attempt to create a new register with the specified value.
116
+ *
117
+ * @returns Promise<true> if write was non-concurrent
118
+ */
119
+ write(key: string, value: T): Promise<boolean>;
120
+ /**
121
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
122
+ */
123
+ read(key: string, policy?: ReadPolicy): T | undefined;
124
+ /**
125
+ * Retrives all concurrent versions. Undefined if not present.
126
+ */
127
+ readVersions(key: string): T[] | undefined;
128
+ /**
129
+ * Returns the keys.
130
+ */
131
+ keys(): string[];
132
+ }
133
+
134
+ /**
135
+ * Events emitted by {@link IConsensusRegisterCollection}.
136
+ *
137
+ * @public
138
+ */
139
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
140
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
141
+ }
142
+
143
+ /**
144
+ * Consensus Register Collection channel factory interface
145
+ *
146
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
147
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
148
+ *
149
+ * @public
150
+ */
151
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
152
+ /**
153
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
154
+ */
155
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
156
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
157
+ }
158
+
159
+ /**
160
+ * Read policies used when reading the map value.
161
+ *
162
+ * @public
163
+ */
164
+ export declare enum ReadPolicy {
165
+ Atomic = 0,
166
+ LWW = 1
167
+ }
168
+
169
+ export { }
@@ -0,0 +1,169 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
13
+ /**
14
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ *
16
+ * @public
17
+ */
18
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
19
+ /**
20
+ * Create a new consensus register collection
21
+ *
22
+ * @param runtime - data store runtime the new consensus register collection belongs to
23
+ * @param id - optional name of the consensus register collection
24
+ * @returns newly create consensus register collection (but not attached yet)
25
+ */
26
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
27
+ /**
28
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
29
+ *
30
+ * @returns a factory that creates and load ConsensusRegisterCollection
31
+ */
32
+ static getFactory(): ConsensusRegisterCollectionFactory;
33
+ private readonly data;
34
+ /**
35
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
36
+ * be provided
37
+ */
38
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
39
+ /**
40
+ * Creates a new register or writes a new value.
41
+ * Returns a promise that will resolve when the write is acked.
42
+ *
43
+ * @returns Promise<true> if write was non-concurrent
44
+ */
45
+ write(key: string, value: T): Promise<boolean>;
46
+ /**
47
+ * Returns the most recent local value of a register.
48
+ * @param key - The key to read
49
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
50
+ */
51
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
52
+ readVersions(key: string): T[] | undefined;
53
+ keys(): string[];
54
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
55
+ /**
56
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
57
+ */
58
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
59
+ protected onDisconnect(): void;
60
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
61
+ private readAtomic;
62
+ /**
63
+ * Process an inbound write op
64
+ * @param key - Key that was written to
65
+ * @param value - Incoming value
66
+ * @param refSeq - RefSeq at the time of write on the remote client
67
+ * @param sequenceNumber - Sequence Number of this write op
68
+ * @param local - Did this write originate on this client
69
+ */
70
+ private processInboundWrite;
71
+ private stringify;
72
+ private parse;
73
+ protected applyStashedOp(): () => void;
74
+ }
75
+
76
+ /**
77
+ * The factory that defines the consensus queue.
78
+ *
79
+ * @public
80
+ */
81
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
82
+ static Type: string;
83
+ static readonly Attributes: IChannelAttributes;
84
+ get type(): string;
85
+ get attributes(): IChannelAttributes;
86
+ /**
87
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
88
+ */
89
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
90
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
91
+ }
92
+
93
+ /**
94
+ * A distributed data structure that holds a set of registers with update
95
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
96
+ * sequence number of the incoming update.
97
+ *
98
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
99
+ * we support:
100
+ *
101
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
102
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
103
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
104
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
105
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
106
+ * the value. So we can safely return the first value.
107
+ *
108
+ * LWW: The last write to a key always wins.
109
+ *
110
+ * @public
111
+ */
112
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
113
+ /**
114
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
115
+ * For a non existent register, it will attempt to create a new register with the specified value.
116
+ *
117
+ * @returns Promise<true> if write was non-concurrent
118
+ */
119
+ write(key: string, value: T): Promise<boolean>;
120
+ /**
121
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
122
+ */
123
+ read(key: string, policy?: ReadPolicy): T | undefined;
124
+ /**
125
+ * Retrives all concurrent versions. Undefined if not present.
126
+ */
127
+ readVersions(key: string): T[] | undefined;
128
+ /**
129
+ * Returns the keys.
130
+ */
131
+ keys(): string[];
132
+ }
133
+
134
+ /**
135
+ * Events emitted by {@link IConsensusRegisterCollection}.
136
+ *
137
+ * @public
138
+ */
139
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
140
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
141
+ }
142
+
143
+ /**
144
+ * Consensus Register Collection channel factory interface
145
+ *
146
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
147
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
148
+ *
149
+ * @public
150
+ */
151
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
152
+ /**
153
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
154
+ */
155
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
156
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
157
+ }
158
+
159
+ /**
160
+ * Read policies used when reading the map value.
161
+ *
162
+ * @public
163
+ */
164
+ export declare enum ReadPolicy {
165
+ Atomic = 0,
166
+ LWW = 1
167
+ }
168
+
169
+ export { }
@@ -0,0 +1,169 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
13
+ /**
14
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ *
16
+ * @public
17
+ */
18
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
19
+ /**
20
+ * Create a new consensus register collection
21
+ *
22
+ * @param runtime - data store runtime the new consensus register collection belongs to
23
+ * @param id - optional name of the consensus register collection
24
+ * @returns newly create consensus register collection (but not attached yet)
25
+ */
26
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
27
+ /**
28
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
29
+ *
30
+ * @returns a factory that creates and load ConsensusRegisterCollection
31
+ */
32
+ static getFactory(): ConsensusRegisterCollectionFactory;
33
+ private readonly data;
34
+ /**
35
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
36
+ * be provided
37
+ */
38
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
39
+ /**
40
+ * Creates a new register or writes a new value.
41
+ * Returns a promise that will resolve when the write is acked.
42
+ *
43
+ * @returns Promise<true> if write was non-concurrent
44
+ */
45
+ write(key: string, value: T): Promise<boolean>;
46
+ /**
47
+ * Returns the most recent local value of a register.
48
+ * @param key - The key to read
49
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
50
+ */
51
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
52
+ readVersions(key: string): T[] | undefined;
53
+ keys(): string[];
54
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
55
+ /**
56
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
57
+ */
58
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
59
+ protected onDisconnect(): void;
60
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
61
+ private readAtomic;
62
+ /**
63
+ * Process an inbound write op
64
+ * @param key - Key that was written to
65
+ * @param value - Incoming value
66
+ * @param refSeq - RefSeq at the time of write on the remote client
67
+ * @param sequenceNumber - Sequence Number of this write op
68
+ * @param local - Did this write originate on this client
69
+ */
70
+ private processInboundWrite;
71
+ private stringify;
72
+ private parse;
73
+ protected applyStashedOp(): () => void;
74
+ }
75
+
76
+ /**
77
+ * The factory that defines the consensus queue.
78
+ *
79
+ * @public
80
+ */
81
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
82
+ static Type: string;
83
+ static readonly Attributes: IChannelAttributes;
84
+ get type(): string;
85
+ get attributes(): IChannelAttributes;
86
+ /**
87
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
88
+ */
89
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
90
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
91
+ }
92
+
93
+ /**
94
+ * A distributed data structure that holds a set of registers with update
95
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
96
+ * sequence number of the incoming update.
97
+ *
98
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
99
+ * we support:
100
+ *
101
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
102
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
103
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
104
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
105
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
106
+ * the value. So we can safely return the first value.
107
+ *
108
+ * LWW: The last write to a key always wins.
109
+ *
110
+ * @public
111
+ */
112
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
113
+ /**
114
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
115
+ * For a non existent register, it will attempt to create a new register with the specified value.
116
+ *
117
+ * @returns Promise<true> if write was non-concurrent
118
+ */
119
+ write(key: string, value: T): Promise<boolean>;
120
+ /**
121
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
122
+ */
123
+ read(key: string, policy?: ReadPolicy): T | undefined;
124
+ /**
125
+ * Retrives all concurrent versions. Undefined if not present.
126
+ */
127
+ readVersions(key: string): T[] | undefined;
128
+ /**
129
+ * Returns the keys.
130
+ */
131
+ keys(): string[];
132
+ }
133
+
134
+ /**
135
+ * Events emitted by {@link IConsensusRegisterCollection}.
136
+ *
137
+ * @public
138
+ */
139
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
140
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
141
+ }
142
+
143
+ /**
144
+ * Consensus Register Collection channel factory interface
145
+ *
146
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
147
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
148
+ *
149
+ * @public
150
+ */
151
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
152
+ /**
153
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
154
+ */
155
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
156
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
157
+ }
158
+
159
+ /**
160
+ * Read policies used when reading the map value.
161
+ *
162
+ * @public
163
+ */
164
+ export declare enum ReadPolicy {
165
+ Atomic = 0,
166
+ LWW = 1
167
+ }
168
+
169
+ export { }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.9"
8
+ "packageVersion": "7.38.0"
9
9
  }
10
10
  ]
11
11
  }