@fluidframework/runtime-definitions 2.0.0-dev.2.2.0.111723 → 2.0.0-dev.3.1.0.125672
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -7
- package/README.md +6 -6
- package/api-extractor.json +2 -2
- package/dist/attribution.d.ts +41 -0
- package/dist/attribution.d.ts.map +1 -0
- package/dist/attribution.js +7 -0
- package/dist/attribution.js.map +1 -0
- package/dist/dataStoreContext.d.ts +27 -8
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +6 -2
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreFactory.d.ts.map +1 -1
- package/dist/dataStoreFactory.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/garbageCollection.d.ts +17 -6
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +9 -3
- package/dist/garbageCollection.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +2 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/summary.d.ts +64 -14
- package/dist/summary.d.ts.map +1 -1
- package/dist/summary.js.map +1 -1
- package/package.json +15 -15
- package/prettier.config.cjs +1 -1
- package/src/attribution.ts +44 -0
- package/src/dataStoreContext.ts +409 -392
- package/src/dataStoreFactory.ts +14 -11
- package/src/dataStoreRegistry.ts +8 -6
- package/src/garbageCollection.ts +20 -10
- package/src/index.ts +18 -2
- package/src/protocol.ts +39 -38
- package/src/summary.ts +226 -175
- package/tsconfig.json +8 -12
package/src/summary.ts
CHANGED
|
@@ -5,26 +5,23 @@
|
|
|
5
5
|
|
|
6
6
|
import { TelemetryEventPropertyType } from "@fluidframework/common-definitions";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
SummaryTree,
|
|
9
|
+
ISummaryTree,
|
|
10
|
+
ISequencedDocumentMessage,
|
|
11
|
+
ISnapshotTree,
|
|
12
|
+
ITree,
|
|
13
13
|
} from "@fluidframework/protocol-definitions";
|
|
14
|
-
import {
|
|
15
|
-
IGarbageCollectionData,
|
|
16
|
-
IGarbageCollectionDetailsBase,
|
|
17
|
-
} from "./garbageCollection";
|
|
14
|
+
import { IGarbageCollectionData, IGarbageCollectionDetailsBase } from "./garbageCollection";
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
* Contains the aggregation data from a Tree/Subtree.
|
|
21
18
|
*/
|
|
22
19
|
export interface ISummaryStats {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
treeNodeCount: number;
|
|
21
|
+
blobNodeCount: number;
|
|
22
|
+
handleNodeCount: number;
|
|
23
|
+
totalBlobSize: number;
|
|
24
|
+
unreferencedBlobSize: number;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
/**
|
|
@@ -35,21 +32,23 @@ export interface ISummaryStats {
|
|
|
35
32
|
* will be taking part of the summarization process.
|
|
36
33
|
*/
|
|
37
34
|
export interface ISummaryTreeWithStats {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Represents an aggregation of node counts and blob sizes associated to the current summary information
|
|
37
|
+
*/
|
|
38
|
+
stats: ISummaryStats;
|
|
39
|
+
/**
|
|
40
|
+
* A recursive data structure that will be converted to a snapshot tree and uploaded
|
|
41
|
+
* to the backend.
|
|
42
|
+
*/
|
|
43
|
+
summary: ISummaryTree;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* Represents a summary at a current sequence number.
|
|
49
48
|
*/
|
|
50
49
|
export interface ISummarizeResult {
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
stats: ISummaryStats;
|
|
51
|
+
summary: SummaryTree;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
/**
|
|
@@ -67,17 +66,25 @@ export interface ISummarizeResult {
|
|
|
67
66
|
* ```
|
|
68
67
|
*/
|
|
69
68
|
export interface ISummarizeInternalResult extends ISummarizeResult {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
id: string;
|
|
70
|
+
/**
|
|
71
|
+
* Additional path parts between this node's ID and its children's IDs.
|
|
72
|
+
*/
|
|
73
|
+
pathPartsForChildren?: string[];
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The garbage collection data of each node in the reference graph.
|
|
78
|
+
*/
|
|
76
79
|
export interface IGarbageCollectionNodeData {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The set of routes to other nodes in the graph.
|
|
82
|
+
*/
|
|
83
|
+
outboundRoutes: string[];
|
|
84
|
+
/**
|
|
85
|
+
* If the node is unreferenced, the timestamp of when it was marked unreferenced.
|
|
86
|
+
*/
|
|
87
|
+
unreferencedTimestampMs?: number;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
/**
|
|
@@ -85,110 +92,143 @@ export interface IGarbageCollectionNodeData {
|
|
|
85
92
|
* GC data.
|
|
86
93
|
*/
|
|
87
94
|
export interface IGarbageCollectionState {
|
|
88
|
-
|
|
95
|
+
gcNodes: { [id: string]: IGarbageCollectionNodeData };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated - IGarbageCollectionState is written in the root of the summary now.
|
|
100
|
+
* Legacy GC details from when the GC details were written at the data store's summary tree.
|
|
101
|
+
*/
|
|
102
|
+
export interface IGarbageCollectionSummaryDetailsLegacy {
|
|
103
|
+
/** A list of routes to Fluid objects that are used in this node. */
|
|
104
|
+
usedRoutes?: string[];
|
|
105
|
+
/** The GC data of this node. */
|
|
106
|
+
gcData?: IGarbageCollectionData;
|
|
107
|
+
/** If this node is unreferenced, the time when it was marked as such. */
|
|
108
|
+
unrefTimestamp?: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The GC data that is read from a snapshot. It contains the Garbage CollectionState state and tombstone state.
|
|
113
|
+
*/
|
|
114
|
+
export interface IGarbageCollectionSnapshotData {
|
|
115
|
+
gcState: IGarbageCollectionState;
|
|
116
|
+
tombstones: string[] | undefined;
|
|
117
|
+
deletedNodes: string[] | undefined;
|
|
89
118
|
}
|
|
90
119
|
|
|
91
120
|
export type SummarizeInternalFn = (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
fullTree: boolean,
|
|
122
|
+
trackState: boolean,
|
|
123
|
+
telemetryContext?: ITelemetryContext,
|
|
95
124
|
) => Promise<ISummarizeInternalResult>;
|
|
96
125
|
|
|
97
126
|
export interface ISummarizerNodeConfig {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
/**
|
|
128
|
+
* True to reuse previous handle when unchanged since last acked summary.
|
|
129
|
+
* Defaults to true.
|
|
130
|
+
*/
|
|
131
|
+
readonly canReuseHandle?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* True to always stop execution on error during summarize, or false to
|
|
134
|
+
* attempt creating a summary that is a pointer ot the last acked summary
|
|
135
|
+
* plus outstanding ops in case of internal summarize failure.
|
|
136
|
+
* Defaults to false.
|
|
137
|
+
*
|
|
138
|
+
* BUG BUG: Default to true while we investigate problem
|
|
139
|
+
* with differential summaries
|
|
140
|
+
*/
|
|
141
|
+
readonly throwOnFailure?: true;
|
|
113
142
|
}
|
|
114
143
|
|
|
115
144
|
export interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
145
|
+
/**
|
|
146
|
+
* True if GC is disabled. If so, don't track GC related state for a summary.
|
|
147
|
+
* This is propagated to all child nodes.
|
|
148
|
+
*/
|
|
149
|
+
readonly gcDisabled?: boolean;
|
|
121
150
|
}
|
|
122
151
|
|
|
123
152
|
export enum CreateSummarizerNodeSource {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
153
|
+
FromSummary,
|
|
154
|
+
FromAttach,
|
|
155
|
+
Local,
|
|
127
156
|
}
|
|
128
|
-
export type CreateChildSummarizerNodeParam =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
157
|
+
export type CreateChildSummarizerNodeParam =
|
|
158
|
+
| {
|
|
159
|
+
type: CreateSummarizerNodeSource.FromSummary;
|
|
160
|
+
}
|
|
161
|
+
| {
|
|
162
|
+
type: CreateSummarizerNodeSource.FromAttach;
|
|
163
|
+
sequenceNumber: number;
|
|
164
|
+
snapshot: ITree;
|
|
165
|
+
}
|
|
166
|
+
| {
|
|
167
|
+
type: CreateSummarizerNodeSource.Local;
|
|
168
|
+
};
|
|
137
169
|
|
|
138
170
|
export interface ISummarizerNode {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Latest successfully acked summary reference sequence number
|
|
173
|
+
*/
|
|
174
|
+
readonly referenceSequenceNumber: number;
|
|
175
|
+
/**
|
|
176
|
+
* Marks the node as having a change with the given sequence number.
|
|
177
|
+
* @param sequenceNumber - sequence number of change
|
|
178
|
+
*/
|
|
179
|
+
invalidate(sequenceNumber: number): void;
|
|
180
|
+
/**
|
|
181
|
+
* Calls the internal summarize function and handles internal state tracking.
|
|
182
|
+
* If unchanged and fullTree is false, it will reuse previous summary subtree.
|
|
183
|
+
* If an error is encountered and throwOnFailure is false, it will try to make
|
|
184
|
+
* a summary with a pointer to the previous summary + a blob of outstanding ops.
|
|
185
|
+
* @param fullTree - true to skip optimizations and always generate the full tree
|
|
186
|
+
* @param trackState - indicates whether the summarizer node should track the state of the summary or not
|
|
187
|
+
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
188
|
+
*/
|
|
189
|
+
summarize(
|
|
190
|
+
fullTree: boolean,
|
|
191
|
+
trackState?: boolean,
|
|
192
|
+
telemetryContext?: ITelemetryContext,
|
|
193
|
+
): Promise<ISummarizeResult>;
|
|
194
|
+
/**
|
|
195
|
+
* Checks if there are any additional path parts for children that need to
|
|
196
|
+
* be loaded from the base summary. Additional path parts represent parts
|
|
197
|
+
* of the path between this SummarizerNode and any child SummarizerNodes
|
|
198
|
+
* that it might have. For example: if datastore "a" contains dds "b", but the
|
|
199
|
+
* path is "/a/.channels/b", then the additional path part is ".channels".
|
|
200
|
+
* @param snapshot - the base summary to parse
|
|
201
|
+
*/
|
|
202
|
+
updateBaseSummaryState(snapshot: ISnapshotTree): void;
|
|
203
|
+
/**
|
|
204
|
+
* Records an op representing a change to this node/subtree.
|
|
205
|
+
* @param op - op of change to record
|
|
206
|
+
*/
|
|
207
|
+
recordChange(op: ISequencedDocumentMessage): void;
|
|
174
208
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
createChild(
|
|
210
|
+
/**
|
|
211
|
+
* Summarize function
|
|
212
|
+
*/
|
|
213
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
214
|
+
/**
|
|
215
|
+
* Initial id or path part of this node
|
|
216
|
+
*/
|
|
217
|
+
id: string,
|
|
218
|
+
/**
|
|
219
|
+
* Information needed to create the node.
|
|
220
|
+
* If it is from a base summary, it will assert that a summary has been seen.
|
|
221
|
+
* Attach information if it is created from an attach op.
|
|
222
|
+
* If it is local, it will throw unsupported errors on calls to summarize.
|
|
223
|
+
*/
|
|
224
|
+
createParam: CreateChildSummarizerNodeParam,
|
|
225
|
+
/**
|
|
226
|
+
* Optional configuration affecting summarize behavior
|
|
227
|
+
*/
|
|
228
|
+
config?: ISummarizerNodeConfig,
|
|
229
|
+
): ISummarizerNode;
|
|
190
230
|
|
|
191
|
-
|
|
231
|
+
getChild(id: string): ISummarizerNode | undefined;
|
|
192
232
|
}
|
|
193
233
|
|
|
194
234
|
/**
|
|
@@ -214,49 +254,60 @@ export interface ISummarizerNode {
|
|
|
214
254
|
* `updateUsedRoutes`: Used to notify this node of routes that are currently in use in it.
|
|
215
255
|
*/
|
|
216
256
|
export interface ISummarizerNodeWithGC extends ISummarizerNode {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
257
|
+
createChild(
|
|
258
|
+
/**
|
|
259
|
+
* Summarize function
|
|
260
|
+
*/
|
|
261
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
262
|
+
/**
|
|
263
|
+
* Initial id or path part of this node
|
|
264
|
+
*/
|
|
265
|
+
id: string,
|
|
266
|
+
/**
|
|
267
|
+
* Information needed to create the node.
|
|
268
|
+
* If it is from a base summary, it will assert that a summary has been seen.
|
|
269
|
+
* Attach information if it is created from an attach op.
|
|
270
|
+
* If it is local, it will throw unsupported errors on calls to summarize.
|
|
271
|
+
*/
|
|
272
|
+
createParam: CreateChildSummarizerNodeParam,
|
|
273
|
+
/**
|
|
274
|
+
* Optional configuration affecting summarize behavior
|
|
275
|
+
*/
|
|
276
|
+
config?: ISummarizerNodeConfigWithGC,
|
|
277
|
+
getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated - The functionality to update child's base GC details is incorporated in the summarizer node.
|
|
280
|
+
*/
|
|
281
|
+
getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,
|
|
282
|
+
): ISummarizerNodeWithGC;
|
|
234
283
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Delete the child with the given id..
|
|
286
|
+
*/
|
|
287
|
+
deleteChild(id: string): void;
|
|
239
288
|
|
|
240
|
-
|
|
289
|
+
getChild(id: string): ISummarizerNodeWithGC | undefined;
|
|
241
290
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Returns this node's data that is used for garbage collection. This includes a list of GC nodes that represent
|
|
293
|
+
* this node. Each node has a set of outbound routes to other GC nodes in the document.
|
|
294
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
295
|
+
*/
|
|
296
|
+
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
248
297
|
|
|
249
|
-
|
|
250
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd
|
|
300
|
+
*/
|
|
301
|
+
isReferenced(): boolean;
|
|
251
302
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
303
|
+
/**
|
|
304
|
+
* After GC has run, called to notify this node of routes that are used in it. These are used for the following:
|
|
305
|
+
* 1. To identify if this node is being referenced in the document or not.
|
|
306
|
+
* 2. To identify if this node or any of its children's used routes changed since last summary.
|
|
307
|
+
*
|
|
308
|
+
* @param usedRoutes - The routes that are used in this node.
|
|
309
|
+
*/
|
|
310
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
260
311
|
}
|
|
261
312
|
|
|
262
313
|
export const channelsTreeName = ".channels";
|
|
@@ -266,27 +317,27 @@ export const channelsTreeName = ".channels";
|
|
|
266
317
|
* This object is expected to be modified directly by various summarize methods.
|
|
267
318
|
*/
|
|
268
319
|
export interface ITelemetryContext {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Sets value for telemetry data being tracked.
|
|
322
|
+
* @param prefix - unique prefix to tag this data with (ex: "fluid:map:")
|
|
323
|
+
* @param property - property name of the telemetry data being tracked (ex: "DirectoryCount")
|
|
324
|
+
* @param value - value to attribute to this summary telemetry data
|
|
325
|
+
*/
|
|
326
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
276
327
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Get the telemetry data being tracked
|
|
330
|
+
* @param prefix - unique prefix for this data (ex: "fluid:map:")
|
|
331
|
+
* @param property - property name of the telemetry data being tracked (ex: "DirectoryCount")
|
|
332
|
+
* @returns undefined if item not found
|
|
333
|
+
*/
|
|
334
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
284
335
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Returns a serialized version of all the telemetry data.
|
|
338
|
+
* Should be used when logging in telemetry events.
|
|
339
|
+
*/
|
|
340
|
+
serialize(): string;
|
|
290
341
|
}
|
|
291
342
|
|
|
292
343
|
export const blobCountPropertyName = "BlobCount";
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*"
|
|
13
|
-
]
|
|
2
|
+
"extends": "@fluidframework/build-common/ts-common-config.json",
|
|
3
|
+
"exclude": ["src/test/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"composite": true,
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*"],
|
|
14
10
|
}
|