@fluidframework/container-runtime 2.0.0-internal.6.2.0 → 2.0.0-internal.6.3.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/CHANGELOG.md +4 -0
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +4 -3
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +1 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +81 -69
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +13 -12
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +18 -3
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +185 -145
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +3 -3
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +2 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +36 -36
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -8
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +19 -20
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaManagerProxyBase.d.ts +1 -1
- package/dist/deltaManagerProxyBase.js +2 -2
- package/dist/deltaManagerProxyBase.js.map +1 -1
- package/dist/deltaScheduler.js +6 -6
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +3 -5
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +4 -21
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +2 -2
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.js +7 -7
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +4 -7
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +15 -52
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +4 -4
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +1 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js +2 -2
- package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/finalSpace.js +2 -2
- package/dist/id-compressor/finalSpace.js.map +1 -1
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js +16 -15
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/id-compressor/sessions.js +5 -5
- package/dist/id-compressor/sessions.js.map +1 -1
- package/dist/id-compressor/utilities.js +2 -2
- package/dist/id-compressor/utilities.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +4 -3
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +11 -10
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +3 -3
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.js +12 -12
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.js +6 -6
- package/dist/opLifecycle/outbox.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/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +12 -13
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +19 -18
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +1 -1
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -1
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +6 -5
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +3 -3
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +1 -1
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +13 -12
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -1
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +4 -3
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +1 -1
- package/dist/summary/summarizerClientElection.js +2 -2
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.js +2 -2
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/index.d.ts +1 -1
- package/dist/summary/summarizerNode/index.d.ts.map +1 -1
- package/dist/summary/summarizerNode/index.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +5 -14
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +32 -109
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +6 -30
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +0 -11
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +5 -88
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +1 -1
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +9 -8
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.js +2 -2
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +10 -10
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +9 -8
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +1 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +52 -40
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +2 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +18 -3
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +147 -107
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +1 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +2 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +2 -2
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +1 -2
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +1 -2
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaManagerProxyBase.d.ts +1 -1
- package/lib/deltaManagerProxyBase.js +1 -1
- package/lib/deltaManagerProxyBase.js.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +3 -5
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +5 -22
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +2 -2
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.js +1 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts +4 -7
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +16 -53
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/finalSpace.js +1 -1
- package/lib/id-compressor/finalSpace.js.map +1 -1
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js +2 -1
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/id-compressor/sessions.js +1 -1
- package/lib/id-compressor/sessions.js.map +1 -1
- package/lib/id-compressor/utilities.js +1 -1
- package/lib/id-compressor/utilities.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +2 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +2 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +1 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -1
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.js +1 -1
- package/lib/opLifecycle/outbox.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/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +1 -2
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +2 -1
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/index.d.ts +1 -1
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +2 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +1 -1
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +5 -4
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -1
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +2 -1
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +1 -1
- package/lib/summary/summarizerClientElection.js +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.js +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/index.d.ts +1 -1
- package/lib/summary/summarizerNode/index.d.ts.map +1 -1
- package/lib/summary/summarizerNode/index.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +5 -14
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +16 -93
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +6 -30
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +0 -11
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -86
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +1 -1
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +2 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.js +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +3 -3
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +4 -3
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +22 -24
- package/src/batchTracker.ts +2 -1
- package/src/blobManager.ts +57 -48
- package/src/connectionTelemetry.ts +2 -1
- package/src/containerRuntime.ts +207 -166
- package/src/dataStore.ts +1 -1
- package/src/dataStoreContext.ts +2 -2
- package/src/dataStoreContexts.ts +1 -2
- package/src/dataStores.ts +1 -2
- package/src/deltaManagerProxyBase.ts +1 -1
- package/src/deltaScheduler.ts +1 -1
- package/src/gc/garbageCollection.ts +6 -41
- package/src/gc/gcDefinitions.ts +2 -6
- package/src/gc/gcHelpers.ts +1 -1
- package/src/gc/gcSummaryStateTracker.ts +19 -65
- package/src/gc/gcUnreferencedStateTracker.ts +1 -1
- package/src/gc/index.ts +0 -1
- package/src/id-compressor/appendOnlySortedMap.ts +1 -1
- package/src/id-compressor/finalSpace.ts +1 -1
- package/src/id-compressor/idCompressor.ts +2 -1
- package/src/id-compressor/sessions.ts +1 -1
- package/src/id-compressor/utilities.ts +1 -1
- package/src/opLifecycle/opCompressor.ts +2 -1
- package/src/opLifecycle/opDecompressor.ts +2 -1
- package/src/opLifecycle/opGroupingManager.ts +1 -1
- package/src/opLifecycle/opSplitter.ts +1 -1
- package/src/opLifecycle/outbox.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +1 -2
- package/src/scheduleManager.ts +2 -1
- package/src/summary/index.ts +1 -2
- package/src/summary/orderedClientElection.ts +2 -1
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +5 -10
- package/src/summary/summarizer.ts +2 -1
- package/src/summary/summarizerClientElection.ts +1 -1
- package/src/summary/summarizerHeuristics.ts +1 -1
- package/src/summary/summarizerNode/index.ts +1 -2
- package/src/summary/summarizerNode/summarizerNode.ts +23 -145
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +7 -38
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +3 -123
- package/src/summary/summaryCollection.ts +2 -1
- package/src/summary/summaryFormat.ts +1 -1
- package/src/summary/summaryGenerator.ts +3 -3
- package/src/summary/summaryManager.ts +4 -3
|
@@ -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 {
|
|
5
|
+
export { IRefreshSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, } 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/summary/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,GACrB,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/summary/summarizerNode/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/summary/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\tIRefreshSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils\";\nexport { IRootSummarizerNode, createRootSummarizerNode } from \"./summarizerNode\";\nexport { IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC } from \"./summarizerNodeWithGc\";\n"]}
|
|
@@ -6,8 +6,7 @@ import { ITelemetryBaseLogger, ITelemetryErrorEvent } from "@fluidframework/core
|
|
|
6
6
|
import { ISummarizerNode, ISummarizerNodeConfig, ISummarizeResult, CreateChildSummarizerNodeParam, SummarizeInternalFn, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
7
7
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import {
|
|
10
|
-
import { EscapedPath, ICreateChildDetails, IFetchSnapshotResult, IInitialSummary, ISummarizerNodeRootContract, RefreshSummaryResult, SummaryNode, ValidateSummaryResult } from "./summarizerNodeUtils";
|
|
9
|
+
import { EscapedPath, ICreateChildDetails, IInitialSummary, IRefreshSummaryResult, ISummarizerNodeRootContract, SummaryNode, ValidateSummaryResult } from "./summarizerNodeUtils";
|
|
11
10
|
export interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
@@ -91,19 +90,12 @@ export declare class SummarizerNode implements IRootSummarizerNode {
|
|
|
91
90
|
clearSummary(): void;
|
|
92
91
|
/**
|
|
93
92
|
* Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,
|
|
94
|
-
* it becomes the latest summary. If the current summary is already ahead
|
|
95
|
-
*
|
|
93
|
+
* it becomes the latest summary. If the current summary is already ahead, we skip the update.
|
|
94
|
+
* If the current summary is behind, then we do not refresh.
|
|
96
95
|
*
|
|
97
|
-
* @returns
|
|
98
|
-
*
|
|
99
|
-
* 1. The latest summary was not updated.
|
|
100
|
-
*
|
|
101
|
-
* 2. The latest summary was updated and the summary corresponding to the params was being tracked.
|
|
102
|
-
*
|
|
103
|
-
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
|
|
104
|
-
* case, the latest summary is updated based on the downloaded snapshot which is also returned.
|
|
96
|
+
* @returns true if the summary is tracked by this node, false otherwise.
|
|
105
97
|
*/
|
|
106
|
-
refreshLatestSummary(proposalHandle: string
|
|
98
|
+
refreshLatestSummary(proposalHandle: string, summaryRefSeq: number): Promise<IRefreshSummaryResult>;
|
|
107
99
|
/**
|
|
108
100
|
* Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
|
|
109
101
|
* from the state in the pending summary queue.
|
|
@@ -111,7 +103,6 @@ export declare class SummarizerNode implements IRootSummarizerNode {
|
|
|
111
103
|
* @param referenceSequenceNumber - reference sequence number of sent summary.
|
|
112
104
|
*/
|
|
113
105
|
protected refreshLatestSummaryFromPending(proposalHandle: string, referenceSequenceNumber: number): void;
|
|
114
|
-
protected refreshLatestSummaryFromSnapshot(referenceSequenceNumber: number, snapshotTree: ISnapshotTree, basePath: EscapedPath | undefined, localPath: EscapedPath, correlatedSummaryLogger: ITelemetryLoggerExt, readAndParseBlob: ReadAndParseBlob): Promise<void>;
|
|
115
106
|
private refreshLatestSummaryCore;
|
|
116
107
|
updateBaseSummaryState(snapshot: ISnapshotTree): void;
|
|
117
108
|
recordChange(op: ISequencedDocumentMessage): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EACN,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAEhB,8BAA8B,EAE9B,mBAAmB,EACnB,iBAAiB,EAEjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,yBAAyB,EAEzB,aAAa,EAEb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,mBAAmB,EAMnB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;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I,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS,CAE5D;IAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEpC,WAAW;IACjB,yBAAyB;IACzB,mBAAmB,EAAE,mBAAmB;IACxC,2CAA2C;IAC3C,EAAE,EAAE,MAAM;IACV;;;;OAIG;IACH,WAAW,EAAE,8BAA8B,EAC3C,MAAM,GAAE,qBAA0B,GAChC,eAAe;IAwBX,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIxD;;;;;OAKG;IACH,SAAS,CAAC,wBAAwB,CACjC,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,8BAA8B,GACzC,mBAAmB;IA2FtB;;;;;;;;OAQG;IACH,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM;IAoBjE,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAI7D;;OAEG;IACI,mBAAmB,IAAI,OAAO;IAIrC;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,GAAG,KAAK;CAWvE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WAC5B,mBAAmB,uBACN,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC3B,mBAYD,CAAC"}
|
|
@@ -8,7 +8,7 @@ exports.createRootSummarizerNode = exports.SummarizerNode = void 0;
|
|
|
8
8
|
const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
|
|
9
9
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
10
10
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
11
|
-
const
|
|
11
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
12
12
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
13
13
|
const summarizerNodeUtils_1 = require("./summarizerNodeUtils");
|
|
14
14
|
/**
|
|
@@ -60,8 +60,8 @@ class SummarizerNode {
|
|
|
60
60
|
return this._latestSummary?.referenceSequenceNumber ?? 0;
|
|
61
61
|
}
|
|
62
62
|
startSummary(referenceSequenceNumber, summaryLogger) {
|
|
63
|
-
(0,
|
|
64
|
-
(0,
|
|
63
|
+
(0, core_utils_1.assert)(this.wipSummaryLogger === undefined, 0x19f /* "wipSummaryLogger should not be set yet in startSummary" */);
|
|
64
|
+
(0, core_utils_1.assert)(this.wipReferenceSequenceNumber === undefined, 0x1a0 /* "Already tracking a summary" */);
|
|
65
65
|
this.wipSummaryLogger = summaryLogger;
|
|
66
66
|
for (const child of this.children.values()) {
|
|
67
67
|
child.startSummary(referenceSequenceNumber, this.wipSummaryLogger);
|
|
@@ -69,8 +69,8 @@ class SummarizerNode {
|
|
|
69
69
|
this.wipReferenceSequenceNumber = referenceSequenceNumber;
|
|
70
70
|
}
|
|
71
71
|
async summarize(fullTree, trackState = true, telemetryContext) {
|
|
72
|
-
(0,
|
|
73
|
-
(0,
|
|
72
|
+
(0, core_utils_1.assert)(this.isSummaryInProgress(), 0x1a1 /* "summarize should not be called when not tracking the summary" */);
|
|
73
|
+
(0, core_utils_1.assert)(this.wipSummaryLogger !== undefined, 0x1a2 /* "wipSummaryLogger should have been set in startSummary or ctor" */);
|
|
74
74
|
// Try to reuse the tree if unchanged
|
|
75
75
|
if (this.canReuseHandle && !fullTree && !this.hasChanged()) {
|
|
76
76
|
const latestSummary = this._latestSummary;
|
|
@@ -94,7 +94,7 @@ class SummarizerNode {
|
|
|
94
94
|
}
|
|
95
95
|
// This assert is the same the other 0a1x1 assert `isSummaryInProgress`, the only difference is that typescript
|
|
96
96
|
// complains if this assert isn't done this way
|
|
97
|
-
(0,
|
|
97
|
+
(0, core_utils_1.assert)(this.wipReferenceSequenceNumber !== undefined, 0x5df /* Summarize should not be called when not tracking the summary */);
|
|
98
98
|
const incrementalSummaryContext = this._latestSummary !== undefined
|
|
99
99
|
? {
|
|
100
100
|
summarySequenceNumber: this.wipReferenceSequenceNumber,
|
|
@@ -155,8 +155,8 @@ class SummarizerNode {
|
|
|
155
155
|
return { success: true };
|
|
156
156
|
}
|
|
157
157
|
wasSummarizeMissed(parentSkipRecursion) {
|
|
158
|
-
(0,
|
|
159
|
-
(0,
|
|
158
|
+
(0, core_utils_1.assert)(this.wipSummaryLogger !== undefined, 0x6fc /* wipSummaryLogger should have been set in startSummary or ctor */);
|
|
159
|
+
(0, core_utils_1.assert)(this.wipReferenceSequenceNumber !== undefined, 0x6fd /* Not tracking a summary */);
|
|
160
160
|
// If the parent node skipped recursion, it did not call summarize on this node. So, summarize was not missed
|
|
161
161
|
// but was intentionally not called.
|
|
162
162
|
// Otherwise, summarize should have been called on this node and wipLocalPaths must be set.
|
|
@@ -201,7 +201,7 @@ class SummarizerNode {
|
|
|
201
201
|
proposalHandle,
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
(0,
|
|
204
|
+
(0, core_utils_1.assert)(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* "Not tracking a summary" */);
|
|
205
205
|
let localPathsToUse = this.wipLocalPaths;
|
|
206
206
|
if (parentSkipRecursion) {
|
|
207
207
|
const latestSummary = this._latestSummary;
|
|
@@ -230,7 +230,7 @@ class SummarizerNode {
|
|
|
230
230
|
}
|
|
231
231
|
// If localPathsToUse is undefined, it means summarize didn't run for this node and in that case the validate
|
|
232
232
|
// step should have failed.
|
|
233
|
-
(0,
|
|
233
|
+
(0, core_utils_1.assert)(localPathsToUse !== undefined, 0x6fe /* summarize didn't run for node */);
|
|
234
234
|
const summary = new summarizerNodeUtils_1.SummaryNode({
|
|
235
235
|
...localPathsToUse,
|
|
236
236
|
referenceSequenceNumber: this.wipReferenceSequenceNumber,
|
|
@@ -260,19 +260,12 @@ class SummarizerNode {
|
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,
|
|
263
|
-
* it becomes the latest summary. If the current summary is already ahead
|
|
264
|
-
*
|
|
263
|
+
* it becomes the latest summary. If the current summary is already ahead, we skip the update.
|
|
264
|
+
* If the current summary is behind, then we do not refresh.
|
|
265
265
|
*
|
|
266
|
-
* @returns
|
|
267
|
-
*
|
|
268
|
-
* 1. The latest summary was not updated.
|
|
269
|
-
*
|
|
270
|
-
* 2. The latest summary was updated and the summary corresponding to the params was being tracked.
|
|
271
|
-
*
|
|
272
|
-
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
|
|
273
|
-
* case, the latest summary is updated based on the downloaded snapshot which is also returned.
|
|
266
|
+
* @returns true if the summary is tracked by this node, false otherwise.
|
|
274
267
|
*/
|
|
275
|
-
async refreshLatestSummary(proposalHandle, summaryRefSeq
|
|
268
|
+
async refreshLatestSummary(proposalHandle, summaryRefSeq) {
|
|
276
269
|
const eventProps = {
|
|
277
270
|
proposalHandle,
|
|
278
271
|
summaryRefSeq,
|
|
@@ -289,57 +282,18 @@ class SummarizerNode {
|
|
|
289
282
|
inProgressSummaryRefSeq: this.wipReferenceSequenceNumber,
|
|
290
283
|
});
|
|
291
284
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
eventProps.wasSummaryTracked = true;
|
|
297
|
-
eventProps.latestSummaryUpdated = true;
|
|
298
|
-
event.end(eventProps);
|
|
299
|
-
return {
|
|
300
|
-
latestSummaryUpdated: true,
|
|
301
|
-
wasSummaryTracked: true,
|
|
302
|
-
summaryRefSeq,
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
const props = {
|
|
306
|
-
summaryRefSeq,
|
|
307
|
-
pendingSize: this.pendingSummaries.size ?? undefined,
|
|
308
|
-
};
|
|
309
|
-
this.logger.sendTelemetryEvent({
|
|
310
|
-
eventName: "PendingSummaryNotFound",
|
|
311
|
-
proposalHandle,
|
|
312
|
-
referenceSequenceNumber: this.referenceSequenceNumber,
|
|
313
|
-
details: JSON.stringify(props),
|
|
314
|
-
});
|
|
285
|
+
let isSummaryTracked = false;
|
|
286
|
+
let isSummaryNewer = false;
|
|
287
|
+
if (summaryRefSeq > this.referenceSequenceNumber) {
|
|
288
|
+
isSummaryNewer = true;
|
|
315
289
|
}
|
|
316
|
-
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return { latestSummaryUpdated: false };
|
|
290
|
+
const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);
|
|
291
|
+
if (maybeSummaryNode !== undefined) {
|
|
292
|
+
this.refreshLatestSummaryFromPending(proposalHandle, maybeSummaryNode.referenceSequenceNumber);
|
|
293
|
+
isSummaryTracked = true;
|
|
321
294
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const { snapshotTree, snapshotRefSeq: fetchedSnapshotRefSeq } = await fetchLatestSnapshot();
|
|
325
|
-
// Possible re-entrancy. We may have updated latest summary state while fetching the snapshot. If the fetched
|
|
326
|
-
// snapshot is older than the latest tracked summary, ignore it.
|
|
327
|
-
if (this.referenceSequenceNumber >= fetchedSnapshotRefSeq) {
|
|
328
|
-
eventProps.latestSummaryUpdated = false;
|
|
329
|
-
event.end(eventProps);
|
|
330
|
-
return { latestSummaryUpdated: false };
|
|
331
|
-
}
|
|
332
|
-
await this.refreshLatestSummaryFromSnapshot(fetchedSnapshotRefSeq, snapshotTree, undefined, summarizerNodeUtils_1.EscapedPath.create(""), correlatedSummaryLogger, readAndParseBlob);
|
|
333
|
-
eventProps.latestSummaryUpdated = true;
|
|
334
|
-
eventProps.wasSummaryTracked = false;
|
|
335
|
-
eventProps.summaryRefSeq = fetchedSnapshotRefSeq;
|
|
336
|
-
event.end(eventProps);
|
|
337
|
-
return {
|
|
338
|
-
latestSummaryUpdated: true,
|
|
339
|
-
wasSummaryTracked: false,
|
|
340
|
-
snapshotTree,
|
|
341
|
-
summaryRefSeq: fetchedSnapshotRefSeq,
|
|
342
|
-
};
|
|
295
|
+
event.end({ ...eventProps, isSummaryNewer, pendingSummaryFound: isSummaryTracked });
|
|
296
|
+
return { isSummaryTracked, isSummaryNewer };
|
|
343
297
|
}, { start: true, end: true, cancel: "error" });
|
|
344
298
|
}
|
|
345
299
|
/**
|
|
@@ -352,11 +306,11 @@ class SummarizerNode {
|
|
|
352
306
|
const summaryNode = this.pendingSummaries.get(proposalHandle);
|
|
353
307
|
if (summaryNode === undefined) {
|
|
354
308
|
// This should only happen if parent skipped recursion AND no prior summary existed.
|
|
355
|
-
(0,
|
|
309
|
+
(0, core_utils_1.assert)(this._latestSummary === undefined, 0x1a6 /* "Not found pending summary, but this node has previously completed a summary" */);
|
|
356
310
|
return;
|
|
357
311
|
}
|
|
358
312
|
else {
|
|
359
|
-
(0,
|
|
313
|
+
(0, core_utils_1.assert)(referenceSequenceNumber === summaryNode.referenceSequenceNumber, 0x1a7 /* Pending summary reference sequence number should be consistent */);
|
|
360
314
|
// Clear earlier pending summaries
|
|
361
315
|
this.pendingSummaries.delete(proposalHandle);
|
|
362
316
|
}
|
|
@@ -367,37 +321,6 @@ class SummarizerNode {
|
|
|
367
321
|
child.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);
|
|
368
322
|
}
|
|
369
323
|
}
|
|
370
|
-
async refreshLatestSummaryFromSnapshot(referenceSequenceNumber, snapshotTree, basePath, localPath, correlatedSummaryLogger, readAndParseBlob) {
|
|
371
|
-
// Possible re-entrancy. If we have already seen a summary later than this one, ignore it.
|
|
372
|
-
if (this.referenceSequenceNumber >= referenceSequenceNumber) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
this.refreshLatestSummaryCore(referenceSequenceNumber);
|
|
376
|
-
this._latestSummary = new summarizerNodeUtils_1.SummaryNode({
|
|
377
|
-
referenceSequenceNumber,
|
|
378
|
-
basePath,
|
|
379
|
-
localPath,
|
|
380
|
-
});
|
|
381
|
-
const pathParts = [];
|
|
382
|
-
const { childrenTree, childrenPathPart } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(snapshotTree);
|
|
383
|
-
if (childrenPathPart !== undefined) {
|
|
384
|
-
pathParts.push(childrenPathPart);
|
|
385
|
-
}
|
|
386
|
-
if (pathParts.length > 0) {
|
|
387
|
-
this._latestSummary.additionalPath = summarizerNodeUtils_1.EscapedPath.createAndConcat(pathParts);
|
|
388
|
-
}
|
|
389
|
-
// Propagate update to all child nodes
|
|
390
|
-
const pathForChildren = this._latestSummary.fullPathForChildren;
|
|
391
|
-
await Promise.all(Array.from(this.children)
|
|
392
|
-
.filter(([id]) => {
|
|
393
|
-
// Assuming subtrees missing from snapshot are newer than the snapshot,
|
|
394
|
-
// but might be nice to assert this using earliest seq for node.
|
|
395
|
-
return childrenTree.trees[id] !== undefined;
|
|
396
|
-
})
|
|
397
|
-
.map(async ([id, child]) => {
|
|
398
|
-
return child.refreshLatestSummaryFromSnapshot(referenceSequenceNumber, childrenTree.trees[id], pathForChildren, summarizerNodeUtils_1.EscapedPath.create(id), correlatedSummaryLogger, readAndParseBlob);
|
|
399
|
-
}));
|
|
400
|
-
}
|
|
401
324
|
refreshLatestSummaryCore(referenceSequenceNumber) {
|
|
402
325
|
for (const [key, value] of this.pendingSummaries) {
|
|
403
326
|
if (value.referenceSequenceNumber < referenceSequenceNumber) {
|
|
@@ -443,7 +366,7 @@ class SummarizerNode {
|
|
|
443
366
|
* Attach information if it is created from an attach op.
|
|
444
367
|
*/
|
|
445
368
|
createParam, config = {}) {
|
|
446
|
-
(0,
|
|
369
|
+
(0, core_utils_1.assert)(!this.children.has(id), 0x1ab /* "Create SummarizerNode child already exists" */);
|
|
447
370
|
const createDetails = this.getCreateDetailsForChild(id, createParam);
|
|
448
371
|
const child = new SummarizerNode(this.logger, summarizeInternalFn, config, createDetails.changeSequenceNumber, createDetails.latestSummary, createDetails.initialSummary, this.wipSummaryLogger, createDetails.telemetryNodeId);
|
|
449
372
|
// There may be additional state that has to be updated in this child. For example, if a summary is being
|
|
@@ -487,7 +410,7 @@ class SummarizerNode {
|
|
|
487
410
|
}
|
|
488
411
|
case runtime_definitions_1.CreateSummarizerNodeSource.FromSummary: {
|
|
489
412
|
if (this.initialSummary === undefined) {
|
|
490
|
-
(0,
|
|
413
|
+
(0, core_utils_1.assert)(!!parentLatestSummary, 0x1ac /* "Cannot create child from summary if parent does not have latest summary" */);
|
|
491
414
|
}
|
|
492
415
|
// fallthrough to local
|
|
493
416
|
}
|
|
@@ -497,16 +420,16 @@ class SummarizerNode {
|
|
|
497
420
|
let childSummary;
|
|
498
421
|
if (parentInitialSummary.summary !== undefined) {
|
|
499
422
|
const { childrenTree } = (0, summarizerNodeUtils_1.parseSummaryTreeForSubtrees)(parentInitialSummary.summary.summary);
|
|
500
|
-
(0,
|
|
423
|
+
(0, core_utils_1.assert)(childrenTree.type === protocol_definitions_1.SummaryType.Tree, 0x1d6 /* "Parent summary object is not a tree" */);
|
|
501
424
|
childSummary = childrenTree.tree[id];
|
|
502
425
|
}
|
|
503
426
|
if (createParam.type === runtime_definitions_1.CreateSummarizerNodeSource.FromSummary) {
|
|
504
427
|
// Locally created would not have differential subtree.
|
|
505
|
-
(0,
|
|
428
|
+
(0, core_utils_1.assert)(!!childSummary, 0x1ad /* "Missing child summary tree" */);
|
|
506
429
|
}
|
|
507
430
|
let childSummaryWithStats;
|
|
508
431
|
if (childSummary !== undefined) {
|
|
509
|
-
(0,
|
|
432
|
+
(0, core_utils_1.assert)(childSummary.type === protocol_definitions_1.SummaryType.Tree, 0x1ae /* "Child summary object is not a tree" */);
|
|
510
433
|
childSummaryWithStats = {
|
|
511
434
|
summary: childSummary,
|
|
512
435
|
stats: (0, runtime_utils_1.calculateStats)(childSummary),
|
|
@@ -524,7 +447,7 @@ class SummarizerNode {
|
|
|
524
447
|
}
|
|
525
448
|
default: {
|
|
526
449
|
const type = createParam.type;
|
|
527
|
-
(0,
|
|
450
|
+
(0, core_utils_1.unreachableCase)(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);
|
|
528
451
|
}
|
|
529
452
|
}
|
|
530
453
|
const childtelemetryNodeId = `${this.telemetryNodeId ?? ""}/${id}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,6EAU6C;AAC7C,+EAK8C;AAC9C,qEAOyC;AACzC,+DAAuE;AACvE,iEAKuC;AACvC,+DAW+B;AAI/B;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAiB1B;;;OAGG;IACH,YACC,UAAgC,EACf,mBAAwC,EACzD,MAA6B,EACrB,qBAA6B;IACrC,8CAA8C;IACtC,cAA4B,EACnB,cAAgC,EACvC,gBAAuC;IACjD,oEAAoE;IAC1D,eAAwB;QARjB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAEjD,0BAAqB,GAArB,qBAAqB,CAAQ;QAE7B,mBAAc,GAAd,cAAc,CAAc;QACnB,mBAAc,GAAd,cAAc,CAAkB;QACvC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAEvC,oBAAe,GAAf,eAAe,CAAS;QAtBhB,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAC7C,qBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAG7D,qBAAgB,GAAG,KAAK,CAAC;QAoBhC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;QACpD,6EAA6E;QAC7E,IAAI,CAAC,MAAM,GAAG,IAAA,mCAAiB,EAAC;YAC/B,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE;gBACX,GAAG,EAAE,IAAA,kCAAgB,EAAC,EAAE,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;aACnD;SACD,CAAC,CAAC;IACJ,CAAC;IAxCD;;;OAGG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,cAAc,EAAE,uBAAuB,IAAI,CAAC,CAAC;IAC1D,CAAC;IAoCM,YAAY,C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ACpB,uBAAuB,KAAK,SAAS;IACpC,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,iCAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,EACrD,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,sBAAsB,EAChC,EAAE,CAAC,qBAAqB,CACxB,CAAC;AAlBU,QAAA,wBAAwB,4BAkBlC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, ITelemetryErrorEvent } from \"@fluidframework/core-interfaces\";\nimport {\n\tISummarizerNode,\n\tISummarizerNodeConfig,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tSummarizeInternalFn,\n\tITelemetryContext,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tISequencedDocumentMessage,\n\tSummaryType,\n\tISnapshotTree,\n\tSummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport {\n\tconvertToSummaryTree,\n\tcalculateStats,\n\tmergeStats,\n\tReadAndParseBlob,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tEscapedPath,\n\tICreateChildDetails,\n\tIFetchSnapshotResult,\n\tIInitialSummary,\n\tISummarizerNodeRootContract,\n\tparseSummaryForSubtrees,\n\tparseSummaryTreeForSubtrees,\n\tRefreshSummaryResult,\n\tSummaryNode,\n\tValidateSummaryResult,\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\t/**\n\t * The reference sequence number of the most recent acked summary.\n\t * Returns 0 if there is not yet an acked summary.\n\t */\n\tpublic get referenceSequenceNumber() {\n\t\treturn this._latestSummary?.referenceSequenceNumber ?? 0;\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\tprotected readonly pendingSummaries = new Map<string, SummaryNode>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\tprivate wipLocalPaths: { localPath: EscapedPath; additionalPath?: EscapedPath } | undefined;\n\tprivate wipSkipRecursion = false;\n\n\tprotected readonly logger: ITelemetryLoggerExt;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfig,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/** Undefined means created without summary */\n\t\tprivate _latestSummary?: SummaryNode,\n\t\tprivate readonly initialSummary?: IInitialSummary,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/** A unique id of this node to be logged when sending telemetry. */\n\t\tprotected telemetryNodeId?: string,\n\t) {\n\t\tthis.canReuseHandle = config.canReuseHandle ?? true;\n\t\t// All logs posted by the summarizer node should include the telemetryNodeId.\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: baseLogger,\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({ id: this.telemetryNodeId }),\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryBaseLogger) {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger === undefined,\n\t\t\t0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber === undefined,\n\t\t\t0x1a0 /* \"Already tracking a summary\" */,\n\t\t);\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.startSummary(referenceSequenceNumber, this.wipSummaryLogger);\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tassert(\n\t\t\tthis.isSummaryInProgress(),\n\t\t\t0x1a1 /* \"summarize should not be called when not tracking the summary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x1a2 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */,\n\t\t);\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (this.canReuseHandle && !fullTree && !this.hasChanged()) {\n\t\t\tconst latestSummary = this._latestSummary;\n\t\t\tif (latestSummary !== undefined) {\n\t\t\t\tthis.wipLocalPaths = {\n\t\t\t\t\tlocalPath: latestSummary.localPath,\n\t\t\t\t\tadditionalPath: latestSummary.additionalPath,\n\t\t\t\t};\n\t\t\t\tthis.wipSkipRecursion = true;\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: latestSummary.fullPath.path,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// This assert is the same the other 0a1x1 assert `isSummaryInProgress`, the only difference is that typescript\n\t\t// complains if this assert isn't done this way\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t);\n\t\tconst incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined =\n\t\t\tthis._latestSummary !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\tlatestSummarySequenceNumber: this._latestSummary.referenceSequenceNumber,\n\t\t\t\t\t\t// TODO: remove summaryPath\n\t\t\t\t\t\tsummaryPath: this._latestSummary.fullPath.path,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrue,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.wipLocalPaths = { localPath: EscapedPath.create(result.id) };\n\t\tif (result.pathPartsForChildren !== undefined) {\n\t\t\tthis.wipLocalPaths.additionalPath = EscapedPath.createAndConcat(\n\t\t\t\tresult.pathPartsForChildren,\n\t\t\t);\n\t\t}\n\t\treturn { summary: result.summary, stats: result.stats };\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct, i.e., summarize should have run for all non-skipped\n\t * nodes. This will only be called for the root summarizer node and is called by it recursively on all child nodes.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tpublic validateSummary(): ValidateSummaryResult {\n\t\treturn this.validateSummaryCore(false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., summarize should have run for all\n\t * non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotSummarize\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\tif (parentSkipRecursion) {\n\t\t\treturn { success: true };\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst result = child.validateSummaryCore(this.wipSkipRecursion || parentSkipRecursion);\n\t\t\t// If any child fails, return the failure.\n\t\t\tif (!result.success) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn { success: true };\n\t}\n\n\tprivate wasSummarizeMissed(parentSkipRecursion: boolean): boolean {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x6fc /* wipSummaryLogger should have been set in startSummary or ctor */,\n\t\t);\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x6fd /* Not tracking a summary */);\n\n\t\t// If the parent node skipped recursion, it did not call summarize on this node. So, summarize was not missed\n\t\t// but was intentionally not called.\n\t\t// Otherwise, summarize should have been called on this node and wipLocalPaths must be set.\n\t\tif (parentSkipRecursion || this.wipLocalPaths !== undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * The absence of wip local path indicates that summarize was not called for this node. Return failure.\n\t\t * This can happen if:\n\t\t * 1. A child node was created after summarize was already called on the parent. For example, a data store\n\t\t * is realized (loaded) after summarize was called on it creating summarizer nodes for its DDSes. In this case,\n\t\t * parentSkipRecursion will be true and the if block above would handle it.\n\t\t * 2. A new node was created but summarize was never called on it. This can mean that the summary that is\n\t\t * generated may not have the data from this node. We should not continue, log and throw an error. This\n\t\t * will help us identify these cases and take appropriate action.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending summary\n\t * queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t */\n\tpublic completeSummary(proposalHandle: string, validate: boolean) {\n\t\tthis.completeSummaryCore(\n\t\t\tproposalHandle,\n\t\t\tundefined /* parentPath */,\n\t\t\tfalse /* parentSkipRecursion */,\n\t\t\tvalidate,\n\t\t);\n\t}\n\n\t/**\n\t * Recursive implementation for completeSummary, with additional internal-only parameters.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t * @param validate - true to validate that the in-progress summary is correct for all nodes.\n\t */\n\tprotected completeSummaryCore(\n\t\tproposalHandle: string,\n\t\tparentPath: EscapedPath | undefined,\n\t\tparentSkipRecursion: boolean,\n\t\tvalidate: boolean,\n\t) {\n\t\tif (validate && this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\tthis.throwUnexpectedError({\n\t\t\t\teventName: \"NodeDidNotSummarize\",\n\t\t\t\tproposalHandle,\n\t\t\t});\n\t\t}\n\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* \"Not tracking a summary\" */);\n\t\tlet localPathsToUse = this.wipLocalPaths;\n\n\t\tif (parentSkipRecursion) {\n\t\t\tconst latestSummary = this._latestSummary;\n\t\t\tif (latestSummary !== undefined) {\n\t\t\t\t// This case the parent node created a failure summary or was reused.\n\t\t\t\t// This node and all children should only try to reference their path\n\t\t\t\t// by its last known good state in the actual summary tree.\n\t\t\t\t// If parent fails or is reused, the child summarize is not called so\n\t\t\t\t// it did not get a chance to change its paths.\n\t\t\t\t// In this case, essentially only propagate the new summary ref seq num.\n\t\t\t\tlocalPathsToUse = {\n\t\t\t\t\tlocalPath: latestSummary.localPath,\n\t\t\t\t\tadditionalPath: latestSummary.additionalPath,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t\t// This node and all children should consider themselves as still not\n\t\t\t\t// having a successful summary yet.\n\t\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\t\tthis.clearSummary();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// If localPathsToUse is undefined, it means summarize didn't run for this node and in that case the validate\n\t\t// step should have failed.\n\t\tassert(localPathsToUse !== undefined, 0x6fe /* summarize didn't run for node */);\n\t\tconst summary = new SummaryNode({\n\t\t\t...localPathsToUse,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\tbasePath: parentPath,\n\t\t});\n\t\tconst fullPathForChildren = summary.fullPathForChildren;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(\n\t\t\t\tproposalHandle,\n\t\t\t\tfullPathForChildren,\n\t\t\t\tthis.wipSkipRecursion || parentSkipRecursion,\n\t\t\t\tvalidate,\n\t\t\t);\n\t\t}\n\t\t// Note that this overwrites existing pending summary with\n\t\t// the same proposalHandle. If proposalHandle is something like\n\t\t// a hash or unique identifier, this should be fine. If storage\n\t\t// can return the same proposalHandle for a different summary,\n\t\t// this should still be okay, because we should be proposing the\n\t\t// newer one later which would have to overwrite the previous one.\n\t\tthis.pendingSummaries.set(proposalHandle, summary);\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary() {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipLocalPaths = undefined;\n\t\tthis.wipSkipRecursion = false;\n\t\tthis.wipSummaryLogger = undefined;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.clearSummary();\n\t\t}\n\t}\n\n\t/**\n\t * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n\t * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),\n\t * we skip the update. Otherwise, we fetch the latest snapshot and update latest summary based off of that.\n\t *\n\t * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:\n\t *\n\t * 1. The latest summary was not updated.\n\t *\n\t * 2. The latest summary was updated and the summary corresponding to the params was being tracked.\n\t *\n\t * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this\n\t * case, the latest summary is updated based on the downloaded snapshot which is also returned.\n\t */\n\tpublic async refreshLatestSummary(\n\t\tproposalHandle: string | undefined,\n\t\tsummaryRefSeq: number,\n\t\tfetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,\n\t\treadAndParseBlob: ReadAndParseBlob,\n\t\tcorrelatedSummaryLogger: ITelemetryLoggerExt,\n\t): Promise<RefreshSummaryResult> {\n\t\tconst eventProps: {\n\t\t\tproposalHandle: string | undefined;\n\t\t\tsummaryRefSeq: number;\n\t\t\treferenceSequenceNumber: number;\n\t\t\tlatestSummaryUpdated?: boolean;\n\t\t\twasSummaryTracked?: boolean;\n\t\t} = {\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t};\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"refreshLatestSummary\",\n\t\t\t\t...eventProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// Refresh latest summary should not happen while a summary is in progress. If it does, it can result\n\t\t\t\t// in inconsistent state, so, we should not continue;\n\t\t\t\tif (this.isSummaryInProgress()) {\n\t\t\t\t\tthrow new LoggingError(\"UnexpectedRefreshDuringSummarize\", {\n\t\t\t\t\t\tinProgressSummaryRefSeq: this.wipReferenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (proposalHandle !== undefined) {\n\t\t\t\t\tconst maybeSummaryNode = this.pendingSummaries.get(proposalHandle);\n\n\t\t\t\t\tif (maybeSummaryNode !== undefined) {\n\t\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\t\tmaybeSummaryNode.referenceSequenceNumber,\n\t\t\t\t\t\t);\n\t\t\t\t\t\teventProps.wasSummaryTracked = true;\n\t\t\t\t\t\teventProps.latestSummaryUpdated = true;\n\t\t\t\t\t\tevent.end(eventProps);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlatestSummaryUpdated: true,\n\t\t\t\t\t\t\twasSummaryTracked: true,\n\t\t\t\t\t\t\tsummaryRefSeq,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst props = {\n\t\t\t\t\t\tsummaryRefSeq,\n\t\t\t\t\t\tpendingSize: this.pendingSummaries.size ?? undefined,\n\t\t\t\t\t};\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"PendingSummaryNotFound\",\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// If the summary for which refresh is called is older than the latest tracked summary, ignore it.\n\t\t\t\tif (this.referenceSequenceNumber >= summaryRefSeq) {\n\t\t\t\t\teventProps.latestSummaryUpdated = false;\n\t\t\t\t\tevent.end(eventProps);\n\t\t\t\t\treturn { latestSummaryUpdated: false };\n\t\t\t\t}\n\n\t\t\t\t// Fetch the latest snapshot and refresh state from it. Note that we need to use the reference sequence number\n\t\t\t\t// of the fetched snapshot and not the \"summaryRefSeq\" that was passed in.\n\t\t\t\tconst { snapshotTree, snapshotRefSeq: fetchedSnapshotRefSeq } =\n\t\t\t\t\tawait fetchLatestSnapshot();\n\n\t\t\t\t// Possible re-entrancy. We may have updated latest summary state while fetching the snapshot. If the fetched\n\t\t\t\t// snapshot is older than the latest tracked summary, ignore it.\n\t\t\t\tif (this.referenceSequenceNumber >= fetchedSnapshotRefSeq) {\n\t\t\t\t\teventProps.latestSummaryUpdated = false;\n\t\t\t\t\tevent.end(eventProps);\n\t\t\t\t\treturn { latestSummaryUpdated: false };\n\t\t\t\t}\n\n\t\t\t\tawait this.refreshLatestSummaryFromSnapshot(\n\t\t\t\t\tfetchedSnapshotRefSeq,\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tundefined,\n\t\t\t\t\tEscapedPath.create(\"\"),\n\t\t\t\t\tcorrelatedSummaryLogger,\n\t\t\t\t\treadAndParseBlob,\n\t\t\t\t);\n\n\t\t\t\teventProps.latestSummaryUpdated = true;\n\t\t\t\teventProps.wasSummaryTracked = false;\n\t\t\t\teventProps.summaryRefSeq = fetchedSnapshotRefSeq;\n\t\t\t\tevent.end(eventProps);\n\t\t\t\treturn {\n\t\t\t\t\tlatestSummaryUpdated: true,\n\t\t\t\t\twasSummaryTracked: false,\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tsummaryRefSeq: fetchedSnapshotRefSeq,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"error\" },\n\t\t);\n\t}\n\t/**\n\t * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n\t * from the state in the pending summary queue.\n\t * @param proposalHandle - Handle for the current proposal.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\tif (summaryNode === undefined) {\n\t\t\t// This should only happen if parent skipped recursion AND no prior summary existed.\n\t\t\tassert(\n\t\t\t\tthis._latestSummary === undefined,\n\t\t\t\t0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\treferenceSequenceNumber === summaryNode.referenceSequenceNumber,\n\t\t\t\t0x1a7 /* Pending summary reference sequence number should be consistent */,\n\t\t\t);\n\n\t\t\t// Clear earlier pending summaries\n\t\t\tthis.pendingSummaries.delete(proposalHandle);\n\t\t}\n\n\t\tthis.refreshLatestSummaryCore(referenceSequenceNumber);\n\n\t\tthis._latestSummary = summaryNode;\n\t\t// Propagate update to all child nodes\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t\t}\n\t}\n\n\tprotected async refreshLatestSummaryFromSnapshot(\n\t\treferenceSequenceNumber: number,\n\t\tsnapshotTree: ISnapshotTree,\n\t\tbasePath: EscapedPath | undefined,\n\t\tlocalPath: EscapedPath,\n\t\tcorrelatedSummaryLogger: ITelemetryLoggerExt,\n\t\treadAndParseBlob: ReadAndParseBlob,\n\t): Promise<void> {\n\t\t// Possible re-entrancy. If we have already seen a summary later than this one, ignore it.\n\t\tif (this.referenceSequenceNumber >= referenceSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.refreshLatestSummaryCore(referenceSequenceNumber);\n\n\t\tthis._latestSummary = new SummaryNode({\n\t\t\treferenceSequenceNumber,\n\t\t\tbasePath,\n\t\t\tlocalPath,\n\t\t});\n\n\t\tconst pathParts: string[] = [];\n\t\tconst { childrenTree, childrenPathPart } = parseSummaryForSubtrees(snapshotTree);\n\t\tif (childrenPathPart !== undefined) {\n\t\t\tpathParts.push(childrenPathPart);\n\t\t}\n\n\t\tif (pathParts.length > 0) {\n\t\t\tthis._latestSummary.additionalPath = EscapedPath.createAndConcat(pathParts);\n\t\t}\n\n\t\t// Propagate update to all child nodes\n\t\tconst pathForChildren = this._latestSummary.fullPathForChildren;\n\t\tawait Promise.all(\n\t\t\tArray.from(this.children)\n\t\t\t\t.filter(([id]) => {\n\t\t\t\t\t// Assuming subtrees missing from snapshot are newer than the snapshot,\n\t\t\t\t\t// but might be nice to assert this using earliest seq for node.\n\t\t\t\t\treturn childrenTree.trees[id] !== undefined;\n\t\t\t\t})\n\t\t\t\t.map(async ([id, child]) => {\n\t\t\t\t\treturn child.refreshLatestSummaryFromSnapshot(\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\tchildrenTree.trees[id],\n\t\t\t\t\t\tpathForChildren,\n\t\t\t\t\t\tEscapedPath.create(id),\n\t\t\t\t\t\tcorrelatedSummaryLogger,\n\t\t\t\t\t\treadAndParseBlob,\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t);\n\t}\n\n\tprivate refreshLatestSummaryCore(referenceSequenceNumber: number): void {\n\t\tfor (const [key, value] of this.pendingSummaries) {\n\t\t\tif (value.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateBaseSummaryState(snapshot: ISnapshotTree) {\n\t\t// Check base summary to see if it has any additional path parts\n\t\t// separating child SummarizerNodes. Checks for .channels subtrees.\n\t\tconst { childrenPathPart } = parseSummaryForSubtrees(snapshot);\n\t\tif (childrenPathPart !== undefined && this._latestSummary !== undefined) {\n\t\t\tthis._latestSummary.additionalPath = EscapedPath.create(childrenPathPart);\n\t\t}\n\t}\n\n\tpublic recordChange(op: ISequencedDocumentMessage): void {\n\t\tthis.invalidate(op.sequenceNumber);\n\t}\n\n\tpublic invalidate(sequenceNumber: number): void {\n\t\tif (sequenceNumber > this._changeSequenceNumber) {\n\t\t\tthis._changeSequenceNumber = sequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * True if a change has been recorded with sequence number exceeding\n\t * the latest successfully acked summary reference sequence number.\n\t * False implies that the previous summary can be reused.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this._changeSequenceNumber > this.referenceSequenceNumber;\n\t}\n\n\tpublic get latestSummary(): Readonly<SummaryNode> | undefined {\n\t\treturn this._latestSummary;\n\t}\n\n\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/** Summarize function */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/** Initial id or path part of this node */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfig = {},\n\t): ISummarizerNode {\n\t\tassert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNode(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.latestSummary,\n\t\t\tcreateDetails.initialSummary,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n\t\t// have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\tpublic getChild(id: string): ISummarizerNode | undefined {\n\t\treturn this.children.get(id);\n\t}\n\n\t/**\n\t * Returns the details needed to create a child node.\n\t * @param id - Initial id or path part of the child node.\n\t * @param createParam - Information needed to create the node.\n\t * @returns the details needed to create the child node.\n\t */\n\tprotected getCreateDetailsForChild(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): ICreateChildDetails {\n\t\tlet initialSummary: IInitialSummary | undefined;\n\t\tlet latestSummary: SummaryNode | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLatestSummary = this._latestSummary;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLatestSummary !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLatestSummary.referenceSequenceNumber\n\t\t\t\t) {\n\t\t\t\t\t// Prioritize latest summary if it was after this node was attached.\n\t\t\t\t\tlatestSummary = parentLatestSummary.createForChild(id);\n\t\t\t\t} else {\n\t\t\t\t\tconst summary = convertToSummaryTree(\n\t\t\t\t\t\tcreateParam.snapshot,\n\t\t\t\t\t) as ISummaryTreeWithStats;\n\t\t\t\t\tinitialSummary = {\n\t\t\t\t\t\tsequenceNumber: createParam.sequenceNumber,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tsummary,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tchangeSequenceNumber = createParam.sequenceNumber;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.FromSummary: {\n\t\t\t\tif (this.initialSummary === undefined) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!parentLatestSummary,\n\t\t\t\t\t\t0x1ac /* \"Cannot create child from summary if parent does not have latest summary\" */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// fallthrough to local\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tconst parentInitialSummary = this.initialSummary;\n\t\t\t\tif (parentInitialSummary !== undefined) {\n\t\t\t\t\tlet childSummary: SummaryObject | undefined;\n\t\t\t\t\tif (parentInitialSummary.summary !== undefined) {\n\t\t\t\t\t\tconst { childrenTree } = parseSummaryTreeForSubtrees(\n\t\t\t\t\t\t\tparentInitialSummary.summary.summary,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildrenTree.type === SummaryType.Tree,\n\t\t\t\t\t\t\t0x1d6 /* \"Parent summary object is not a tree\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tchildSummary = childrenTree.tree[id];\n\t\t\t\t\t}\n\t\t\t\t\tif (createParam.type === CreateSummarizerNodeSource.FromSummary) {\n\t\t\t\t\t\t// Locally created would not have differential subtree.\n\t\t\t\t\t\tassert(!!childSummary, 0x1ad /* \"Missing child summary tree\" */);\n\t\t\t\t\t}\n\t\t\t\t\tlet childSummaryWithStats: ISummaryTreeWithStats | undefined;\n\t\t\t\t\tif (childSummary !== undefined) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildSummary.type === SummaryType.Tree,\n\t\t\t\t\t\t\t0x1ae /* \"Child summary object is not a tree\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tchildSummaryWithStats = {\n\t\t\t\t\t\t\tsummary: childSummary,\n\t\t\t\t\t\t\tstats: calculateStats(childSummary),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tinitialSummary = {\n\t\t\t\t\t\tsequenceNumber: parentInitialSummary.sequenceNumber,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tsummary: childSummaryWithStats,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlatestSummary = parentLatestSummary?.createForChild(id);\n\t\t\t\tchangeSequenceNumber = parentLatestSummary?.referenceSequenceNumber ?? -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n\t\t\t\tunreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst childtelemetryNodeId = `${this.telemetryNodeId ?? \"\"}/${id}`;\n\n\t\treturn {\n\t\t\tinitialSummary,\n\t\t\tlatestSummary,\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childtelemetryNodeId,\n\t\t};\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t *\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNode, id: string) {\n\t\t// If a summary is in progress, this child was created after the summary started. So, we need to update the\n\t\t// child's summary state as well.\n\t\tif (this.isSummaryInProgress()) {\n\t\t\tchild.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n\t\t}\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child._latestSummary !== undefined) {\n\t\t\tfor (const [key, value] of this.pendingSummaries.entries()) {\n\t\t\t\tconst newLatestSummaryNode = new SummaryNode({\n\t\t\t\t\treferenceSequenceNumber: value.referenceSequenceNumber,\n\t\t\t\t\tbasePath: child._latestSummary.basePath,\n\t\t\t\t\tlocalPath: child._latestSummary.localPath,\n\t\t\t\t});\n\n\t\t\t\tchild.addPendingSummary(key, newLatestSummaryNode);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, summary: SummaryNode) {\n\t\tthis.pendingSummaries.set(key, summary);\n\t}\n\n\t/**\n\t * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n\t */\n\tpublic isSummaryInProgress(): boolean {\n\t\treturn this.wipReferenceSequenceNumber !== undefined;\n\t}\n\n\t/**\n\t * Creates and throws an error due to unexpected conditions.\n\t */\n\tprotected throwUnexpectedError(eventProps: ITelemetryErrorEvent): never {\n\t\tconst error = new LoggingError(eventProps.eventName, {\n\t\t\t...eventProps,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tid: this.telemetryNodeId,\n\t\t\t}),\n\t\t});\n\t\tthis.logger.sendErrorEvent(eventProps, error);\n\t\tthrow error;\n\t}\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\tlogger: ITelemetryLoggerExt,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfig = {},\n): IRootSummarizerNode =>\n\tnew SummarizerNode(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber === undefined\n\t\t\t? undefined\n\t\t\t: SummaryNode.createForRoot(referenceSequenceNumber),\n\t\tundefined /* initialSummary */,\n\t\tundefined /* wipSummaryLogger */,\n\t\t\"\" /* telemetryNodeId */,\n\t);\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,6EAU6C;AAC7C,+EAK8C;AAC9C,qEAOyC;AACzC,2DAAqE;AACrE,iEAAiG;AACjG,+DAU+B;AAI/B;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAiB1B;;;OAGG;IACH,YACC,UAAgC,EACf,mBAAwC,EACzD,MAA6B,EACrB,qBAA6B;IACrC,8CAA8C;IACtC,cAA4B,EACnB,cAAgC,EACvC,gBAAuC;IACjD,oEAAoE;IAC1D,eAAwB;QARjB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAEjD,0BAAqB,GAArB,qBAAqB,CAAQ;QAE7B,mBAAc,GAAd,cAAc,CAAc;QACnB,mBAAc,GAAd,cAAc,CAAkB;QACvC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAEvC,oBAAe,GAAf,eA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,CAAC;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC;IACb,CAAC;CACD;AA3nBD,wCA2nBC;AAED;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACvC,MAA2B,EAC3B,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAgC,EAAE,EACZ,EAAE,CACxB,IAAI,cAAc,CACjB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS;IACpC,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,iCAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,EACrD,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,sBAAsB,EAChC,EAAE,CAAC,qBAAqB,CACxB,CAAC;AAlBU,QAAA,wBAAwB,4BAkBlC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, ITelemetryErrorEvent } from \"@fluidframework/core-interfaces\";\nimport {\n\tISummarizerNode,\n\tISummarizerNodeConfig,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tSummarizeInternalFn,\n\tITelemetryContext,\n\tIExperimentalIncrementalSummaryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tISequencedDocumentMessage,\n\tSummaryType,\n\tISnapshotTree,\n\tSummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { convertToSummaryTree, calculateStats, mergeStats } from \"@fluidframework/runtime-utils\";\nimport {\n\tEscapedPath,\n\tICreateChildDetails,\n\tIInitialSummary,\n\tIRefreshSummaryResult,\n\tISummarizerNodeRootContract,\n\tparseSummaryForSubtrees,\n\tparseSummaryTreeForSubtrees,\n\tSummaryNode,\n\tValidateSummaryResult,\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\t/**\n\t * The reference sequence number of the most recent acked summary.\n\t * Returns 0 if there is not yet an acked summary.\n\t */\n\tpublic get referenceSequenceNumber() {\n\t\treturn this._latestSummary?.referenceSequenceNumber ?? 0;\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\tprotected readonly pendingSummaries = new Map<string, SummaryNode>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\tprivate wipLocalPaths: { localPath: EscapedPath; additionalPath?: EscapedPath } | undefined;\n\tprivate wipSkipRecursion = false;\n\n\tprotected readonly logger: ITelemetryLoggerExt;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfig,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/** Undefined means created without summary */\n\t\tprivate _latestSummary?: SummaryNode,\n\t\tprivate readonly initialSummary?: IInitialSummary,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/** A unique id of this node to be logged when sending telemetry. */\n\t\tprotected telemetryNodeId?: string,\n\t) {\n\t\tthis.canReuseHandle = config.canReuseHandle ?? true;\n\t\t// All logs posted by the summarizer node should include the telemetryNodeId.\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: baseLogger,\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({ id: this.telemetryNodeId }),\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryBaseLogger) {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger === undefined,\n\t\t\t0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber === undefined,\n\t\t\t0x1a0 /* \"Already tracking a summary\" */,\n\t\t);\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.startSummary(referenceSequenceNumber, this.wipSummaryLogger);\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tassert(\n\t\t\tthis.isSummaryInProgress(),\n\t\t\t0x1a1 /* \"summarize should not be called when not tracking the summary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x1a2 /* \"wipSummaryLogger should have been set in startSummary or ctor\" */,\n\t\t);\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (this.canReuseHandle && !fullTree && !this.hasChanged()) {\n\t\t\tconst latestSummary = this._latestSummary;\n\t\t\tif (latestSummary !== undefined) {\n\t\t\t\tthis.wipLocalPaths = {\n\t\t\t\t\tlocalPath: latestSummary.localPath,\n\t\t\t\t\tadditionalPath: latestSummary.additionalPath,\n\t\t\t\t};\n\t\t\t\tthis.wipSkipRecursion = true;\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: latestSummary.fullPath.path,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// This assert is the same the other 0a1x1 assert `isSummaryInProgress`, the only difference is that typescript\n\t\t// complains if this assert isn't done this way\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t);\n\t\tconst incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined =\n\t\t\tthis._latestSummary !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\tlatestSummarySequenceNumber: this._latestSummary.referenceSequenceNumber,\n\t\t\t\t\t\t// TODO: remove summaryPath\n\t\t\t\t\t\tsummaryPath: this._latestSummary.fullPath.path,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrue,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\tthis.wipLocalPaths = { localPath: EscapedPath.create(result.id) };\n\t\tif (result.pathPartsForChildren !== undefined) {\n\t\t\tthis.wipLocalPaths.additionalPath = EscapedPath.createAndConcat(\n\t\t\t\tresult.pathPartsForChildren,\n\t\t\t);\n\t\t}\n\t\treturn { summary: result.summary, stats: result.stats };\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct, i.e., summarize should have run for all non-skipped\n\t * nodes. This will only be called for the root summarizer node and is called by it recursively on all child nodes.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tpublic validateSummary(): ValidateSummaryResult {\n\t\treturn this.validateSummaryCore(false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., summarize should have run for all\n\t * non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotSummarize\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\tif (parentSkipRecursion) {\n\t\t\treturn { success: true };\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst result = child.validateSummaryCore(this.wipSkipRecursion || parentSkipRecursion);\n\t\t\t// If any child fails, return the failure.\n\t\t\tif (!result.success) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn { success: true };\n\t}\n\n\tprivate wasSummarizeMissed(parentSkipRecursion: boolean): boolean {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x6fc /* wipSummaryLogger should have been set in startSummary or ctor */,\n\t\t);\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x6fd /* Not tracking a summary */);\n\n\t\t// If the parent node skipped recursion, it did not call summarize on this node. So, summarize was not missed\n\t\t// but was intentionally not called.\n\t\t// Otherwise, summarize should have been called on this node and wipLocalPaths must be set.\n\t\tif (parentSkipRecursion || this.wipLocalPaths !== undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * The absence of wip local path indicates that summarize was not called for this node. Return failure.\n\t\t * This can happen if:\n\t\t * 1. A child node was created after summarize was already called on the parent. For example, a data store\n\t\t * is realized (loaded) after summarize was called on it creating summarizer nodes for its DDSes. In this case,\n\t\t * parentSkipRecursion will be true and the if block above would handle it.\n\t\t * 2. A new node was created but summarize was never called on it. This can mean that the summary that is\n\t\t * generated may not have the data from this node. We should not continue, log and throw an error. This\n\t\t * will help us identify these cases and take appropriate action.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending summary\n\t * queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t */\n\tpublic completeSummary(proposalHandle: string, validate: boolean) {\n\t\tthis.completeSummaryCore(\n\t\t\tproposalHandle,\n\t\t\tundefined /* parentPath */,\n\t\t\tfalse /* parentSkipRecursion */,\n\t\t\tvalidate,\n\t\t);\n\t}\n\n\t/**\n\t * Recursive implementation for completeSummary, with additional internal-only parameters.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t * @param validate - true to validate that the in-progress summary is correct for all nodes.\n\t */\n\tprotected completeSummaryCore(\n\t\tproposalHandle: string,\n\t\tparentPath: EscapedPath | undefined,\n\t\tparentSkipRecursion: boolean,\n\t\tvalidate: boolean,\n\t) {\n\t\tif (validate && this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\tthis.throwUnexpectedError({\n\t\t\t\teventName: \"NodeDidNotSummarize\",\n\t\t\t\tproposalHandle,\n\t\t\t});\n\t\t}\n\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* \"Not tracking a summary\" */);\n\t\tlet localPathsToUse = this.wipLocalPaths;\n\n\t\tif (parentSkipRecursion) {\n\t\t\tconst latestSummary = this._latestSummary;\n\t\t\tif (latestSummary !== undefined) {\n\t\t\t\t// This case the parent node created a failure summary or was reused.\n\t\t\t\t// This node and all children should only try to reference their path\n\t\t\t\t// by its last known good state in the actual summary tree.\n\t\t\t\t// If parent fails or is reused, the child summarize is not called so\n\t\t\t\t// it did not get a chance to change its paths.\n\t\t\t\t// In this case, essentially only propagate the new summary ref seq num.\n\t\t\t\tlocalPathsToUse = {\n\t\t\t\t\tlocalPath: latestSummary.localPath,\n\t\t\t\t\tadditionalPath: latestSummary.additionalPath,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t\t// This node and all children should consider themselves as still not\n\t\t\t\t// having a successful summary yet.\n\t\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\t\tthis.clearSummary();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// If localPathsToUse is undefined, it means summarize didn't run for this node and in that case the validate\n\t\t// step should have failed.\n\t\tassert(localPathsToUse !== undefined, 0x6fe /* summarize didn't run for node */);\n\t\tconst summary = new SummaryNode({\n\t\t\t...localPathsToUse,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\tbasePath: parentPath,\n\t\t});\n\t\tconst fullPathForChildren = summary.fullPathForChildren;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(\n\t\t\t\tproposalHandle,\n\t\t\t\tfullPathForChildren,\n\t\t\t\tthis.wipSkipRecursion || parentSkipRecursion,\n\t\t\t\tvalidate,\n\t\t\t);\n\t\t}\n\t\t// Note that this overwrites existing pending summary with\n\t\t// the same proposalHandle. If proposalHandle is something like\n\t\t// a hash or unique identifier, this should be fine. If storage\n\t\t// can return the same proposalHandle for a different summary,\n\t\t// this should still be okay, because we should be proposing the\n\t\t// newer one later which would have to overwrite the previous one.\n\t\tthis.pendingSummaries.set(proposalHandle, summary);\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary() {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipLocalPaths = undefined;\n\t\tthis.wipSkipRecursion = false;\n\t\tthis.wipSummaryLogger = undefined;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.clearSummary();\n\t\t}\n\t}\n\n\t/**\n\t * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n\t * it becomes the latest summary. If the current summary is already ahead, we skip the update.\n\t * If the current summary is behind, then we do not refresh.\n\t *\n\t * @returns true if the summary is tracked by this node, false otherwise.\n\t */\n\tpublic async refreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult> {\n\t\tconst eventProps: {\n\t\t\tproposalHandle: string | undefined;\n\t\t\tsummaryRefSeq: number;\n\t\t\treferenceSequenceNumber: number;\n\t\t\tisSummaryTracked?: boolean;\n\t\t\tpendingSummaryFound?: boolean;\n\t\t} = {\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t};\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"refreshLatestSummary\",\n\t\t\t\t...eventProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// Refresh latest summary should not happen while a summary is in progress. If it does, it can result\n\t\t\t\t// in inconsistent state, so, we should not continue;\n\t\t\t\tif (this.isSummaryInProgress()) {\n\t\t\t\t\tthrow new LoggingError(\"UnexpectedRefreshDuringSummarize\", {\n\t\t\t\t\t\tinProgressSummaryRefSeq: this.wipReferenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tlet isSummaryTracked = false;\n\t\t\t\tlet isSummaryNewer = false;\n\n\t\t\t\tif (summaryRefSeq > this.referenceSequenceNumber) {\n\t\t\t\t\tisSummaryNewer = true;\n\t\t\t\t}\n\t\t\t\tconst maybeSummaryNode = this.pendingSummaries.get(proposalHandle);\n\t\t\t\tif (maybeSummaryNode !== undefined) {\n\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\tmaybeSummaryNode.referenceSequenceNumber,\n\t\t\t\t\t);\n\t\t\t\t\tisSummaryTracked = true;\n\t\t\t\t}\n\t\t\t\tevent.end({ ...eventProps, isSummaryNewer, pendingSummaryFound: isSummaryTracked });\n\t\t\t\treturn { isSummaryTracked, isSummaryNewer };\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"error\" },\n\t\t);\n\t}\n\t/**\n\t * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n\t * from the state in the pending summary queue.\n\t * @param proposalHandle - Handle for the current proposal.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\tconst summaryNode = this.pendingSummaries.get(proposalHandle);\n\t\tif (summaryNode === undefined) {\n\t\t\t// This should only happen if parent skipped recursion AND no prior summary existed.\n\t\t\tassert(\n\t\t\t\tthis._latestSummary === undefined,\n\t\t\t\t0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\treferenceSequenceNumber === summaryNode.referenceSequenceNumber,\n\t\t\t\t0x1a7 /* Pending summary reference sequence number should be consistent */,\n\t\t\t);\n\n\t\t\t// Clear earlier pending summaries\n\t\t\tthis.pendingSummaries.delete(proposalHandle);\n\t\t}\n\n\t\tthis.refreshLatestSummaryCore(referenceSequenceNumber);\n\n\t\tthis._latestSummary = summaryNode;\n\t\t// Propagate update to all child nodes\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t\t}\n\t}\n\n\tprivate refreshLatestSummaryCore(referenceSequenceNumber: number): void {\n\t\tfor (const [key, value] of this.pendingSummaries) {\n\t\t\tif (value.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateBaseSummaryState(snapshot: ISnapshotTree) {\n\t\t// Check base summary to see if it has any additional path parts\n\t\t// separating child SummarizerNodes. Checks for .channels subtrees.\n\t\tconst { childrenPathPart } = parseSummaryForSubtrees(snapshot);\n\t\tif (childrenPathPart !== undefined && this._latestSummary !== undefined) {\n\t\t\tthis._latestSummary.additionalPath = EscapedPath.create(childrenPathPart);\n\t\t}\n\t}\n\n\tpublic recordChange(op: ISequencedDocumentMessage): void {\n\t\tthis.invalidate(op.sequenceNumber);\n\t}\n\n\tpublic invalidate(sequenceNumber: number): void {\n\t\tif (sequenceNumber > this._changeSequenceNumber) {\n\t\t\tthis._changeSequenceNumber = sequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * True if a change has been recorded with sequence number exceeding\n\t * the latest successfully acked summary reference sequence number.\n\t * False implies that the previous summary can be reused.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this._changeSequenceNumber > this.referenceSequenceNumber;\n\t}\n\n\tpublic get latestSummary(): Readonly<SummaryNode> | undefined {\n\t\treturn this._latestSummary;\n\t}\n\n\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/** Summarize function */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/** Initial id or path part of this node */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfig = {},\n\t): ISummarizerNode {\n\t\tassert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNode(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.latestSummary,\n\t\t\tcreateDetails.initialSummary,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n\t\t// have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\tpublic getChild(id: string): ISummarizerNode | undefined {\n\t\treturn this.children.get(id);\n\t}\n\n\t/**\n\t * Returns the details needed to create a child node.\n\t * @param id - Initial id or path part of the child node.\n\t * @param createParam - Information needed to create the node.\n\t * @returns the details needed to create the child node.\n\t */\n\tprotected getCreateDetailsForChild(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): ICreateChildDetails {\n\t\tlet initialSummary: IInitialSummary | undefined;\n\t\tlet latestSummary: SummaryNode | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLatestSummary = this._latestSummary;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLatestSummary !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLatestSummary.referenceSequenceNumber\n\t\t\t\t) {\n\t\t\t\t\t// Prioritize latest summary if it was after this node was attached.\n\t\t\t\t\tlatestSummary = parentLatestSummary.createForChild(id);\n\t\t\t\t} else {\n\t\t\t\t\tconst summary = convertToSummaryTree(\n\t\t\t\t\t\tcreateParam.snapshot,\n\t\t\t\t\t) as ISummaryTreeWithStats;\n\t\t\t\t\tinitialSummary = {\n\t\t\t\t\t\tsequenceNumber: createParam.sequenceNumber,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tsummary,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tchangeSequenceNumber = createParam.sequenceNumber;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.FromSummary: {\n\t\t\t\tif (this.initialSummary === undefined) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!parentLatestSummary,\n\t\t\t\t\t\t0x1ac /* \"Cannot create child from summary if parent does not have latest summary\" */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// fallthrough to local\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tconst parentInitialSummary = this.initialSummary;\n\t\t\t\tif (parentInitialSummary !== undefined) {\n\t\t\t\t\tlet childSummary: SummaryObject | undefined;\n\t\t\t\t\tif (parentInitialSummary.summary !== undefined) {\n\t\t\t\t\t\tconst { childrenTree } = parseSummaryTreeForSubtrees(\n\t\t\t\t\t\t\tparentInitialSummary.summary.summary,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildrenTree.type === SummaryType.Tree,\n\t\t\t\t\t\t\t0x1d6 /* \"Parent summary object is not a tree\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tchildSummary = childrenTree.tree[id];\n\t\t\t\t\t}\n\t\t\t\t\tif (createParam.type === CreateSummarizerNodeSource.FromSummary) {\n\t\t\t\t\t\t// Locally created would not have differential subtree.\n\t\t\t\t\t\tassert(!!childSummary, 0x1ad /* \"Missing child summary tree\" */);\n\t\t\t\t\t}\n\t\t\t\t\tlet childSummaryWithStats: ISummaryTreeWithStats | undefined;\n\t\t\t\t\tif (childSummary !== undefined) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tchildSummary.type === SummaryType.Tree,\n\t\t\t\t\t\t\t0x1ae /* \"Child summary object is not a tree\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tchildSummaryWithStats = {\n\t\t\t\t\t\t\tsummary: childSummary,\n\t\t\t\t\t\t\tstats: calculateStats(childSummary),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tinitialSummary = {\n\t\t\t\t\t\tsequenceNumber: parentInitialSummary.sequenceNumber,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tsummary: childSummaryWithStats,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlatestSummary = parentLatestSummary?.createForChild(id);\n\t\t\t\tchangeSequenceNumber = parentLatestSummary?.referenceSequenceNumber ?? -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n\t\t\t\tunreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst childtelemetryNodeId = `${this.telemetryNodeId ?? \"\"}/${id}`;\n\n\t\treturn {\n\t\t\tinitialSummary,\n\t\t\tlatestSummary,\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childtelemetryNodeId,\n\t\t};\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t *\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNode, id: string) {\n\t\t// If a summary is in progress, this child was created after the summary started. So, we need to update the\n\t\t// child's summary state as well.\n\t\tif (this.isSummaryInProgress()) {\n\t\t\tchild.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n\t\t}\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child._latestSummary !== undefined) {\n\t\t\tfor (const [key, value] of this.pendingSummaries.entries()) {\n\t\t\t\tconst newLatestSummaryNode = new SummaryNode({\n\t\t\t\t\treferenceSequenceNumber: value.referenceSequenceNumber,\n\t\t\t\t\tbasePath: child._latestSummary.basePath,\n\t\t\t\t\tlocalPath: child._latestSummary.localPath,\n\t\t\t\t});\n\n\t\t\t\tchild.addPendingSummary(key, newLatestSummaryNode);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, summary: SummaryNode) {\n\t\tthis.pendingSummaries.set(key, summary);\n\t}\n\n\t/**\n\t * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n\t */\n\tpublic isSummaryInProgress(): boolean {\n\t\treturn this.wipReferenceSequenceNumber !== undefined;\n\t}\n\n\t/**\n\t * Creates and throws an error due to unexpected conditions.\n\t */\n\tprotected throwUnexpectedError(eventProps: ITelemetryErrorEvent): never {\n\t\tconst error = new LoggingError(eventProps.eventName, {\n\t\t\t...eventProps,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tid: this.telemetryNodeId,\n\t\t\t}),\n\t\t});\n\t\tthis.logger.sendErrorEvent(eventProps, error);\n\t\tthrow error;\n\t}\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\tlogger: ITelemetryLoggerExt,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfig = {},\n): IRootSummarizerNode =>\n\tnew SummarizerNode(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber === undefined\n\t\t\t? undefined\n\t\t\t: SummaryNode.createForRoot(referenceSequenceNumber),\n\t\tundefined /* initialSummary */,\n\t\tundefined /* wipSummaryLogger */,\n\t\t\"\" /* telemetryNodeId */,\n\t);\n"]}
|
|
@@ -5,35 +5,11 @@
|
|
|
5
5
|
import { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { ISnapshotTree, ISummaryTree, SummaryObject } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.
|
|
15
|
-
*
|
|
16
|
-
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the
|
|
17
|
-
* latest snapshot is fetched and the latest summary state is updated based on it.
|
|
18
|
-
*/
|
|
19
|
-
export declare type RefreshSummaryResult = {
|
|
20
|
-
latestSummaryUpdated: false;
|
|
21
|
-
} | {
|
|
22
|
-
latestSummaryUpdated: true;
|
|
23
|
-
wasSummaryTracked: true;
|
|
24
|
-
summaryRefSeq: number;
|
|
25
|
-
} | {
|
|
26
|
-
latestSummaryUpdated: true;
|
|
27
|
-
wasSummaryTracked: false;
|
|
28
|
-
snapshotTree: ISnapshotTree;
|
|
29
|
-
summaryRefSeq: number;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Result of snapshot fetch during refreshing latest summary state.
|
|
33
|
-
*/
|
|
34
|
-
export interface IFetchSnapshotResult {
|
|
35
|
-
snapshotTree: ISnapshotTree;
|
|
36
|
-
snapshotRefSeq: number;
|
|
8
|
+
export interface IRefreshSummaryResult {
|
|
9
|
+
/** Tells whether this summary is tracked by this client. */
|
|
10
|
+
isSummaryTracked: boolean;
|
|
11
|
+
/** Tells whether this summary is newer than the latest one tracked by this client. */
|
|
12
|
+
isSummaryNewer: boolean;
|
|
37
13
|
}
|
|
38
14
|
/**
|
|
39
15
|
* Return type of validateSummary function. In case of success, the object returned should have success: true.
|
|
@@ -59,7 +35,7 @@ export interface ISummarizerNodeRootContract {
|
|
|
59
35
|
validateSummary(): ValidateSummaryResult;
|
|
60
36
|
completeSummary(proposalHandle: string, validate: boolean): void;
|
|
61
37
|
clearSummary(): void;
|
|
62
|
-
refreshLatestSummary(proposalHandle: string
|
|
38
|
+
refreshLatestSummary(proposalHandle: string, summaryRefSeq: number): Promise<IRefreshSummaryResult>;
|
|
63
39
|
}
|
|
64
40
|
/** Path for nodes in a tree with escaped special characters */
|
|
65
41
|
export declare class EscapedPath {
|