@fluid-experimental/tree 0.59.4001 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SharedTree.d.ts +89 -30
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +94 -59
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.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/lib/SharedTree.d.ts +89 -30
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +95 -60
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.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/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +3 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +27 -50
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +19 -19
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +11 -11
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/package.json +18 -31
- package/src/SharedTree.ts +196 -47
- package/src/SharedTreeEncoder.ts +1 -1
- package/src/index.ts +4 -0
package/dist/SharedTree.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { IFluidSerializer, ISharedObjectEvents, SharedObject } from '@fluidframe
|
|
|
7
7
|
import { ITelemetryLogger, ITelemetryProperties } from '@fluidframework/common-definitions';
|
|
8
8
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
9
9
|
import { OrderedEditSet } from './EditLog';
|
|
10
|
-
import { EditId, NodeId, StableNodeId } from './Identifiers';
|
|
10
|
+
import { EditId, NodeId, StableNodeId, AttributionId } from './Identifiers';
|
|
11
11
|
import { LogViewer } from './LogViewer';
|
|
12
12
|
import { ReconciliationPath } from './ReconciliationPath';
|
|
13
13
|
import { ChangeInternal, Edit, EditStatus, SharedTreeSummaryBase, WriteFormat, InternalizedChange } from './persisted-types';
|
|
@@ -15,15 +15,68 @@ import { NodeIdContext } from './NodeIdUtilities';
|
|
|
15
15
|
import { RevisionView } from './RevisionView';
|
|
16
16
|
import { Change } from './ChangeTypes';
|
|
17
17
|
import { TransactionInternal } from './TransactionInternal';
|
|
18
|
+
/**
|
|
19
|
+
* The write format and associated options used to construct a `SharedTree`
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];
|
|
23
|
+
/**
|
|
24
|
+
* The type of shared tree options for a given write format
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare type SharedTreeOptions<WF extends WriteFormat, HistoryCompatibility extends 'Forwards' | 'None' = 'Forwards'> = Omit<WF extends WriteFormat.v0_0_2 ? SharedTreeOptions_0_0_2 : WF extends WriteFormat.v0_1_1 ? SharedTreeOptions_0_1_1 : never, HistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never>;
|
|
28
|
+
/**
|
|
29
|
+
* Configuration options for a SharedTree with write format 0.0.2
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export interface SharedTreeOptions_0_0_2 {
|
|
33
|
+
/**
|
|
34
|
+
* Determines if the history is included in summaries.
|
|
35
|
+
*
|
|
36
|
+
* Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
|
|
37
|
+
* later once it has been enabled, and thus the history cannot be safely deleted.
|
|
38
|
+
*
|
|
39
|
+
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
40
|
+
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
41
|
+
*
|
|
42
|
+
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
43
|
+
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
44
|
+
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
45
|
+
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
46
|
+
*/
|
|
47
|
+
summarizeHistory?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Configuration options for a SharedTree with write format 0.1.1
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export interface SharedTreeOptions_0_1_1 {
|
|
54
|
+
/**
|
|
55
|
+
* Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
56
|
+
*
|
|
57
|
+
* Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
|
|
58
|
+
* later once it has been enabled, and thus the history cannot be safely deleted.
|
|
59
|
+
*
|
|
60
|
+
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
61
|
+
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
62
|
+
*
|
|
63
|
+
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
64
|
+
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
65
|
+
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
66
|
+
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
67
|
+
*/
|
|
68
|
+
summarizeHistory?: false | {
|
|
69
|
+
uploadEditChunks: boolean;
|
|
70
|
+
};
|
|
71
|
+
/** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */
|
|
72
|
+
attributionId?: AttributionId;
|
|
73
|
+
}
|
|
18
74
|
/**
|
|
19
75
|
* Factory for SharedTree.
|
|
20
76
|
* Includes history in the summary.
|
|
21
77
|
* @public
|
|
22
78
|
*/
|
|
23
79
|
export declare class SharedTreeFactory implements IChannelFactory {
|
|
24
|
-
private readonly writeFormat;
|
|
25
|
-
private readonly summarizeHistory;
|
|
26
|
-
private expensiveValidation;
|
|
27
80
|
/**
|
|
28
81
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
29
82
|
*/
|
|
@@ -32,18 +85,16 @@ export declare class SharedTreeFactory implements IChannelFactory {
|
|
|
32
85
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
33
86
|
*/
|
|
34
87
|
static Attributes: IChannelAttributes;
|
|
88
|
+
private readonly args;
|
|
35
89
|
/**
|
|
36
90
|
* Get a factory for SharedTree to register with the data store.
|
|
37
91
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
38
92
|
* documentation](../docs/Write-Format.md) for more information.
|
|
39
|
-
* @param
|
|
40
|
-
* See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
|
|
41
|
-
* @param expensiveValidation - Enables expensive asserts on SharedTree.
|
|
93
|
+
* @param options - Configuration options for this tree
|
|
42
94
|
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
43
95
|
*/
|
|
44
|
-
constructor(
|
|
45
|
-
|
|
46
|
-
}, expensiveValidation?: boolean);
|
|
96
|
+
constructor(...args: SharedTreeArgs<WriteFormat.v0_0_2>);
|
|
97
|
+
constructor(...args: SharedTreeArgs<WriteFormat.v0_1_1>);
|
|
47
98
|
/**
|
|
48
99
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
49
100
|
*/
|
|
@@ -61,7 +112,7 @@ export declare class SharedTreeFactory implements IChannelFactory {
|
|
|
61
112
|
* @param runtime - data store runtime that owns the new SharedTree
|
|
62
113
|
* @param id - optional name for the SharedTree
|
|
63
114
|
*/
|
|
64
|
-
create(runtime: IFluidDataStoreRuntime, id: string
|
|
115
|
+
create(runtime: IFluidDataStoreRuntime, id: string): SharedTree;
|
|
65
116
|
private createSharedTree;
|
|
66
117
|
}
|
|
67
118
|
/**
|
|
@@ -141,33 +192,30 @@ export declare type SequencedEditAppliedHandler = (args: SequencedEditAppliedEve
|
|
|
141
192
|
*/
|
|
142
193
|
export declare class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
|
|
143
194
|
private writeFormat;
|
|
144
|
-
private readonly expensiveValidation;
|
|
145
195
|
/**
|
|
146
196
|
* Create a new SharedTree. It will contain the default value (see initialTree).
|
|
147
197
|
*/
|
|
148
198
|
static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree;
|
|
149
199
|
/**
|
|
150
200
|
* Get a factory for SharedTree to register with the data store.
|
|
151
|
-
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
152
|
-
*
|
|
153
|
-
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
154
|
-
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
155
|
-
*
|
|
156
|
-
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
157
|
-
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
158
|
-
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
159
|
-
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
160
201
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
|
|
161
202
|
* This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
|
|
162
203
|
* that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
|
|
163
204
|
* as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
|
|
164
205
|
* written.
|
|
165
206
|
* See [the write format documentation](../docs/Write-Format.md) for more information.
|
|
207
|
+
* @param options - Configuration options for this tree
|
|
166
208
|
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
167
209
|
*/
|
|
168
|
-
static getFactory(
|
|
169
|
-
|
|
170
|
-
|
|
210
|
+
static getFactory(...args: SharedTreeArgs<WriteFormat.v0_0_2>): SharedTreeFactory;
|
|
211
|
+
static getFactory(...args: SharedTreeArgs<WriteFormat.v0_1_1>): SharedTreeFactory;
|
|
212
|
+
/**
|
|
213
|
+
* The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
|
|
214
|
+
* greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
|
|
215
|
+
* with a write format of 0.0.2) use the nil UUID as their attribution ID.
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
get attributionId(): AttributionId;
|
|
171
219
|
private idCompressor;
|
|
172
220
|
private readonly idNormalizer;
|
|
173
221
|
private interner;
|
|
@@ -195,18 +243,22 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
|
|
|
195
243
|
private readonly processSequencedEditResult;
|
|
196
244
|
private summarizeHistory;
|
|
197
245
|
private uploadEditChunks;
|
|
246
|
+
private getHistoryPolicy;
|
|
198
247
|
/**
|
|
199
|
-
* Create a new
|
|
248
|
+
* Create a new SharedTree.
|
|
200
249
|
* @param runtime - The runtime the SharedTree will be associated with
|
|
201
250
|
* @param id - Unique ID for the SharedTree
|
|
202
251
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
203
252
|
* documentation](../docs/Write-Format.md) for more information.
|
|
204
|
-
* @param
|
|
205
|
-
|
|
253
|
+
* @param options - Configuration options for this tree
|
|
254
|
+
*/
|
|
255
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);
|
|
256
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);
|
|
257
|
+
/**
|
|
258
|
+
* The write format version currently used by this `SharedTree`. This is always initialized to the write format
|
|
259
|
+
* passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
|
|
260
|
+
* SharedTree with a higher write format, or when loading a summary with a higher write format).
|
|
206
261
|
*/
|
|
207
|
-
constructor(runtime: IFluidDataStoreRuntime, id: string, writeFormat: WriteFormat, summarizeHistory?: false | {
|
|
208
|
-
uploadEditChunks: boolean;
|
|
209
|
-
}, expensiveValidation?: boolean);
|
|
210
262
|
getWriteFormat(): WriteFormat;
|
|
211
263
|
/**
|
|
212
264
|
* Re-computes currentIsOldest and emits an event if it has changed.
|
|
@@ -268,6 +320,13 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
|
|
|
268
320
|
* @public
|
|
269
321
|
*/
|
|
270
322
|
tryConvertToNodeId(id: StableNodeId): NodeId | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
|
|
325
|
+
* with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default
|
|
326
|
+
* `attributionId` of the tree.
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
attributeNodeId(id: NodeId): AttributionId;
|
|
271
330
|
/**
|
|
272
331
|
* @returns the edit history of the tree.
|
|
273
332
|
* @public
|
package/dist/SharedTree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAChB,mBAAmB,EAEnB,YAAY,EACZ,MAAM,oCAAoC,CA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CAAC;IAa7D;;;;;;;;;OASG;IACI,cAAc,CACpB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,EACzC,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,YAAY,GACnD,MAAM,EAAE;IAaX;;;;;;OAMG;IACI,iBAAiB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,SAAS,cAAc,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;IAa/G;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAmExD,OAAO,CAAC,gBAAgB;IAgBxB;;;;;OAKG;IACI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAYjD;;;;;;OAMG;IACI,aAAa,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,cAAc,EAAE,GAAG,SAAS;IAIhH;;OAEG;IACH,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,aAAa;IAIrB,oEAAoE;IACpE,OAAO,CAAC,QAAQ;IAQT,UAAU,IAAI,sBAAsB;IAI3C;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;IA6C3C,OAAO,CAAC,iBAAiB;IAKzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAuB7B"}
|
package/dist/SharedTree.js
CHANGED
|
@@ -27,25 +27,15 @@ const ChangeTypes_1 = require("./ChangeTypes");
|
|
|
27
27
|
const id_compressor_1 = require("./id-compressor");
|
|
28
28
|
const IdConversion_1 = require("./IdConversion");
|
|
29
29
|
const StringInterner_1 = require("./StringInterner");
|
|
30
|
+
const UuidUtilities_1 = require("./UuidUtilities");
|
|
30
31
|
/**
|
|
31
32
|
* Factory for SharedTree.
|
|
32
33
|
* Includes history in the summary.
|
|
33
34
|
* @public
|
|
34
35
|
*/
|
|
35
36
|
class SharedTreeFactory {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
39
|
-
* documentation](../docs/Write-Format.md) for more information.
|
|
40
|
-
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
41
|
-
* See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
|
|
42
|
-
* @param expensiveValidation - Enables expensive asserts on SharedTree.
|
|
43
|
-
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
44
|
-
*/
|
|
45
|
-
constructor(writeFormat, summarizeHistory = false, expensiveValidation = false) {
|
|
46
|
-
this.writeFormat = writeFormat;
|
|
47
|
-
this.summarizeHistory = summarizeHistory;
|
|
48
|
-
this.expensiveValidation = expensiveValidation;
|
|
37
|
+
constructor(...args) {
|
|
38
|
+
this.args = args;
|
|
49
39
|
}
|
|
50
40
|
/**
|
|
51
41
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
@@ -72,15 +62,21 @@ class SharedTreeFactory {
|
|
|
72
62
|
* @param runtime - data store runtime that owns the new SharedTree
|
|
73
63
|
* @param id - optional name for the SharedTree
|
|
74
64
|
*/
|
|
75
|
-
create(runtime, id
|
|
76
|
-
this.expensiveValidation = expensiveValidation;
|
|
65
|
+
create(runtime, id) {
|
|
77
66
|
const sharedTree = this.createSharedTree(runtime, id);
|
|
78
67
|
sharedTree.initializeLocal();
|
|
79
68
|
return sharedTree;
|
|
80
69
|
}
|
|
81
70
|
createSharedTree(runtime, id) {
|
|
82
|
-
const
|
|
83
|
-
|
|
71
|
+
const [writeFormat] = this.args;
|
|
72
|
+
switch (writeFormat) {
|
|
73
|
+
case persisted_types_1.WriteFormat.v0_0_2:
|
|
74
|
+
return new SharedTree(runtime, id, ...this.args);
|
|
75
|
+
case persisted_types_1.WriteFormat.v0_1_1:
|
|
76
|
+
return new SharedTree(runtime, id, ...this.args);
|
|
77
|
+
default:
|
|
78
|
+
(0, Common_1.fail)('Unknown write format');
|
|
79
|
+
}
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
exports.SharedTreeFactory = SharedTreeFactory;
|
|
@@ -110,20 +106,9 @@ const sharedTreeTelemetryProperties = { all: { isSharedTreeEvent: true } };
|
|
|
110
106
|
* @public
|
|
111
107
|
*/
|
|
112
108
|
class SharedTree extends shared_object_base_1.SharedObject {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @param runtime - The runtime the SharedTree will be associated with
|
|
116
|
-
* @param id - Unique ID for the SharedTree
|
|
117
|
-
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
118
|
-
* documentation](../docs/Write-Format.md) for more information.
|
|
119
|
-
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
120
|
-
* @param expensiveValidation - Enable expensive asserts.
|
|
121
|
-
*/
|
|
122
|
-
constructor(runtime, id, writeFormat, summarizeHistory = false, expensiveValidation = false) {
|
|
123
|
-
super(id, runtime, SharedTreeFactory.Attributes);
|
|
109
|
+
constructor(runtime, id, writeFormat, options = {}) {
|
|
110
|
+
super(id, runtime, SharedTreeFactory.Attributes, 'fluid_sharedTree_');
|
|
124
111
|
this.writeFormat = writeFormat;
|
|
125
|
-
this.expensiveValidation = expensiveValidation;
|
|
126
|
-
this.idCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount);
|
|
127
112
|
this.idNormalizer = {
|
|
128
113
|
tree: this,
|
|
129
114
|
get localSessionId() {
|
|
@@ -166,8 +151,9 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
166
151
|
}
|
|
167
152
|
}
|
|
168
153
|
};
|
|
169
|
-
|
|
170
|
-
this.
|
|
154
|
+
const historyPolicy = this.getHistoryPolicy(options);
|
|
155
|
+
this.summarizeHistory = historyPolicy.summarizeHistory;
|
|
156
|
+
this.uploadEditChunks = historyPolicy.uploadEditChunks;
|
|
171
157
|
// This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime
|
|
172
158
|
// which SharedTree does not have access to.
|
|
173
159
|
// TODO:#55900: Get rid of copy-pasted OldestClientObserver code
|
|
@@ -179,11 +165,12 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
179
165
|
runtime.on('disconnected', this.updateOldest);
|
|
180
166
|
this.logger = telemetry_utils_1.ChildLogger.create(runtime.logger, 'SharedTree', sharedTreeTelemetryProperties);
|
|
181
167
|
this.sequencedEditAppliedLogger = telemetry_utils_1.ChildLogger.create(this.logger, 'SequencedEditApplied', sharedTreeTelemetryProperties);
|
|
168
|
+
const attributionId = options.attributionId;
|
|
169
|
+
this.idCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount, attributionId);
|
|
182
170
|
const { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary({
|
|
183
171
|
editChunks: [],
|
|
184
172
|
editIds: [],
|
|
185
|
-
}, undefined, this.idCompressor,
|
|
186
|
-
this.processEditResult, this.processSequencedEditResult, persisted_types_1.WriteFormat.v0_1_1);
|
|
173
|
+
}, undefined, this.idCompressor, this.processEditResult, this.processSequencedEditResult, persisted_types_1.WriteFormat.v0_1_1);
|
|
187
174
|
this.editLog = editLog;
|
|
188
175
|
this.cachingLogViewer = cachingLogViewer;
|
|
189
176
|
this.encoder_0_0_2 = new SharedTreeEncoder_1.SharedTreeEncoder_0_0_2(this.summarizeHistory);
|
|
@@ -195,31 +182,39 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
195
182
|
static create(runtime, id) {
|
|
196
183
|
return runtime.createChannel(id, SharedTreeFactory.Type);
|
|
197
184
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
201
|
-
*
|
|
202
|
-
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
203
|
-
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
204
|
-
*
|
|
205
|
-
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
206
|
-
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
207
|
-
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
208
|
-
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
209
|
-
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
|
|
210
|
-
* This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
|
|
211
|
-
* that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
|
|
212
|
-
* as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
|
|
213
|
-
* written.
|
|
214
|
-
* See [the write format documentation](../docs/Write-Format.md) for more information.
|
|
215
|
-
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
216
|
-
*/
|
|
217
|
-
static getFactory(writeFormat, summarizeHistory = false) {
|
|
185
|
+
static getFactory(...args) {
|
|
186
|
+
const [writeFormat] = args;
|
|
218
187
|
// On 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.
|
|
219
188
|
// Note that this means staged rollout changing this value should not be attempted.
|
|
220
189
|
// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.
|
|
221
190
|
// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
222
|
-
|
|
191
|
+
switch (writeFormat) {
|
|
192
|
+
case persisted_types_1.WriteFormat.v0_0_2:
|
|
193
|
+
return new SharedTreeFactory(...args);
|
|
194
|
+
case persisted_types_1.WriteFormat.v0_1_1:
|
|
195
|
+
return new SharedTreeFactory(...args);
|
|
196
|
+
default:
|
|
197
|
+
(0, Common_1.fail)('Unknown write format');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
|
|
202
|
+
* greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
|
|
203
|
+
* with a write format of 0.0.2) use the nil UUID as their attribution ID.
|
|
204
|
+
* @public
|
|
205
|
+
*/
|
|
206
|
+
get attributionId() {
|
|
207
|
+
switch (this.writeFormat) {
|
|
208
|
+
case persisted_types_1.WriteFormat.v0_0_2:
|
|
209
|
+
return UuidUtilities_1.nilUuid;
|
|
210
|
+
default: {
|
|
211
|
+
const { attributionId } = this.idCompressor;
|
|
212
|
+
if (attributionId === persisted_types_1.ghostSessionId) {
|
|
213
|
+
return UuidUtilities_1.nilUuid;
|
|
214
|
+
}
|
|
215
|
+
return attributionId;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
223
218
|
}
|
|
224
219
|
/**
|
|
225
220
|
* Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).
|
|
@@ -227,6 +222,27 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
227
222
|
get logViewer() {
|
|
228
223
|
return this.cachingLogViewer;
|
|
229
224
|
}
|
|
225
|
+
getHistoryPolicy(options) {
|
|
226
|
+
var _a;
|
|
227
|
+
const noCompatOptions = options;
|
|
228
|
+
if (typeof noCompatOptions.summarizeHistory === 'object') {
|
|
229
|
+
return {
|
|
230
|
+
summarizeHistory: true,
|
|
231
|
+
uploadEditChunks: noCompatOptions.summarizeHistory.uploadEditChunks,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return {
|
|
236
|
+
summarizeHistory: (_a = noCompatOptions.summarizeHistory) !== null && _a !== void 0 ? _a : false,
|
|
237
|
+
uploadEditChunks: false,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The write format version currently used by this `SharedTree`. This is always initialized to the write format
|
|
243
|
+
* passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
|
|
244
|
+
* SharedTree with a higher write format, or when loading a summary with a higher write format).
|
|
245
|
+
*/
|
|
230
246
|
getWriteFormat() {
|
|
231
247
|
return this.writeFormat;
|
|
232
248
|
}
|
|
@@ -323,6 +339,25 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
323
339
|
tryConvertToNodeId(id) {
|
|
324
340
|
return this.idCompressor.tryRecompress(id);
|
|
325
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
|
|
344
|
+
* with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default
|
|
345
|
+
* `attributionId` of the tree.
|
|
346
|
+
* @public
|
|
347
|
+
*/
|
|
348
|
+
attributeNodeId(id) {
|
|
349
|
+
switch (this.writeFormat) {
|
|
350
|
+
case persisted_types_1.WriteFormat.v0_0_2:
|
|
351
|
+
return UuidUtilities_1.nilUuid;
|
|
352
|
+
default: {
|
|
353
|
+
const attributionId = this.idCompressor.attributeId(id);
|
|
354
|
+
if (attributionId === persisted_types_1.ghostSessionId) {
|
|
355
|
+
return UuidUtilities_1.nilUuid;
|
|
356
|
+
}
|
|
357
|
+
return attributionId;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
326
361
|
/**
|
|
327
362
|
* @returns the edit history of the tree.
|
|
328
363
|
* @public
|
|
@@ -469,7 +504,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
469
504
|
let convertedSummary;
|
|
470
505
|
switch (loadedSummaryVersion) {
|
|
471
506
|
case persisted_types_1.WriteFormat.v0_0_2:
|
|
472
|
-
convertedSummary = this.encoder_0_0_2.decodeSummary(summary);
|
|
507
|
+
convertedSummary = this.encoder_0_0_2.decodeSummary(summary, this.attributionId);
|
|
473
508
|
break;
|
|
474
509
|
case persisted_types_1.WriteFormat.v0_1_1: {
|
|
475
510
|
const typedSummary = summary;
|
|
@@ -480,7 +515,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
480
515
|
this.uploadEditChunks = loadedSummaryIncludesHistory;
|
|
481
516
|
this.encoder_0_1_1 = new SharedTreeEncoder_1.SharedTreeEncoder_0_1_1(this.summarizeHistory);
|
|
482
517
|
}
|
|
483
|
-
convertedSummary = this.encoder_0_1_1.decodeSummary(summary);
|
|
518
|
+
convertedSummary = this.encoder_0_1_1.decodeSummary(summary, this.attributionId);
|
|
484
519
|
break;
|
|
485
520
|
}
|
|
486
521
|
default:
|
|
@@ -768,7 +803,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
768
803
|
this.interner = new StringInterner_1.MutableStringInterner([InitialTree_1.initialTree.definition]);
|
|
769
804
|
const oldIdCompressor = this.idCompressor;
|
|
770
805
|
// Create the IdCompressor that will be used after the upgrade
|
|
771
|
-
const newIdCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount);
|
|
806
|
+
const newIdCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount, this.attributionId);
|
|
772
807
|
const newContext = (0, NodeIdUtilities_1.getNodeIdContext)(newIdCompressor);
|
|
773
808
|
// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.
|
|
774
809
|
// This will allow the client to continue to use local IDs that were allocated pre-upgrade
|
|
@@ -782,7 +817,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
782
817
|
}
|
|
783
818
|
};
|
|
784
819
|
// Construct a temporary "ghost" compressor which is used to generate final IDs that will be consistent across all upgrading clients
|
|
785
|
-
const ghostIdCompressor = new id_compressor_1.IdCompressor(persisted_types_1.ghostSessionId, persisted_types_1.reservedIdCount);
|
|
820
|
+
const ghostIdCompressor = new id_compressor_1.IdCompressor(persisted_types_1.ghostSessionId, persisted_types_1.reservedIdCount);
|
|
786
821
|
const ghostContext = (0, NodeIdUtilities_1.getNodeIdContext)(ghostIdCompressor);
|
|
787
822
|
if (this.summarizeHistory) {
|
|
788
823
|
// All clients have the full history, and can therefore all "generate" the same final IDs for every ID in the history
|