@fluidframework/runtime-definitions 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1

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/src/summary.ts CHANGED
@@ -5,26 +5,23 @@
5
5
 
6
6
  import { TelemetryEventPropertyType } from "@fluidframework/common-definitions";
7
7
  import {
8
- SummaryTree,
9
- ISummaryTree,
10
- ISequencedDocumentMessage,
11
- ISnapshotTree,
12
- ITree,
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
- treeNodeCount: number;
24
- blobNodeCount: number;
25
- handleNodeCount: number;
26
- totalBlobSize: number;
27
- unreferencedBlobSize: number;
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
- * Represents an aggregation of node counts and blob sizes associated to the current summary information
40
- */
41
- stats: ISummaryStats;
42
- /**
43
- * A recursive data structure that will be converted to a snapshot tree and uploaded
44
- * to the backend.
45
- */
46
- summary: ISummaryTree;
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
- stats: ISummaryStats;
54
- summary: SummaryTree;
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
- id: string;
73
- /**
74
- * Additional path parts between this node's ID and its children's IDs.
75
- */
76
- pathPartsForChildren?: string[];
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
- * The set of routes to other nodes in the graph.
85
- */
86
- outboundRoutes: string[];
87
- /**
88
- * If the node is unreferenced, the timestamp of when it was marked unreferenced.
89
- */
90
- unreferencedTimestampMs?: number;
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
- gcNodes: { [ id: string ]: IGarbageCollectionNodeData; };
95
+ gcNodes: { [id: string]: IGarbageCollectionNodeData };
99
96
  }
100
97
 
101
98
  /**
@@ -103,136 +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
- /** A list of routes to Fluid objects that are used in this node. */
107
- usedRoutes?: string[];
108
- /** The GC data of this node. */
109
- gcData?: IGarbageCollectionData;
110
- /** If this node is unreferenced, the time when it was marked as such. */
111
- unrefTimestamp?: number;
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
- gcState: IGarbageCollectionState;
119
- tombstones: string[] | undefined;
120
- deletedNodes: string[] | undefined;
115
+ gcState: IGarbageCollectionState;
116
+ tombstones: string[] | undefined;
117
+ deletedNodes: string[] | undefined;
121
118
  }
122
119
 
123
-
124
120
  export type SummarizeInternalFn = (
125
- fullTree: boolean,
126
- trackState: boolean,
127
- telemetryContext?: ITelemetryContext,
121
+ fullTree: boolean,
122
+ trackState: boolean,
123
+ telemetryContext?: ITelemetryContext,
128
124
  ) => Promise<ISummarizeInternalResult>;
129
125
 
130
126
  export interface ISummarizerNodeConfig {
131
- /**
132
- * True to reuse previous handle when unchanged since last acked summary.
133
- * Defaults to true.
134
- */
135
- readonly canReuseHandle?: boolean;
136
- /**
137
- * True to always stop execution on error during summarize, or false to
138
- * attempt creating a summary that is a pointer ot the last acked summary
139
- * plus outstanding ops in case of internal summarize failure.
140
- * Defaults to false.
141
- *
142
- * BUG BUG: Default to true while we investigate problem
143
- * with differential summaries
144
- */
145
- readonly throwOnFailure?: true;
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
- * True if GC is disabled. If so, don't track GC related state for a summary.
151
- * This is propagated to all child nodes.
152
- */
153
- readonly gcDisabled?: boolean;
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
- FromSummary,
158
- FromAttach,
159
- Local,
153
+ FromSummary,
154
+ FromAttach,
155
+ Local,
160
156
  }
161
- export type CreateChildSummarizerNodeParam = {
162
- type: CreateSummarizerNodeSource.FromSummary;
163
- } | {
164
- type: CreateSummarizerNodeSource.FromAttach;
165
- sequenceNumber: number;
166
- snapshot: ITree;
167
- } | {
168
- type: CreateSummarizerNodeSource.Local;
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
- * Latest successfully acked summary reference sequence number
174
- */
175
- readonly referenceSequenceNumber: number;
176
- /**
177
- * Marks the node as having a change with the given sequence number.
178
- * @param sequenceNumber - sequence number of change
179
- */
180
- invalidate(sequenceNumber: number): void;
181
- /**
182
- * Calls the internal summarize function and handles internal state tracking.
183
- * If unchanged and fullTree is false, it will reuse previous summary subtree.
184
- * If an error is encountered and throwOnFailure is false, it will try to make
185
- * a summary with a pointer to the previous summary + a blob of outstanding ops.
186
- * @param fullTree - true to skip optimizations and always generate the full tree
187
- * @param trackState - indicates whether the summarizer node should track the state of the summary or not
188
- * @param telemetryContext - summary data passed through the layers for telemetry purposes
189
- */
190
- summarize(
191
- fullTree: boolean,
192
- trackState?: boolean,
193
- telemetryContext?: ITelemetryContext,
194
- ): Promise<ISummarizeResult>;
195
- /**
196
- * Checks if there are any additional path parts for children that need to
197
- * be loaded from the base summary. Additional path parts represent parts
198
- * of the path between this SummarizerNode and any child SummarizerNodes
199
- * that it might have. For example: if datastore "a" contains dds "b", but the
200
- * path is "/a/.channels/b", then the additional path part is ".channels".
201
- * @param snapshot - the base summary to parse
202
- */
203
- updateBaseSummaryState(snapshot: ISnapshotTree): void;
204
- /**
205
- * Records an op representing a change to this node/subtree.
206
- * @param op - op of change to record
207
- */
208
- recordChange(op: ISequencedDocumentMessage): void;
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
- createChild(
211
- /**
212
- * Summarize function
213
- */
214
- summarizeInternalFn: SummarizeInternalFn,
215
- /**
216
- * Initial id or path part of this node
217
- */
218
- id: string,
219
- /**
220
- * Information needed to create the node.
221
- * If it is from a base summary, it will assert that a summary has been seen.
222
- * Attach information if it is created from an attach op.
223
- * If it is local, it will throw unsupported errors on calls to summarize.
224
- */
225
- createParam: CreateChildSummarizerNodeParam,
226
- /**
227
- * Optional configuration affecting summarize behavior
228
- */
229
- config?: ISummarizerNodeConfig,
230
- ): ISummarizerNode;
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
- getChild(id: string): ISummarizerNode | undefined;
233
-
234
- /** True if a summary is currently in progress */
235
- isSummaryInProgress?(): boolean;
231
+ getChild(id: string): ISummarizerNode | undefined;
236
232
  }
