@fluidframework/container-runtime 2.4.0-294316 → 2.4.0-297385
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/container-runtime.test-files.tar +0 -0
- package/dist/containerRuntime.d.ts +1 -3
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +11 -12
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +0 -3
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +0 -7
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +0 -16
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +30 -13
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +84 -102
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +15 -42
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +10 -88
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +28 -38
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/containerRuntime.d.ts +1 -3
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +9 -10
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +0 -3
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +0 -7
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +0 -16
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +30 -13
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +85 -103
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +15 -42
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js +8 -84
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +29 -39
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/package.json +24 -20
- package/src/containerRuntime.ts +10 -10
- package/src/dataStoreContext.ts +0 -3
- package/src/index.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/summary/orderedClientElection.ts +0 -19
- package/src/summary/summarizerNode/summarizerNode.ts +90 -123
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +19 -99
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +37 -53
|
@@ -64,104 +64,46 @@ export interface ISummarizerNodeRootContract {
|
|
|
64
64
|
): Promise<IRefreshSummaryResult>;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/**
|
|
67
|
+
/** Class to build paths for nodes in a tree with escaped special characters */
|
|
68
68
|
export class EscapedPath {
|
|
69
69
|
private constructor(public readonly path: string) {}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Creates and returns a new instance of this class.
|
|
73
|
+
* @param path - Id or path part of a node
|
|
74
|
+
*/
|
|
70
75
|
public static create(path: string): EscapedPath {
|
|
71
76
|
return new EscapedPath(encodeURIComponent(path));
|
|
72
77
|
}
|
|
73
|
-
public static createAndConcat(pathParts: string[]): EscapedPath {
|
|
74
|
-
let ret = EscapedPath.create(pathParts[0] ?? "");
|
|
75
|
-
for (let i = 1; i < pathParts.length; i++) {
|
|
76
|
-
ret = ret.concat(EscapedPath.create(pathParts[i]));
|
|
77
|
-
}
|
|
78
|
-
return ret;
|
|
79
|
-
}
|
|
80
78
|
public toString(): string {
|
|
81
79
|
return this.path;
|
|
82
80
|
}
|
|
83
|
-
public concat(path: EscapedPath): EscapedPath {
|
|
84
|
-
return new EscapedPath(`${this.path}/${path.path}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** Information about a summary relevant to a specific node in the tree */
|
|
89
|
-
export class SummaryNode {
|
|
90
|
-
/** Creates an instance that is valid for the root with specific basePath and localPath */
|
|
91
|
-
public static createForRoot(referenceSequenceNumber: number): SummaryNode {
|
|
92
|
-
return new SummaryNode({
|
|
93
|
-
referenceSequenceNumber,
|
|
94
|
-
basePath: undefined,
|
|
95
|
-
localPath: EscapedPath.create(""), // root hard-coded to ""
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** Summary reference sequence number, i.e. last sequence number seen when it was created */
|
|
100
|
-
public get referenceSequenceNumber(): number {
|
|
101
|
-
return this.summary.referenceSequenceNumber;
|
|
102
|
-
}
|
|
103
|
-
/** Full path to parent node, or undefined if this is the root */
|
|
104
|
-
public get basePath(): EscapedPath | undefined {
|
|
105
|
-
return this.summary.basePath;
|
|
106
|
-
}
|
|
107
|
-
/** Relative path to this node from its parent node */
|
|
108
|
-
public get localPath(): EscapedPath {
|
|
109
|
-
return this.summary.localPath;
|
|
110
|
-
}
|
|
111
|
-
/** Relative path from this node to its node innermost base summary */
|
|
112
|
-
public get additionalPath(): EscapedPath | undefined {
|
|
113
|
-
return this.summary.additionalPath;
|
|
114
|
-
}
|
|
115
|
-
public set additionalPath(additionalPath: EscapedPath | undefined) {
|
|
116
|
-
this.summary.additionalPath = additionalPath;
|
|
117
|
-
}
|
|
118
|
-
constructor(
|
|
119
|
-
private readonly summary: {
|
|
120
|
-
readonly referenceSequenceNumber: number;
|
|
121
|
-
readonly basePath: EscapedPath | undefined;
|
|
122
|
-
readonly localPath: EscapedPath;
|
|
123
|
-
additionalPath?: EscapedPath;
|
|
124
|
-
},
|
|
125
|
-
) {}
|
|
126
|
-
|
|
127
|
-
/** Gets the full path to this node, to be used when sending a handle */
|
|
128
|
-
public get fullPath(): EscapedPath {
|
|
129
|
-
return this.basePath?.concat(this.localPath) ?? this.localPath;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Gets the full path to this node's innermost base summary.
|
|
134
|
-
* The children nodes can use this as their basePath to determine their path.
|
|
135
|
-
*/
|
|
136
|
-
public get fullPathForChildren(): EscapedPath {
|
|
137
|
-
return this.additionalPath !== undefined
|
|
138
|
-
? this.fullPath.concat(this.additionalPath)
|
|
139
|
-
: this.fullPath;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
81
|
/**
|
|
143
|
-
* Creates a new
|
|
144
|
-
* @param id - id of the child node
|
|
82
|
+
* Creates and returns a new instance of this class for child of the current node.
|
|
145
83
|
*/
|
|
146
|
-
public
|
|
147
|
-
return new
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
localPath: EscapedPath.create(id),
|
|
151
|
-
});
|
|
84
|
+
public createChildPath(childNodePath: EscapedPath): EscapedPath {
|
|
85
|
+
return new EscapedPath(
|
|
86
|
+
`${this.path}/${encodeURIComponent(channelsTreeName)}/${childNodePath.path}`,
|
|
87
|
+
);
|
|
152
88
|
}
|
|
153
89
|
}
|
|
90
|
+
export interface PendingSummaryInfo {
|
|
91
|
+
/** The sequence number at which the summary was created. */
|
|
92
|
+
referenceSequenceNumber: number;
|
|
93
|
+
}
|
|
154
94
|
|
|
155
95
|
/**
|
|
156
96
|
* Represents the details needed to create a child summarizer node.
|
|
157
97
|
*/
|
|
158
98
|
export interface ICreateChildDetails {
|
|
159
|
-
/** Latest summary from server node data */
|
|
160
|
-
latestSummary: SummaryNode | undefined;
|
|
161
99
|
/** Sequence number of latest known change to the node */
|
|
162
100
|
changeSequenceNumber: number;
|
|
163
101
|
/** A unique id of this child to be logged when sending telemetry. */
|
|
164
102
|
telemetryNodeId: string;
|
|
103
|
+
/** Summary handle for child node */
|
|
104
|
+
summaryHandleId: EscapedPath;
|
|
105
|
+
/** the reference sequence number of the last successful summary. */
|
|
106
|
+
lastSummaryReferenceSequenceNumber: number | undefined;
|
|
165
107
|
}
|
|
166
108
|
|
|
167
109
|
export interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {
|
|
@@ -170,25 +112,3 @@ export interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {
|
|
|
170
112
|
/** Additional path part where children are isolated */
|
|
171
113
|
childrenPathPart: string | undefined;
|
|
172
114
|
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Checks if the summary contains .channels subtree where the children subtrees
|
|
176
|
-
* would be located if exists.
|
|
177
|
-
* @param baseSummary - summary to check
|
|
178
|
-
*/
|
|
179
|
-
export function parseSummaryForSubtrees(
|
|
180
|
-
baseSummary: ISnapshotTree,
|
|
181
|
-
): ISubtreeInfo<ISnapshotTree> {
|
|
182
|
-
// New versions of snapshots have child nodes isolated in .channels subtree
|
|
183
|
-
const channelsSubtree = baseSummary.trees[channelsTreeName];
|
|
184
|
-
if (channelsSubtree !== undefined) {
|
|
185
|
-
return {
|
|
186
|
-
childrenTree: channelsSubtree,
|
|
187
|
-
childrenPathPart: channelsTreeName,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
childrenTree: baseSummary,
|
|
192
|
-
childrenPathPart: undefined,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
ICreateChildDetails,
|
|
29
29
|
IStartSummaryResult,
|
|
30
30
|
ISummarizerNodeRootContract,
|
|
31
|
-
|
|
31
|
+
PendingSummaryInfo,
|
|
32
32
|
ValidateSummaryResult,
|
|
33
33
|
} from "./summarizerNodeUtils.js";
|
|
34
34
|
|
|
@@ -36,19 +36,9 @@ export interface IRootSummarizerNodeWithGC
|
|
|
36
36
|
extends ISummarizerNodeWithGC,
|
|
37
37
|
ISummarizerNodeRootContract {}
|
|
38
38
|
|
|
39
|
-
// Extend
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
public readonly serializedUsedRoutes: string | undefined,
|
|
43
|
-
summary: {
|
|
44
|
-
readonly referenceSequenceNumber: number;
|
|
45
|
-
readonly basePath: EscapedPath | undefined;
|
|
46
|
-
readonly localPath: EscapedPath;
|
|
47
|
-
additionalPath?: EscapedPath;
|
|
48
|
-
},
|
|
49
|
-
) {
|
|
50
|
-
super(summary);
|
|
51
|
-
}
|
|
39
|
+
// Extend PendingSummaryInfo to add used routes tracking it.
|
|
40
|
+
interface PendingSummaryInfoWithGC extends PendingSummaryInfo {
|
|
41
|
+
serializedUsedRoutes: string | undefined;
|
|
52
42
|
}
|
|
53
43
|
|
|
54
44
|
/**
|
|
@@ -103,9 +93,10 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
103
93
|
logger: ITelemetryBaseLogger,
|
|
104
94
|
summarizeInternalFn: SummarizeInternalFn,
|
|
105
95
|
config: ISummarizerNodeConfigWithGC,
|
|
96
|
+
_summaryHandleId: EscapedPath,
|
|
106
97
|
changeSequenceNumber: number,
|
|
107
|
-
/**
|
|
108
|
-
|
|
98
|
+
/** Summary reference sequence number, i.e. last sequence number seen when it was created */
|
|
99
|
+
lastSummaryReferenceSequenceNumber?: number,
|
|
109
100
|
wipSummaryLogger?: ITelemetryBaseLogger,
|
|
110
101
|
private readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
|
|
111
102
|
getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,
|
|
@@ -116,8 +107,9 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
116
107
|
logger,
|
|
117
108
|
summarizeInternalFn,
|
|
118
109
|
config,
|
|
110
|
+
_summaryHandleId,
|
|
119
111
|
changeSequenceNumber,
|
|
120
|
-
|
|
112
|
+
lastSummaryReferenceSequenceNumber,
|
|
121
113
|
wipSummaryLogger,
|
|
122
114
|
telemetryId,
|
|
123
115
|
);
|
|
@@ -268,29 +260,27 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
268
260
|
* Called after summary has been uploaded to the server. Add the work-in-progress state to the pending
|
|
269
261
|
* summary queue. We track this until we get an ack from the server for this summary.
|
|
270
262
|
* @param proposalHandle - The handle of the summary that was uploaded to the server.
|
|
271
|
-
* @param parentPath - The path of the parent node which is used to build the path of this node.
|
|
272
263
|
* @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.
|
|
273
264
|
* In that case, the children will not have work-in-progress state.
|
|
274
265
|
*/
|
|
275
|
-
protected completeSummaryCore(
|
|
276
|
-
proposalHandle: string,
|
|
277
|
-
parentPath: EscapedPath | undefined,
|
|
278
|
-
parentSkipRecursion: boolean,
|
|
279
|
-
) {
|
|
266
|
+
protected completeSummaryCore(proposalHandle: string, parentSkipRecursion: boolean) {
|
|
280
267
|
let wipSerializedUsedRoutes: string | undefined;
|
|
281
268
|
// If GC is disabled, don't set wip used routes.
|
|
282
269
|
if (!this.gcDisabled) {
|
|
283
270
|
wipSerializedUsedRoutes = this.wipSerializedUsedRoutes;
|
|
284
271
|
}
|
|
285
272
|
|
|
286
|
-
super.completeSummaryCore(proposalHandle,
|
|
273
|
+
super.completeSummaryCore(proposalHandle, parentSkipRecursion);
|
|
287
274
|
|
|
288
275
|
// If GC is disabled, skip setting pending summary with GC state.
|
|
289
276
|
if (!this.gcDisabled) {
|
|
290
|
-
const
|
|
291
|
-
if (
|
|
292
|
-
const
|
|
293
|
-
|
|
277
|
+
const pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);
|
|
278
|
+
if (pendingSummaryInfo !== undefined) {
|
|
279
|
+
const pendingSummaryInfoWithGC = {
|
|
280
|
+
serializedUsedRoutes: wipSerializedUsedRoutes,
|
|
281
|
+
...pendingSummaryInfo,
|
|
282
|
+
};
|
|
283
|
+
this.pendingSummaries.set(proposalHandle, pendingSummaryInfoWithGC);
|
|
294
284
|
}
|
|
295
285
|
}
|
|
296
286
|
}
|
|
@@ -314,10 +304,10 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
314
304
|
): void {
|
|
315
305
|
// If GC is disabled, skip setting referenced used routes since we are not tracking GC state.
|
|
316
306
|
if (!this.gcDisabled) {
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
307
|
+
const pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);
|
|
308
|
+
if (pendingSummaryInfo !== undefined) {
|
|
319
309
|
// If a pending summary exists, it must have used routes since GC is enabled.
|
|
320
|
-
const summaryNodeWithGC =
|
|
310
|
+
const summaryNodeWithGC = pendingSummaryInfo as PendingSummaryInfoWithGC;
|
|
321
311
|
if (summaryNodeWithGC.serializedUsedRoutes === undefined) {
|
|
322
312
|
const error = new LoggingError("MissingGCStateInPendingSummary", {
|
|
323
313
|
proposalHandle,
|
|
@@ -379,8 +369,9 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
379
369
|
// Propagate our gcDisabled state to the child if its not explicity specified in child's config.
|
|
380
370
|
gcDisabled: config.gcDisabled ?? this.gcDisabled,
|
|
381
371
|
},
|
|
372
|
+
createDetails.summaryHandleId,
|
|
382
373
|
createDetails.changeSequenceNumber,
|
|
383
|
-
createDetails.
|
|
374
|
+
createDetails.lastSummaryReferenceSequenceNumber,
|
|
384
375
|
this.wipSummaryLogger,
|
|
385
376
|
getGCDataFn,
|
|
386
377
|
getChildBaseGCDetailsFn,
|
|
@@ -422,24 +413,18 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
422
413
|
}
|
|
423
414
|
|
|
424
415
|
// In case we have pending summaries on the parent, let's initialize it on the child.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
basePath: child.latestSummary.basePath,
|
|
438
|
-
localPath: child.latestSummary.localPath,
|
|
439
|
-
},
|
|
440
|
-
);
|
|
441
|
-
child.addPendingSummary(key, newLatestSummaryNode);
|
|
442
|
-
}
|
|
416
|
+
for (const [key, pendingSummary] of this.pendingSummaries.entries()) {
|
|
417
|
+
const pendingSummaryWithGC = pendingSummary as PendingSummaryInfoWithGC;
|
|
418
|
+
if (pendingSummaryWithGC.serializedUsedRoutes !== undefined) {
|
|
419
|
+
const childNodeUsedRoutes = unpackChildNodesUsedRoutes(
|
|
420
|
+
JSON.parse(pendingSummaryWithGC.serializedUsedRoutes),
|
|
421
|
+
);
|
|
422
|
+
const newSerializedRoutes = childNodeUsedRoutes.get(id) ?? [""];
|
|
423
|
+
const childPendingSummaryInfo = {
|
|
424
|
+
...pendingSummaryWithGC,
|
|
425
|
+
serializedUsedRoutes: JSON.stringify(newSerializedRoutes),
|
|
426
|
+
};
|
|
427
|
+
child.addPendingSummary(key, childPendingSummaryInfo);
|
|
443
428
|
}
|
|
444
429
|
}
|
|
445
430
|
}
|
|
@@ -530,10 +515,9 @@ export const createRootSummarizerNodeWithGC = (
|
|
|
530
515
|
logger,
|
|
531
516
|
summarizeInternalFn,
|
|
532
517
|
config,
|
|
518
|
+
EscapedPath.create("") /* summaryHandleId */,
|
|
533
519
|
changeSequenceNumber,
|
|
534
|
-
referenceSequenceNumber
|
|
535
|
-
? undefined
|
|
536
|
-
: SummaryNode.createForRoot(referenceSequenceNumber),
|
|
520
|
+
referenceSequenceNumber,
|
|
537
521
|
undefined /* wipSummaryLogger */,
|
|
538
522
|
getGCDataFn,
|
|
539
523
|
getBaseGCDetailsFn,
|