@fluidframework/runtime-definitions 2.0.0-internal.3.0.0 → 2.0.0-internal.3.1.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 +5 -7
- package/README.md +6 -6
- package/api-extractor.json +2 -2
- package/dist/attribution.d.ts +66 -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 +3 -3
- package/dist/dataStoreContext.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/garbageCollection.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/summary.js.map +1 -1
- package/package.json +64 -74
- package/prettier.config.cjs +1 -1
- package/src/attribution.ts +72 -0
- package/src/dataStoreContext.ts +405 -407
- package/src/dataStoreFactory.ts +14 -11
- package/src/dataStoreRegistry.ts +8 -6
- package/src/garbageCollection.ts +12 -12
- package/src/index.ts +21 -9
- package/src/protocol.ts +39 -38
- package/src/summary.ts +210 -211
- 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,23 +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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
/**
|
|
50
47
|
* Represents a summary at a current sequence number.
|
|
51
48
|
*/
|
|
52
49
|
export interface ISummarizeResult {
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
stats: ISummaryStats;
|
|
51
|
+
summary: SummaryTree;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
/**
|
|
@@ -69,25 +66,25 @@ export interface ISummarizeResult {
|
|
|
69
66
|
* ```
|
|
70
67
|
*/
|
|
71
68
|
export interface ISummarizeInternalResult extends ISummarizeResult {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
id: string;
|
|
70
|
+
/**
|
|
71
|
+
* Additional path parts between this node's ID and its children's IDs.
|
|
72
|
+
*/
|
|
73
|
+
pathPartsForChildren?: string[];
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
/**
|
|
80
77
|
* The garbage collection data of each node in the reference graph.
|
|
81
78
|
*/
|
|
82
79
|
export interface IGarbageCollectionNodeData {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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;
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
/**
|
|
@@ -95,7 +92,7 @@ export interface IGarbageCollectionNodeData {
|
|
|
95
92
|
* GC data.
|
|
96
93
|
*/
|
|
97
94
|
export interface IGarbageCollectionState {
|
|
98
|
-
|
|
95
|
+
gcNodes: { [id: string]: IGarbageCollectionNodeData };
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
/**
|
|
@@ -103,133 +100,135 @@ export interface IGarbageCollectionState {
|
|
|
103
100
|
* Legacy GC details from when the GC details were written at the data store's summary tree.
|
|
104
101
|
*/
|
|
105
102
|
export interface IGarbageCollectionSummaryDetailsLegacy {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
/**
|
|
115
112
|
* The GC data that is read from a snapshot. It contains the Garbage CollectionState state and tombstone state.
|
|
116
113
|
*/
|
|
117
114
|
export interface IGarbageCollectionSnapshotData {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
gcState: IGarbageCollectionState;
|
|
116
|
+
tombstones: string[] | undefined;
|
|
117
|
+
deletedNodes: string[] | undefined;
|
|
121
118
|
}
|
|
122
119
|
|
|
123
|
-
|
|
124
120
|
export type SummarizeInternalFn = (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
fullTree: boolean,
|
|
122
|
+
trackState: boolean,
|
|
123
|
+
telemetryContext?: ITelemetryContext,
|
|
128
124
|
) => Promise<ISummarizeInternalResult>;
|
|
129
125
|
|
|
130
126
|
export interface ISummarizerNodeConfig {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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;
|
|
146
142
|
}
|
|
147
143
|
|
|
148
144
|
export interface ISummarizerNodeConfigWithGC extends ISummarizerNodeConfig {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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;
|
|
154
150
|
}
|
|
155
151
|
|
|
156
152
|
export enum CreateSummarizerNodeSource {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
FromSummary,
|
|
154
|
+
FromAttach,
|
|
155
|
+
Local,
|
|
160
156
|
}
|
|
161
|
-
export type CreateChildSummarizerNodeParam =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
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
|
+
};
|
|
170
169
|
|
|
171
170
|
export interface ISummarizerNode {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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;
|
|
209
208
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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;
|
|
231
230
|
|
|
232
|
-
|
|
231
|
+
getChild(id: string): ISummarizerNode | undefined;
|
|
233
232
|
}
|
|
234
233
|
|
|
235
234
|
/**
|
|
@@ -255,60 +254,60 @@ export interface ISummarizerNode {
|
|
|
255
254
|
* `updateUsedRoutes`: Used to notify this node of routes that are currently in use in it.
|
|
256
255
|
*/
|
|
257
256
|
export interface ISummarizerNodeWithGC extends ISummarizerNode {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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;
|
|
284
283
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Delete the child with the given id..
|
|
286
|
+
*/
|
|
287
|
+
deleteChild(id: string): void;
|
|
289
288
|
|
|
290
|
-
|
|
289
|
+
getChild(id: string): ISummarizerNodeWithGC | undefined;
|
|
291
290
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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>;
|
|
298
297
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd
|
|
300
|
+
*/
|
|
301
|
+
isReferenced(): boolean;
|
|
303
302
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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;
|
|
312
311
|
}
|
|
313
312
|
|
|
314
313
|
export const channelsTreeName = ".channels";
|
|
@@ -318,27 +317,27 @@ export const channelsTreeName = ".channels";
|
|
|
318
317
|
* This object is expected to be modified directly by various summarize methods.
|
|
319
318
|
*/
|
|
320
319
|
export interface ITelemetryContext {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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;
|
|
328
327
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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;
|
|
336
335
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Returns a serialized version of all the telemetry data.
|
|
338
|
+
* Should be used when logging in telemetry events.
|
|
339
|
+
*/
|
|
340
|
+
serialize(): string;
|
|
342
341
|
}
|
|
343
342
|
|
|
344
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
|
}
|