@fluidframework/container-runtime 2.53.0 → 2.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/api-report/{container-runtime.legacy.alpha.api.md → container-runtime.legacy.beta.api.md} +55 -55
- package/container-runtime.test-files.tar +0 -0
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager/blobManager.d.ts +8 -2
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +45 -33
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/index.d.ts +2 -2
- package/dist/blobManager/index.d.ts.map +1 -1
- package/dist/blobManager/index.js.map +1 -1
- package/dist/channelCollection.d.ts +9 -11
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +2 -3
- package/dist/channelCollection.js.map +1 -1
- package/dist/compressionDefinitions.d.ts +3 -6
- package/dist/compressionDefinitions.d.ts.map +1 -1
- package/dist/compressionDefinitions.js +2 -4
- package/dist/compressionDefinitions.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +3 -4
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts +2 -2
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +13 -20
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +3 -6
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +3 -3
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +8 -8
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +2 -2
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/deltaManagerProxies.d.ts +2 -3
- package/dist/deltaManagerProxies.d.ts.map +1 -1
- package/dist/deltaManagerProxies.js.map +1 -1
- package/dist/deltaScheduler.d.ts +2 -2
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +4 -4
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts +3 -3
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +10 -11
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +4 -4
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
- package/dist/gc/gcSummaryDefinitions.d.ts +1 -1
- package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -1
- package/dist/gc/gcSummaryDefinitions.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +4 -4
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +6 -6
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +3 -3
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js.map +1 -1
- package/dist/inboundBatchAggregator.d.ts +2 -2
- package/dist/inboundBatchAggregator.d.ts.map +1 -1
- package/dist/inboundBatchAggregator.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +7 -8
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +1 -2
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +2 -2
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/duplicateBatchDetector.d.ts +1 -1
- package/dist/opLifecycle/duplicateBatchDetector.d.ts.map +1 -1
- package/dist/opLifecycle/duplicateBatchDetector.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +5 -5
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +2 -2
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +2 -2
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +3 -3
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +4 -4
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +9 -9
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +4 -4
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.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 +3 -3
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/storageServiceWithAttachBlobs.d.ts +1 -1
- package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/dist/storageServiceWithAttachBlobs.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +1 -2
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/index.d.ts +10 -10
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +4 -4
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +5 -5
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerNode/index.d.ts +3 -3
- 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 -6
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- 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 +3 -3
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +25 -44
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summarizerUtils.d.ts +3 -3
- package/dist/summary/summarizerUtils.d.ts.map +1 -1
- package/dist/summary/summarizerUtils.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +13 -23
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +1 -2
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/index.d.ts +2 -2
- package/dist/summary/summaryDelayLoadedModule/index.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/index.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts +1 -1
- package/dist/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.d.ts +3 -3
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizer.d.ts +5 -5
- package/dist/summary/summaryDelayLoadedModule/summarizer.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizer.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts +3 -4
- package/dist/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryGenerator.d.ts +3 -3
- package/dist/summary/summaryDelayLoadedModule/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.js.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts +5 -10
- package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts.map +1 -1
- package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +9 -14
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryHelpers.d.ts +1 -2
- package/dist/summary/summaryHelpers.d.ts.map +1 -1
- package/dist/summary/summaryHelpers.js +1 -2
- package/dist/summary/summaryHelpers.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +3 -3
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +8 -2
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +37 -25
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/index.d.ts +2 -2
- package/lib/blobManager/index.d.ts.map +1 -1
- package/lib/blobManager/index.js.map +1 -1
- package/lib/channelCollection.d.ts +9 -11
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +2 -3
- package/lib/channelCollection.js.map +1 -1
- package/lib/compressionDefinitions.d.ts +3 -6
- package/lib/compressionDefinitions.d.ts.map +1 -1
- package/lib/compressionDefinitions.js +2 -4
- package/lib/compressionDefinitions.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +3 -4
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts +2 -2
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +13 -20
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +3 -6
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +3 -3
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +8 -8
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +2 -2
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/deltaManagerProxies.d.ts +2 -3
- package/lib/deltaManagerProxies.d.ts.map +1 -1
- package/lib/deltaManagerProxies.js.map +1 -1
- package/lib/deltaScheduler.d.ts +2 -2
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/error.d.ts +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +4 -4
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts +3 -3
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +10 -11
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +4 -4
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -1
- package/lib/gc/gcSummaryDefinitions.d.ts +1 -1
- package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -1
- package/lib/gc/gcSummaryDefinitions.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts +4 -4
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +6 -6
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +3 -3
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/inboundBatchAggregator.d.ts +2 -2
- package/lib/inboundBatchAggregator.d.ts.map +1 -1
- package/lib/inboundBatchAggregator.js.map +1 -1
- package/lib/index.d.ts +7 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +7 -8
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +1 -2
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +2 -2
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +1 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/duplicateBatchDetector.d.ts +1 -1
- package/lib/opLifecycle/duplicateBatchDetector.d.ts.map +1 -1
- package/lib/opLifecycle/duplicateBatchDetector.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +5 -5
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +2 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +2 -2
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts +3 -3
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +4 -4
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -1
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +9 -9
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +4 -4
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.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 +3 -3
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/lib/storageServiceWithAttachBlobs.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +1 -2
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/index.d.ts +10 -10
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +4 -4
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +5 -5
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerNode/index.d.ts +3 -3
- 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 -6
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +3 -3
- 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 +3 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +25 -44
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summarizerUtils.d.ts +3 -3
- package/lib/summary/summarizerUtils.d.ts.map +1 -1
- package/lib/summary/summarizerUtils.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +13 -23
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +1 -2
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/index.d.ts +2 -2
- package/lib/summary/summaryDelayLoadedModule/index.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/index.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts +1 -1
- package/lib/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.d.ts +3 -3
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizer.d.ts +5 -5
- package/lib/summary/summaryDelayLoadedModule/summarizer.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizer.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts +3 -4
- package/lib/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryGenerator.d.ts +3 -3
- package/lib/summary/summaryDelayLoadedModule/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.js.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts +5 -10
- package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts.map +1 -1
- package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +9 -14
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryHelpers.d.ts +1 -2
- package/lib/summary/summaryHelpers.d.ts.map +1 -1
- package/lib/summary/summaryHelpers.js +1 -2
- package/lib/summary/summaryHelpers.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +3 -3
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +19 -19
- package/src/batchTracker.ts +3 -3
- package/src/blobManager/blobManager.ts +47 -53
- package/src/blobManager/index.ts +4 -4
- package/src/channelCollection.ts +28 -29
- package/src/compressionDefinitions.ts +3 -6
- package/src/connectionTelemetry.ts +8 -9
- package/src/containerHandleContext.ts +2 -2
- package/src/containerRuntime.ts +42 -49
- package/src/dataStore.ts +6 -6
- package/src/dataStoreContext.ts +33 -33
- package/src/dataStoreContexts.ts +3 -3
- package/src/dataStoreRegistry.ts +1 -1
- package/src/deltaManagerProxies.ts +3 -3
- package/src/deltaScheduler.ts +6 -3
- package/src/error.ts +1 -1
- package/src/gc/garbageCollection.ts +18 -18
- package/src/gc/gcConfigs.ts +7 -7
- package/src/gc/gcDefinitions.ts +11 -12
- package/src/gc/gcHelpers.ts +7 -7
- package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
- package/src/gc/gcSummaryDefinitions.ts +1 -1
- package/src/gc/gcSummaryStateTracker.ts +5 -5
- package/src/gc/gcTelemetry.ts +8 -8
- package/src/gc/index.ts +18 -18
- package/src/inboundBatchAggregator.ts +4 -4
- package/src/index.ts +79 -79
- package/src/messageTypes.ts +9 -10
- package/src/opLifecycle/batchManager.ts +2 -2
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/opLifecycle/duplicateBatchDetector.ts +1 -1
- package/src/opLifecycle/index.ts +9 -9
- package/src/opLifecycle/opCompressor.ts +2 -2
- package/src/opLifecycle/opDecompressor.ts +3 -3
- package/src/opLifecycle/opGroupingManager.ts +6 -6
- package/src/opLifecycle/opSplitter.ts +10 -7
- package/src/opLifecycle/outbox.ts +17 -14
- package/src/opLifecycle/remoteMessageProcessor.ts +4 -4
- package/src/opProperties.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +10 -10
- package/src/storageServiceWithAttachBlobs.ts +11 -11
- package/src/summary/documentSchema.ts +1 -2
- package/src/summary/index.ts +69 -69
- package/src/summary/orderedClientElection.ts +12 -4
- package/src/summary/summarizerClientElection.ts +5 -5
- package/src/summary/summarizerNode/index.ts +3 -3
- package/src/summary/summarizerNode/summarizerNode.ts +14 -12
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -3
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +3 -3
- package/src/summary/summarizerTypes.ts +25 -44
- package/src/summary/summarizerUtils.ts +3 -3
- package/src/summary/summaryCollection.ts +19 -29
- package/src/summary/summaryDelayLoadedModule/index.ts +2 -2
- package/src/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/summaryDelayLoadedModule/runningSummarizer.ts +4 -4
- package/src/summary/summaryDelayLoadedModule/summarizer.ts +8 -8
- package/src/summary/summaryDelayLoadedModule/summarizerHeuristics.ts +4 -4
- package/src/summary/summaryDelayLoadedModule/summaryGenerator.ts +3 -3
- package/src/summary/summaryDelayLoadedModule/summaryResultBuilder.ts +3 -3
- package/src/summary/summaryDelayLoadedModule/summaryResultTypes.ts +5 -10
- package/src/summary/summaryFormat.ts +9 -14
- package/src/summary/summaryHelpers.ts +1 -2
- package/src/summary/summaryManager.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerClientElection.js","sourceRoot":"","sources":["../../src/summary/summarizerClientElection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,0EAA0E;AAQ1E,6DAA4D;AAa5D;;;;GAIG;AACH,MAAa,wBACZ,SAAQ,gCAAkD;IAiB1D,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC;IACpD,CAAC;IACD,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC;IACpD,CAAC;IAED,YACkB,MAA2B,EAC3B,iBAA6D,EAC9D,cAAsC,EACr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C;QACD,OAAO,wBAAwB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;;AAvGF,4DA2GC;AAFuB,oDAA2B,GAAG,CAAC,OAAuB,EAAW,EAAE,CACzF,OAAO,CAAC,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,yCAAoB,AADxB,CACyB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tIOrderedClientElection,\n\tISerializedElection,\n\tITrackedClient,\n} from \"./orderedClientElection.js\";\nimport { summarizerClientType } from \"./summarizerTypes.js\";\nimport { ISummaryCollectionOpEvents } from \"./summaryCollection.js\";\n\nexport interface ISummarizerClientElectionEvents extends IEvent {\n\t(event: \"electedSummarizerChanged\", handler: () => void): void;\n}\n\nexport interface ISummarizerClientElection\n\textends IEventProvider<ISummarizerClientElectionEvents> {\n\treadonly electedClientId: string | undefined;\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * This class encapsulates logic around tracking the elected summarizer client.\n * It will handle updating the elected client when a summary ack hasn't been seen\n * for some configured number of ops.\n */\nexport class SummarizerClientElection\n\textends TypedEventEmitter<ISummarizerClientElectionEvents>\n\timplements ISummarizerClientElection\n{\n\t/**\n\t * Used to calculate number of ops since last summary ack for the current elected client.\n\t * This will be undefined if there is no elected summarizer, or no summary ack has been\n\t * observed since this client was elected.\n\t * When a summary ack comes in, this will be set to the sequence number of the summary ack.\n\t */\n\tprivate lastSummaryAckSeqForClient: number | undefined;\n\t/**\n\t * Used to prevent excess logging by recording the sequence number that we last reported at,\n\t * and making sure we don't report another event to telemetry. If things work as intended,\n\t * this is not needed, otherwise it could report an event on every op in worst case scenario.\n\t */\n\tprivate lastReportedSeq = 0;\n\n\tpublic get electedClientId(): string | undefined {\n\t\treturn this.clientElection.electedClient?.clientId;\n\t}\n\tpublic get electedParentId(): string | undefined {\n\t\treturn this.clientElection.electedParent?.clientId;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summaryCollection: IEventProvider<ISummaryCollectionOpEvents>,\n\t\tpublic readonly clientElection: IOrderedClientElection,\n\t\tprivate readonly maxOpsSinceLastSummary: number,\n\t) {\n\t\tsuper();\n\t\t// On every inbound op, if enough ops pass without seeing a summary ack (per elected client),\n\t\t// elect a new client and log to telemetry.\n\t\tthis.summaryCollection.on(\"default\", ({ sequenceNumber }) => {\n\t\t\tconst electedClientId = this.electedClientId;\n\t\t\tif (electedClientId === undefined) {\n\t\t\t\t// Reset election if no elected client, but eligible clients are connected.\n\t\t\t\t// This should be uncommon, but is possible if the initial state of the\n\t\t\t\t// ordered client election contains an undefined client id or one not found\n\t\t\t\t// in the quorum (the latter would already log an error).\n\t\t\t\tif (this.clientElection.eligibleCount > 0) {\n\t\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst electionSequenceNumber = this.clientElection.electionSequenceNumber;\n\t\t\tconst opsWithoutSummary =\n\t\t\t\tsequenceNumber - (this.lastSummaryAckSeqForClient ?? electionSequenceNumber);\n\t\t\tif (opsWithoutSummary > this.maxOpsSinceLastSummary) {\n\t\t\t\t// Log and elect a new summarizer client.\n\t\t\t\tconst opsSinceLastReport = sequenceNumber - this.lastReportedSeq;\n\t\t\t\tif (opsSinceLastReport > this.maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ElectedClientNotSummarizing\",\n\t\t\t\t\t\telectedClientId,\n\t\t\t\t\t\tlastSummaryAckSeqForClient: this.lastSummaryAckSeqForClient,\n\t\t\t\t\t\telectionSequenceNumber,\n\t\t\t\t\t\tnextElectedClientId: this.clientElection.peekNextElectedClient()?.clientId,\n\t\t\t\t\t});\n\t\t\t\t\tthis.lastReportedSeq = sequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// When a summary ack comes in, reset our op seq counter.\n\t\tthis.summaryCollection.on(MessageType.SummaryAck, (op) => {\n\t\t\tthis.lastSummaryAckSeqForClient = op.sequenceNumber;\n\t\t});\n\n\t\t// Use oldest client election for unanimously and deterministically deciding\n\t\t// which client should summarize.\n\t\tthis.clientElection.on(\"election\", (client, sequenceNumber) => {\n\t\t\tthis.lastSummaryAckSeqForClient = undefined;\n\t\t\tif (client === undefined && this.clientElection.eligibleCount > 0) {\n\t\t\t\t// If no client is valid for election, reset to the oldest again.\n\t\t\t\t// Also make extra sure not to get stuck in an infinite loop here:\n\t\t\t\t// If there are no eligible clients, just wait until a client joins\n\t\t\t\t// and will be auto-elected.\n\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t}\n\t\t\t// Election can trigger a change in SummaryManager state.\n\t\t\tthis.emit(\"electedSummarizerChanged\");\n\t\t});\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\tconst { electedClientId, electedParentId, electionSequenceNumber } =\n\t\t\tthis.clientElection.serialize();\n\t\treturn {\n\t\t\telectedClientId,\n\t\t\telectedParentId,\n\t\t\telectionSequenceNumber: this.lastSummaryAckSeqForClient ?? electionSequenceNumber,\n\t\t};\n\t}\n\n\tpublic static isClientEligible(client: ITrackedClient): boolean {\n\t\tconst details = client.client.details;\n\t\tif (details === undefined) {\n\t\t\t// Very old clients back-compat\n\t\t\treturn true;\n\t\t}\n\t\treturn SummarizerClientElection.clientDetailsPermitElection(details);\n\t}\n\n\tpublic static readonly clientDetailsPermitElection = (details: IClientDetails): boolean =>\n\t\tdetails.capabilities.interactive || details.type === summarizerClientType;\n}\n"]}
|
|
1
|
+
{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J,CAAC;IAEM,SAAS;QACf,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,GACjE,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO;YACN,eAAe;YACf,eAAe;YACf,sBAAsB,EAAE,IAAI,CAAC,0BAA0B,IAAI,sBAAsB;SACjF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,MAAsB;QACpD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,+BAA+B;YAC/B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,wBAAwB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;;AAvGF,4DA2GC;AAFuB,oDAA2B,GAAG,CAAC,OAAuB,EAAW,EAAE,CACzF,OAAO,CAAC,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,yCAAoB,AADxB,CACyB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport type { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type {\n\tIOrderedClientElection,\n\tISerializedElection,\n\tITrackedClient,\n} from \"./orderedClientElection.js\";\nimport { summarizerClientType } from \"./summarizerTypes.js\";\nimport type { ISummaryCollectionOpEvents } from \"./summaryCollection.js\";\n\nexport interface ISummarizerClientElectionEvents extends IEvent {\n\t(event: \"electedSummarizerChanged\", handler: () => void): void;\n}\n\nexport interface ISummarizerClientElection\n\textends IEventProvider<ISummarizerClientElectionEvents> {\n\treadonly electedClientId: string | undefined;\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * This class encapsulates logic around tracking the elected summarizer client.\n * It will handle updating the elected client when a summary ack hasn't been seen\n * for some configured number of ops.\n */\nexport class SummarizerClientElection\n\textends TypedEventEmitter<ISummarizerClientElectionEvents>\n\timplements ISummarizerClientElection\n{\n\t/**\n\t * Used to calculate number of ops since last summary ack for the current elected client.\n\t * This will be undefined if there is no elected summarizer, or no summary ack has been\n\t * observed since this client was elected.\n\t * When a summary ack comes in, this will be set to the sequence number of the summary ack.\n\t */\n\tprivate lastSummaryAckSeqForClient: number | undefined;\n\t/**\n\t * Used to prevent excess logging by recording the sequence number that we last reported at,\n\t * and making sure we don't report another event to telemetry. If things work as intended,\n\t * this is not needed, otherwise it could report an event on every op in worst case scenario.\n\t */\n\tprivate lastReportedSeq = 0;\n\n\tpublic get electedClientId(): string | undefined {\n\t\treturn this.clientElection.electedClient?.clientId;\n\t}\n\tpublic get electedParentId(): string | undefined {\n\t\treturn this.clientElection.electedParent?.clientId;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summaryCollection: IEventProvider<ISummaryCollectionOpEvents>,\n\t\tpublic readonly clientElection: IOrderedClientElection,\n\t\tprivate readonly maxOpsSinceLastSummary: number,\n\t) {\n\t\tsuper();\n\t\t// On every inbound op, if enough ops pass without seeing a summary ack (per elected client),\n\t\t// elect a new client and log to telemetry.\n\t\tthis.summaryCollection.on(\"default\", ({ sequenceNumber }) => {\n\t\t\tconst electedClientId = this.electedClientId;\n\t\t\tif (electedClientId === undefined) {\n\t\t\t\t// Reset election if no elected client, but eligible clients are connected.\n\t\t\t\t// This should be uncommon, but is possible if the initial state of the\n\t\t\t\t// ordered client election contains an undefined client id or one not found\n\t\t\t\t// in the quorum (the latter would already log an error).\n\t\t\t\tif (this.clientElection.eligibleCount > 0) {\n\t\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst electionSequenceNumber = this.clientElection.electionSequenceNumber;\n\t\t\tconst opsWithoutSummary =\n\t\t\t\tsequenceNumber - (this.lastSummaryAckSeqForClient ?? electionSequenceNumber);\n\t\t\tif (opsWithoutSummary > this.maxOpsSinceLastSummary) {\n\t\t\t\t// Log and elect a new summarizer client.\n\t\t\t\tconst opsSinceLastReport = sequenceNumber - this.lastReportedSeq;\n\t\t\t\tif (opsSinceLastReport > this.maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ElectedClientNotSummarizing\",\n\t\t\t\t\t\telectedClientId,\n\t\t\t\t\t\tlastSummaryAckSeqForClient: this.lastSummaryAckSeqForClient,\n\t\t\t\t\t\telectionSequenceNumber,\n\t\t\t\t\t\tnextElectedClientId: this.clientElection.peekNextElectedClient()?.clientId,\n\t\t\t\t\t});\n\t\t\t\t\tthis.lastReportedSeq = sequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// When a summary ack comes in, reset our op seq counter.\n\t\tthis.summaryCollection.on(MessageType.SummaryAck, (op) => {\n\t\t\tthis.lastSummaryAckSeqForClient = op.sequenceNumber;\n\t\t});\n\n\t\t// Use oldest client election for unanimously and deterministically deciding\n\t\t// which client should summarize.\n\t\tthis.clientElection.on(\"election\", (client, sequenceNumber) => {\n\t\t\tthis.lastSummaryAckSeqForClient = undefined;\n\t\t\tif (client === undefined && this.clientElection.eligibleCount > 0) {\n\t\t\t\t// If no client is valid for election, reset to the oldest again.\n\t\t\t\t// Also make extra sure not to get stuck in an infinite loop here:\n\t\t\t\t// If there are no eligible clients, just wait until a client joins\n\t\t\t\t// and will be auto-elected.\n\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t}\n\t\t\t// Election can trigger a change in SummaryManager state.\n\t\t\tthis.emit(\"electedSummarizerChanged\");\n\t\t});\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\tconst { electedClientId, electedParentId, electionSequenceNumber } =\n\t\t\tthis.clientElection.serialize();\n\t\treturn {\n\t\t\telectedClientId,\n\t\t\telectedParentId,\n\t\t\telectionSequenceNumber: this.lastSummaryAckSeqForClient ?? electionSequenceNumber,\n\t\t};\n\t}\n\n\tpublic static isClientEligible(client: ITrackedClient): boolean {\n\t\tconst details = client.client.details;\n\t\tif (details === undefined) {\n\t\t\t// Very old clients back-compat\n\t\t\treturn true;\n\t\t}\n\t\treturn SummarizerClientElection.clientDetailsPermitElection(details);\n\t}\n\n\tpublic static readonly clientDetailsPermitElection = (details: IClientDetails): boolean =>\n\t\tdetails.capabilities.interactive || details.type === summarizerClientType;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { IRefreshSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, } from "./summarizerNodeUtils.js";
|
|
6
|
-
export { IRootSummarizerNode, createRootSummarizerNode } from "./summarizerNode.js";
|
|
7
|
-
export { IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC, } from "./summarizerNodeWithGc.js";
|
|
5
|
+
export type { IRefreshSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, } from "./summarizerNodeUtils.js";
|
|
6
|
+
export { type IRootSummarizerNode, createRootSummarizerNode } from "./summarizerNode.js";
|
|
7
|
+
export { type IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC, } from "./summarizerNodeWithGc.js";
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EACN,KAAK,yBAAyB,EAC9B,8BAA8B,GAC9B,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAAyF;AAAtD,6HAAA,wBAAwB,OAAA;AAC3D,qEAGmC;AADlC,yIAAA,8BAA8B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tIRefreshSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils.js\";\n\nexport { type IRootSummarizerNode, createRootSummarizerNode } from \"./summarizerNode.js\";\nexport {\n\ttype IRootSummarizerNodeWithGC,\n\tcreateRootSummarizerNodeWithGC,\n} from \"./summarizerNodeWithGc.js\";\n"]}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ITelemetryContext, CreateChildSummarizerNodeParam, ISummarizeResult, ISummarizerNode, ISummarizerNodeConfig, SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ICreateChildDetails, IRefreshSummaryResult, IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, PendingSummaryInfo } from "./summarizerNodeUtils.js";
|
|
5
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { type ITelemetryContext, type CreateChildSummarizerNodeParam, type ISummarizeResult, type ISummarizerNode, type ISummarizerNodeConfig, type SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
|
|
8
|
+
import type { ITelemetryErrorEventExt, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
import type { ICreateChildDetails, IRefreshSummaryResult, IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, PendingSummaryInfo } from "./summarizerNodeUtils.js";
|
|
11
10
|
export interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
@@ -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,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAG5E,OAAO,KAAK,EACX,aAAa,EACb,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EAEnC,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,MAAM,8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ACV;;;;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;IAyCtB;;;;;;;;OAQG;IACH,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAcxE,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,IAAI;IAItF;;OAEG;IACI,mBAAmB,IAAI,OAAO;IAIrC;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,uBAAuB,GAAG,KAAK;CAW1E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WAC5B,mBAAmB,uBACN,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC3B,mBAUD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA8E;AAC9E,2EAAiE;AAKjE,2EAUsD;AACtD,qEAAoE;AAEpE,uEAOkD;AAalD;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAC1B;;;OAGG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,mCAAmC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAmBD;;;OAGG;IACH,YACC,UAAgC,EACf,mBAAwC,EACzD,MAA6B;IAC7B;;OAEG;IACc,g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AC,OAAO,EAAE,EAAE,CAAC;gBACpF,KAAK,CAAC,iBAAiB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;IACF,CAAC;IAES,iBAAiB,CAAC,GAAW,EAAE,kBAAsC;QAC9E,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,mBAAmB;QACzB,OAAO,IAAI,CAAC,0BAA0B,KAAK,SAAS,CAAC;IACtD,CAAC;IAED;;OAEG;IACO,oBAAoB,CAAC,UAAmC;QACjE,MAAM,KAAK,GAAG,IAAI,uBAAY,CAAC,UAAU,CAAC,SAAS,EAAE;YACpD,GAAG,UAAU;YACb,uBAAuB,EAAE,IAAI,CAAC,0BAA0B;YACxD,GAAG,IAAA,2BAAgB,EAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,eAAe;aACxB,CAAC;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC;IACb,CAAC;CACD;AAllBD,wCAklBC;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,EAAE,CAAC,qBAAqB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,CAAC,sBAAsB,EAChC,EAAE,CAAC,qBAAqB,CACxB,CAAC;AAhBU,QAAA,wBAAwB,4BAgBlC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tchannelsTreeName,\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tISummarizeResult,\n\tISummarizerNode,\n\tISummarizerNodeConfig,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { mergeStats } from \"@fluidframework/runtime-utils/internal\";\nimport { type ITelemetryErrorEventExt } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tICreateChildDetails,\n\tIRefreshSummaryResult,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n\tPendingSummaryInfo,\n} from \"./summarizerNodeUtils.js\";\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(): number {\n\t\treturn this._lastSummaryReferenceSequenceNumber ?? 0;\n\t}\n\n\t/**\n\t * returns the handle of the last successful summary of this summarizerNode in string format\n\t * (this getter is primarily only used in the test code)\n\t */\n\tpublic get summaryHandleId(): string {\n\t\treturn this._summaryHandleId;\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\t/**\n\t * Key value pair of summaries submitted by this client which are not yet acked.\n\t * Key is the proposalHandle and value is the summary op's referece sequence number.\n\t */\n\tprotected readonly pendingSummaries = new Map<string, PendingSummaryInfo>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\t/**\n\t * True if the current node was summarized during the current summary process\n\t * This flag is used to identify scenarios where summarize was not called on a node.\n\t * For example, this node was created after its parent was already summarized due to out-of-order realization via application code.\n\t */\n\tprivate wipSummarizeCalled: boolean = false;\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\t/**\n\t\t * Encoded handle or path to the node\n\t\t */\n\t\tprivate readonly _summaryHandleId: string,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when last successful summary was created\n\t\t */\n\t\tprivate _lastSummaryReferenceSequenceNumber?: number,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\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\t/**\n\t * In order to produce a summary with a summarizer node, the summarizer node system must be notified a summary has\n\t * started. This is done by calling startSummary. This will track the reference sequence number of the summary and\n\t * run some validation checks to ensure the summary is correct.\n\t * @param referenceSequenceNumber - the number of ops processed up to this point\n\t * @param summaryLogger - the logger to use for the summary\n\t * @param latestSummaryRefSeqNum - the reference sequence number of the latest summary. Another way to think about\n\t * it is the reference sequence number of the previous summary.\n\t * @returns the number of nodes in the tree, the number of nodes that are invalid, and the different types of\n\t * sequence number mismatches\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\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\tlet nodes = 1; // number of summarizerNodes at the start of the summary\n\t\tlet invalidNodes = 0;\n\t\tconst sequenceNumberMismatchKeySet = new Set<string>();\n\t\tconst nodeLatestSummaryRefSeqNum = this._lastSummaryReferenceSequenceNumber;\n\t\tif (\n\t\t\tnodeLatestSummaryRefSeqNum !== undefined &&\n\t\t\tlatestSummaryRefSeqNum !== nodeLatestSummaryRefSeqNum\n\t\t) {\n\t\t\tinvalidNodes++;\n\t\t\tsequenceNumberMismatchKeySet.add(\n\t\t\t\t`${latestSummaryRefSeqNum}-${nodeLatestSummaryRefSeqNum}`,\n\t\t\t);\n\t\t}\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst childStartSummaryResult = child.startSummary(\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tthis.wipSummaryLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\t\t\tnodes += childStartSummaryResult.nodes;\n\t\t\tinvalidNodes += childStartSummaryResult.invalidNodes;\n\t\t\tfor (const invalidSequenceNumber of childStartSummaryResult.mismatchNumbers) {\n\t\t\t\tsequenceNumberMismatchKeySet.add(invalidSequenceNumber);\n\t\t\t}\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t\treturn {\n\t\t\tnodes,\n\t\t\tinvalidNodes,\n\t\t\tmismatchNumbers: sequenceNumberMismatchKeySet,\n\t\t};\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\t// If trackState is false, call summarize internal directly and don't track any state.\n\t\tif (!trackState) {\n\t\t\treturn this.summarizeInternalFn(fullTree, trackState, telemetryContext);\n\t\t}\n\n\t\t// Set to wipSummarizeCalled true to represent that current node was included in the summary process.\n\t\tthis.wipSummarizeCalled = true;\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullTree &&\n\t\t\t!this.hasChanged() &&\n\t\t\tthis._lastSummaryReferenceSequenceNumber !== undefined\n\t\t) {\n\t\t\tthis.wipSkipRecursion = true;\n\t\t\tconst stats = mergeStats();\n\t\t\tstats.handleNodeCount++;\n\t\t\treturn {\n\t\t\t\tsummary: {\n\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\thandle: this.summaryHandleId,\n\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t},\n\t\t\t\tstats,\n\t\t\t};\n\t\t}\n\n\t\tlet incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined;\n\t\tif (!fullTree) {\n\t\t\tassert(\n\t\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t\t);\n\t\t\tincrementalSummaryContext =\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\t\tlatestSummarySequenceNumber: this._lastSummaryReferenceSequenceNumber,\n\t\t\t\t\t\t\t// TODO: remove summaryPath.\n\t\t\t\t\t\t\tsummaryPath: this.summaryHandleId,\n\t\t\t\t\t\t};\n\t\t}\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\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 wipSummarizeCalled must be set.\n\t\tif (parentSkipRecursion || this.wipSummarizeCalled) {\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): void {\n\t\tthis.completeSummaryCore(proposalHandle, false /* parentSkipRecursion */);\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(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x1a4 /* \"Not tracking a summary\" */,\n\t\t);\n\t\tif (parentSkipRecursion && this._lastSummaryReferenceSequenceNumber === undefined) {\n\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t// This node and all children should consider themselves as still not\n\t\t\t// having a successful summary yet.\n\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\tthis.clearSummary();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(proposalHandle, this.wipSkipRecursion || parentSkipRecursion);\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, {\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t});\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary(): void {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipSummarizeCalled = false;\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 * @param proposalHandle - Handle of the generated / uploaded summary.\n\t * @param summaryRefSeq - Reference sequence of the acked summary\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\n\t\t\t\t// If the acked summary is found in the pendingSummaries, it means the summary was created and tracked by the current client\n\t\t\t\t// so set the isSummaryTracked to true.\n\t\t\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\t\t\tif (pendingSummary?.referenceSequenceNumber !== undefined) {\n\t\t\t\t\tisSummaryTracked = true;\n\t\t\t\t\t// update the pendingSummariesMap for the root and all child summarizerNodes\n\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\tpendingSummary.referenceSequenceNumber,\n\t\t\t\t\t);\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 pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\tif (pendingSummary === 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._lastSummaryReferenceSequenceNumber === 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 === pendingSummary.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\t// Delete all summaries whose reference sequence number is smaller than the one just acked.\n\t\tfor (const [key, summary] of this.pendingSummaries) {\n\t\t\tif (summary.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t\t// Update the latest successful summary reference number\n\t\tthis._lastSummaryReferenceSequenceNumber = pendingSummary.referenceSequenceNumber;\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\tpublic updateBaseSummaryState(snapshot: ISnapshotTree): void {\n\t\t// Function deprecated. Empty declaration is kept around to compat failures.\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\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\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.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\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 childLastSummaryReferenceSequenceNumber: number | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLastSummaryReferenceSequenceNumber = this._lastSummaryReferenceSequenceNumber;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLastSummaryReferenceSequenceNumber !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLastSummaryReferenceSequenceNumber\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\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\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\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\tchangeSequenceNumber = parentLastSummaryReferenceSequenceNumber ?? -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\t\t// parentHandleId/.channels/childId\n\t\tconst childSummaryHandleId = `${this._summaryHandleId}/${channelsTreeName}/${id}`;\n\n\t\treturn {\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childTelemetryNodeId,\n\t\t\tsummaryHandleId: childSummaryHandleId,\n\t\t\tlastSummaryReferenceSequenceNumber: childLastSummaryReferenceSequenceNumber,\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): void {\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._lastSummaryReferenceSequenceNumber !== undefined) {\n\t\t\tfor (const [proposedHandle, pendingSummaryInfo] of this.pendingSummaries.entries()) {\n\t\t\t\tchild.addPendingSummary(proposedHandle, pendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, pendingSummaryInfo: PendingSummaryInfo): void {\n\t\tthis.pendingSummaries.set(key, pendingSummaryInfo);\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: ITelemetryErrorEventExt): 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\t\"\" /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\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,kEAA8E;AAC9E,2EAAiE;AAKjE,2EAUsD;AACtD,qEAAoE;AACpE,uEAMkD;AAiBlD;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAC1B;;;OAGG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,mCAAmC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,IAAW,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Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tchannelsTreeName,\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype ITelemetryContext,\n\ttype CreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\ttype ISummarizeResult,\n\ttype ISummarizerNode,\n\ttype ISummarizerNodeConfig,\n\ttype SummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { mergeStats } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type {\n\tITelemetryErrorEventExt,\n\tITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type {\n\tICreateChildDetails,\n\tIRefreshSummaryResult,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n\tPendingSummaryInfo,\n} from \"./summarizerNodeUtils.js\";\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(): number {\n\t\treturn this._lastSummaryReferenceSequenceNumber ?? 0;\n\t}\n\n\t/**\n\t * returns the handle of the last successful summary of this summarizerNode in string format\n\t * (this getter is primarily only used in the test code)\n\t */\n\tpublic get summaryHandleId(): string {\n\t\treturn this._summaryHandleId;\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\t/**\n\t * Key value pair of summaries submitted by this client which are not yet acked.\n\t * Key is the proposalHandle and value is the summary op's referece sequence number.\n\t */\n\tprotected readonly pendingSummaries = new Map<string, PendingSummaryInfo>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\t/**\n\t * True if the current node was summarized during the current summary process\n\t * This flag is used to identify scenarios where summarize was not called on a node.\n\t * For example, this node was created after its parent was already summarized due to out-of-order realization via application code.\n\t */\n\tprivate wipSummarizeCalled: boolean = false;\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\t/**\n\t\t * Encoded handle or path to the node\n\t\t */\n\t\tprivate readonly _summaryHandleId: string,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when last successful summary was created\n\t\t */\n\t\tprivate _lastSummaryReferenceSequenceNumber?: number,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\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\t/**\n\t * In order to produce a summary with a summarizer node, the summarizer node system must be notified a summary has\n\t * started. This is done by calling startSummary. This will track the reference sequence number of the summary and\n\t * run some validation checks to ensure the summary is correct.\n\t * @param referenceSequenceNumber - the number of ops processed up to this point\n\t * @param summaryLogger - the logger to use for the summary\n\t * @param latestSummaryRefSeqNum - the reference sequence number of the latest summary. Another way to think about\n\t * it is the reference sequence number of the previous summary.\n\t * @returns the number of nodes in the tree, the number of nodes that are invalid, and the different types of\n\t * sequence number mismatches\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\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\tlet nodes = 1; // number of summarizerNodes at the start of the summary\n\t\tlet invalidNodes = 0;\n\t\tconst sequenceNumberMismatchKeySet = new Set<string>();\n\t\tconst nodeLatestSummaryRefSeqNum = this._lastSummaryReferenceSequenceNumber;\n\t\tif (\n\t\t\tnodeLatestSummaryRefSeqNum !== undefined &&\n\t\t\tlatestSummaryRefSeqNum !== nodeLatestSummaryRefSeqNum\n\t\t) {\n\t\t\tinvalidNodes++;\n\t\t\tsequenceNumberMismatchKeySet.add(\n\t\t\t\t`${latestSummaryRefSeqNum}-${nodeLatestSummaryRefSeqNum}`,\n\t\t\t);\n\t\t}\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst childStartSummaryResult = child.startSummary(\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tthis.wipSummaryLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\t\t\tnodes += childStartSummaryResult.nodes;\n\t\t\tinvalidNodes += childStartSummaryResult.invalidNodes;\n\t\t\tfor (const invalidSequenceNumber of childStartSummaryResult.mismatchNumbers) {\n\t\t\t\tsequenceNumberMismatchKeySet.add(invalidSequenceNumber);\n\t\t\t}\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t\treturn {\n\t\t\tnodes,\n\t\t\tinvalidNodes,\n\t\t\tmismatchNumbers: sequenceNumberMismatchKeySet,\n\t\t};\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\t// If trackState is false, call summarize internal directly and don't track any state.\n\t\tif (!trackState) {\n\t\t\treturn this.summarizeInternalFn(fullTree, trackState, telemetryContext);\n\t\t}\n\n\t\t// Set to wipSummarizeCalled true to represent that current node was included in the summary process.\n\t\tthis.wipSummarizeCalled = true;\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullTree &&\n\t\t\t!this.hasChanged() &&\n\t\t\tthis._lastSummaryReferenceSequenceNumber !== undefined\n\t\t) {\n\t\t\tthis.wipSkipRecursion = true;\n\t\t\tconst stats = mergeStats();\n\t\t\tstats.handleNodeCount++;\n\t\t\treturn {\n\t\t\t\tsummary: {\n\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\thandle: this.summaryHandleId,\n\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t},\n\t\t\t\tstats,\n\t\t\t};\n\t\t}\n\n\t\tlet incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined;\n\t\tif (!fullTree) {\n\t\t\tassert(\n\t\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t\t);\n\t\t\tincrementalSummaryContext =\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\t\tlatestSummarySequenceNumber: this._lastSummaryReferenceSequenceNumber,\n\t\t\t\t\t\t\t// TODO: remove summaryPath.\n\t\t\t\t\t\t\tsummaryPath: this.summaryHandleId,\n\t\t\t\t\t\t};\n\t\t}\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\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 wipSummarizeCalled must be set.\n\t\tif (parentSkipRecursion || this.wipSummarizeCalled) {\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): void {\n\t\tthis.completeSummaryCore(proposalHandle, false /* parentSkipRecursion */);\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(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x1a4 /* \"Not tracking a summary\" */,\n\t\t);\n\t\tif (parentSkipRecursion && this._lastSummaryReferenceSequenceNumber === undefined) {\n\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t// This node and all children should consider themselves as still not\n\t\t\t// having a successful summary yet.\n\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\tthis.clearSummary();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(proposalHandle, this.wipSkipRecursion || parentSkipRecursion);\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, {\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t});\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary(): void {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipSummarizeCalled = false;\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 * @param proposalHandle - Handle of the generated / uploaded summary.\n\t * @param summaryRefSeq - Reference sequence of the acked summary\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\n\t\t\t\t// If the acked summary is found in the pendingSummaries, it means the summary was created and tracked by the current client\n\t\t\t\t// so set the isSummaryTracked to true.\n\t\t\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\t\t\tif (pendingSummary?.referenceSequenceNumber !== undefined) {\n\t\t\t\t\tisSummaryTracked = true;\n\t\t\t\t\t// update the pendingSummariesMap for the root and all child summarizerNodes\n\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\tpendingSummary.referenceSequenceNumber,\n\t\t\t\t\t);\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 pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\tif (pendingSummary === 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._lastSummaryReferenceSequenceNumber === 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 === pendingSummary.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\t// Delete all summaries whose reference sequence number is smaller than the one just acked.\n\t\tfor (const [key, summary] of this.pendingSummaries) {\n\t\t\tif (summary.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t\t// Update the latest successful summary reference number\n\t\tthis._lastSummaryReferenceSequenceNumber = pendingSummary.referenceSequenceNumber;\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\tpublic updateBaseSummaryState(snapshot: ISnapshotTree): void {\n\t\t// Function deprecated. Empty declaration is kept around to compat failures.\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\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\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.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\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 childLastSummaryReferenceSequenceNumber: number | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLastSummaryReferenceSequenceNumber = this._lastSummaryReferenceSequenceNumber;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLastSummaryReferenceSequenceNumber !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLastSummaryReferenceSequenceNumber\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\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\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\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\tchangeSequenceNumber = parentLastSummaryReferenceSequenceNumber ?? -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\t\t// parentHandleId/.channels/childId\n\t\tconst childSummaryHandleId = `${this._summaryHandleId}/${channelsTreeName}/${id}`;\n\n\t\treturn {\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childTelemetryNodeId,\n\t\t\tsummaryHandleId: childSummaryHandleId,\n\t\t\tlastSummaryReferenceSequenceNumber: childLastSummaryReferenceSequenceNumber,\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): void {\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._lastSummaryReferenceSequenceNumber !== undefined) {\n\t\t\tfor (const [proposedHandle, pendingSummaryInfo] of this.pendingSummaries.entries()) {\n\t\t\t\tchild.addPendingSummary(proposedHandle, pendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, pendingSummaryInfo: PendingSummaryInfo): void {\n\t\tthis.pendingSummaries.set(key, pendingSummaryInfo);\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: ITelemetryErrorEventExt): 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\t\"\" /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\n\t\tundefined /* wipSummaryLogger */,\n\t\t\"\" /* telemetryNodeId */,\n\t);\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { SummaryObject } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import type { SummaryObject } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
export interface IRefreshSummaryResult {
|
|
9
9
|
/**
|
|
10
10
|
* Tells whether this summary is tracked by this client.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EACX,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC9B;IACA,OAAO,EAAE,IAAI,CAAC;CACb,GACD;IACA,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,EAAE;QACH,GAAG,EAAE,gBAAgB,CAAC,YAAY,CAAC;QACnC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEL,MAAM,WAAW,2BAA2B;IAC3C,YAAY,CACX,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,mBAAmB,EAClC,sBAAsB,EAAE,MAAM,GAC5B,mBAAmB,CAAC;IACvB,eAAe,IAAI,qBAAqB,CAAC;IACzC,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,YAAY,IAAI,IAAI,CAAC;IACrB,oBAAoB,CACnB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,kCAAkC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACpE;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryObject } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport interface IRefreshSummaryResult {\n\t/**\n\t * Tells whether this summary is tracked by this client.\n\t */\n\tisSummaryTracked: boolean;\n\t/**\n\t * Tells whether this summary is newer than the latest one tracked by this client.\n\t */\n\tisSummaryNewer: boolean;\n}\n\nexport interface IStartSummaryResult {\n\t/**\n\t * The number of summarizerNodes at the start of the summary.\n\t */\n\tnodes: number;\n\t/**\n\t * The number of summarizerNodes in the wrong state.\n\t */\n\tinvalidNodes: number;\n\t/**\n\t * The invalid sequence numbers and their values. It should be in the format of validateSequenceNumber-nodeSequenceNumber\n\t */\n\tmismatchNumbers: Set<string>;\n}\n\n/**\n * Return type of validateSummary function. In case of success, the object returned should have success: true.\n * In case of failure, the object returned should have success: false and additional properties to indicate what\n * the failure was, where it was, can it be retried, etc.\n */\nexport type ValidateSummaryResult =\n\t| {\n\t\t\tsuccess: true;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\t/**\n\t\t\t * The failure reason\n\t\t\t */\n\t\t\treason: string;\n\t\t\t/**\n\t\t\t * id of the node that failed during validation\n\t\t\t */\n\t\t\tid: {\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact;\n\t\t\t\tvalue: string | undefined;\n\t\t\t};\n\t\t\t/**\n\t\t\t * If the error can be retried, time to wait before retrying\n\t\t\t */\n\t\t\tretryAfterSeconds?: number;\n\t };\n\nexport interface ISummarizerNodeRootContract {\n\tstartSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryLoggerExt,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult;\n\tvalidateSummary(): ValidateSummaryResult;\n\tcompleteSummary(proposalHandle: string): void;\n\tclearSummary(): void;\n\trefreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult>;\n}\n\nexport interface PendingSummaryInfo {\n\t/**\n\t * The sequence number at which the summary was created.\n\t */\n\treferenceSequenceNumber: number;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n\t/**\n\t * Sequence number of latest known change to the node\n\t */\n\tchangeSequenceNumber: number;\n\t/**\n\t * A unique id of this child to be logged when sending telemetry.\n\t */\n\ttelemetryNodeId: string;\n\t/**\n\t * Summary handle for child node\n\t */\n\tsummaryHandleId: string;\n\t/**\n\t * the reference sequence number of the last successful summary.\n\t */\n\tlastSummaryReferenceSequenceNumber: number | undefined;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n\t/**\n\t * Tree to use to find children subtrees\n\t */\n\tchildrenTree: T;\n\t/**\n\t * Additional path part where children are isolated\n\t */\n\tchildrenPathPart: string | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SummaryObject } from \"@fluidframework/driver-definitions\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tITelemetryLoggerExt,\n\tTelemetryDataTag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport interface IRefreshSummaryResult {\n\t/**\n\t * Tells whether this summary is tracked by this client.\n\t */\n\tisSummaryTracked: boolean;\n\t/**\n\t * Tells whether this summary is newer than the latest one tracked by this client.\n\t */\n\tisSummaryNewer: boolean;\n}\n\nexport interface IStartSummaryResult {\n\t/**\n\t * The number of summarizerNodes at the start of the summary.\n\t */\n\tnodes: number;\n\t/**\n\t * The number of summarizerNodes in the wrong state.\n\t */\n\tinvalidNodes: number;\n\t/**\n\t * The invalid sequence numbers and their values. It should be in the format of validateSequenceNumber-nodeSequenceNumber\n\t */\n\tmismatchNumbers: Set<string>;\n}\n\n/**\n * Return type of validateSummary function. In case of success, the object returned should have success: true.\n * In case of failure, the object returned should have success: false and additional properties to indicate what\n * the failure was, where it was, can it be retried, etc.\n */\nexport type ValidateSummaryResult =\n\t| {\n\t\t\tsuccess: true;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\t/**\n\t\t\t * The failure reason\n\t\t\t */\n\t\t\treason: string;\n\t\t\t/**\n\t\t\t * id of the node that failed during validation\n\t\t\t */\n\t\t\tid: {\n\t\t\t\ttag: TelemetryDataTag.CodeArtifact;\n\t\t\t\tvalue: string | undefined;\n\t\t\t};\n\t\t\t/**\n\t\t\t * If the error can be retried, time to wait before retrying\n\t\t\t */\n\t\t\tretryAfterSeconds?: number;\n\t };\n\nexport interface ISummarizerNodeRootContract {\n\tstartSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryLoggerExt,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult;\n\tvalidateSummary(): ValidateSummaryResult;\n\tcompleteSummary(proposalHandle: string): void;\n\tclearSummary(): void;\n\trefreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult>;\n}\n\nexport interface PendingSummaryInfo {\n\t/**\n\t * The sequence number at which the summary was created.\n\t */\n\treferenceSequenceNumber: number;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n\t/**\n\t * Sequence number of latest known change to the node\n\t */\n\tchangeSequenceNumber: number;\n\t/**\n\t * A unique id of this child to be logged when sending telemetry.\n\t */\n\ttelemetryNodeId: string;\n\t/**\n\t * Summary handle for child node\n\t */\n\tsummaryHandleId: string;\n\t/**\n\t * the reference sequence number of the last successful summary.\n\t */\n\tlastSummaryReferenceSequenceNumber: number | undefined;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n\t/**\n\t * Tree to use to find children subtrees\n\t */\n\tchildrenTree: T;\n\t/**\n\t * Additional path part where children are isolated\n\t */\n\tchildrenPathPart: string | undefined;\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IGarbageCollectionData, CreateChildSummarizerNodeParam, IGarbageCollectionDetailsBase, ISummarizerNodeConfigWithGC, ISummarizerNodeWithGC, SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
|
|
5
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IGarbageCollectionData, CreateChildSummarizerNodeParam, IGarbageCollectionDetailsBase, ISummarizerNodeConfigWithGC, ISummarizerNodeWithGC, SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
|
|
7
7
|
import { SummarizerNode } from "./summarizerNode.js";
|
|
8
|
-
import { IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult } from "./summarizerNodeUtils.js";
|
|
8
|
+
import type { IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult } from "./summarizerNodeUtils.js";
|
|
9
9
|
export interface IRootSummarizerNodeWithGC extends ISummarizerNodeWithGC, ISummarizerNodeRootContract {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeWithGc.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"summarizer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qB,GAAG,SAAS;IAIvD,YAAY,IAAI,OAAO;IAIvB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAYnD;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAW3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,WAClC,oBAAoB,uBACP,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,2BAA2B,gBACrB,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,QAAQ,sBAAsB,CAAC,uBAC9C,MAAM,QAAQ,6BAA6B,CAAC,KAC/D,yBAYD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA0E;AAS1E,qEAAoF;AACpF,uEAIkD;AAElD,gDAA2E;AAE3E,2DAAqD;AAkBrD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAqB,SAAQ,kCAAc;IA+BvD;;;OAGG;IACH,YACC,MAA4B,EAC5B,mBAAwC,EACxC,MAAmC,EACnC,gBAAwB,EACxB,oBAA4B;IAC5B;;OAEG;IACH,kCAA2C,EAC3C,gBAAuC,EACtB,WAAmE,EACpF,kBAAiE;IACjE;;OAEG;IACH,WAAoB;QAEpB,KAAK,CACJ,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,kCAAkC,EAClC,gBAAgB,EAChB,WAAW,CACX,CAAC;QAhBe,gBAAW,GAAX,WAAW,CAAwD;QAjCrF,4FAA4F;QACpF,wBAAmB,GAAY,KAAK,CAAC;QAS7C,mHAAmH;QACnH,iHAAiH;QACjH,iHAAiH;QACzG,eAAU,GAAa,CA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CAAC;AApBU,QAAA,8BAA8B,kCAoBxC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIGarbageCollectionDetailsBase,\n\tISummarizerNodeConfigWithGC,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { unpackChildNodesUsedRoutes } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { cloneGCData, unpackChildNodesGCDetails } from \"../../gc/index.js\";\n\nimport { SummarizerNode } from \"./summarizerNode.js\";\nimport {\n\tICreateChildDetails,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tPendingSummaryInfo,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNodeWithGC\n\textends ISummarizerNodeWithGC,\n\t\tISummarizerNodeRootContract {}\n\n// Extend PendingSummaryInfo to add used routes tracking it.\ninterface PendingSummaryInfoWithGC extends PendingSummaryInfo {\n\tserializedUsedRoutes: string | undefined;\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n *- Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n\t// Tracks the work-in-progress used routes during summary.\n\tprivate wipSerializedUsedRoutes: string | undefined;\n\n\t// Tracks the work-in-progress used routes of child nodes during summary.\n\tprivate wipChildNodesUsedRoutes: Map<string, string[]> | undefined;\n\n\t// This is the last known used routes of this node as seen by the server as part of a summary.\n\tprivate referenceUsedRoutes: string[] | undefined;\n\n\t// The base GC details of this node used to initialize the GC state.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t// Keeps track of whether we have loaded the base details to ensure that we only do it once.\n\tprivate baseGCDetailsLoaded: boolean = false;\n\n\t// The base GC details for the child nodes. This is passed to child nodes when creating them.\n\tprivate readonly childNodesBaseGCDetailsP: Promise<\n\t\tMap<string, IGarbageCollectionDetailsBase>\n\t>;\n\n\tprivate gcData: IGarbageCollectionData | undefined;\n\n\t// Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n\t// that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n\t// removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n\tprivate usedRoutes: string[] = [\"\"];\n\n\t// True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n\tprivate readonly gcDisabled: boolean;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfigWithGC,\n\t\t_summaryHandleId: string,\n\t\tchangeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when it was created\n\t\t */\n\t\tlastSummaryReferenceSequenceNumber?: number,\n\t\twipSummaryLogger?: ITelemetryBaseLogger,\n\t\tprivate readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\n\t\ttelemetryId?: string,\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\t_summaryHandleId,\n\t\t\tchangeSequenceNumber,\n\t\t\tlastSummaryReferenceSequenceNumber,\n\t\t\twipSummaryLogger,\n\t\t\ttelemetryId,\n\t\t);\n\n\t\tthis.gcDisabled = config.gcDisabled === true;\n\n\t\tthis.baseGCDetailsP = new LazyPromise(async () => {\n\t\t\treturn (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n\t\t});\n\n\t\tthis.childNodesBaseGCDetailsP = new LazyPromise(async () => {\n\t\t\tawait this.loadBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n\t\t});\n\t}\n\n\t/**\n\t * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n\t * seen by the server for this client:\n\t * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n\t * - gcData: The garbage collection data of this node that is required for running GC.\n\t */\n\tprivate async loadBaseGCDetails(): Promise<void> {\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tconst baseGCDetails = await this.baseGCDetailsP;\n\n\t\t// Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n\t\t// the state from the base details only once.\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.baseGCDetailsLoaded = true;\n\n\t\t// Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n\t\t// across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n\t\t// If the GC details has GC data, initialize our GC data from it.\n\t\tif (baseGCDetails.gcData !== undefined) {\n\t\t\tthis.gcData = cloneGCData(baseGCDetails.gcData);\n\t\t}\n\t\tif (baseGCDetails.usedRoutes !== undefined) {\n\t\t\tthis.usedRoutes = [...baseGCDetails.usedRoutes].sort();\n\t\t\tthis.referenceUsedRoutes = [...baseGCDetails.usedRoutes].sort();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n\t * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tassert(\n\t\t\t!this.gcDisabled,\n\t\t\t0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.getGCDataFn !== undefined,\n\t\t\t0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */,\n\t\t);\n\n\t\t// Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n\t\t// called and the node's data has not changed since last summary, the GC data in initial details is returned.\n\t\tawait this.loadBaseGCDetails();\n\n\t\t// If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n\t\t// GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n\t\t// Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n\t\t// summary must be generated.\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullGC &&\n\t\t\t!this.hasDataChanged() &&\n\t\t\tthis.gcData !== undefined\n\t\t) {\n\t\t\treturn cloneGCData(this.gcData);\n\t\t}\n\n\t\tconst gcData = await this.getGCDataFn(fullGC);\n\t\tthis.gcData = cloneGCData(gcData);\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Called during the start of a summary. Updates the work-in-progress used routes.\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\t// If GC is disabled, skip setting wip used routes since we should not track GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tassert(\n\t\t\t\tthis.wipSerializedUsedRoutes === undefined,\n\t\t\t\t0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */,\n\t\t\t);\n\t\t}\n\t\treturn super.startSummary(referenceSequenceNumber, summaryLogger, latestSummaryRefSeqNum);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., GC should have run for non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when running GC.\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.wasGCMissed()) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotRunGC\",\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 / GC is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\treturn super.validateSummaryCore(parentSkipRecursion);\n\t}\n\n\tprivate wasGCMissed(): boolean {\n\t\t// If GC is disabled, it should not have run so it was not missed.\n\t\t// Otherwise, GC should have been called on this node and wipSerializedUsedRoutes must be set.\n\t\tif (this.gcDisabled || this.wipSerializedUsedRoutes !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t\t/**\n\t\t * The absence of wip used routes indicates that GC was not run on this node. This can happen if:\n\t\t * 1. A child node was created after GC was already run on the parent. For example, a data store\n\t\t * is realized (loaded) after GC was run on it creating summarizer nodes for its DDSes. In this\n\t\t * case, the parent will pass on used routes to the child nodes and it will have wip used routes.\n\t\t * 2. A new node was created but GC was never run on it. This can mean that the GC data generated\n\t\t * during summarize is incomplete.\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\n\t * summary 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 * @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\tprotected completeSummaryCore(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tlet wipSerializedUsedRoutes: string | undefined;\n\t\t// If GC is disabled, don't set wip used routes.\n\t\tif (!this.gcDisabled) {\n\t\t\twipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n\t\t}\n\n\t\tsuper.completeSummaryCore(proposalHandle, parentSkipRecursion);\n\n\t\t// If GC is disabled, skip setting pending summary with GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (pendingSummaryInfo !== undefined) {\n\t\t\t\tconst pendingSummaryInfoWithGC = {\n\t\t\t\t\tserializedUsedRoutes: wipSerializedUsedRoutes,\n\t\t\t\t\t...pendingSummaryInfo,\n\t\t\t\t};\n\t\t\t\tthis.pendingSummaries.set(proposalHandle, pendingSummaryInfoWithGC);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clears the work-in-progress state.\n\t */\n\tpublic clearSummary(): void {\n\t\tthis.wipSerializedUsedRoutes = undefined;\n\t\tthis.wipChildNodesUsedRoutes = undefined;\n\t\tsuper.clearSummary();\n\t}\n\n\t/**\n\t * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n\t * from the state in the pending summary queue.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\t// If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (pendingSummaryInfo !== undefined) {\n\t\t\t\t// If a pending summary exists, it must have used routes since GC is enabled.\n\t\t\t\tconst summaryNodeWithGC = pendingSummaryInfo as PendingSummaryInfoWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes === undefined) {\n\t\t\t\t\tconst error = new LoggingError(\"MissingGCStateInPendingSummary\", {\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tid: this.telemetryNodeId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: error.message,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tthis.referenceUsedRoutes = JSON.parse(\n\t\t\t\t\tsummaryNodeWithGC.serializedUsedRoutes,\n\t\t\t\t) as string[];\n\t\t\t}\n\t\t}\n\n\t\treturn super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Override the createChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\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: ISummarizerNodeConfigWithGC = {},\n\t\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t): ISummarizerNodeWithGC {\n\t\tassert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\t\t/**\n\t\t * Update the child node's base GC details from this node's current GC details instead of updating from the base\n\t\t * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n\t\t * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n\t\t * the one from the downloaded snapshot and not the base GC details.\n\t\t */\n\t\tconst getChildBaseGCDetailsFn = async (): Promise<IGarbageCollectionDetailsBase> => {\n\t\t\tconst childNodesBaseGCDetails = await this.childNodesBaseGCDetailsP;\n\t\t\treturn childNodesBaseGCDetails.get(id) ?? {};\n\t\t};\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNodeWithGC(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\t// Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n\t\t\t\tgcDisabled: config.gcDisabled ?? this.gcDisabled,\n\t\t\t},\n\t\t\tcreateDetails.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tgetGCDataFn,\n\t\t\tgetChildBaseGCDetailsFn,\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.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\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. Finally, if the pendingSummaries entries have serializedRoutes, replicate them to the\n\t * pendingSummaries from the child nodes.\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\tprotected maybeUpdateChildState(child: SummarizerNodeWithGC, id: string): void {\n\t\tsuper.maybeUpdateChildState(child, id);\n\n\t\t// If GC has run on this node and summarization isn't complete, this.wipSerializedUsedRoutes will be defined.\n\t\t// In that case, update the used routes of the child node. This can happen in scenarios where a data store\n\t\t// doesn't have any ops but its reference state changed. So, it gets realized during summarize after GC ran\n\t\t// so GC would not have run on this node which is fine.\n\t\tif (this.wipSerializedUsedRoutes !== undefined) {\n\t\t\t// If the child route used routes are not defined, initialize it now and it can be used for all child nodes\n\t\t\t// created until this summarization process is completed. This is an optimization to unpack the used routes\n\t\t\t// only when needed.\n\t\t\tif (this.wipChildNodesUsedRoutes === undefined) {\n\t\t\t\tthis.wipChildNodesUsedRoutes = unpackChildNodesUsedRoutes(this.usedRoutes);\n\t\t\t}\n\t\t\tchild.updateUsedRoutes(this.wipChildNodesUsedRoutes.get(id) ?? [\"\"]);\n\t\t}\n\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tfor (const [key, pendingSummary] of this.pendingSummaries.entries()) {\n\t\t\tconst pendingSummaryWithGC = pendingSummary as PendingSummaryInfoWithGC;\n\t\t\tif (pendingSummaryWithGC.serializedUsedRoutes !== undefined) {\n\t\t\t\tconst childNodeUsedRoutes = unpackChildNodesUsedRoutes(\n\t\t\t\t\tJSON.parse(pendingSummaryWithGC.serializedUsedRoutes) as string[],\n\t\t\t\t);\n\t\t\t\tconst newSerializedRoutes = childNodeUsedRoutes.get(id) ?? [\"\"];\n\t\t\t\tconst childPendingSummaryInfo = {\n\t\t\t\t\t...pendingSummaryWithGC,\n\t\t\t\t\tserializedUsedRoutes: JSON.stringify(newSerializedRoutes),\n\t\t\t\t};\n\t\t\t\tchild.addPendingSummary(key, childPendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the child node with the given id.\n\t */\n\tpublic deleteChild(id: string): void {\n\t\tthis.children.delete(id);\n\t}\n\n\t/**\n\t * Override the getChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic getChild(id: string): ISummarizerNodeWithGC | undefined {\n\t\treturn this.children.get(id) as SummarizerNodeWithGC;\n\t}\n\n\tpublic isReferenced(): boolean {\n\t\treturn this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t// Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n\t\t// are in the same order.\n\t\tthis.usedRoutes = usedRoutes.sort();\n\n\t\t// If GC is not disabled and a summary is in progress, update the work-in-progress used routes so that it can\n\t\t// be tracked for this summary.\n\t\tif (!this.gcDisabled && this.isSummaryInProgress()) {\n\t\t\tthis.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n\t\t}\n\t}\n\n\t/**\n\t * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this.hasDataChanged() || this.hasUsedStateChanged();\n\t}\n\n\t/**\n\t * This tells whether the data in this node has changed or not.\n\t */\n\tprivate hasDataChanged(): boolean {\n\t\treturn super.hasChanged();\n\t}\n\n\t/**\n\t * This tells whether the used state of this node has changed since last successful summary. If the used routes\n\t * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n\t * was previously used and became unused (or vice versa), its used state has changed.\n\t */\n\tprivate hasUsedStateChanged(): boolean {\n\t\t// If GC is disabled, it should not affect summary state, return false.\n\t\tif (this.gcDisabled) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tthis.referenceUsedRoutes === undefined ||\n\t\t\tJSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes)\n\t\t);\n\t}\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\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 * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n\tlogger: ITelemetryBaseLogger,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfigWithGC = {},\n\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC =>\n\tnew SummarizerNodeWithGC(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\t\"\" /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\n\t\tundefined /* wipSummaryLogger */,\n\t\tgetGCDataFn,\n\t\tgetBaseGCDetailsFn,\n\t\t\"\" /* telemetryId */,\n\t);\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA0E;AAS1E,qEAAoF;AACpF,uEAIkD;AAElD,gDAA2E;AAE3E,2DAAqD;AAkBrD;;;;;;;;;;;;GAYG;AACH,MAAa,oBAAqB,SAAQ,kCAAc;IA+BvD;;;OAGG;IACH,YACC,MAA4B,EAC5B,mBAAwC,EACxC,MAAmC,EACnC,gBAAwB,EACxB,oBAA4B;IAC5B;;OAEG;IACH,kCAA2C,EAC3C,gBAAuC,EACtB,WAAmE,EACpF,kBAAiE;IACjE;;OAEG;IACH,WAAoB;QAEpB,KAAK,CACJ,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,kCAAkC,EAClC,gBAAgB,EAChB,WAAW,CACX,CAAC;QAhBe,gBAAW,GAAX,WAAW,CAAwD;QAjCrF,4FAA4F;QACpF,wBAAmB,GAAY,KAAK,CAAC;QAS7C,mHAAmH;QACnH,iHAAiH;QACjH,iHAAiH;QACzG,eAAU,GAAa,CAAC,EAAE,CAAC,CAAC;QAsCnC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,KAA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ors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIGarbageCollectionDetailsBase,\n\tISummarizerNodeConfigWithGC,\n\tISummarizerNodeWithGC,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { unpackChildNodesUsedRoutes } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tTelemetryDataTag,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { cloneGCData, unpackChildNodesGCDetails } from \"../../gc/index.js\";\n\nimport { SummarizerNode } from \"./summarizerNode.js\";\nimport type {\n\tICreateChildDetails,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tPendingSummaryInfo,\n\tValidateSummaryResult,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNodeWithGC\n\textends ISummarizerNodeWithGC,\n\t\tISummarizerNodeRootContract {}\n\n// Extend PendingSummaryInfo to add used routes tracking it.\ninterface PendingSummaryInfoWithGC extends PendingSummaryInfo {\n\tserializedUsedRoutes: string | undefined;\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n *- Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n\t// Tracks the work-in-progress used routes during summary.\n\tprivate wipSerializedUsedRoutes: string | undefined;\n\n\t// Tracks the work-in-progress used routes of child nodes during summary.\n\tprivate wipChildNodesUsedRoutes: Map<string, string[]> | undefined;\n\n\t// This is the last known used routes of this node as seen by the server as part of a summary.\n\tprivate referenceUsedRoutes: string[] | undefined;\n\n\t// The base GC details of this node used to initialize the GC state.\n\tprivate readonly baseGCDetailsP: Promise<IGarbageCollectionDetailsBase>;\n\n\t// Keeps track of whether we have loaded the base details to ensure that we only do it once.\n\tprivate baseGCDetailsLoaded: boolean = false;\n\n\t// The base GC details for the child nodes. This is passed to child nodes when creating them.\n\tprivate readonly childNodesBaseGCDetailsP: Promise<\n\t\tMap<string, IGarbageCollectionDetailsBase>\n\t>;\n\n\tprivate gcData: IGarbageCollectionData | undefined;\n\n\t// Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n\t// that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n\t// removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n\tprivate usedRoutes: string[] = [\"\"];\n\n\t// True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n\tprivate readonly gcDisabled: boolean;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfigWithGC,\n\t\t_summaryHandleId: string,\n\t\tchangeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when it was created\n\t\t */\n\t\tlastSummaryReferenceSequenceNumber?: number,\n\t\twipSummaryLogger?: ITelemetryBaseLogger,\n\t\tprivate readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\n\t\ttelemetryId?: string,\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\t_summaryHandleId,\n\t\t\tchangeSequenceNumber,\n\t\t\tlastSummaryReferenceSequenceNumber,\n\t\t\twipSummaryLogger,\n\t\t\ttelemetryId,\n\t\t);\n\n\t\tthis.gcDisabled = config.gcDisabled === true;\n\n\t\tthis.baseGCDetailsP = new LazyPromise(async () => {\n\t\t\treturn (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n\t\t});\n\n\t\tthis.childNodesBaseGCDetailsP = new LazyPromise(async () => {\n\t\t\tawait this.loadBaseGCDetails();\n\t\t\treturn unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n\t\t});\n\t}\n\n\t/**\n\t * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n\t * seen by the server for this client:\n\t * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n\t * - gcData: The garbage collection data of this node that is required for running GC.\n\t */\n\tprivate async loadBaseGCDetails(): Promise<void> {\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tconst baseGCDetails = await this.baseGCDetailsP;\n\n\t\t// Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n\t\t// the state from the base details only once.\n\t\tif (this.baseGCDetailsLoaded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.baseGCDetailsLoaded = true;\n\n\t\t// Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n\t\t// across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n\t\t// If the GC details has GC data, initialize our GC data from it.\n\t\tif (baseGCDetails.gcData !== undefined) {\n\t\t\tthis.gcData = cloneGCData(baseGCDetails.gcData);\n\t\t}\n\t\tif (baseGCDetails.usedRoutes !== undefined) {\n\t\t\tthis.usedRoutes = [...baseGCDetails.usedRoutes].sort();\n\t\t\tthis.referenceUsedRoutes = [...baseGCDetails.usedRoutes].sort();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n\t * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tassert(\n\t\t\t!this.gcDisabled,\n\t\t\t0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.getGCDataFn !== undefined,\n\t\t\t0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */,\n\t\t);\n\n\t\t// Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n\t\t// called and the node's data has not changed since last summary, the GC data in initial details is returned.\n\t\tawait this.loadBaseGCDetails();\n\n\t\t// If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n\t\t// GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n\t\t// Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n\t\t// summary must be generated.\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullGC &&\n\t\t\t!this.hasDataChanged() &&\n\t\t\tthis.gcData !== undefined\n\t\t) {\n\t\t\treturn cloneGCData(this.gcData);\n\t\t}\n\n\t\tconst gcData = await this.getGCDataFn(fullGC);\n\t\tthis.gcData = cloneGCData(gcData);\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Called during the start of a summary. Updates the work-in-progress used routes.\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\t// If GC is disabled, skip setting wip used routes since we should not track GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tassert(\n\t\t\t\tthis.wipSerializedUsedRoutes === undefined,\n\t\t\t\t0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */,\n\t\t\t);\n\t\t}\n\t\treturn super.startSummary(referenceSequenceNumber, summaryLogger, latestSummaryRefSeqNum);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., GC should have run for non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when running GC.\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.wasGCMissed()) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotRunGC\",\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 / GC is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\treturn super.validateSummaryCore(parentSkipRecursion);\n\t}\n\n\tprivate wasGCMissed(): boolean {\n\t\t// If GC is disabled, it should not have run so it was not missed.\n\t\t// Otherwise, GC should have been called on this node and wipSerializedUsedRoutes must be set.\n\t\tif (this.gcDisabled || this.wipSerializedUsedRoutes !== undefined) {\n\t\t\treturn false;\n\t\t}\n\t\t/**\n\t\t * The absence of wip used routes indicates that GC was not run on this node. This can happen if:\n\t\t * 1. A child node was created after GC was already run on the parent. For example, a data store\n\t\t * is realized (loaded) after GC was run on it creating summarizer nodes for its DDSes. In this\n\t\t * case, the parent will pass on used routes to the child nodes and it will have wip used routes.\n\t\t * 2. A new node was created but GC was never run on it. This can mean that the GC data generated\n\t\t * during summarize is incomplete.\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\n\t * summary 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 * @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\tprotected completeSummaryCore(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tlet wipSerializedUsedRoutes: string | undefined;\n\t\t// If GC is disabled, don't set wip used routes.\n\t\tif (!this.gcDisabled) {\n\t\t\twipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n\t\t}\n\n\t\tsuper.completeSummaryCore(proposalHandle, parentSkipRecursion);\n\n\t\t// If GC is disabled, skip setting pending summary with GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (pendingSummaryInfo !== undefined) {\n\t\t\t\tconst pendingSummaryInfoWithGC = {\n\t\t\t\t\tserializedUsedRoutes: wipSerializedUsedRoutes,\n\t\t\t\t\t...pendingSummaryInfo,\n\t\t\t\t};\n\t\t\t\tthis.pendingSummaries.set(proposalHandle, pendingSummaryInfoWithGC);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clears the work-in-progress state.\n\t */\n\tpublic clearSummary(): void {\n\t\tthis.wipSerializedUsedRoutes = undefined;\n\t\tthis.wipChildNodesUsedRoutes = undefined;\n\t\tsuper.clearSummary();\n\t}\n\n\t/**\n\t * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n\t * from the state in the pending summary queue.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\t// If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n\t\tif (!this.gcDisabled) {\n\t\t\tconst pendingSummaryInfo = this.pendingSummaries.get(proposalHandle);\n\t\t\tif (pendingSummaryInfo !== undefined) {\n\t\t\t\t// If a pending summary exists, it must have used routes since GC is enabled.\n\t\t\t\tconst summaryNodeWithGC = pendingSummaryInfo as PendingSummaryInfoWithGC;\n\t\t\t\tif (summaryNodeWithGC.serializedUsedRoutes === undefined) {\n\t\t\t\t\tconst error = new LoggingError(\"MissingGCStateInPendingSummary\", {\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tid: this.telemetryNodeId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: error.message,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tthis.referenceUsedRoutes = JSON.parse(\n\t\t\t\t\tsummaryNodeWithGC.serializedUsedRoutes,\n\t\t\t\t) as string[];\n\t\t\t}\n\t\t}\n\n\t\treturn super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Override the createChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\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: ISummarizerNodeConfigWithGC = {},\n\t\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t): ISummarizerNodeWithGC {\n\t\tassert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\t\t/**\n\t\t * Update the child node's base GC details from this node's current GC details instead of updating from the base\n\t\t * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n\t\t * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n\t\t * the one from the downloaded snapshot and not the base GC details.\n\t\t */\n\t\tconst getChildBaseGCDetailsFn = async (): Promise<IGarbageCollectionDetailsBase> => {\n\t\t\tconst childNodesBaseGCDetails = await this.childNodesBaseGCDetailsP;\n\t\t\treturn childNodesBaseGCDetails.get(id) ?? {};\n\t\t};\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNodeWithGC(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\t{\n\t\t\t\t...config,\n\t\t\t\t// Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n\t\t\t\tgcDisabled: config.gcDisabled ?? this.gcDisabled,\n\t\t\t},\n\t\t\tcreateDetails.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tgetGCDataFn,\n\t\t\tgetChildBaseGCDetailsFn,\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.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\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. Finally, if the pendingSummaries entries have serializedRoutes, replicate them to the\n\t * pendingSummaries from the child nodes.\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\tprotected maybeUpdateChildState(child: SummarizerNodeWithGC, id: string): void {\n\t\tsuper.maybeUpdateChildState(child, id);\n\n\t\t// If GC has run on this node and summarization isn't complete, this.wipSerializedUsedRoutes will be defined.\n\t\t// In that case, update the used routes of the child node. This can happen in scenarios where a data store\n\t\t// doesn't have any ops but its reference state changed. So, it gets realized during summarize after GC ran\n\t\t// so GC would not have run on this node which is fine.\n\t\tif (this.wipSerializedUsedRoutes !== undefined) {\n\t\t\t// If the child route used routes are not defined, initialize it now and it can be used for all child nodes\n\t\t\t// created until this summarization process is completed. This is an optimization to unpack the used routes\n\t\t\t// only when needed.\n\t\t\tif (this.wipChildNodesUsedRoutes === undefined) {\n\t\t\t\tthis.wipChildNodesUsedRoutes = unpackChildNodesUsedRoutes(this.usedRoutes);\n\t\t\t}\n\t\t\tchild.updateUsedRoutes(this.wipChildNodesUsedRoutes.get(id) ?? [\"\"]);\n\t\t}\n\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tfor (const [key, pendingSummary] of this.pendingSummaries.entries()) {\n\t\t\tconst pendingSummaryWithGC = pendingSummary as PendingSummaryInfoWithGC;\n\t\t\tif (pendingSummaryWithGC.serializedUsedRoutes !== undefined) {\n\t\t\t\tconst childNodeUsedRoutes = unpackChildNodesUsedRoutes(\n\t\t\t\t\tJSON.parse(pendingSummaryWithGC.serializedUsedRoutes) as string[],\n\t\t\t\t);\n\t\t\t\tconst newSerializedRoutes = childNodeUsedRoutes.get(id) ?? [\"\"];\n\t\t\t\tconst childPendingSummaryInfo = {\n\t\t\t\t\t...pendingSummaryWithGC,\n\t\t\t\t\tserializedUsedRoutes: JSON.stringify(newSerializedRoutes),\n\t\t\t\t};\n\t\t\t\tchild.addPendingSummary(key, childPendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the child node with the given id.\n\t */\n\tpublic deleteChild(id: string): void {\n\t\tthis.children.delete(id);\n\t}\n\n\t/**\n\t * Override the getChild method to return an instance of SummarizerNodeWithGC.\n\t */\n\tpublic getChild(id: string): ISummarizerNodeWithGC | undefined {\n\t\treturn this.children.get(id) as SummarizerNodeWithGC;\n\t}\n\n\tpublic isReferenced(): boolean {\n\t\treturn this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]): void {\n\t\t// Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n\t\t// are in the same order.\n\t\tthis.usedRoutes = usedRoutes.sort();\n\n\t\t// If GC is not disabled and a summary is in progress, update the work-in-progress used routes so that it can\n\t\t// be tracked for this summary.\n\t\tif (!this.gcDisabled && this.isSummaryInProgress()) {\n\t\t\tthis.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n\t\t}\n\t}\n\n\t/**\n\t * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this.hasDataChanged() || this.hasUsedStateChanged();\n\t}\n\n\t/**\n\t * This tells whether the data in this node has changed or not.\n\t */\n\tprivate hasDataChanged(): boolean {\n\t\treturn super.hasChanged();\n\t}\n\n\t/**\n\t * This tells whether the used state of this node has changed since last successful summary. If the used routes\n\t * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n\t * was previously used and became unused (or vice versa), its used state has changed.\n\t */\n\tprivate hasUsedStateChanged(): boolean {\n\t\t// If GC is disabled, it should not affect summary state, return false.\n\t\tif (this.gcDisabled) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tthis.referenceUsedRoutes === undefined ||\n\t\t\tJSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes)\n\t\t);\n\t}\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\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 * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n\tlogger: ITelemetryBaseLogger,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfigWithGC = {},\n\tgetGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\tgetBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC =>\n\tnew SummarizerNodeWithGC(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\t\"\" /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\n\t\tundefined /* wipSummaryLogger */,\n\t\tgetGCDataFn,\n\t\tgetBaseGCDetailsFn,\n\t\t\"\" /* telemetryId */,\n\t);\n"]}
|