@fluidframework/runtime-utils 2.0.0-internal.2.4.0 → 2.0.0-internal.2.4.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- 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/summarizerNode/index.d.ts +1 -1
- package/dist/summarizerNode/index.d.ts.map +1 -1
- package/dist/summarizerNode/index.js.map +1 -1
- package/dist/summarizerNode/summarizerNode.d.ts +4 -5
- package/dist/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNode.js +26 -9
- package/dist/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summarizerNode/summarizerNodeUtils.d.ts +14 -5
- package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js +3 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +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/summarizerNode/index.d.ts +1 -1
- package/lib/summarizerNode/index.d.ts.map +1 -1
- package/lib/summarizerNode/index.js.map +1 -1
- package/lib/summarizerNode/summarizerNode.d.ts +4 -5
- package/lib/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNode.js +26 -9
- package/lib/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summarizerNode/summarizerNodeUtils.d.ts +14 -5
- package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js +3 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/package.json +19 -14
- package/src/index.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/summarizerNode/index.ts +5 -1
- package/src/summarizerNode/summarizerNode.ts +35 -10
- package/src/summarizerNode/summarizerNodeUtils.ts +15 -5
- package/src/summarizerNode/summarizerNodeWithGc.ts +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { ObjectStoragePartition } from "./objectstoragepartition";
|
|
|
8
8
|
export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils";
|
|
9
9
|
export { RequestParser } from "./requestParser";
|
|
10
10
|
export { RuntimeFactoryHelper } from "./runtimeFactoryHelper";
|
|
11
|
-
export { createRootSummarizerNode, createRootSummarizerNodeWithGC, IRootSummarizerNode, IRootSummarizerNodeWithGC, ISummarizerNodeRootContract, RefreshSummaryResult, } from "./summarizerNode";
|
|
11
|
+
export { createRootSummarizerNode, createRootSummarizerNodeWithGC, IFetchSnapshotResult, IRootSummarizerNode, IRootSummarizerNodeWithGC, ISummarizerNodeRootContract, RefreshSummaryResult, } from "./summarizerNode";
|
|
12
12
|
export { addBlobToSummary, addSummarizeResultToSummary, addTreeToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, getBlobSize, mergeStats, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils";
|
|
13
13
|
export { ReadAndParseBlob, seqFromTree } from "./utils";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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AAoB,EACpB,6BAA6B,EAC7B,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAS4B;AAR3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEhB,kIAAA,8BAA8B,OAAA;AACjC,sHAAA,kBAAkB,OAAA;AAClB,uHAAA,mBAAmB,OAAA;AAEpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAS4B;AAR3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEhB,kIAAA,8BAA8B,OAAA;AACjC,sHAAA,kBAAkB,OAAA;AAClB,uHAAA,mBAAmB,OAAA;AAEpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,mDAQ0B;AAPzB,0HAAA,wBAAwB,OAAA;AACxB,gIAAA,8BAA8B,OAAA;AAO/B,+CAcwB;AAbvB,gHAAA,gBAAgB,OAAA;AAChB,2HAAA,2BAA2B,OAAA;AAC3B,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,gIAAA,gCAAgC,OAAA;AAChC,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,6HAAA,6BAA6B,OAAA;AAC7B,2GAAA,WAAW,OAAA;AACX,0GAAA,UAAU,OAAA;AACV,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AAEf,iCAAwD;AAA7B,oGAAA,WAAW,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils\";\nexport {\n\tcreate404Response,\n\tcreateDataStoreFactory,\n\tcreateResponseError,\n\texceptionToResponse,\n\tFactory,\n packagePathToTelemetryProperty,\n\trequestFluidObject,\n\tresponseToException,\n} from \"./dataStoreHelpers\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition\";\nexport { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from \"./objectstorageutils\";\nexport { RequestParser } from \"./requestParser\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper\";\nexport {\n\tcreateRootSummarizerNode,\n\tcreateRootSummarizerNodeWithGC,\n IFetchSnapshotResult,\n\tIRootSummarizerNode,\n\tIRootSummarizerNodeWithGC,\n\tISummarizerNodeRootContract,\n\tRefreshSummaryResult,\n} from \"./summarizerNode\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\taddTreeToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tgetBlobSize,\n\tmergeStats,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils\";\nexport { ReadAndParseBlob, seqFromTree } from \"./utils\";\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/runtime-utils";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.2.4.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.2.4.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/runtime-utils";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.2.4.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.2.4.1";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.0.0-internal.2.4.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.0.0-internal.2.4.1\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { ISummarizerNodeRootContract, RefreshSummaryResult } from "./summarizerNodeUtils";
|
|
5
|
+
export { IFetchSnapshotResult, ISummarizerNodeRootContract, RefreshSummaryResult, } from "./summarizerNodeUtils";
|
|
6
6
|
export { IRootSummarizerNode, createRootSummarizerNode } from "./summarizerNode";
|
|
7
7
|
export { IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC } from "./summarizerNodeWithGc";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/summarizerNode/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/summarizerNode/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,mDAAiF;AAAnD,0HAAA,wBAAwB,OAAA;AACtD,+DAAmG;AAA/D,sIAAA,8BAA8B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIFetchSnapshotResult,\n\tISummarizerNodeRootContract,\n\tRefreshSummaryResult,\n} from \"./summarizerNodeUtils\";\nexport { IRootSummarizerNode, createRootSummarizerNode } from \"./summarizerNode\";\nexport { IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC } from \"./summarizerNodeWithGc\";\n"]}
|
|
@@ -6,7 +6,7 @@ import { ISummarizerNode, ISummarizerNodeConfig, ISummarizeResult, CreateChildSu
|
|
|
6
6
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
import { ReadAndParseBlob } from "../utils";
|
|
9
|
-
import { EscapedPath, ICreateChildDetails, IInitialSummary, ISummarizerNodeRootContract, RefreshSummaryResult, SummaryNode } from "./summarizerNodeUtils";
|
|
9
|
+
import { EscapedPath, ICreateChildDetails, IFetchSnapshotResult, IInitialSummary, ISummarizerNodeRootContract, RefreshSummaryResult, SummaryNode } from "./summarizerNodeUtils";
|
|
10
10
|
export interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -54,19 +54,18 @@ export declare class SummarizerNode implements IRootSummarizerNode {
|
|
|
54
54
|
/**
|
|
55
55
|
* Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,
|
|
56
56
|
* it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),
|
|
57
|
-
* we skip the update. Otherwise, we
|
|
58
|
-
* summary based off of that.
|
|
57
|
+
* we skip the update. Otherwise, we fetch the latest snapshot and update latest summary based off of that.
|
|
59
58
|
*
|
|
60
59
|
* @returns A RefreshSummaryResult type which returns information based on the following three scenarios:
|
|
61
60
|
*
|
|
62
|
-
* 1. The latest summary was not
|
|
61
|
+
* 1. The latest summary was not updated.
|
|
63
62
|
*
|
|
64
63
|
* 2. The latest summary was updated and the summary corresponding to the params was being tracked.
|
|
65
64
|
*
|
|
66
65
|
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
|
|
67
66
|
* case, the latest summary is updated based on the downloaded snapshot which is also returned.
|
|
68
67
|
*/
|
|
69
|
-
refreshLatestSummary(proposalHandle: string | undefined, summaryRefSeq: number,
|
|
68
|
+
refreshLatestSummary(proposalHandle: string | undefined, summaryRefSeq: number, fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>, readAndParseBlob: ReadAndParseBlob, correlatedSummaryLogger: ITelemetryLogger): Promise<RefreshSummaryResult>;
|
|
70
69
|
/**
|
|
71
70
|
* Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
|
|
72
71
|
* from the state in the pending summary queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAEhB,8BAA8B,EAE9B,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,yBAAyB,EAEzB,aAAa,EAEhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACH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E,MAAM,GAAG,IAAI;IAM/C;;;;OAIG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B,IAAW,aAAa,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS,CAE5D;IAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAE3C;;;OAGG;gBAEoB,aAAa,EAAE,gBAAgB,EACjC,mBAAmB,EAAE,mBAAmB,EACzD,MAAM,EAAE,qBAAqB,EACrB,qBAAqB,EAAE,MAAM;IACrC,8CAA8C;IACtC,cAAc,CAAC,yBAAa,EACnB,cAAc,CAAC,6BAAiB,EACvC,gBAAgB,CAAC,8BAAkB;IAK1C,WAAW;IACd,yBAAyB;IACzB,mBAAmB,EAAE,mBAAmB;IACxC,2CAA2C;IAC3C,EAAE,EAAE,MAAM;IACV;;;;OAIG;IACH,WAAW,EAAE,8BAA8B,EAC3C,MAAM,GAAE,qBAA0B,GACnC,eAAe;IAuBX,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIxD;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,8BAA8B,GAAG,mBAAmB;IAmFhH;;;;;;OAMG;IACH,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,cAAc;IAoBrD,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAG7D;;OAEG;IACH,SAAS,CAAC,oBAAoB,IAAI,OAAO;CAG5C;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WACzB,gBAAgB,uBACH,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC9B,mBAME,CAAC"}
|
|
@@ -159,25 +159,30 @@ class SummarizerNode {
|
|
|
159
159
|
/**
|
|
160
160
|
* Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,
|
|
161
161
|
* it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),
|
|
162
|
-
* we skip the update. Otherwise, we
|
|
163
|
-
* summary based off of that.
|
|
162
|
+
* we skip the update. Otherwise, we fetch the latest snapshot and update latest summary based off of that.
|
|
164
163
|
*
|
|
165
164
|
* @returns A RefreshSummaryResult type which returns information based on the following three scenarios:
|
|
166
165
|
*
|
|
167
|
-
* 1. The latest summary was not
|
|
166
|
+
* 1. The latest summary was not updated.
|
|
168
167
|
*
|
|
169
168
|
* 2. The latest summary was updated and the summary corresponding to the params was being tracked.
|
|
170
169
|
*
|
|
171
170
|
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
|
|
172
171
|
* case, the latest summary is updated based on the downloaded snapshot which is also returned.
|
|
173
172
|
*/
|
|
174
|
-
async refreshLatestSummary(proposalHandle, summaryRefSeq,
|
|
173
|
+
async refreshLatestSummary(proposalHandle, summaryRefSeq, fetchLatestSnapshot, readAndParseBlob, correlatedSummaryLogger) {
|
|
175
174
|
var _a;
|
|
175
|
+
this.defaultLogger.sendTelemetryEvent({
|
|
176
|
+
eventName: "refreshLatestSummary_start",
|
|
177
|
+
proposalHandle,
|
|
178
|
+
referenceSequenceNumber: this.referenceSequenceNumber,
|
|
179
|
+
summaryRefSeq,
|
|
180
|
+
});
|
|
176
181
|
if (proposalHandle !== undefined) {
|
|
177
182
|
const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);
|
|
178
183
|
if (maybeSummaryNode !== undefined) {
|
|
179
184
|
this.refreshLatestSummaryFromPending(proposalHandle, maybeSummaryNode.referenceSequenceNumber);
|
|
180
|
-
return { latestSummaryUpdated: true, wasSummaryTracked: true };
|
|
185
|
+
return { latestSummaryUpdated: true, wasSummaryTracked: true, summaryRefSeq };
|
|
181
186
|
}
|
|
182
187
|
const props = {
|
|
183
188
|
summaryRefSeq,
|
|
@@ -190,13 +195,25 @@ class SummarizerNode {
|
|
|
190
195
|
details: JSON.stringify(props),
|
|
191
196
|
});
|
|
192
197
|
}
|
|
193
|
-
// If
|
|
198
|
+
// If the summary for which refresh is called is older than the latest tracked summary, ignore it.
|
|
194
199
|
if (this.referenceSequenceNumber >= summaryRefSeq) {
|
|
195
200
|
return { latestSummaryUpdated: false };
|
|
196
201
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
202
|
+
// Fetch the latest snapshot and refresh state from it. Note that we need to use the reference sequence number
|
|
203
|
+
// of the fetched snapshot and not the "summaryRefSeq" that was passed in.
|
|
204
|
+
const { snapshotTree, snapshotRefSeq: fetchedSnapshotRefSeq } = await fetchLatestSnapshot();
|
|
205
|
+
// Possible re-entrancy. We may have updated latest summary state while fetching the snapshot. If the fetched
|
|
206
|
+
// snapshot is older than the latest tracked summary, ignore it.
|
|
207
|
+
if (this.referenceSequenceNumber >= fetchedSnapshotRefSeq) {
|
|
208
|
+
return { latestSummaryUpdated: false };
|
|
209
|
+
}
|
|
210
|
+
await this.refreshLatestSummaryFromSnapshot(fetchedSnapshotRefSeq, snapshotTree, undefined, summarizerNodeUtils_1.EscapedPath.create(""), correlatedSummaryLogger, readAndParseBlob);
|
|
211
|
+
return {
|
|
212
|
+
latestSummaryUpdated: true,
|
|
213
|
+
wasSummaryTracked: false,
|
|
214
|
+
snapshotTree,
|
|
215
|
+
summaryRefSeq: fetchedSnapshotRefSeq,
|
|
216
|
+
};
|
|
200
217
|
}
|
|
201
218
|
/**
|
|
202
219
|
* Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAS6C;AAC7C,+EAK8C;AAE9C,+DAAuE;AACvE,kDAAmF;AAEnF,+DAS+B;AAI/B;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAiVvB;;;OAGG;IACH,YACuB,aAA+B,EACjC,mBAAwC,EACzD,MAA6B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,oBAAoB,GAAG,IAAI,iCAAW,CAAC;oBACzC,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;oBACtD,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ;oBACvC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS;iBAC5C,CAAC,CAAC;gBAEH,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;aACtD;SACJ;IACL,CAAC;IAES,iBAAiB,CAAC,GAAW,EAAE,OAAoB;QACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IACD;;OAEG;IACO,oBAAoB;QAC1B,OAAO,IAAI,CAAC,0BAA0B,KAAK,SAAS,CAAC;IACzD,CAAC;CACJ;AAtgBD,wCAsgBC;AAED;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACpC,MAAwB,EACxB,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAgC,EAAE,EACf,EAAE,CAAC,IAAI,cAAc,CACpC,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,CACzG,CAAC;AAZO,QAAA,wBAAwB,4BAY/B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ISummarizerNode,\n ISummarizerNodeConfig,\n ISummarizeResult,\n ISummaryTreeWithStats,\n CreateChildSummarizerNodeParam,\n CreateSummarizerNodeSource,\n SummarizeInternalFn,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n ISequencedDocumentMessage,\n SummaryType,\n ISnapshotTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { mergeStats, convertToSummaryTree, calculateStats } from \"../summaryUtils\";\nimport { ReadAndParseBlob } from \"../utils\";\nimport {\n EscapedPath,\n ICreateChildDetails,\n IInitialSummary,\n ISummarizerNodeRootContract,\n parseSummaryForSubtrees,\n parseSummaryTreeForSubtrees,\n RefreshSummaryResult,\n SummaryNode,\n} from \"./summarizerNodeUtils\";\n\nexport interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {}\n\n/**\n * Encapsulates the summarizing work and state of an individual tree node in the\n * summary tree. It tracks changes and allows for optimizations when unchanged, or\n * can allow for fallback summaries to be generated when an error is encountered.\n * Usage is for the root node to call startSummary first to begin tracking a WIP\n * (work in progress) summary. Then all nodes will call summarize to summaries their\n * individual parts. Once completed and uploaded to storage, the root node will call\n * completeSummary or clearSummary to clear the WIP summary tracking state if something\n * went wrong. The SummarizerNodes will track all pending summaries that have been\n * recorded by the completeSummary call. When one of them is acked, the root node should\n * call refreshLatestSummary to inform the tree of SummarizerNodes of the new baseline\n * latest successful summary.\n */\nexport class SummarizerNode implements IRootSummarizerNode {\n /**\n * The reference sequence number of the most recent acked summary.\n * Returns 0 if there is not yet an acked summary.\n */\n public get referenceSequenceNumber() {\n return this._latestSummary?.referenceSequenceNumber ?? 0;\n }\n\n protected readonly children = new Map<string, SummarizerNode>();\n protected readonly pendingSummaries = new Map<string, SummaryNode>();\n private wipReferenceSequenceNumber: number | undefined;\n private wipLocalPaths: { localPath: EscapedPath; additionalPath?: EscapedPath; } | undefined;\n private wipSkipRecursion = false;\n\n public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger) {\n assert(this.wipSummaryLogger === undefined,\n 0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */);\n assert(this.wipReferenceSequenceNumber === undefined, 0x1a0 /* \"Already tracking a summary\" */);\n\n this.wipSummaryLogger = summaryLogger;\n\n for (const child of this.children.values()) {\n child.startSummary(referenceSequenceNumber, this.wipSummaryLogger);\n }\n this.wipReferenceSequenceNumber = referenceSequenceNumber;\n }\n\n public async summarize(\n fullTree: boolean,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isTrackingInProgress(), 0x1a1 /* \"summarize should not be called when not tracking the summary\" */);\n assert(this.wipSummaryLogger !== undefined,\n 0x1a2 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */);\n\n // Try to reuse the tree if unchanged\n if (this.canReuseHandle && !fullTree && !this.hasChanged()) {\n const latestSummary = this._latestSummary;\n if (latestSummary !== undefined) {\n this.wipLocalPaths = {\n localPath: latestSummary.localPath,\n additionalPath: latestSummary.additionalPath,\n };\n this.wipSkipRecursion = true;\n const stats = mergeStats();\n stats.handleNodeCount++;\n return {\n summary: {\n type: SummaryType.Handle,\n handle: latestSummary.fullPath.path,\n handleType: SummaryType.Tree,\n },\n stats,\n };\n }\n }\n\n const result = await this.summarizeInternalFn(fullTree, true, telemetryContext);\n this.wipLocalPaths = { localPath: EscapedPath.create(result.id) };\n if (result.pathPartsForChildren !== undefined) {\n this.wipLocalPaths.additionalPath = EscapedPath.createAndConcat(result.pathPartsForChildren);\n }\n return { summary: result.summary, stats: result.stats };\n }\n\n /**\n * Complete the WIP summary for the given proposalHandle\n */\n public completeSummary(proposalHandle: string) {\n this.completeSummaryCore(proposalHandle, undefined, false);\n }\n\n /**\n * Recursive implementation for completeSummary, with additional internal-only parameters\n */\n protected completeSummaryCore(\n proposalHandle: string,\n parentPath: EscapedPath | undefined,\n parentSkipRecursion: boolean,\n ) {\n assert(this.wipSummaryLogger !== undefined,\n 0x1a3 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */);\n assert(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* \"Not tracking a summary\" */);\n let localPathsToUse = this.wipLocalPaths;\n\n if (parentSkipRecursion) {\n const latestSummary = this._latestSummary;\n if (latestSummary !== undefined) {\n // This case the parent node created a failure summary or was reused.\n // This node and all children should only try to reference their path\n // by its last known good state in the actual summary tree.\n // If parent fails or is reused, the child summarize is not called so\n // it did not get a chance to change its paths.\n // In this case, essentially only propagate the new summary ref seq num.\n localPathsToUse = {\n localPath: latestSummary.localPath,\n additionalPath: latestSummary.additionalPath,\n };\n } else {\n // This case the child is added after the latest non-failure summary.\n // This node and all children should consider themselves as still not\n // having a successful summary yet.\n // We cannot \"reuse\" this node if unchanged since that summary, because\n // handles will be unable to point to that node. It never made it to the\n // tree itself, and only exists as an attach op in the _outstandingOps.\n this.clearSummary();\n return;\n }\n }\n\n // This should come from wipLocalPaths in normal cases, or from the latestSummary\n // if parentIsFailure or parentIsReused is true.\n // If there is no latestSummary, clearSummary and return before reaching this code.\n assert(!!localPathsToUse, 0x1a5 /* \"Tracked summary local paths not set\" */);\n\n const summary = new SummaryNode({\n ...localPathsToUse,\n referenceSequenceNumber: this.wipReferenceSequenceNumber,\n basePath: parentPath,\n });\n const fullPathForChildren = summary.fullPathForChildren;\n for (const child of this.children.values()) {\n child.completeSummaryCore(\n proposalHandle,\n fullPathForChildren,\n this.wipSkipRecursion || parentSkipRecursion,\n );\n }\n // Note that this overwrites existing pending summary with\n // the same proposalHandle. If proposalHandle is something like\n // a hash or unique identifier, this should be fine. If storage\n // can return the same proposalHandle for a different summary,\n // this should still be okay, because we should be proposing the\n // newer one later which would have to overwrite the previous one.\n this.pendingSummaries.set(proposalHandle, summary);\n this.clearSummary();\n }\n\n public clearSummary() {\n this.wipReferenceSequenceNumber = undefined;\n this.wipLocalPaths = undefined;\n this.wipSkipRecursion = false;\n this.wipSummaryLogger = undefined;\n for (const child of this.children.values()) {\n child.clearSummary();\n }\n }\n\n /**\n * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),\n * we skip the update. Otherwise, we get the snapshot by calling `getSnapshot` and update latest\n * summary based off of that.\n *\n * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:\n *\n * 1. The latest summary was not udpated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was being tracked.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this\n * case, the latest summary is updated based on the downloaded snapshot which is also returned.\n */\n public async refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n getSnapshot: () => Promise<ISnapshotTree>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult> {\n if (proposalHandle !== undefined) {\n const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);\n\n if (maybeSummaryNode !== undefined) {\n this.refreshLatestSummaryFromPending(proposalHandle, maybeSummaryNode.referenceSequenceNumber);\n return { latestSummaryUpdated: true, wasSummaryTracked: true };\n }\n\n const props = {\n summaryRefSeq,\n pendingSize: this.pendingSummaries.size ?? undefined,\n };\n this.defaultLogger.sendTelemetryEvent({\n eventName: \"PendingSummaryNotFound\",\n proposalHandle,\n referenceSequenceNumber: this.referenceSequenceNumber,\n details: JSON.stringify(props),\n });\n }\n\n // If we have seen a summary same or later as the current one, ignore it.\n if (this.referenceSequenceNumber >= summaryRefSeq) {\n return { latestSummaryUpdated: false };\n }\n\n const snapshotTree = await getSnapshot();\n await this.refreshLatestSummaryFromSnapshot(\n summaryRefSeq,\n snapshotTree,\n undefined,\n EscapedPath.create(\"\"),\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n return { latestSummaryUpdated: true, wasSummaryTracked: false, snapshot: snapshotTree };\n }\n/**\n * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n * from the state in the pending summary queue.\n * @param proposalHandle - Handle for the current proposal.\n * @param referenceSequenceNumber - reference sequence number of sent summary.\n */\n protected refreshLatestSummaryFromPending(\n proposalHandle: string,\n referenceSequenceNumber: number,\n ): void {\n const summaryNode = this.pendingSummaries.get(proposalHandle);\n if (summaryNode === undefined) {\n // This should only happen if parent skipped recursion AND no prior summary existed.\n assert(\n this._latestSummary === undefined,\n 0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n );\n return;\n } else {\n assert(\n referenceSequenceNumber === summaryNode.referenceSequenceNumber,\n 0x1a7 /* Pending summary reference sequence number should be consistent */,\n );\n\n // Clear earlier pending summaries\n this.pendingSummaries.delete(proposalHandle);\n }\n\n this.refreshLatestSummaryCore(referenceSequenceNumber);\n\n this._latestSummary = summaryNode;\n // Propagate update to all child nodes\n for (const child of this.children.values()) {\n child.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n }\n }\n\n protected async refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n basePath: EscapedPath | undefined,\n localPath: EscapedPath,\n correlatedSummaryLogger: ITelemetryLogger,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n // Possible re-entrancy. If we have already seen a summary later than this one, ignore it.\n if (this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n this.refreshLatestSummaryCore(referenceSequenceNumber);\n\n this._latestSummary = new SummaryNode({\n referenceSequenceNumber,\n basePath,\n localPath,\n });\n\n const pathParts: string[] = [];\n const { childrenTree, childrenPathPart } = parseSummaryForSubtrees(snapshotTree);\n if (childrenPathPart !== undefined) {\n pathParts.push(childrenPathPart);\n }\n\n if (pathParts.length > 0) {\n this._latestSummary.additionalPath = EscapedPath.createAndConcat(pathParts);\n }\n\n // Propagate update to all child nodes\n const pathForChildren = this._latestSummary.fullPathForChildren;\n await Promise.all(Array.from(this.children)\n .filter(([id]) => {\n // Assuming subtrees missing from snapshot are newer than the snapshot,\n // but might be nice to assert this using earliest seq for node.\n return childrenTree.trees[id] !== undefined;\n }).map(async ([id, child]) => {\n return child.refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber,\n childrenTree.trees[id],\n pathForChildren,\n EscapedPath.create(id),\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n }));\n }\n\n private refreshLatestSummaryCore(referenceSequenceNumber: number): void {\n for (const [key, value] of this.pendingSummaries) {\n if (value.referenceSequenceNumber < referenceSequenceNumber) {\n this.pendingSummaries.delete(key);\n }\n }\n }\n\n public updateBaseSummaryState(snapshot: ISnapshotTree) {\n // Check base summary to see if it has any additional path parts\n // separating child SummarizerNodes. Checks for .channels subtrees.\n const { childrenPathPart } = parseSummaryForSubtrees(snapshot);\n if (childrenPathPart !== undefined && this._latestSummary !== undefined) {\n this._latestSummary.additionalPath = EscapedPath.create(childrenPathPart);\n }\n }\n\n public recordChange(op: ISequencedDocumentMessage): void {\n this.invalidate(op.sequenceNumber);\n }\n\n public invalidate(sequenceNumber: number): void {\n if (sequenceNumber > this._changeSequenceNumber) {\n this._changeSequenceNumber = sequenceNumber;\n }\n }\n\n /**\n * True if a change has been recorded with sequence number exceeding\n * the latest successfully acked summary reference sequence number.\n * False implies that the previous summary can be reused.\n */\n protected hasChanged(): boolean {\n return this._changeSequenceNumber > this.referenceSequenceNumber;\n }\n\n public get latestSummary(): Readonly<SummaryNode> | undefined {\n return this._latestSummary;\n }\n\n protected readonly canReuseHandle: boolean;\n\n /**\n * Do not call constructor directly.\n * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n */\n public constructor(\n protected readonly defaultLogger: ITelemetryLogger,\n private readonly summarizeInternalFn: SummarizeInternalFn,\n config: ISummarizerNodeConfig,\n private _changeSequenceNumber: number,\n /** Undefined means created without summary */\n private _latestSummary?: SummaryNode,\n private readonly initialSummary?: IInitialSummary,\n protected wipSummaryLogger?: ITelemetryLogger,\n ) {\n this.canReuseHandle = config.canReuseHandle ?? true;\n }\n\n public createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n */\n createParam: CreateChildSummarizerNodeParam,\n config: ISummarizerNodeConfig = {},\n ): ISummarizerNode {\n assert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n const child = new SummarizerNode(\n this.defaultLogger,\n summarizeInternalFn,\n config,\n createDetails.changeSequenceNumber,\n createDetails.latestSummary,\n createDetails.initialSummary,\n this.wipSummaryLogger,\n );\n\n // There may be additional state that has to be updated in this child. For example, if a summary is being\n // tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n // have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n this.maybeUpdateChildState(child);\n\n this.children.set(id, child);\n return child;\n }\n\n public getChild(id: string): ISummarizerNode | undefined {\n return this.children.get(id);\n }\n\n /**\n * Returns the details needed to create a child node.\n * @param id - Initial id or path part of the child node.\n * @param createParam - Information needed to create the node.\n * @returns the details needed to create the child node.\n */\n protected getCreateDetailsForChild(id: string, createParam: CreateChildSummarizerNodeParam): ICreateChildDetails {\n let initialSummary: IInitialSummary | undefined;\n let latestSummary: SummaryNode | undefined;\n let changeSequenceNumber: number;\n\n const parentLatestSummary = this._latestSummary;\n switch (createParam.type) {\n case CreateSummarizerNodeSource.FromAttach: {\n if (\n parentLatestSummary !== undefined\n && createParam.sequenceNumber <= parentLatestSummary.referenceSequenceNumber\n ) {\n // Prioritize latest summary if it was after this node was attached.\n latestSummary = parentLatestSummary.createForChild(id);\n } else {\n const summary = convertToSummaryTree(createParam.snapshot) as ISummaryTreeWithStats;\n initialSummary = {\n sequenceNumber: createParam.sequenceNumber,\n id,\n summary,\n };\n }\n changeSequenceNumber = createParam.sequenceNumber;\n break;\n }\n case CreateSummarizerNodeSource.FromSummary: {\n if (this.initialSummary === undefined) {\n assert(\n !!parentLatestSummary,\n 0x1ac /* \"Cannot create child from summary if parent does not have latest summary\" */);\n }\n // fallthrough to local\n }\n case CreateSummarizerNodeSource.Local: {\n const parentInitialSummary = this.initialSummary;\n if (parentInitialSummary !== undefined) {\n let childSummary: SummaryObject | undefined;\n if (parentInitialSummary.summary !== undefined) {\n const { childrenTree } = parseSummaryTreeForSubtrees(parentInitialSummary.summary.summary);\n assert(\n childrenTree.type === SummaryType.Tree,\n 0x1d6 /* \"Parent summary object is not a tree\" */,\n );\n childSummary = childrenTree.tree[id];\n }\n if (createParam.type === CreateSummarizerNodeSource.FromSummary) {\n // Locally created would not have differential subtree.\n assert(!!childSummary, 0x1ad /* \"Missing child summary tree\" */);\n }\n let childSummaryWithStats: ISummaryTreeWithStats | undefined;\n if (childSummary !== undefined) {\n assert(\n childSummary.type === SummaryType.Tree,\n 0x1ae /* \"Child summary object is not a tree\" */,\n );\n childSummaryWithStats = {\n summary: childSummary,\n stats: calculateStats(childSummary),\n };\n }\n initialSummary = {\n sequenceNumber: parentInitialSummary.sequenceNumber,\n id,\n summary: childSummaryWithStats,\n };\n }\n latestSummary = parentLatestSummary?.createForChild(id);\n changeSequenceNumber = parentLatestSummary?.referenceSequenceNumber ?? -1;\n break;\n }\n default: {\n const type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n unreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n }\n }\n\n return {\n initialSummary,\n latestSummary,\n changeSequenceNumber,\n };\n }\n\n /**\n * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n * summary tracking state needs to be updated too.\n * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n * pending summary as well.\n * @param child - The child node whose state is to be updated.\n */\n protected maybeUpdateChildState(child: SummarizerNode) {\n // If we are tracking a summary, this child was created after the tracking started. So, we need to update the\n // child's tracking state as well.\n if (this.isTrackingInProgress()) {\n child.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n }\n // In case we have pending summaries on the parent, let's initialize it on the child.\n if (child._latestSummary !== undefined) {\n for (const [key, value] of this.pendingSummaries.entries()) {\n const newLatestSummaryNode = new SummaryNode({\n referenceSequenceNumber: value.referenceSequenceNumber,\n basePath: child._latestSummary.basePath,\n localPath: child._latestSummary.localPath,\n });\n\n child.addPendingSummary(key, newLatestSummaryNode);\n }\n }\n }\n\n protected addPendingSummary(key: string, summary: SummaryNode) {\n this.pendingSummaries.set(key, summary);\n }\n /**\n * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n */\n protected isTrackingInProgress(): boolean {\n return this.wipReferenceSequenceNumber !== undefined;\n }\n}\n\n/**\n * Creates a root summarizer node.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n */\nexport const createRootSummarizerNode = (\n logger: ITelemetryLogger,\n summarizeInternalFn: SummarizeInternalFn,\n changeSequenceNumber: number,\n referenceSequenceNumber: number | undefined,\n config: ISummarizerNodeConfig = {},\n): IRootSummarizerNode => new SummarizerNode(\n logger,\n summarizeInternalFn,\n config,\n changeSequenceNumber,\n referenceSequenceNumber === undefined ? undefined : SummaryNode.createForRoot(referenceSequenceNumber),\n );\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAS6C;AAC7C,+EAK8C;AAE9C,+DAAuE;AACvE,kDAAmF;AAEnF,+DAU+B;AAI/B;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAyWvB;;;OAGG;IACH,YACuB,aAA+B,EACjC,mBAAwC,EACzD,MAA6B,EACrB,qBAA6B;IACrC,8CAA8C;IACtC,cAA4B,EACnB,cAAgC,EACvC,gBAAmC;;QAP1B,kBAAa,GAAb,aAAa,CAAkB;QACjC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAEjD,0BAAqB,GAArB,qBAAqB,CAAQ;QAE7B,mBAAc,GAAd,cAAc,CAAc;QACnB,mBAAc,GAAd,cAAc,CAAkB;QACvC,qBAAgB,GAAhB,gBAAgB,CAAmB;QA5W9B,aAAQ,GAAG,IAAI,GAAG,EAA0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K,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;gBACxD,MAAM,oBAAoB,GAAG,IAAI,iCAAW,CAAC;oBACzC,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;oBACtD,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ;oBACvC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS;iBAC5C,CAAC,CAAC;gBAEH,KAAK,CAAC,iBAAiB,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;aACtD;SACJ;IACL,CAAC;IAES,iBAAiB,CAAC,GAAW,EAAE,OAAoB;QACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IACD;;OAEG;IACO,oBAAoB;QAC1B,OAAO,IAAI,CAAC,0BAA0B,KAAK,SAAS,CAAC;IACzD,CAAC;CACJ;AA9hBD,wCA8hBC;AAED;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACpC,MAAwB,EACxB,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAgC,EAAE,EACf,EAAE,CAAC,IAAI,cAAc,CACpC,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iCAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,CACzG,CAAC;AAZO,QAAA,wBAAwB,4BAY/B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ISummarizerNode,\n ISummarizerNodeConfig,\n ISummarizeResult,\n ISummaryTreeWithStats,\n CreateChildSummarizerNodeParam,\n CreateSummarizerNodeSource,\n SummarizeInternalFn,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n ISequencedDocumentMessage,\n SummaryType,\n ISnapshotTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { mergeStats, convertToSummaryTree, calculateStats } from \"../summaryUtils\";\nimport { ReadAndParseBlob } from \"../utils\";\nimport {\n EscapedPath,\n ICreateChildDetails,\n IFetchSnapshotResult,\n IInitialSummary,\n ISummarizerNodeRootContract,\n parseSummaryForSubtrees,\n parseSummaryTreeForSubtrees,\n RefreshSummaryResult,\n SummaryNode,\n} from \"./summarizerNodeUtils\";\n\nexport interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {}\n\n/**\n * Encapsulates the summarizing work and state of an individual tree node in the\n * summary tree. It tracks changes and allows for optimizations when unchanged, or\n * can allow for fallback summaries to be generated when an error is encountered.\n * Usage is for the root node to call startSummary first to begin tracking a WIP\n * (work in progress) summary. Then all nodes will call summarize to summaries their\n * individual parts. Once completed and uploaded to storage, the root node will call\n * completeSummary or clearSummary to clear the WIP summary tracking state if something\n * went wrong. The SummarizerNodes will track all pending summaries that have been\n * recorded by the completeSummary call. When one of them is acked, the root node should\n * call refreshLatestSummary to inform the tree of SummarizerNodes of the new baseline\n * latest successful summary.\n */\nexport class SummarizerNode implements IRootSummarizerNode {\n /**\n * The reference sequence number of the most recent acked summary.\n * Returns 0 if there is not yet an acked summary.\n */\n public get referenceSequenceNumber() {\n return this._latestSummary?.referenceSequenceNumber ?? 0;\n }\n\n protected readonly children = new Map<string, SummarizerNode>();\n protected readonly pendingSummaries = new Map<string, SummaryNode>();\n private wipReferenceSequenceNumber: number | undefined;\n private wipLocalPaths: { localPath: EscapedPath; additionalPath?: EscapedPath; } | undefined;\n private wipSkipRecursion = false;\n\n public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger) {\n assert(this.wipSummaryLogger === undefined,\n 0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */);\n assert(this.wipReferenceSequenceNumber === undefined, 0x1a0 /* \"Already tracking a summary\" */);\n\n this.wipSummaryLogger = summaryLogger;\n\n for (const child of this.children.values()) {\n child.startSummary(referenceSequenceNumber, this.wipSummaryLogger);\n }\n this.wipReferenceSequenceNumber = referenceSequenceNumber;\n }\n\n public async summarize(\n fullTree: boolean,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n assert(this.isTrackingInProgress(), 0x1a1 /* \"summarize should not be called when not tracking the summary\" */);\n assert(this.wipSummaryLogger !== undefined,\n 0x1a2 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */);\n\n // Try to reuse the tree if unchanged\n if (this.canReuseHandle && !fullTree && !this.hasChanged()) {\n const latestSummary = this._latestSummary;\n if (latestSummary !== undefined) {\n this.wipLocalPaths = {\n localPath: latestSummary.localPath,\n additionalPath: latestSummary.additionalPath,\n };\n this.wipSkipRecursion = true;\n const stats = mergeStats();\n stats.handleNodeCount++;\n return {\n summary: {\n type: SummaryType.Handle,\n handle: latestSummary.fullPath.path,\n handleType: SummaryType.Tree,\n },\n stats,\n };\n }\n }\n\n const result = await this.summarizeInternalFn(fullTree, true, telemetryContext);\n this.wipLocalPaths = { localPath: EscapedPath.create(result.id) };\n if (result.pathPartsForChildren !== undefined) {\n this.wipLocalPaths.additionalPath = EscapedPath.createAndConcat(result.pathPartsForChildren);\n }\n return { summary: result.summary, stats: result.stats };\n }\n\n /**\n * Complete the WIP summary for the given proposalHandle\n */\n public completeSummary(proposalHandle: string) {\n this.completeSummaryCore(proposalHandle, undefined, false);\n }\n\n /**\n * Recursive implementation for completeSummary, with additional internal-only parameters\n */\n protected completeSummaryCore(\n proposalHandle: string,\n parentPath: EscapedPath | undefined,\n parentSkipRecursion: boolean,\n ) {\n assert(this.wipSummaryLogger !== undefined,\n 0x1a3 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */);\n assert(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* \"Not tracking a summary\" */);\n let localPathsToUse = this.wipLocalPaths;\n\n if (parentSkipRecursion) {\n const latestSummary = this._latestSummary;\n if (latestSummary !== undefined) {\n // This case the parent node created a failure summary or was reused.\n // This node and all children should only try to reference their path\n // by its last known good state in the actual summary tree.\n // If parent fails or is reused, the child summarize is not called so\n // it did not get a chance to change its paths.\n // In this case, essentially only propagate the new summary ref seq num.\n localPathsToUse = {\n localPath: latestSummary.localPath,\n additionalPath: latestSummary.additionalPath,\n };\n } else {\n // This case the child is added after the latest non-failure summary.\n // This node and all children should consider themselves as still not\n // having a successful summary yet.\n // We cannot \"reuse\" this node if unchanged since that summary, because\n // handles will be unable to point to that node. It never made it to the\n // tree itself, and only exists as an attach op in the _outstandingOps.\n this.clearSummary();\n return;\n }\n }\n\n // This should come from wipLocalPaths in normal cases, or from the latestSummary\n // if parentIsFailure or parentIsReused is true.\n // If there is no latestSummary, clearSummary and return before reaching this code.\n assert(!!localPathsToUse, 0x1a5 /* \"Tracked summary local paths not set\" */);\n\n const summary = new SummaryNode({\n ...localPathsToUse,\n referenceSequenceNumber: this.wipReferenceSequenceNumber,\n basePath: parentPath,\n });\n const fullPathForChildren = summary.fullPathForChildren;\n for (const child of this.children.values()) {\n child.completeSummaryCore(\n proposalHandle,\n fullPathForChildren,\n this.wipSkipRecursion || parentSkipRecursion,\n );\n }\n // Note that this overwrites existing pending summary with\n // the same proposalHandle. If proposalHandle is something like\n // a hash or unique identifier, this should be fine. If storage\n // can return the same proposalHandle for a different summary,\n // this should still be okay, because we should be proposing the\n // newer one later which would have to overwrite the previous one.\n this.pendingSummaries.set(proposalHandle, summary);\n this.clearSummary();\n }\n\n public clearSummary() {\n this.wipReferenceSequenceNumber = undefined;\n this.wipLocalPaths = undefined;\n this.wipSkipRecursion = false;\n this.wipSummaryLogger = undefined;\n for (const child of this.children.values()) {\n child.clearSummary();\n }\n }\n\n /**\n * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),\n * we skip the update. Otherwise, we fetch the latest snapshot and update latest summary based off of that.\n *\n * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:\n *\n * 1. The latest summary was not updated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was being tracked.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this\n * case, the latest summary is updated based on the downloaded snapshot which is also returned.\n */\n public async refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult> {\n this.defaultLogger.sendTelemetryEvent({\n eventName: \"refreshLatestSummary_start\",\n proposalHandle,\n referenceSequenceNumber: this.referenceSequenceNumber,\n summaryRefSeq,\n });\n\n if (proposalHandle !== undefined) {\n const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);\n\n if (maybeSummaryNode !== undefined) {\n this.refreshLatestSummaryFromPending(\n proposalHandle,\n maybeSummaryNode.referenceSequenceNumber,\n );\n return { latestSummaryUpdated: true, wasSummaryTracked: true, summaryRefSeq };\n }\n\n const props = {\n summaryRefSeq,\n pendingSize: this.pendingSummaries.size ?? undefined,\n };\n this.defaultLogger.sendTelemetryEvent({\n eventName: \"PendingSummaryNotFound\",\n proposalHandle,\n referenceSequenceNumber: this.referenceSequenceNumber,\n details: JSON.stringify(props),\n });\n }\n\n // If the summary for which refresh is called is older than the latest tracked summary, ignore it.\n if (this.referenceSequenceNumber >= summaryRefSeq) {\n return { latestSummaryUpdated: false };\n }\n\n // Fetch the latest snapshot and refresh state from it. Note that we need to use the reference sequence number\n // of the fetched snapshot and not the \"summaryRefSeq\" that was passed in.\n const { snapshotTree, snapshotRefSeq: fetchedSnapshotRefSeq } = await fetchLatestSnapshot();\n\n // Possible re-entrancy. We may have updated latest summary state while fetching the snapshot. If the fetched\n // snapshot is older than the latest tracked summary, ignore it.\n if (this.referenceSequenceNumber >= fetchedSnapshotRefSeq) {\n return { latestSummaryUpdated: false };\n }\n\n await this.refreshLatestSummaryFromSnapshot(\n fetchedSnapshotRefSeq,\n snapshotTree,\n undefined,\n EscapedPath.create(\"\"),\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n\n return {\n latestSummaryUpdated: true,\n wasSummaryTracked: false,\n snapshotTree,\n summaryRefSeq: fetchedSnapshotRefSeq,\n };\n }\n/**\n * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n * from the state in the pending summary queue.\n * @param proposalHandle - Handle for the current proposal.\n * @param referenceSequenceNumber - reference sequence number of sent summary.\n */\n protected refreshLatestSummaryFromPending(\n proposalHandle: string,\n referenceSequenceNumber: number,\n ): void {\n const summaryNode = this.pendingSummaries.get(proposalHandle);\n if (summaryNode === undefined) {\n // This should only happen if parent skipped recursion AND no prior summary existed.\n assert(\n this._latestSummary === undefined,\n 0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n );\n return;\n } else {\n assert(\n referenceSequenceNumber === summaryNode.referenceSequenceNumber,\n 0x1a7 /* Pending summary reference sequence number should be consistent */,\n );\n\n // Clear earlier pending summaries\n this.pendingSummaries.delete(proposalHandle);\n }\n\n this.refreshLatestSummaryCore(referenceSequenceNumber);\n\n this._latestSummary = summaryNode;\n // Propagate update to all child nodes\n for (const child of this.children.values()) {\n child.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n }\n }\n\n protected async refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n basePath: EscapedPath | undefined,\n localPath: EscapedPath,\n correlatedSummaryLogger: ITelemetryLogger,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n // Possible re-entrancy. If we have already seen a summary later than this one, ignore it.\n if (this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n this.refreshLatestSummaryCore(referenceSequenceNumber);\n\n this._latestSummary = new SummaryNode({\n referenceSequenceNumber,\n basePath,\n localPath,\n });\n\n const pathParts: string[] = [];\n const { childrenTree, childrenPathPart } = parseSummaryForSubtrees(snapshotTree);\n if (childrenPathPart !== undefined) {\n pathParts.push(childrenPathPart);\n }\n\n if (pathParts.length > 0) {\n this._latestSummary.additionalPath = EscapedPath.createAndConcat(pathParts);\n }\n\n // Propagate update to all child nodes\n const pathForChildren = this._latestSummary.fullPathForChildren;\n await Promise.all(Array.from(this.children)\n .filter(([id]) => {\n // Assuming subtrees missing from snapshot are newer than the snapshot,\n // but might be nice to assert this using earliest seq for node.\n return childrenTree.trees[id] !== undefined;\n }).map(async ([id, child]) => {\n return child.refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber,\n childrenTree.trees[id],\n pathForChildren,\n EscapedPath.create(id),\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n }));\n }\n\n private refreshLatestSummaryCore(referenceSequenceNumber: number): void {\n for (const [key, value] of this.pendingSummaries) {\n if (value.referenceSequenceNumber < referenceSequenceNumber) {\n this.pendingSummaries.delete(key);\n }\n }\n }\n\n public updateBaseSummaryState(snapshot: ISnapshotTree) {\n // Check base summary to see if it has any additional path parts\n // separating child SummarizerNodes. Checks for .channels subtrees.\n const { childrenPathPart } = parseSummaryForSubtrees(snapshot);\n if (childrenPathPart !== undefined && this._latestSummary !== undefined) {\n this._latestSummary.additionalPath = EscapedPath.create(childrenPathPart);\n }\n }\n\n public recordChange(op: ISequencedDocumentMessage): void {\n this.invalidate(op.sequenceNumber);\n }\n\n public invalidate(sequenceNumber: number): void {\n if (sequenceNumber > this._changeSequenceNumber) {\n this._changeSequenceNumber = sequenceNumber;\n }\n }\n\n /**\n * True if a change has been recorded with sequence number exceeding\n * the latest successfully acked summary reference sequence number.\n * False implies that the previous summary can be reused.\n */\n protected hasChanged(): boolean {\n return this._changeSequenceNumber > this.referenceSequenceNumber;\n }\n\n public get latestSummary(): Readonly<SummaryNode> | undefined {\n return this._latestSummary;\n }\n\n protected readonly canReuseHandle: boolean;\n\n /**\n * Do not call constructor directly.\n * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n */\n public constructor(\n protected readonly defaultLogger: ITelemetryLogger,\n private readonly summarizeInternalFn: SummarizeInternalFn,\n config: ISummarizerNodeConfig,\n private _changeSequenceNumber: number,\n /** Undefined means created without summary */\n private _latestSummary?: SummaryNode,\n private readonly initialSummary?: IInitialSummary,\n protected wipSummaryLogger?: ITelemetryLogger,\n ) {\n this.canReuseHandle = config.canReuseHandle ?? true;\n }\n\n public createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n */\n createParam: CreateChildSummarizerNodeParam,\n config: ISummarizerNodeConfig = {},\n ): ISummarizerNode {\n assert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n const child = new SummarizerNode(\n this.defaultLogger,\n summarizeInternalFn,\n config,\n createDetails.changeSequenceNumber,\n createDetails.latestSummary,\n createDetails.initialSummary,\n this.wipSummaryLogger,\n );\n\n // There may be additional state that has to be updated in this child. For example, if a summary is being\n // tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n // have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n this.maybeUpdateChildState(child);\n\n this.children.set(id, child);\n return child;\n }\n\n public getChild(id: string): ISummarizerNode | undefined {\n return this.children.get(id);\n }\n\n /**\n * Returns the details needed to create a child node.\n * @param id - Initial id or path part of the child node.\n * @param createParam - Information needed to create the node.\n * @returns the details needed to create the child node.\n */\n protected getCreateDetailsForChild(id: string, createParam: CreateChildSummarizerNodeParam): ICreateChildDetails {\n let initialSummary: IInitialSummary | undefined;\n let latestSummary: SummaryNode | undefined;\n let changeSequenceNumber: number;\n\n const parentLatestSummary = this._latestSummary;\n switch (createParam.type) {\n case CreateSummarizerNodeSource.FromAttach: {\n if (\n parentLatestSummary !== undefined\n && createParam.sequenceNumber <= parentLatestSummary.referenceSequenceNumber\n ) {\n // Prioritize latest summary if it was after this node was attached.\n latestSummary = parentLatestSummary.createForChild(id);\n } else {\n const summary = convertToSummaryTree(createParam.snapshot) as ISummaryTreeWithStats;\n initialSummary = {\n sequenceNumber: createParam.sequenceNumber,\n id,\n summary,\n };\n }\n changeSequenceNumber = createParam.sequenceNumber;\n break;\n }\n case CreateSummarizerNodeSource.FromSummary: {\n if (this.initialSummary === undefined) {\n assert(\n !!parentLatestSummary,\n 0x1ac /* \"Cannot create child from summary if parent does not have latest summary\" */);\n }\n // fallthrough to local\n }\n case CreateSummarizerNodeSource.Local: {\n const parentInitialSummary = this.initialSummary;\n if (parentInitialSummary !== undefined) {\n let childSummary: SummaryObject | undefined;\n if (parentInitialSummary.summary !== undefined) {\n const { childrenTree } = parseSummaryTreeForSubtrees(parentInitialSummary.summary.summary);\n assert(\n childrenTree.type === SummaryType.Tree,\n 0x1d6 /* \"Parent summary object is not a tree\" */,\n );\n childSummary = childrenTree.tree[id];\n }\n if (createParam.type === CreateSummarizerNodeSource.FromSummary) {\n // Locally created would not have differential subtree.\n assert(!!childSummary, 0x1ad /* \"Missing child summary tree\" */);\n }\n let childSummaryWithStats: ISummaryTreeWithStats | undefined;\n if (childSummary !== undefined) {\n assert(\n childSummary.type === SummaryType.Tree,\n 0x1ae /* \"Child summary object is not a tree\" */,\n );\n childSummaryWithStats = {\n summary: childSummary,\n stats: calculateStats(childSummary),\n };\n }\n initialSummary = {\n sequenceNumber: parentInitialSummary.sequenceNumber,\n id,\n summary: childSummaryWithStats,\n };\n }\n latestSummary = parentLatestSummary?.createForChild(id);\n changeSequenceNumber = parentLatestSummary?.referenceSequenceNumber ?? -1;\n break;\n }\n default: {\n const type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n unreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n }\n }\n\n return {\n initialSummary,\n latestSummary,\n changeSequenceNumber,\n };\n }\n\n /**\n * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n * summary tracking state needs to be updated too.\n * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n * pending summary as well.\n * @param child - The child node whose state is to be updated.\n */\n protected maybeUpdateChildState(child: SummarizerNode) {\n // If we are tracking a summary, this child was created after the tracking started. So, we need to update the\n // child's tracking state as well.\n if (this.isTrackingInProgress()) {\n child.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n }\n // In case we have pending summaries on the parent, let's initialize it on the child.\n if (child._latestSummary !== undefined) {\n for (const [key, value] of this.pendingSummaries.entries()) {\n const newLatestSummaryNode = new SummaryNode({\n referenceSequenceNumber: value.referenceSequenceNumber,\n basePath: child._latestSummary.basePath,\n localPath: child._latestSummary.localPath,\n });\n\n child.addPendingSummary(key, newLatestSummaryNode);\n }\n }\n }\n\n protected addPendingSummary(key: string, summary: SummaryNode) {\n this.pendingSummaries.set(key, summary);\n }\n /**\n * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n */\n protected isTrackingInProgress(): boolean {\n return this.wipReferenceSequenceNumber !== undefined;\n }\n}\n\n/**\n * Creates a root summarizer node.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n */\nexport const createRootSummarizerNode = (\n logger: ITelemetryLogger,\n summarizeInternalFn: SummarizeInternalFn,\n changeSequenceNumber: number,\n referenceSequenceNumber: number | undefined,\n config: ISummarizerNodeConfig = {},\n): IRootSummarizerNode => new SummarizerNode(\n logger,\n summarizeInternalFn,\n config,\n changeSequenceNumber,\n referenceSequenceNumber === undefined ? undefined : SummaryNode.createForRoot(referenceSequenceNumber),\n );\n"]}
|
|
@@ -7,30 +7,39 @@ import { ISnapshotTree, ISummaryTree, SummaryObject } from "@fluidframework/prot
|
|
|
7
7
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
8
8
|
import { ReadAndParseBlob } from "../utils";
|
|
9
9
|
/**
|
|
10
|
-
* Return
|
|
10
|
+
* Return type of refreshSummaryAck function. There can be three different scenarios based on the passed params:
|
|
11
11
|
*
|
|
12
|
-
* 1. The latest summary was not
|
|
12
|
+
* 1. The latest summary was not updated.
|
|
13
13
|
*
|
|
14
14
|
* 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.
|
|
15
15
|
*
|
|
16
16
|
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the
|
|
17
|
-
* latest
|
|
17
|
+
* latest snapshot is fetched and the latest summary state is updated based on it.
|
|
18
18
|
*/
|
|
19
19
|
export declare type RefreshSummaryResult = {
|
|
20
20
|
latestSummaryUpdated: false;
|
|
21
21
|
} | {
|
|
22
22
|
latestSummaryUpdated: true;
|
|
23
23
|
wasSummaryTracked: true;
|
|
24
|
+
summaryRefSeq: number;
|
|
24
25
|
} | {
|
|
25
26
|
latestSummaryUpdated: true;
|
|
26
27
|
wasSummaryTracked: false;
|
|
27
|
-
|
|
28
|
+
snapshotTree: ISnapshotTree;
|
|
29
|
+
summaryRefSeq: number;
|
|
28
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Result of snapshot fetch during refreshing latest summary state.
|
|
33
|
+
*/
|
|
34
|
+
export interface IFetchSnapshotResult {
|
|
35
|
+
snapshotTree: ISnapshotTree;
|
|
36
|
+
snapshotRefSeq: number;
|
|
37
|
+
}
|
|
29
38
|
export interface ISummarizerNodeRootContract {
|
|
30
39
|
startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;
|
|
31
40
|
completeSummary(proposalHandle: string): void;
|
|
32
41
|
clearSummary(): void;
|
|
33
|
-
refreshLatestSummary(proposalHandle: string | undefined, summaryRefSeq: number,
|
|
42
|
+
refreshLatestSummary(proposalHandle: string | undefined, summaryRefSeq: number, fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>, readAndParseBlob: ReadAndParseBlob, correlatedSummaryLogger: ITelemetryLogger): Promise<RefreshSummaryResult>;
|
|
34
43
|
}
|
|
35
44
|
/** Path for nodes in a tree with escaped special characters */
|
|
36
45
|
export declare class EscapedPath {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACH,aAAa,EACb,YAAY,EACZ,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,oBAAoB,EAAE,KAAK,CAAC;CAC/B,GAAG;IACA,oBAAoB,EAAE,IAAI,CAAC;IAC3B,iBAAiB,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACH,aAAa,EACb,YAAY,EACZ,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,oBAAoB,EAAE,KAAK,CAAC;CAC/B,GAAG;IACA,oBAAoB,EAAE,IAAI,CAAC;IAC3B,iBAAiB,EAAE,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC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,EAAE,IAAI,CAAC,mBAAmB;YAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;SACpC,CAAC,CAAC;IACP,CAAC;CACJ;AA9DD,kCA8DC;AA6CD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,WAA0B;IAC9D,2EAA2E;IAC3E,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,sCAAgB,CAAC,CAAC;IAC5D,IAAI,eAAe,KAAK,SAAS,EAAE;QAC/B,OAAO;YACH,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,sCAAgB;SACrC,CAAC;KACL;IACD,OAAO;QACH,YAAY,EAAE,WAAW;QACzB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC;AAbD,0DAaC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,OAAqB;IAC7D,2EAA2E;IAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,sCAAgB,CAAC,CAAC;IACvD,IAAI,eAAe,KAAK,SAAS,EAAE;QAC/B,OAAO;YACH,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,sCAAgB;SACrC,CAAC;KACL;IACD,OAAO;QACH,YAAY,EAAE,OAAO;QACrB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC;AAbD,kEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n ISnapshotTree,\n ISummaryTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { channelsTreeName, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\n\n/**\n * Return value of refreshSummaryAck function. There can be three different scenarios based on the passed params:\n *\n * 1. The latest summary was not udpated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the\n * latest summary is updated based on the downloaded snapshot which is also returned.\n */\nexport type RefreshSummaryResult = {\n latestSummaryUpdated: false;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: true;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: false;\n snapshot: ISnapshotTree;\n};\n\nexport interface ISummarizerNodeRootContract {\n startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;\n completeSummary(proposalHandle: string): void;\n clearSummary(): void;\n refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n getSnapshot: () => Promise<ISnapshotTree>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n private constructor(public readonly path: string) { }\n public static create(path: string): EscapedPath {\n return new EscapedPath(encodeURIComponent(path));\n }\n public static createAndConcat(pathParts: string[]): EscapedPath {\n let ret = EscapedPath.create(pathParts[0] ?? \"\");\n for (let i = 1; i < pathParts.length; i++) {\n ret = ret.concat(EscapedPath.create(pathParts[i]));\n }\n return ret;\n }\n public toString(): string {\n return this.path;\n }\n public concat(path: EscapedPath): EscapedPath {\n return new EscapedPath(`${this.path}/${path.path}`);\n }\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n /** Creates an instance that is valid for the root with specific basePath and localPath */\n public static createForRoot(referenceSequenceNumber: number): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber,\n basePath: undefined,\n localPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n });\n }\n\n /** Summary reference sequence number, i.e. last sequence number seen when it was created */\n public get referenceSequenceNumber(): number {\n return this.summary.referenceSequenceNumber;\n }\n /** Full path to parent node, or undefined if this is the root */\n public get basePath(): EscapedPath | undefined {\n return this.summary.basePath;\n }\n /** Relative path to this node from its parent node */\n public get localPath(): EscapedPath {\n return this.summary.localPath;\n }\n /** Relative path from this node to its node innermost base summary */\n public get additionalPath(): EscapedPath | undefined {\n return this.summary.additionalPath;\n }\n public set additionalPath(additionalPath: EscapedPath | undefined) {\n this.summary.additionalPath = additionalPath;\n }\n constructor(private readonly summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n }) { }\n\n /** Gets the full path to this node, to be used when sending a handle */\n public get fullPath(): EscapedPath {\n return this.basePath?.concat(this.localPath) ?? this.localPath;\n }\n\n /**\n * Gets the full path to this node's innermost base summary.\n * The children nodes can use this as their basePath to determine their path.\n */\n public get fullPathForChildren(): EscapedPath {\n return this.additionalPath !== undefined\n ? this.fullPath.concat(this.additionalPath)\n : this.fullPath;\n }\n\n /**\n * Creates a new node within the same summary for a child of this node.\n * @param id - id of the child node\n */\n public createForChild(id: string): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber: this.referenceSequenceNumber,\n basePath: this.fullPathForChildren,\n localPath: EscapedPath.create(id),\n });\n }\n}\n\n/**\n * Parameter to help encode summary with conditional behavior.\n * When fromSummary is true, it will contain the SummaryNode of\n * its previous summary, which it can use to point to with a handle.\n * When fromSummary is false, it will use an actual summary tree\n * as its base summary in case the first summary is a differential summary.\n */\nexport type EncodeSummaryParam = {\n fromSummary: true;\n summaryNode: SummaryNode;\n} | {\n fromSummary: false;\n initialSummary: ISummaryTreeWithStats;\n};\n\n/**\n * Information about the initial summary tree found from an attach op.\n */\nexport interface IInitialSummary {\n sequenceNumber: number;\n id: string;\n summary: ISummaryTreeWithStats | undefined;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n /** Summary from attach op if known */\n initialSummary: IInitialSummary | undefined;\n /** Latest summary from server node data */\n latestSummary: SummaryNode | undefined;\n /** Sequence number of latest known change to the node */\n changeSequenceNumber: number;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n /** Tree to use to find children subtrees */\n childrenTree: T;\n /** Additional path part where children are isolated */\n childrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInfo<ISnapshotTree> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = baseSummary.trees[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: baseSummary,\n childrenPathPart: undefined,\n };\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryTreeForSubtrees(summary: ISummaryTree): ISubtreeInfo<SummaryObject> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = summary.tree[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: summary,\n childrenPathPart: undefined,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,6EAA8F;AA+C9F,+DAA+D;AAC/D,MAAa,WAAW;IACpB,YAAoC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAI,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,IAAY;QAC7B,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IACM,MAAM,CAAC,eAAe,CAAC,SAAmB;;QAC7C,IAAI,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,MAAA,SAAS,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC,CAAC;QACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,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Y,EAAE,OAAO;QACrB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC;AAbD,kEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n ISnapshotTree,\n ISummaryTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { channelsTreeName, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\n\n/**\n * Return type of refreshSummaryAck function. There can be three different scenarios based on the passed params:\n *\n * 1. The latest summary was not updated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the\n * latest snapshot is fetched and the latest summary state is updated based on it.\n */\nexport type RefreshSummaryResult = {\n latestSummaryUpdated: false;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: true;\n summaryRefSeq: number;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: false;\n snapshotTree: ISnapshotTree;\n summaryRefSeq: number;\n};\n\n/**\n * Result of snapshot fetch during refreshing latest summary state.\n */\nexport interface IFetchSnapshotResult {\n snapshotTree: ISnapshotTree;\n snapshotRefSeq: number;\n}\n\nexport interface ISummarizerNodeRootContract {\n startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;\n completeSummary(proposalHandle: string): void;\n clearSummary(): void;\n refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n private constructor(public readonly path: string) { }\n public static create(path: string): EscapedPath {\n return new EscapedPath(encodeURIComponent(path));\n }\n public static createAndConcat(pathParts: string[]): EscapedPath {\n let ret = EscapedPath.create(pathParts[0] ?? \"\");\n for (let i = 1; i < pathParts.length; i++) {\n ret = ret.concat(EscapedPath.create(pathParts[i]));\n }\n return ret;\n }\n public toString(): string {\n return this.path;\n }\n public concat(path: EscapedPath): EscapedPath {\n return new EscapedPath(`${this.path}/${path.path}`);\n }\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n /** Creates an instance that is valid for the root with specific basePath and localPath */\n public static createForRoot(referenceSequenceNumber: number): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber,\n basePath: undefined,\n localPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n });\n }\n\n /** Summary reference sequence number, i.e. last sequence number seen when it was created */\n public get referenceSequenceNumber(): number {\n return this.summary.referenceSequenceNumber;\n }\n /** Full path to parent node, or undefined if this is the root */\n public get basePath(): EscapedPath | undefined {\n return this.summary.basePath;\n }\n /** Relative path to this node from its parent node */\n public get localPath(): EscapedPath {\n return this.summary.localPath;\n }\n /** Relative path from this node to its node innermost base summary */\n public get additionalPath(): EscapedPath | undefined {\n return this.summary.additionalPath;\n }\n public set additionalPath(additionalPath: EscapedPath | undefined) {\n this.summary.additionalPath = additionalPath;\n }\n constructor(private readonly summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n }) { }\n\n /** Gets the full path to this node, to be used when sending a handle */\n public get fullPath(): EscapedPath {\n return this.basePath?.concat(this.localPath) ?? this.localPath;\n }\n\n /**\n * Gets the full path to this node's innermost base summary.\n * The children nodes can use this as their basePath to determine their path.\n */\n public get fullPathForChildren(): EscapedPath {\n return this.additionalPath !== undefined\n ? this.fullPath.concat(this.additionalPath)\n : this.fullPath;\n }\n\n /**\n * Creates a new node within the same summary for a child of this node.\n * @param id - id of the child node\n */\n public createForChild(id: string): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber: this.referenceSequenceNumber,\n basePath: this.fullPathForChildren,\n localPath: EscapedPath.create(id),\n });\n }\n}\n\n/**\n * Parameter to help encode summary with conditional behavior.\n * When fromSummary is true, it will contain the SummaryNode of\n * its previous summary, which it can use to point to with a handle.\n * When fromSummary is false, it will use an actual summary tree\n * as its base summary in case the first summary is a differential summary.\n */\nexport type EncodeSummaryParam = {\n fromSummary: true;\n summaryNode: SummaryNode;\n} | {\n fromSummary: false;\n initialSummary: ISummaryTreeWithStats;\n};\n\n/**\n * Information about the initial summary tree found from an attach op.\n */\nexport interface IInitialSummary {\n sequenceNumber: number;\n id: string;\n summary: ISummaryTreeWithStats | undefined;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n /** Summary from attach op if known */\n initialSummary: IInitialSummary | undefined;\n /** Latest summary from server node data */\n latestSummary: SummaryNode | undefined;\n /** Sequence number of latest known change to the node */\n changeSequenceNumber: number;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n /** Tree to use to find children subtrees */\n childrenTree: T;\n /** Additional path part where children are isolated */\n childrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInfo<ISnapshotTree> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = baseSummary.trees[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: baseSummary,\n childrenPathPart: undefined,\n };\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryTreeForSubtrees(summary: ISummaryTree): ISubtreeInfo<SummaryObject> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = summary.tree[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: summary,\n childrenPathPart: undefined,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeWithGc.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACH,8BAA8B,EAE9B,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACH,WAAW,EAEX,eAAe,EACf,2BAA2B,EAE3B,WAAW,EACd,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB,EAAE,2BAA2B;CAAG;AAiBxG;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAqB,SAAQ,cAAe,YAAW,yBAAyB;IA6BrF,OAAO,CAAC,QAAQ,CAAC,WAAW;IAW5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAtCjC,OAAO,CAAC,uBAAuB,CAAqB;IAGpD,OAAO,CAAC,mBAAmB,CAAuB;IAGlD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAG5E,OAAO,CAAC,mBAAmB,CAAkB;IAE7C,OAAO,CAAC,MAAM,CAAqC;IAKnD,OAAO,CAAC,UAAU,CAAkB;IAGpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IAErC;;;OAGG;gBAEC,MAAM,EAAE,gBAAgB,EACP,WAAW,EA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A2C;IAC3C,EAAE,EAAE,MAAM;IACV;;;;OAIG;IACH,WAAW,EAAE,8BAA8B,EAC3C,MAAM,GAAE,2BAAgC,EACxC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,sBAAsB,CAAC,EACnE,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,6BAA6B,CAAC,GAClE,qBAAqB;IA0CxB;;OAEG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAIvD,YAAY,IAAI,OAAO;IAIvB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;IAY5C;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAS9B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,WAC/B,gBAAgB,uBACH,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,2BAA2B,mDACC,QAAQ,sBAAsB,CAAC,2CACxC,QAAQ,6BAA6B,CAAC,kBAClE,yBAUF,CAAC"}
|
|
@@ -240,7 +240,9 @@ class SummarizerNodeWithGC extends summarizerNode_1.SummarizerNode {
|
|
|
240
240
|
const gcDetailsMap = (0, garbage_collector_1.unpackChildNodesGCDetails)(gcDetails);
|
|
241
241
|
const { childrenTree } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(snapshotTree);
|
|
242
242
|
gcDetailsMap.forEach((childGCDetails, childId) => {
|
|
243
|
-
childrenTree.trees[childId]
|
|
243
|
+
if (childrenTree.trees[childId] !== undefined) {
|
|
244
|
+
childrenTree.trees[childId].blobs[runtime_definitions_1.gcTreeKey] = JSON.stringify(childGCDetails);
|
|
245
|
+
}
|
|
244
246
|
});
|
|
245
247
|
}
|
|
246
248
|
/**
|