237
233
 
238
234
  /**
@@ -258,60 +254,60 @@ export interface ISummarizerNode {
258
254
  * `updateUsedRoutes`: Used to notify this node of routes that are currently in use in it.
259
255
  */
260
256
  export interface ISummarizerNodeWithGC extends ISummarizerNode {
261
- createChild(
262
- /**
263
- * Summarize function
264
- */
265
- summarizeInternalFn: SummarizeInternalFn,
266
- /**
267
- * Initial id or path part of this node
268
- */
269
- id: string,
270
- /**
271
- * Information needed to create the node.
272
- * If it is from a base summary, it will assert that a summary has been seen.
273
- * Attach information if it is created from an attach op.
274
- * If it is local, it will throw unsupported errors on calls to summarize.
275
- */
276
- createParam: CreateChildSummarizerNodeParam,
277
- /**
278
- * Optional configuration affecting summarize behavior
279
- */
280
- config?: ISummarizerNodeConfigWithGC,
281
- getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
282
- /**
283
- * @deprecated - The functionality to update child's base GC details is incorporated in the summarizer node.
284
- */
285
- getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,
286
- ): ISummarizerNodeWithGC;
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;
287
283
 
288
- /**
289
- * Delete the child with the given id..
290
- */
291
- deleteChild(id: string): void;
284
+ /**
285
+ * Delete the child with the given id..
286
+ */
287
+ deleteChild(id: string): void;
292
288
 
293
- getChild(id: string): ISummarizerNodeWithGC | undefined;
289
+ getChild(id: string): ISummarizerNodeWithGC | undefined;
294
290
 
295
- /**
296
- * Returns this node's data that is used for garbage collection. This includes a list of GC nodes that represent
297
- * this node. Each node has a set of outbound routes to other GC nodes in the document.
298
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
299
- */
300
- getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
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>;
301
297
 
302
- /**
303
- * Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd
304
- */
305
- isReferenced(): boolean;
298
+ /**
299
+ * Tells whether this node is being referenced in this document or not. Unreferenced node will get GC'd
300
+ */
301
+ isReferenced(): boolean;
306
302
 
307
- /**
308
- * After GC has run, called to notify this node of routes that are used in it. These are used for the following:
309
- * 1. To identify if this node is being referenced in the document or not.
310
- * 2. To identify if this node or any of its children's used routes changed since last summary.
311
- *
312
- * @param usedRoutes - The routes that are used in this node.
313
- */
314
- updateUsedRoutes(usedRoutes: string[]): void;
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;
315
311
  }
316
312
 
317
313
  export const channelsTreeName = ".channels";
@@ -321,39 +317,27 @@ export const channelsTreeName = ".channels";
321
317
  * This object is expected to be modified directly by various summarize methods.
322
318
  */
323
319
  export interface ITelemetryContext {
324
- /**
325
- * Sets value for telemetry data being tracked.
326
- * @param prefix - unique prefix to tag this data with (ex: "fluid:map:")
327
- * @param property - property name of the telemetry data being tracked (ex: "DirectoryCount")
328
- * @param value - value to attribute to this summary telemetry data
329
- */
330
- set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
331
-
332
- /**
333
- * Sets a set of values for telemetry data being tracked.
334
- * @param prefix - unique prefix to tag this data with (ex: "fluid:summarize:")
335
- * @param property - property name of the telemetry data being tracked (ex: "Options")
336
- * @param values - A set of values to attribute to this summary telemetry data.
337
- */
338
- setAll(
339
- prefix: string,
340
- property: string,
341
- values: Record<string, TelemetryEventPropertyType>,
342
- ): void;
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;
343
327
 
344
- /**
345
- * Get the telemetry data being tracked
346
- * @param prefix - unique prefix for this data (ex: "fluid:map:")
347
- * @param property - property name of the telemetry data being tracked (ex: "DirectoryCount")
348
- * @returns undefined if item not found
349
- */
350
- get(prefix: string, property: string): TelemetryEventPropertyType;
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;
351
335
 
352
- /**
353
- * Returns a serialized version of all the telemetry data.
354
- * Should be used when logging in telemetry events.
355
- */
356
- serialize(): string;
336
+ /**
337
+ * Returns a serialized version of all the telemetry data.
338
+ * Should be used when logging in telemetry events.
339
+ */
340
+ serialize(): string;
357
341
  }
358
342
 
359
343
  export const blobCountPropertyName = "BlobCount";
package/tsconfig.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true,
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
  }