@fluidframework/merge-tree 2.0.0-internal.2.1.1 → 2.0.0-internal.2.2.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/.eslintrc.js +2 -1
- package/docs/Attribution.md +383 -0
- package/package.json +26 -23
- package/prettier.config.cjs +8 -0
package/.eslintrc.js
CHANGED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
This design document covers a high-level plan for embedding attribution information into merge-tree.
|
|
4
|
+
It attempts to be detailed enough to start fleshing out proposed optimizations into code, though the actual factoring of the code
|
|
5
|
+
(responsibilities of objects, names/semantics) may be subject to change in further refinements of the design.
|
|
6
|
+
|
|
7
|
+
## Motivation
|
|
8
|
+
|
|
9
|
+
A common feature in collaborative applications is the ability to attribute pieces of content to a particular user.
|
|
10
|
+
This attribution information generally contains information about who edited the content as well as when the edit occurred.
|
|
11
|
+
|
|
12
|
+
At the time of writing this document, the Fluid Framework doesn't natively support this kind of functionality,
|
|
13
|
+
though in theory it has all of the data it needs (the op envelope contains both a timestamp and a client id, which can
|
|
14
|
+
be mapped to information about the user using the audience).
|
|
15
|
+
This has forced Fluid consumers that want attribution information to use workaround schemes. For example, in SharedString it's
|
|
16
|
+
straightforward to conceptualize a scheme where each time a client submits an op that edits the string, it waits for that op to
|
|
17
|
+
ack and uses the timestamp on that op to submit an additional op that annotates the edited segments with attribution information.
|
|
18
|
+
|
|
19
|
+
Besides unnecessarily complicating client code, this has several drawbacks:
|
|
20
|
+
- It is noisy on the wire
|
|
21
|
+
- Attribution information can be lost in various cases if the submitting client disconnects
|
|
22
|
+
- In-memory and snapshot size for the SharedString is more bloated than it should be; without binning the timestamps this strategy
|
|
23
|
+
entirely invalidated the zamboni scheme, and even if the timestamps are binned this will unnecessarily include the same user info
|
|
24
|
+
many times on different segments
|
|
25
|
+
|
|
26
|
+
Rather than force this burden on consumers, it makes more sense to bake some attribution capability into the Fluid Framework in an opt-in way.
|
|
27
|
+
Though this document will cover an approach for doing so in merge-tree (primarily targeted at support for attribution in SharedString),
|
|
28
|
+
none of the above concerns are specific to a single DDS.
|
|
29
|
+
It's imaginible that Fluid will eventually want to generalize this to a platform mechanism that's supported by each DDS that wants to opt in to it.
|
|
30
|
+
For that reason, the design is aimed to modularize into areas that are generic to the container runtime and those that are DDS-specific.
|
|
31
|
+
|
|
32
|
+
## High-level
|
|
33
|
+
|
|
34
|
+
If one had access to the entire op stream, a lookup from all historical client ids to their user info,
|
|
35
|
+
and every DDS retained information about which sequence number created/modified each part of its data,
|
|
36
|
+
attribution would be straightforward. Ask the DDS for the relevant sequence number, then look at this sequence number's op for a timestamp + clientId
|
|
37
|
+
and use the client id to look up user information.
|
|
38
|
+
|
|
39
|
+
All of this information is knowable from the Fluid runtime perspective, though not all of it is persisted indefinitely.
|
|
40
|
+
Notably:
|
|
41
|
+
- Access to the entire op stream is an unreasonable assumption due to the summarization process
|
|
42
|
+
- User information is only accessible for connected clients
|
|
43
|
+
|
|
44
|
+
However, this conceptualization of attribution does suggest a reasonable split of concerns that can be individually assessed:
|
|
45
|
+
none of the association between sequence numbers, timestamps, clientIds, and user information is specific to any given DDS.
|
|
46
|
+
Thus, all of this bookkeeping could be generically done by the framework (potential candidates include on container runtime, data store runtime, or channel context),
|
|
47
|
+
and any query-style APIs a DDS might support for retrieving attribution information could be accomplished by asking the runtime for information about a given sequence number.
|
|
48
|
+
|
|
49
|
+
This leaves two high-level problems:
|
|
50
|
+
|
|
51
|
+
1. How can the framework manage to associate sequence numbers to attribution information efficiently?
|
|
52
|
+
2. What degrees of freedom should merge-tree expose for attributing its state to different users?
|
|
53
|
+
|
|
54
|
+
## Sequence Number to Attribution Association
|
|
55
|
+
|
|
56
|
+
Setting aside the problem of where to put the state for now, there are two primary ways by which associations between sequence numbers and attribution
|
|
57
|
+
can be made practical from a memory perspective.
|
|
58
|
+
First, there needs to be a garbage collection scheme to clean up attribution information on removed content.
|
|
59
|
+
|
|
60
|
+
Secondly, attribution information needs to be compacted to an efficient format, both in terms of snapshot size (i.e. plain data representation) and desired
|
|
61
|
+
level of granularity (applications don't care about millisecond-accurate timestamps).
|
|
62
|
+
|
|
63
|
+
Finally, the in-memory data structures that support the necessary APIs are discussed.
|
|
64
|
+
|
|
65
|
+
### Cleanup of outdated information
|
|
66
|
+
|
|
67
|
+
Since the semantics of each op is opaque to the runtime, the runtime needs some mechanism to ascertain when an op's attribution is no longer relevant, i.e.
|
|
68
|
+
not referenced.
|
|
69
|
+
|
|
70
|
+
There are a few general models that could work:
|
|
71
|
+
|
|
72
|
+
1. Assume that the runtime controls authoring of references to attribution information. It could stamp such information with a unique symbol such that it could
|
|
73
|
+
later be recognized in serialization to determine if the info was still referenced.
|
|
74
|
+
This approach is not far off from how `IFluidHandle`s work.
|
|
75
|
+
Reference counting the created objects could also work, but would likely be messier (responsibility of cleanup will likely end up extending past where we want it).
|
|
76
|
+
2. Demand objects that store attribution information implement a function that exposes all sequence numbers they reference.
|
|
77
|
+
|
|
78
|
+
Option 1 might look something like
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
|
|
82
|
+
const attributionHandle = Symbol('attribution handle');
|
|
83
|
+
|
|
84
|
+
class /*Container/DataStore/etc. (TBD)*/Runtime {
|
|
85
|
+
|
|
86
|
+
public createAttributionHandle(sequenceNumber: number) {
|
|
87
|
+
return {
|
|
88
|
+
[attributionHandle]: true,
|
|
89
|
+
sequenceNumber
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Serialization logic in ISerializer would need to look for attributionHandle symbol usages
|
|
95
|
+
// and serialize it appropriately.
|
|
96
|
+
// Similarly for deserialization.
|
|
97
|
+
// At summary time, the set of sequence numbers that were referenced can be recorded for each data store,
|
|
98
|
+
// and any sequence numbers that are no longer referenced could have their attribution information cleaned up.
|
|
99
|
+
// Incremental summaries make the bookkeeping of this scheme slightly more complicated, but the general idea
|
|
100
|
+
// still works.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The main advantage of option 1 is that it requires less DDS/application code.
|
|
104
|
+
However, it causes larger-sized snapshots, since the serialized form of runtime-minted attribution handles will be more verbose than a simple number.
|
|
105
|
+
It also leads to a potentially nasty bug pit: there's not a practical way to enforce that objects storing attribution information actually call
|
|
106
|
+
`createAttributionHandle` before serializing their data: they could just as easily store the sequence number and only call `createAttributionHandle`
|
|
107
|
+
directly before trying to obtain attribution information.
|
|
108
|
+
This would risk attribution information getting GC'd too early.
|
|
109
|
+
|
|
110
|
+
Option 2 would look closer to this:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
|
|
114
|
+
interface IReferenceAttributionInfo {
|
|
115
|
+
/**
|
|
116
|
+
* @returns an iterable over all sequence numbers for which this object references attribution information.
|
|
117
|
+
*/
|
|
118
|
+
getReferencedSeqs(): Iterable<number>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
class MergeTree implements IReferenceAttributionInfo {
|
|
122
|
+
public getReferencedSeqs() {
|
|
123
|
+
const seqs = new Set();
|
|
124
|
+
this.walkAllSegments(this.root, (seg) => {
|
|
125
|
+
seqs.add(seg.seq)
|
|
126
|
+
});
|
|
127
|
+
return seqs;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Though this design forces extra code on users, it's typically not conceptually difficult to implement and enables the serialized format to be more compact.
|
|
133
|
+
|
|
134
|
+
It's worth noting that both of these models have interesting interactions with partial checkouts / schemes for more incremental summarization at the DDS level (via blob re-use [see #832](https://dev.azure.com/fluidframework/internal/_workitems/edit/832)): each would need to support some notion of reference count deltas from the previous result.
|
|
135
|
+
|
|
136
|
+
### Compaction of similar information
|
|
137
|
+
|
|
138
|
+
One primary motivation for supporting attribution information natively in the framework is the potential to reduce redundant attribution information in snapshots.
|
|
139
|
+
There are two obvious ways data is redundant: user information gets repeatedly inlined into `JSON.stringify`d content, and various sets of ops all likely have
|
|
140
|
+
virtually the same attribution information (same user, perhaps a slightly different timestamp).
|
|
141
|
+
Ops that have closer together sequence number are more likely to contain such redundant information, as users tend to edit documents in bursts.
|
|
142
|
+
This suggests a few strategies for keeping a compact format (either only on serialization or in-memory as well):
|
|
143
|
+
|
|
144
|
+
1. Intern user objects
|
|
145
|
+
2. Intern attribution objects
|
|
146
|
+
3. If a range of sequence numbers all have the same attribution information, store it as such
|
|
147
|
+
4. Allow "equivalent timestamp" policy injection: it's unlikely any app needs millisecond or better accuracy on the server ack timestamp for attribution purposes.
|
|
148
|
+
There should be a configurable policy for how timestamps get binned. Basic implementations could bin on a fixed cadence, but for even more compact files a dynamic bin size policy with larger bins for less recent data could also give a reasonable user experience
|
|
149
|
+
|
|
150
|
+
Optimizations 1 through 3 are all things that standard compression algorithms can detect: interning objects is essentially
|
|
151
|
+
[dictionary compression](https://en.wikipedia.org/wiki/Dictionary_coder) and compressing adjacent ranges is
|
|
152
|
+
[run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding), so before going through the trouble of writing bespoke compression code
|
|
153
|
+
we should experiment with things like [LZ4](https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)) and [DEFLATE](https://en.wikipedia.org/wiki/Deflate).
|
|
154
|
+
For the purposes of illustration, the following sections will outline how the bespoke code might look.
|
|
155
|
+
|
|
156
|
+
#### Interning
|
|
157
|
+
|
|
158
|
+
Rather than repeatedly serialize the same information in the snapshot format, we can internally add a level of indirection to the `user` field, the entire
|
|
159
|
+
attribution object, or both.
|
|
160
|
+
This optimization would be entirely transparent to the public API: whatever snapshot/in-memory format we use, we'd always convert to `AttributionInfo` before
|
|
161
|
+
returning the information for a given seq to the DDS/application.
|
|
162
|
+
|
|
163
|
+
Interfaces might look like this, with exported properties being those visible to an application:
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
export interface AttributionInfo {
|
|
167
|
+
user: IUser;
|
|
168
|
+
timestamp: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface IAttributor {
|
|
172
|
+
getAttributionInfo(seq: number): AttributionInfo;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type InternedRef = number & { readonly InternedRef: 'e86840d8-8384-450c-b0e3-9a2855ba2d21'};
|
|
176
|
+
|
|
177
|
+
interface ObjectInterner {
|
|
178
|
+
getOrCreateRef(obj: Jsonable): InternedRef;
|
|
179
|
+
getObject(id: InternedRef): Jsonable;
|
|
180
|
+
getSerializable(): Jsonable;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface CompactAttributionInfo {
|
|
184
|
+
userRef: InternedRef;
|
|
185
|
+
timestamp: number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Concrete types for a particular `Attributor` implementation
|
|
189
|
+
interface SerializedAttributor {
|
|
190
|
+
interner: Jsonable /* result of calling getSerializable() on an ObjectInterner */
|
|
191
|
+
lookup: {
|
|
192
|
+
[seq: number]: InternedRef /* to CompactAttributionInfo */ | CompactAttributionInfo
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### Adjacent Range Coalescing
|
|
198
|
+
|
|
199
|
+
Typical documents will likely have a number of consecutive ops with the same attribution information.
|
|
200
|
+
This happens for a few reasons: users might make a number of edits in a short period of time (consider a user typing
|
|
201
|
+
out a new paragraph), and ops submitted by a single container are batched under some circumstances.
|
|
202
|
+
|
|
203
|
+
Rather than end up with a `SerializedAttributor` that resembles this:
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
{
|
|
207
|
+
interner: [{ email: "john.doe@contoso.com", id: "f400ddf3-4d04-48e9-8783-4b1db8a45fc3" }, { user: 0, timestamp: 1661974200000 }],
|
|
208
|
+
lookup: {
|
|
209
|
+
50: 1,
|
|
210
|
+
51: 1,
|
|
211
|
+
52: 1,
|
|
212
|
+
53: 1,
|
|
213
|
+
54: 1
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
we could instead serialize the lookup table like so:
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
{
|
|
222
|
+
interner: [{ email: "john.doe@contoso.com", id: "f400ddf3-4d04-48e9-8783-4b1db8a45fc3" }, { user: 0, timestamp: 1661974200000 }],
|
|
223
|
+
lookup: [{ key: [50, 54], value: 1 }]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Since objects are distinguishable from numbers, single-number ranges could just have a number key.
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
interface AttributionEntry {
|
|
231
|
+
/**
|
|
232
|
+
* Either a single `seq` number for this attribution entry, or a consecutive range `[start, end]` (inclusive)
|
|
233
|
+
* of `seq` numbers which all have the same attribution information.
|
|
234
|
+
*/
|
|
235
|
+
k: number | [number, number];
|
|
236
|
+
v: InternedRef | CompactAttributionInfo;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Concrete types for a particular `Attributor` implementation
|
|
240
|
+
interface SerializedAttributor {
|
|
241
|
+
interner: Jsonable; /* result of calling getSerializable() on an ObjectInterner */
|
|
242
|
+
lookup: AttributionEntry[];
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Timestamp Binning
|
|
247
|
+
|
|
248
|
+
One key aspect of information compaction is the ability to bin the precise timestamps given by the server into more reasonable granularity levels for attribution.
|
|
249
|
+
Unlike the other optimizations to compact information, binning is lossy.
|
|
250
|
+
Binning can simply be dictated by a function that takes in a timestamp and returns a timestamp for the output bin.
|
|
251
|
+
Simple strategies like "bin every 5 minutes" are as simple as `(timestamp: number) => timestamp - (timestamp % (1000 * 60 * 5))`,
|
|
252
|
+
but allowing an arbitrary function here also empowers more advanced users to make partitions of timespace like "5-minute granularity up to a day ago, 1-day granularity up to a month ago, 1-month granularity up to a year ago, yearly granularity otherwise".
|
|
253
|
+
For the simple strategy, running the binning function on initial sequencing of the op would be sufficient.
|
|
254
|
+
To make the second function behave as desired ("old attribution information tends to get coalesced"),
|
|
255
|
+
the runtime would also have to re-bin existing attribution information either every so often or just on document load.
|
|
256
|
+
|
|
257
|
+
We should apply this optimization last, and only if we need it. It's possible standard time-series compression of numbers will be sufficient here.
|
|
258
|
+
|
|
259
|
+
### In-memory attribution structure
|
|
260
|
+
|
|
261
|
+
Attributor bookkeeping needs to efficiently support:
|
|
262
|
+
- Lookup of attribution information at a `seq`
|
|
263
|
+
- Adding attribution information for a newly sequenced op
|
|
264
|
+
- Merging consecutive attribution entries that should now be coalesced (depending on other design choices, this one is less important)
|
|
265
|
+
|
|
266
|
+
One candidate implementation would be to expand the serialized format entirely and use a `Map`. This implementation is viable, but uses
|
|
267
|
+
`O(attributed seq#s)` memory. It would provide `O(1)` lookup.
|
|
268
|
+
Another reasonable candidate would be to keep the overall structure of having coalesced adjacent ranges, putting the serialized form into a
|
|
269
|
+
sorted list that can be binary searched.
|
|
270
|
+
This would give a reasonable memory win at the cost of increasing lookup time to `O(log(attributed seq#s))`.
|
|
271
|
+
|
|
272
|
+
Putting all of the optimizations together, an `Attributor` implementation might look something like this:
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
export interface IAttributor {
|
|
276
|
+
getAttributionInfo(seq: number): AttributionInfo;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export const binByMinutes = (interval: number) => (timestamp: number) => timestamp - (timestamp % (1000 * 60 * interval));
|
|
280
|
+
|
|
281
|
+
const seqComparator = (a: AttributionEntry, b: AttributionEntry) => {
|
|
282
|
+
aEnd = typeof a.k === 'number' ? a.k : a.k[1];
|
|
283
|
+
bEnd = typeof a.k === 'number' ? b.k : b.k[1];
|
|
284
|
+
return aEnd - bEnd;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
class Attributor implements IAttributor {
|
|
288
|
+
private seqToInfo: SortedList<AttributionEntry> = new SortedList(seqComparator);
|
|
289
|
+
constructor(
|
|
290
|
+
runtime: IFluidDataStoreRuntime,
|
|
291
|
+
serialized?: SerializedAttributor,
|
|
292
|
+
bin: (timestamp: number) => number = binByMinutes(5)
|
|
293
|
+
) {
|
|
294
|
+
if (serialized) {
|
|
295
|
+
const interner = new ObjectInterner(serialized.interner);
|
|
296
|
+
// Note: this implementation doesn't coalesce re-binned attribution entries that are newly equivalent and adjacent.
|
|
297
|
+
this.seqToInfo.extend(...serialized.lookup.map(({ k, v: internedV }) => {
|
|
298
|
+
const { timestamp, userRef } = isInternedRef(maybeInternedV) ? interner.getObject(maybeInternedV) : maybeInternedV;
|
|
299
|
+
const v = {
|
|
300
|
+
timestamp: bin(timestamp),
|
|
301
|
+
user: interner.getObject(userRef)
|
|
302
|
+
};
|
|
303
|
+
return { k, v };
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const { deltaManager, audience } = runtime;
|
|
308
|
+
deltaManager.on("op", (message: ISequencedDocumentMessage) => {
|
|
309
|
+
const attributionInfo = {
|
|
310
|
+
/* note: for object interning to work, this needs to be a referentially equal user object. If that isn't provided by the
|
|
311
|
+
Fluid Framework, we probably would want a layer of caching here. For interning of overall attribution info objects,
|
|
312
|
+
we may want a similar cache. */
|
|
313
|
+
user: audience.get(message.clientId).user,
|
|
314
|
+
timestamp: bin(message.timestamp)
|
|
315
|
+
};
|
|
316
|
+
const { k, v } = seqToInfo.getAt(seqToInfo.length - 1);
|
|
317
|
+
const lastEntryStart = typeof k === 'number' ? k : k[0];
|
|
318
|
+
const lastEntryEnd = typeof k === 'number' ? k : k[1];
|
|
319
|
+
if (
|
|
320
|
+
attributionInfosAreEquivalent(attributionInfo, v) &&
|
|
321
|
+
// Note: this coalescing logic is somewhat unideal since no-ops break it.
|
|
322
|
+
message.seq === 1 + lastEntryEnd)
|
|
323
|
+
) {
|
|
324
|
+
this.seqToInfo.pop();
|
|
325
|
+
this.seqToInfo.insert({ k: [lastEntryStart, message.seq], v });
|
|
326
|
+
} else {
|
|
327
|
+
this.seqToInfo.insert({ k: message.seq, v: attributionInfo });
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
public getAttributionInfo(seq: number): AttributionInfo {
|
|
333
|
+
const { k, v } = seqToInfo.findAtOrAfter(seq);
|
|
334
|
+
assert(k === seq || (k.length === 2 && k[0] <= seq && seq <= k[1]));
|
|
335
|
+
return v;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Unpictured:
|
|
339
|
+
// - serialization (not interesting; deserialization logic is pictured)
|
|
340
|
+
// - GC (there are several ways to hook this up, though one can check the data structure should support it in O(n))
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
### Bookkeeping Placement Considerations
|
|
347
|
+
|
|
348
|
+
There are several levels that the framework could choose to conceptually store "sequence number to attribution" information:
|
|
349
|
+
|
|
350
|
+
- Container Runtime
|
|
351
|
+
- Data store runtime
|
|
352
|
+
- DDS
|
|
353
|
+
|
|
354
|
+
The initial attributor implementation will likely be hooked up to only `SharedString` due to current feature asks of partner teams.
|
|
355
|
+
However, it's worth calling out that depending on which layer the runtime places the information, there are consequences with respect
|
|
356
|
+
to GC and how well information compacts.
|
|
357
|
+
|
|
358
|
+
For GC:
|
|
359
|
+
|
|
360
|
+
- Determining whether sequence numbers are referenced by any attribution information gets complicated slightly by incremental summarization if
|
|
361
|
+
information is stored on container runtime
|
|
362
|
+
|
|
363
|
+
For compaction:
|
|
364
|
+
|
|
365
|
+
- Compaction schemes potentially get worse for sequences of ops that alter different data stores if attribution information is stored at a
|
|
366
|
+
fine-grained level (e.g. DDS, Data store runtime).
|
|
367
|
+
|
|
368
|
+
## Merge-Tree Attribution API
|
|
369
|
+
|
|
370
|
+
TODO: This section will cover planned extension points for specifying attribution information on merge-tree.
|
|
371
|
+
|
|
372
|
+
My current thinking is something along the lines of the following:
|
|
373
|
+
|
|
374
|
+
Segments have a `attribution` field which is an opaque object to merge-tree, but splits/combines/impacts merge behavior a la tracking groups.
|
|
375
|
+
Users of merge-tree are empowered to inject policy into the `attribution` of the segment as they see fit.
|
|
376
|
+
The most basic policy which we should get for free would be to use `clientSeq` as the only tracked attribution state, which corresponds to
|
|
377
|
+
an application that only wants to track who inserted the segment and when they did it.
|
|
378
|
+
|
|
379
|
+
More advanced users could provide fancier json-serializable state objects such as `{ inserted: number, annotated: number }` and set up proper
|
|
380
|
+
semantics for those fields.
|
|
381
|
+
|
|
382
|
+
I need to think through if current merge-tree delta operation events are a sufficient entrypoint for managing such state, or if there's a nicer
|
|
383
|
+
way to encapsulate common desires.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/merge-tree",
|
|
3
|
-
"version": "2.0.0-internal.2.
|
|
3
|
+
"version": "2.0.0-internal.2.2.0",
|
|
4
4
|
"description": "Merge tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -27,16 +27,20 @@
|
|
|
27
27
|
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
28
28
|
"eslint": "eslint --format stylish src",
|
|
29
29
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
30
|
+
"format": "npm run prettier:fix",
|
|
30
31
|
"lint": "npm run eslint",
|
|
31
32
|
"lint:fix": "npm run eslint:fix",
|
|
32
33
|
"postpack": "cd dist && tar -cvf ../merge-tree.test-files.tar ./test",
|
|
34
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
35
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
33
36
|
"test": "npm run test:mocha",
|
|
34
37
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
38
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup -r source-map-support/register --unhandled-rejections=strict",
|
|
36
39
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
40
|
"test:stress": "cross-env FUZZ_STRESS_RUN=1 FUZZ_TEST_COUNT=1 npm run test:mocha",
|
|
38
41
|
"tsc": "tsc",
|
|
39
|
-
"typetests:gen": "
|
|
42
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
43
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
40
44
|
},
|
|
41
45
|
"nyc": {
|
|
42
46
|
"all": true,
|
|
@@ -61,25 +65,25 @@
|
|
|
61
65
|
"dependencies": {
|
|
62
66
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
63
67
|
"@fluidframework/common-utils": "^1.0.0",
|
|
64
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.2.
|
|
65
|
-
"@fluidframework/container-utils": ">=2.0.0-internal.2.
|
|
66
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.
|
|
67
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.2.
|
|
68
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
69
|
+
"@fluidframework/container-utils": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
70
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
71
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
68
72
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
69
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.
|
|
70
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.
|
|
71
|
-
"@fluidframework/shared-object-base": ">=2.0.0-internal.2.
|
|
72
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.
|
|
73
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
74
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
75
|
+
"@fluidframework/shared-object-base": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
76
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0"
|
|
73
77
|
},
|
|
74
78
|
"devDependencies": {
|
|
75
|
-
"@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.2.
|
|
76
|
-
"@fluid-tools/build-cli": "^0.
|
|
79
|
+
"@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
80
|
+
"@fluid-tools/build-cli": "^0.7.0",
|
|
77
81
|
"@fluidframework/build-common": "^1.1.0",
|
|
78
|
-
"@fluidframework/build-tools": "^0.
|
|
79
|
-
"@fluidframework/eslint-config-fluid": "^1.
|
|
80
|
-
"@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.0.0-internal.2.
|
|
81
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.
|
|
82
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.
|
|
82
|
+
"@fluidframework/build-tools": "^0.7.0",
|
|
83
|
+
"@fluidframework/eslint-config-fluid": "^1.2.0",
|
|
84
|
+
"@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.0.0-internal.2.1.0",
|
|
85
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
86
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.2.2.0 <2.0.0-internal.3.0.0",
|
|
83
87
|
"@microsoft/api-extractor": "^7.22.2",
|
|
84
88
|
"@rushstack/eslint-config": "^2.5.1",
|
|
85
89
|
"@types/diff": "^3.5.1",
|
|
@@ -93,17 +97,16 @@
|
|
|
93
97
|
"eslint": "~8.6.0",
|
|
94
98
|
"mocha": "^10.0.0",
|
|
95
99
|
"nyc": "^15.0.0",
|
|
100
|
+
"prettier": "~2.6.2",
|
|
96
101
|
"random-js": "^1.0.8",
|
|
97
102
|
"rimraf": "^2.6.2",
|
|
98
103
|
"source-map-support": "^0.5.16",
|
|
99
104
|
"typescript": "~4.5.5"
|
|
100
105
|
},
|
|
101
106
|
"typeValidation": {
|
|
102
|
-
"version": "2.0.0-internal.2.
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
107
|
+
"version": "2.0.0-internal.2.2.0",
|
|
108
|
+
"baselineRange": ">=2.0.0-internal.2.1.0 <2.0.0-internal.2.2.0",
|
|
109
|
+
"baselineVersion": "2.0.0-internal.2.1.0",
|
|
110
|
+
"broken": {}
|
|
108
111
|
}
|
|
109
112
|
}
|