@fluidframework/container-runtime 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.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/{.eslintrc.js → .eslintrc.cjs} +5 -5
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +54 -0
- package/README.md +45 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/container-runtime.api.md +68 -30
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +223 -0
- package/dist/channelCollection.d.ts.map +1 -0
- package/dist/{dataStores.js → channelCollection.js} +399 -83
- package/dist/channelCollection.js.map +1 -0
- package/dist/connectionTelemetry.d.ts +11 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +42 -4
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +98 -40
- package/dist/container-runtime-beta.d.ts +27 -9
- package/dist/container-runtime-public.d.ts +27 -9
- package/dist/container-runtime-untrimmed.d.ts +123 -40
- package/dist/containerHandleContext.d.ts +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +79 -55
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +541 -411
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +2 -3
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +12 -11
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +71 -30
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +182 -141
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts +29 -4
- package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/dist/deltaManagerSummarizerProxy.js +91 -5
- package/dist/deltaManagerSummarizerProxy.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +22 -5
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +134 -75
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts +2 -2
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +21 -21
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +29 -6
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +5 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +2 -2
- 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/gcSummaryStateTracker.d.ts +12 -5
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +18 -6
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +7 -7
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +20 -20
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +6 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +22 -11
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +8 -8
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +40 -38
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +8 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -40
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +4 -4
- package/dist/messageTypes.d.ts.map +1 -1
- 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 +2 -2
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +8 -8
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +18 -18
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +4 -4
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +3 -3
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +1 -10
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +5 -5
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +7 -7
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +20 -12
- 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 +2 -2
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/package.json +3 -0
- 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 +2 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +18 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +1 -2
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +5 -5
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +12 -12
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +43 -43
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.js +8 -8
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +11 -10
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +114 -81
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +4 -4
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +6 -6
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +2 -2
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +3 -3
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.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 +4 -4
- package/dist/summary/summarizerNode/index.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +17 -7
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +45 -57
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +10 -19
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +1 -21
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +16 -16
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +10 -21
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +15 -2
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +6 -5
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +10 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +5 -6
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +4 -5
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/{batchTracker.d.mts → batchTracker.d.ts} +2 -3
- package/lib/batchTracker.d.ts.map +1 -0
- package/lib/{batchTracker.mjs → batchTracker.js} +1 -1
- package/lib/batchTracker.js.map +1 -0
- package/lib/{blobManager.d.mts → blobManager.d.ts} +1 -1
- package/lib/blobManager.d.ts.map +1 -0
- package/lib/{blobManager.mjs → blobManager.js} +1 -1
- package/lib/blobManager.js.map +1 -0
- package/lib/channelCollection.d.ts +223 -0
- package/lib/channelCollection.d.ts.map +1 -0
- package/lib/{dataStores.mjs → channelCollection.js} +384 -71
- package/lib/channelCollection.js.map +1 -0
- package/lib/{connectionTelemetry.d.mts → connectionTelemetry.d.ts} +12 -2
- package/lib/connectionTelemetry.d.ts.map +1 -0
- package/lib/{connectionTelemetry.mjs → connectionTelemetry.js} +43 -5
- package/lib/connectionTelemetry.js.map +1 -0
- package/lib/{container-runtime-alpha.d.mts → container-runtime-alpha.d.ts} +98 -40
- package/lib/{container-runtime-public.d.mts → container-runtime-beta.d.ts} +27 -9
- package/lib/{container-runtime-beta.d.mts → container-runtime-public.d.ts} +27 -9
- package/lib/{container-runtime-untrimmed.d.mts → container-runtime-untrimmed.d.ts} +123 -40
- package/lib/{containerHandleContext.d.mts → containerHandleContext.d.ts} +2 -2
- package/lib/containerHandleContext.d.ts.map +1 -0
- package/lib/{containerHandleContext.mjs → containerHandleContext.js} +1 -1
- package/lib/containerHandleContext.js.map +1 -0
- package/lib/{containerRuntime.d.mts → containerRuntime.d.ts} +84 -56
- package/lib/containerRuntime.d.ts.map +1 -0
- package/lib/{containerRuntime.mjs → containerRuntime.js} +460 -332
- package/lib/containerRuntime.js.map +1 -0
- package/lib/{dataStore.d.mts → dataStore.d.ts} +3 -4
- package/lib/dataStore.d.ts.map +1 -0
- package/lib/{dataStore.mjs → dataStore.js} +13 -12
- package/lib/dataStore.js.map +1 -0
- package/lib/{dataStoreContext.d.mts → dataStoreContext.d.ts} +72 -31
- package/lib/dataStoreContext.d.ts.map +1 -0
- package/lib/{dataStoreContext.mjs → dataStoreContext.js} +174 -133
- package/lib/dataStoreContext.js.map +1 -0
- package/lib/{dataStoreContexts.d.mts → dataStoreContexts.d.ts} +2 -2
- package/lib/dataStoreContexts.d.ts.map +1 -0
- package/lib/{dataStoreContexts.mjs → dataStoreContexts.js} +1 -1
- package/lib/dataStoreContexts.js.map +1 -0
- package/lib/{dataStoreRegistry.d.mts → dataStoreRegistry.d.ts} +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -0
- package/lib/{dataStoreRegistry.mjs → dataStoreRegistry.js} +5 -1
- package/lib/dataStoreRegistry.js.map +1 -0
- package/{dist/deltaManagerProxyBase.d.ts → lib/deltaManagerSummarizerProxy.d.ts} +16 -7
- package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
- package/lib/deltaManagerSummarizerProxy.js +124 -0
- package/lib/deltaManagerSummarizerProxy.js.map +1 -0
- package/lib/{deltaScheduler.d.mts → deltaScheduler.d.ts} +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -0
- package/lib/{deltaScheduler.mjs → deltaScheduler.js} +1 -1
- package/lib/deltaScheduler.js.map +1 -0
- package/lib/{error.d.mts → error.d.ts} +1 -1
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +1 -1
- package/lib/error.js.map +1 -0
- package/lib/gc/{garbageCollection.d.mts → garbageCollection.d.ts} +23 -6
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/gc/{garbageCollection.mjs → garbageCollection.js} +103 -44
- package/lib/gc/garbageCollection.js.map +1 -0
- package/lib/gc/{gcConfigs.d.mts → gcConfigs.d.ts} +3 -3
- package/lib/gc/gcConfigs.d.ts.map +1 -0
- package/lib/gc/{gcConfigs.mjs → gcConfigs.js} +3 -3
- package/lib/gc/gcConfigs.js.map +1 -0
- package/lib/gc/{gcDefinitions.d.mts → gcDefinitions.d.ts} +30 -7
- package/lib/gc/gcDefinitions.d.ts.map +1 -0
- package/lib/gc/{gcDefinitions.mjs → gcDefinitions.js} +5 -1
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/lib/gc/{gcHelpers.d.mts → gcHelpers.d.ts} +3 -3
- package/lib/gc/{gcHelpers.d.mts.map → gcHelpers.d.ts.map} +1 -1
- package/lib/gc/{gcHelpers.mjs → gcHelpers.js} +1 -1
- package/lib/gc/gcHelpers.js.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.d.mts → gcReferenceGraphAlgorithm.d.ts} +2 -2
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.mjs → gcReferenceGraphAlgorithm.js} +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.d.mts → gcSummaryDefinitions.d.ts} +1 -1
- package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.mjs → gcSummaryDefinitions.js} +1 -1
- package/lib/gc/gcSummaryDefinitions.js.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.d.mts → gcSummaryStateTracker.d.ts} +13 -6
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.mjs → gcSummaryStateTracker.js} +17 -5
- package/lib/gc/gcSummaryStateTracker.js.map +1 -0
- package/lib/gc/{gcTelemetry.d.mts → gcTelemetry.d.ts} +8 -8
- package/lib/gc/gcTelemetry.d.ts.map +1 -0
- package/lib/gc/{gcTelemetry.mjs → gcTelemetry.js} +5 -5
- package/lib/gc/gcTelemetry.js.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.d.mts → gcUnreferencedStateTracker.d.ts} +7 -2
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.mjs → gcUnreferencedStateTracker.js} +12 -2
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/lib/gc/{index.d.mts → index.d.ts} +9 -9
- package/lib/gc/index.d.ts.map +1 -0
- package/lib/gc/{index.mjs → index.js} +8 -8
- package/lib/gc/index.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +9 -21
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/{messageTypes.d.mts → messageTypes.d.ts} +5 -5
- package/lib/messageTypes.d.ts.map +1 -0
- package/lib/{messageTypes.mjs → messageTypes.js} +1 -1
- package/lib/messageTypes.js.map +1 -0
- package/lib/{metadata.d.mts → metadata.d.ts} +1 -1
- package/lib/metadata.d.ts.map +1 -0
- package/lib/{metadata.mjs → metadata.js} +1 -1
- package/lib/metadata.js.map +1 -0
- package/lib/opLifecycle/{batchManager.d.mts → batchManager.d.ts} +3 -3
- package/lib/opLifecycle/batchManager.d.ts.map +1 -0
- package/lib/opLifecycle/{batchManager.mjs → batchManager.js} +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -0
- package/lib/opLifecycle/{definitions.d.mts → definitions.d.ts} +3 -3
- package/lib/opLifecycle/definitions.d.ts.map +1 -0
- package/lib/opLifecycle/{definitions.mjs → definitions.js} +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -0
- package/lib/opLifecycle/index.d.ts +13 -0
- package/lib/opLifecycle/index.d.ts.map +1 -0
- package/lib/opLifecycle/index.js +12 -0
- package/lib/opLifecycle/index.js.map +1 -0
- package/lib/opLifecycle/{opCompressor.d.mts → opCompressor.d.ts} +2 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
- package/lib/opLifecycle/{opCompressor.mjs → opCompressor.js} +3 -3
- package/lib/opLifecycle/opCompressor.js.map +1 -0
- package/lib/opLifecycle/{opDecompressor.d.mts → opDecompressor.d.ts} +2 -2
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
- package/lib/opLifecycle/{opDecompressor.mjs → opDecompressor.js} +2 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.d.mts → opGroupingManager.d.ts} +2 -2
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.mjs → opGroupingManager.js} +2 -11
- package/lib/opLifecycle/opGroupingManager.js.map +1 -0
- package/lib/opLifecycle/{opSplitter.d.mts → opSplitter.d.ts} +2 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
- package/lib/opLifecycle/{opSplitter.mjs → opSplitter.js} +3 -3
- package/lib/opLifecycle/opSplitter.js.map +1 -0
- package/lib/opLifecycle/{outbox.d.mts → outbox.d.ts} +8 -8
- package/lib/opLifecycle/outbox.d.ts.map +1 -0
- package/lib/opLifecycle/{outbox.mjs → outbox.js} +12 -4
- package/lib/opLifecycle/outbox.js.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.d.mts → remoteMessageProcessor.d.ts} +5 -5
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.mjs → remoteMessageProcessor.js} +2 -2
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
- package/lib/{opProperties.d.mts → opProperties.d.ts} +1 -1
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/{opProperties.mjs → opProperties.js} +1 -1
- package/lib/opProperties.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{pendingStateManager.d.mts → pendingStateManager.d.ts} +3 -2
- package/lib/pendingStateManager.d.ts.map +1 -0
- package/lib/{pendingStateManager.mjs → pendingStateManager.js} +18 -10
- package/lib/pendingStateManager.js.map +1 -0
- package/lib/{scheduleManager.d.mts → scheduleManager.d.ts} +6 -3
- package/lib/scheduleManager.d.ts.map +1 -0
- package/lib/{scheduleManager.mjs → scheduleManager.js} +3 -3
- package/lib/scheduleManager.js.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.d.mts → storageServiceWithAttachBlobs.d.ts} +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.mjs → storageServiceWithAttachBlobs.js} +1 -1
- package/lib/storageServiceWithAttachBlobs.js.map +1 -0
- package/lib/summary/{index.d.mts → index.d.ts} +13 -13
- package/lib/summary/index.d.ts.map +1 -0
- package/lib/summary/{index.mjs → index.js} +12 -12
- package/lib/summary/index.js.map +1 -0
- package/lib/summary/{orderedClientElection.d.mts → orderedClientElection.d.ts} +5 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -0
- package/lib/summary/{orderedClientElection.mjs → orderedClientElection.js} +2 -2
- package/lib/summary/orderedClientElection.js.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.d.mts → runWhileConnectedCoordinator.d.ts} +2 -2
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.mjs → runWhileConnectedCoordinator.js} +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/lib/summary/{runningSummarizer.d.mts → runningSummarizer.d.ts} +12 -11
- package/lib/summary/runningSummarizer.d.ts.map +1 -0
- package/lib/summary/{runningSummarizer.mjs → runningSummarizer.js} +108 -75
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/summary/{summarizer.d.mts → summarizer.d.ts} +5 -5
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/summary/{summarizer.mjs → summarizer.js} +4 -4
- package/lib/summary/summarizer.js.map +1 -0
- package/lib/summary/{summarizerClientElection.d.mts → summarizerClientElection.d.ts} +3 -3
- package/lib/summary/summarizerClientElection.d.ts.map +1 -0
- package/lib/summary/{summarizerClientElection.mjs → summarizerClientElection.js} +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -0
- package/lib/summary/{summarizerHeuristics.d.mts → summarizerHeuristics.d.ts} +4 -4
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/summary/{summarizerHeuristics.mjs → summarizerHeuristics.js} +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/lib/summary/summarizerNode/{index.d.mts → index.d.ts} +4 -4
- package/lib/summary/summarizerNode/index.d.ts.map +1 -0
- package/lib/summary/summarizerNode/index.js +7 -0
- package/lib/summary/summarizerNode/index.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.d.mts → summarizerNode.d.ts} +18 -8
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.mjs → summarizerNode.js} +41 -53
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.d.mts → summarizerNodeUtils.d.ts} +11 -20
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.mjs → summarizerNodeUtils.js} +1 -20
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.mts → summarizerNodeWithGc.d.ts} +6 -7
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.mjs → summarizerNodeWithGc.js} +12 -12
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
- package/lib/summary/{summarizerTypes.d.mts → summarizerTypes.d.ts} +11 -22
- package/lib/summary/summarizerTypes.d.ts.map +1 -0
- package/lib/summary/{summarizerTypes.mjs → summarizerTypes.js} +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -0
- package/lib/summary/{summaryCollection.d.mts → summaryCollection.d.ts} +1 -1
- package/lib/summary/summaryCollection.d.ts.map +1 -0
- package/lib/summary/{summaryCollection.mjs → summaryCollection.js} +1 -1
- package/lib/summary/summaryCollection.js.map +1 -0
- package/lib/summary/{summaryFormat.d.mts → summaryFormat.d.ts} +16 -3
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/summary/{summaryFormat.mjs → summaryFormat.js} +1 -1
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/{summaryGenerator.d.mts → summaryGenerator.d.ts} +7 -6
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/summary/{summaryGenerator.mjs → summaryGenerator.js} +11 -2
- package/lib/summary/summaryGenerator.js.map +1 -0
- package/lib/summary/{summaryManager.d.mts → summaryManager.d.ts} +6 -7
- package/lib/summary/summaryManager.d.ts.map +1 -0
- package/lib/summary/{summaryManager.mjs → summaryManager.js} +4 -5
- package/lib/summary/summaryManager.js.map +1 -0
- package/lib/test/batchTracker.spec.js +88 -0
- package/lib/test/batchTracker.spec.js.map +1 -0
- package/lib/test/blobManager.spec.js +835 -0
- package/lib/test/blobManager.spec.js.map +1 -0
- package/lib/test/channelCollection.spec.js +141 -0
- package/lib/test/channelCollection.spec.js.map +1 -0
- package/lib/test/containerRuntime.spec.js +1748 -0
- package/lib/test/containerRuntime.spec.js.map +1 -0
- package/lib/test/dataStoreContext.spec.js +801 -0
- package/lib/test/dataStoreContext.spec.js.map +1 -0
- package/lib/test/dataStoreCreation.spec.js +312 -0
- package/lib/test/dataStoreCreation.spec.js.map +1 -0
- package/lib/test/dataStoreRegistry.spec.js +26 -0
- package/lib/test/dataStoreRegistry.spec.js.map +1 -0
- package/lib/test/fuzz/fuzzUtils.js +66 -0
- package/lib/test/fuzz/fuzzUtils.js.map +1 -0
- package/lib/test/fuzz/summarizer.fuzz.spec.js +31 -0
- package/lib/test/fuzz/summarizer.fuzz.spec.js.map +1 -0
- package/lib/test/fuzz/summarizerFuzzMocks.js +162 -0
- package/lib/test/fuzz/summarizerFuzzMocks.js.map +1 -0
- package/lib/test/fuzz/summarizerFuzzSuite.js +106 -0
- package/lib/test/fuzz/summarizerFuzzSuite.js.map +1 -0
- package/lib/test/gc/garbageCollection.spec.js +1465 -0
- package/lib/test/gc/garbageCollection.spec.js.map +1 -0
- package/lib/test/gc/gcConfigs.spec.js +690 -0
- package/lib/test/gc/gcConfigs.spec.js.map +1 -0
- package/lib/test/gc/gcHelpers.spec.js +110 -0
- package/lib/test/gc/gcHelpers.spec.js.map +1 -0
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +68 -0
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +1 -0
- package/lib/test/gc/gcStats.spec.js +391 -0
- package/lib/test/gc/gcStats.spec.js.map +1 -0
- package/lib/test/gc/gcSummaryStateTracker.spec.js +228 -0
- package/lib/test/gc/gcSummaryStateTracker.spec.js.map +1 -0
- package/lib/test/gc/gcTelemetry.spec.js +530 -0
- package/lib/test/gc/gcTelemetry.spec.js.map +1 -0
- package/lib/test/gc/gcUnitTestHelpers.js +29 -0
- package/lib/test/gc/gcUnitTestHelpers.js.map +1 -0
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js +192 -0
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +1 -0
- package/lib/test/getPendingBlobs.spec.js +193 -0
- package/lib/test/getPendingBlobs.spec.js.map +1 -0
- package/lib/test/hardwareStats.spec.js +93 -0
- package/lib/test/hardwareStats.spec.js.map +1 -0
- package/lib/test/index.js +6 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/opLifecycle/OpGroupingManager.spec.js +225 -0
- package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +1 -0
- package/lib/test/opLifecycle/batchManager.spec.js +189 -0
- package/lib/test/opLifecycle/batchManager.spec.js.map +1 -0
- package/lib/test/opLifecycle/opCompressor.spec.js +74 -0
- package/lib/test/opLifecycle/opCompressor.spec.js.map +1 -0
- package/lib/test/opLifecycle/opDecompressor.spec.js +218 -0
- package/lib/test/opLifecycle/opDecompressor.spec.js.map +1 -0
- package/lib/test/opLifecycle/opSplitter.spec.js +272 -0
- package/lib/test/opLifecycle/opSplitter.spec.js.map +1 -0
- package/lib/test/opLifecycle/outbox.spec.js +675 -0
- package/lib/test/opLifecycle/outbox.spec.js.map +1 -0
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +196 -0
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +1 -0
- package/lib/test/pendingStateManager.spec.js +329 -0
- package/lib/test/pendingStateManager.spec.js.map +1 -0
- package/lib/test/scheduleManager.spec.js +270 -0
- package/lib/test/scheduleManager.spec.js.map +1 -0
- package/lib/test/summarizerNode.spec.js +326 -0
- package/lib/test/summarizerNode.spec.js.map +1 -0
- package/lib/test/summarizerNodeWithGc.spec.js +318 -0
- package/lib/test/summarizerNodeWithGc.spec.js.map +1 -0
- package/lib/test/summary/orderedClientElection.spec.js +535 -0
- package/lib/test/summary/orderedClientElection.spec.js.map +1 -0
- package/lib/test/summary/runningSummarizer.spec.js +1349 -0
- package/lib/test/summary/runningSummarizer.spec.js.map +1 -0
- package/lib/test/summary/summarizer.spec.js +29 -0
- package/lib/test/summary/summarizer.spec.js.map +1 -0
- package/lib/test/summary/summarizerClientElection.spec.js +436 -0
- package/lib/test/summary/summarizerClientElection.spec.js.map +1 -0
- package/lib/test/summary/summarizerHeuristics.spec.js +289 -0
- package/lib/test/summary/summarizerHeuristics.spec.js.map +1 -0
- package/lib/test/summary/summaryCollection.spec.js +200 -0
- package/lib/test/summary/summaryCollection.spec.js.map +1 -0
- package/lib/test/summary/summaryManager.spec.js +430 -0
- package/lib/test/summary/summaryManager.spec.js.map +1 -0
- package/lib/test/summary/testQuorumClients.js +34 -0
- package/lib/test/summary/testQuorumClients.js.map +1 -0
- package/lib/test/throttler.spec.js +175 -0
- package/lib/test/throttler.spec.js.map +1 -0
- package/lib/test/types/validateContainerRuntimePrevious.generated.js +180 -0
- package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +1 -0
- package/lib/{throttler.d.mts → throttler.d.ts} +1 -1
- package/lib/throttler.d.ts.map +1 -0
- package/lib/{throttler.mjs → throttler.js} +1 -1
- package/lib/throttler.js.map +1 -0
- package/package.json +99 -88
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +1 -1
- package/src/{dataStores.ts → channelCollection.ts} +520 -84
- package/src/connectionTelemetry.ts +42 -3
- package/src/containerHandleContext.ts +1 -1
- package/src/containerRuntime.ts +661 -464
- package/src/dataStore.ts +13 -15
- package/src/dataStoreContext.ts +257 -184
- package/src/dataStoreContexts.ts +1 -1
- package/src/deltaManagerSummarizerProxy.ts +132 -7
- package/src/gc/garbageCollection.ts +121 -46
- package/src/gc/gcConfigs.ts +3 -3
- package/src/gc/gcDefinitions.ts +30 -7
- package/src/gc/gcHelpers.ts +2 -2
- package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
- package/src/gc/gcSummaryStateTracker.ts +19 -7
- package/src/gc/gcTelemetry.ts +10 -9
- package/src/gc/gcUnreferencedStateTracker.ts +12 -1
- package/src/gc/index.ts +10 -8
- package/src/index.ts +16 -27
- package/src/messageTypes.ts +4 -4
- package/src/opLifecycle/README.md +2 -4
- package/src/opLifecycle/batchManager.ts +2 -2
- package/src/opLifecycle/definitions.ts +2 -2
- package/src/opLifecycle/index.ts +8 -8
- package/src/opLifecycle/opCompressor.ts +3 -3
- package/src/opLifecycle/opDecompressor.ts +3 -3
- package/src/opLifecycle/opGroupingManager.ts +3 -12
- package/src/opLifecycle/opSplitter.ts +3 -3
- package/src/opLifecycle/outbox.ts +29 -9
- package/src/opLifecycle/remoteMessageProcessor.ts +4 -4
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +19 -13
- package/src/scheduleManager.ts +4 -4
- package/src/summary/index.ts +13 -12
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +141 -93
- package/src/summary/summarizer.ts +7 -7
- package/src/summary/summarizerClientElection.ts +2 -2
- package/src/summary/summarizerHeuristics.ts +3 -3
- package/src/summary/summarizerNode/index.ts +6 -3
- package/src/summary/summarizerNode/summarizerNode.ts +54 -69
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +16 -34
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +11 -17
- package/src/summary/summarizerTypes.ts +12 -24
- package/src/summary/summaryFormat.ts +16 -2
- package/src/summary/summaryGenerator.ts +16 -4
- package/src/summary/summaryManager.ts +6 -7
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/dist/dataStores.d.ts +0 -149
- package/dist/dataStores.d.ts.map +0 -1
- package/dist/dataStores.js.map +0 -1
- package/dist/deltaManagerProxyBase.d.ts.map +0 -1
- package/dist/deltaManagerProxyBase.js +0 -77
- package/dist/deltaManagerProxyBase.js.map +0 -1
- package/lib/batchTracker.d.mts.map +0 -1
- package/lib/batchTracker.mjs.map +0 -1
- package/lib/blobManager.d.mts.map +0 -1
- package/lib/blobManager.mjs.map +0 -1
- package/lib/connectionTelemetry.d.mts.map +0 -1
- package/lib/connectionTelemetry.mjs.map +0 -1
- package/lib/containerHandleContext.d.mts.map +0 -1
- package/lib/containerHandleContext.mjs.map +0 -1
- package/lib/containerRuntime.d.mts.map +0 -1
- package/lib/containerRuntime.mjs.map +0 -1
- package/lib/dataStore.d.mts.map +0 -1
- package/lib/dataStore.mjs.map +0 -1
- package/lib/dataStoreContext.d.mts.map +0 -1
- package/lib/dataStoreContext.mjs.map +0 -1
- package/lib/dataStoreContexts.d.mts.map +0 -1
- package/lib/dataStoreContexts.mjs.map +0 -1
- package/lib/dataStoreRegistry.d.mts.map +0 -1
- package/lib/dataStoreRegistry.mjs.map +0 -1
- package/lib/dataStores.d.mts +0 -149
- package/lib/dataStores.d.mts.map +0 -1
- package/lib/dataStores.mjs.map +0 -1
- package/lib/deltaManagerProxyBase.d.mts +0 -35
- package/lib/deltaManagerProxyBase.d.mts.map +0 -1
- package/lib/deltaManagerProxyBase.mjs +0 -73
- package/lib/deltaManagerProxyBase.mjs.map +0 -1
- package/lib/deltaManagerSummarizerProxy.d.mts +0 -19
- package/lib/deltaManagerSummarizerProxy.d.mts.map +0 -1
- package/lib/deltaManagerSummarizerProxy.mjs +0 -38
- package/lib/deltaManagerSummarizerProxy.mjs.map +0 -1
- package/lib/deltaScheduler.d.mts.map +0 -1
- package/lib/deltaScheduler.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/gc/garbageCollection.d.mts.map +0 -1
- package/lib/gc/garbageCollection.mjs.map +0 -1
- package/lib/gc/gcConfigs.d.mts.map +0 -1
- package/lib/gc/gcConfigs.mjs.map +0 -1
- package/lib/gc/gcDefinitions.d.mts.map +0 -1
- package/lib/gc/gcDefinitions.mjs.map +0 -1
- package/lib/gc/gcHelpers.mjs.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +0 -1
- package/lib/gc/gcSummaryDefinitions.d.mts.map +0 -1
- package/lib/gc/gcSummaryDefinitions.mjs.map +0 -1
- package/lib/gc/gcSummaryStateTracker.d.mts.map +0 -1
- package/lib/gc/gcSummaryStateTracker.mjs.map +0 -1
- package/lib/gc/gcTelemetry.d.mts.map +0 -1
- package/lib/gc/gcTelemetry.mjs.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.d.mts.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.mjs.map +0 -1
- package/lib/gc/index.d.mts.map +0 -1
- package/lib/gc/index.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -24
- package/lib/index.mjs.map +0 -1
- package/lib/messageTypes.d.mts.map +0 -1
- package/lib/messageTypes.mjs.map +0 -1
- package/lib/metadata.d.mts.map +0 -1
- package/lib/metadata.mjs.map +0 -1
- package/lib/opLifecycle/batchManager.d.mts.map +0 -1
- package/lib/opLifecycle/batchManager.mjs.map +0 -1
- package/lib/opLifecycle/definitions.d.mts.map +0 -1
- package/lib/opLifecycle/definitions.mjs.map +0 -1
- package/lib/opLifecycle/index.d.mts +0 -13
- package/lib/opLifecycle/index.d.mts.map +0 -1
- package/lib/opLifecycle/index.mjs +0 -12
- package/lib/opLifecycle/index.mjs.map +0 -1
- package/lib/opLifecycle/opCompressor.d.mts.map +0 -1
- package/lib/opLifecycle/opCompressor.mjs.map +0 -1
- package/lib/opLifecycle/opDecompressor.d.mts.map +0 -1
- package/lib/opLifecycle/opDecompressor.mjs.map +0 -1
- package/lib/opLifecycle/opGroupingManager.d.mts.map +0 -1
- package/lib/opLifecycle/opGroupingManager.mjs.map +0 -1
- package/lib/opLifecycle/opSplitter.d.mts.map +0 -1
- package/lib/opLifecycle/opSplitter.mjs.map +0 -1
- package/lib/opLifecycle/outbox.d.mts.map +0 -1
- package/lib/opLifecycle/outbox.mjs.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.mjs.map +0 -1
- package/lib/opProperties.d.mts.map +0 -1
- package/lib/opProperties.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/pendingStateManager.d.mts.map +0 -1
- package/lib/pendingStateManager.mjs.map +0 -1
- package/lib/scheduleManager.d.mts.map +0 -1
- package/lib/scheduleManager.mjs.map +0 -1
- package/lib/storageServiceWithAttachBlobs.d.mts.map +0 -1
- package/lib/storageServiceWithAttachBlobs.mjs.map +0 -1
- package/lib/summary/index.d.mts.map +0 -1
- package/lib/summary/index.mjs.map +0 -1
- package/lib/summary/orderedClientElection.d.mts.map +0 -1
- package/lib/summary/orderedClientElection.mjs.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.d.mts.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.mjs.map +0 -1
- package/lib/summary/runningSummarizer.d.mts.map +0 -1
- package/lib/summary/runningSummarizer.mjs.map +0 -1
- package/lib/summary/summarizer.d.mts.map +0 -1
- package/lib/summary/summarizer.mjs.map +0 -1
- package/lib/summary/summarizerClientElection.d.mts.map +0 -1
- package/lib/summary/summarizerClientElection.mjs.map +0 -1
- package/lib/summary/summarizerHeuristics.d.mts.map +0 -1
- package/lib/summary/summarizerHeuristics.mjs.map +0 -1
- package/lib/summary/summarizerNode/index.d.mts.map +0 -1
- package/lib/summary/summarizerNode/index.mjs +0 -7
- package/lib/summary/summarizerNode/index.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +0 -1
- package/lib/summary/summarizerTypes.d.mts.map +0 -1
- package/lib/summary/summarizerTypes.mjs.map +0 -1
- package/lib/summary/summaryCollection.d.mts.map +0 -1
- package/lib/summary/summaryCollection.mjs.map +0 -1
- package/lib/summary/summaryFormat.d.mts.map +0 -1
- package/lib/summary/summaryFormat.mjs.map +0 -1
- package/lib/summary/summaryGenerator.d.mts.map +0 -1
- package/lib/summary/summaryGenerator.mjs.map +0 -1
- package/lib/summary/summaryManager.d.mts.map +0 -1
- package/lib/summary/summaryManager.mjs.map +0 -1
- package/lib/throttler.d.mts.map +0 -1
- package/lib/throttler.mjs.map +0 -1
- package/src/deltaManagerProxyBase.ts +0 -111
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.mts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-rc.1.0.4\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pendingStateManager.d.mts","sourceRoot":"","sources":["../src/pendingStateManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,WAAW,EAAE,MAAM,iCAAiC;OAEtD,EAAE,uBAAuB,EAAE,MAAM,uCAAuC;OAExE,EAAuB,mBAAmB,EAAE,MAAM,iCAAiC;OAEnF,EAAE,uCAAuC,EAAE;AAIlD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,aAAa,EAAE,eAAe,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,oBAAoB;IACpC,SAAS,IAAI,OAAO,CAAC;IACrB,QAAQ,IAAI,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,CAAC,KAAK,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC7C,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;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,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aACvC;iBAAM;gBACN,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;oBAC1B,OAAO,EAAE,cAAc,CAAC,OAAO;oBAC/B,eAAe,EAAE,cAAc,CAAC,eAAe;oBAC/C,UAAU,EAAE,cAAc,CAAC,UAAU;iBACrC,CAAC,CAAC;aACH;SACD;QAED,qFAAqF;QACrF,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,+GAA+G;QAC/G,6GAA6G;QAC7G,mFAAmF;QACnF,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE;YAC3C,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAC/B,SAAS,EAAE,uBAAuB;gBAClC,KAAK,EAAE,2BAA2B;gBAClC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;aACtC,CAAC,CAAC;SACH;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport Deque from \"double-ended-queue\";\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { DataProcessingError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\nimport { InboundSequencedContainerRuntimeMessage } from \"./messageTypes\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IBatchMetadata } from \"./metadata\";\n\n/**\n * This represents a message that has been submitted and is added to the pending queue when `submit` is called on the\n * ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.\n */\nexport interface IPendingMessage {\n\ttype: \"message\";\n\treferenceSequenceNumber: number;\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IPendingLocalState {\n\t/**\n\t * list of pending states, including ops and batch information\n\t */\n\tpendingStates: IPendingMessage[];\n}\n\nexport interface IPendingBatchMessage {\n\tcontent: string;\n\tlocalOpMetadata: unknown;\n\topMetadata: Record<string, unknown> | undefined;\n}\n\nexport interface IRuntimeStateHandler {\n\tconnected(): boolean;\n\tclientId(): string | undefined;\n\tclose(error?: ICriticalContainerError): void;\n\tapplyStashedOp(content: string): Promise<unknown>;\n\treSubmit(message: IPendingBatchMessage): void;\n\treSubmitBatch(batch: IPendingBatchMessage[]): void;\n\tisActiveConnection: () => boolean;\n}\n\n/** Union of keys of T */\ntype KeysOfUnion<T extends object> = T extends T ? keyof T : never;\n/** *Partial* type all possible combinations of properties and values of union T.\n * This loosens typing allowing access to all possible properties without\n * narrowing.\n */\ntype AnyComboFromUnion<T extends object> = { [P in KeysOfUnion<T>]?: T[P] };\n\nfunction buildPendingMessageContent(\n\t// AnyComboFromUnion is needed need to gain access to compatDetails that\n\t// is only defined for some cases.\n\tmessage: AnyComboFromUnion<InboundSequencedContainerRuntimeMessage>,\n): string {\n\t// IMPORTANT: Order matters here, this must match the order of the properties used\n\t// when submitting the message.\n\tconst { type, contents, compatDetails } = message;\n\t// Any properties that are not defined, won't be emitted by stringify.\n\treturn JSON.stringify({ type, contents, compatDetails });\n}\n\n/**\n * PendingStateManager is responsible for maintaining the messages that have not been sent or have not yet been\n * acknowledged by the server. It also maintains the batch information for both automatically and manually flushed\n * batches along with the messages.\n * When the Container reconnects, it replays the pending states, which includes manual flushing\n * of messages and triggering resubmission of unacked ops.\n *\n * It verifies that all the ops are acked, are received in the right order and batch information is correct.\n */\nexport class PendingStateManager implements IDisposable {\n\tprivate readonly pendingMessages = new Deque<IPendingMessage>();\n\tprivate readonly initialMessages = new Deque<IPendingMessage>();\n\n\t/**\n\t * Sequenced local ops that are saved when stashing since pending ops may depend on them\n\t */\n\tprivate savedOps: IPendingMessage[] = [];\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => {\n\t\tthis.initialMessages.clear();\n\t\tthis.pendingMessages.clear();\n\t});\n\n\t// Indicates whether we are processing a batch.\n\tprivate isProcessingBatch: boolean = false;\n\n\t// This stores the first message in the batch that we are processing. This is used to verify that we get\n\t// the correct batch metadata.\n\tprivate pendingBatchBeginMessage: ISequencedDocumentMessage | undefined;\n\n\tprivate clientId: string | undefined;\n\n\t/**\n\t * The pending messages count. Includes `pendingMessages` and `initialMessages` to keep in sync with\n\t * 'hasPendingMessages'.\n\t */\n\tpublic get pendingMessagesCount(): number {\n\t\treturn this.pendingMessages.length + this.initialMessages.length;\n\t}\n\n\t/**\n\t * Called to check if there are any pending messages in the pending message queue.\n\t * @returns A boolean indicating whether there are messages or not.\n\t */\n\tpublic hasPendingMessages(): boolean {\n\t\treturn this.pendingMessagesCount !== 0;\n\t}\n\n\tpublic getLocalState(): IPendingLocalState | undefined {\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x2e9 /* \"Must call getLocalState() after applying initial states\" */,\n\t\t);\n\t\tif (!this.pendingMessages.isEmpty()) {\n\t\t\treturn {\n\t\t\t\tpendingStates: [...this.savedOps, ...this.pendingMessages.toArray()].map(\n\t\t\t\t\t(message) => {\n\t\t\t\t\t\t// delete localOpMetadata since it may not be serializable\n\t\t\t\t\t\t// and will be regenerated by applyStashedOp()\n\t\t\t\t\t\treturn { ...message, localOpMetadata: undefined };\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly stateHandler: IRuntimeStateHandler,\n\t\tinitialLocalState: IPendingLocalState | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t) {\n\t\tif (initialLocalState?.pendingStates) {\n\t\t\tthis.initialMessages.push(...initialLocalState.pendingStates);\n\t\t}\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\t/**\n\t * Called when a message is submitted locally. Adds the message and the associated details to the pending state\n\t * queue.\n\t * @param type - The container message type.\n\t * @param content - The message content.\n\t * @param localOpMetadata - The local metadata associated with the message.\n\t */\n\tpublic onSubmitMessage(\n\t\tcontent: string,\n\t\treferenceSequenceNumber: number,\n\t\tlocalOpMetadata: unknown,\n\t\topMetadata: Record<string, unknown> | undefined,\n\t) {\n\t\tconst pendingMessage: IPendingMessage = {\n\t\t\ttype: \"message\",\n\t\t\treferenceSequenceNumber,\n\t\t\tcontent,\n\t\t\tlocalOpMetadata,\n\t\t\topMetadata,\n\t\t};\n\n\t\tthis.pendingMessages.push(pendingMessage);\n\t}\n\n\t/**\n\t * Applies stashed ops at their reference sequence number so they are ready to be ACKed or resubmitted\n\t * @param seqNum - Sequence number at which to apply ops. Will apply all ops if seqNum is undefined.\n\t */\n\tpublic async applyStashedOpsAt(seqNum?: number) {\n\t\t// apply stashed ops at sequence number\n\t\twhile (!this.initialMessages.isEmpty()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst nextMessage = this.initialMessages.peekFront()!;\n\t\t\tif (seqNum !== undefined) {\n\t\t\t\tif (nextMessage.referenceSequenceNumber > seqNum) {\n\t\t\t\t\tbreak; // nothing left to do at this sequence number\n\t\t\t\t}\n\t\t\t\tif (nextMessage.referenceSequenceNumber < seqNum) {\n\t\t\t\t\tthrow new Error(\"loaded from snapshot too recent to apply stashed ops\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it\n\t\t\t\tconst localOpMetadata = await this.stateHandler.applyStashedOp(nextMessage.content);\n\t\t\t\tnextMessage.localOpMetadata = localOpMetadata;\n\t\t\t} catch (error) {\n\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(error, \"applyStashedOp\", nextMessage);\n\t\t\t}\n\n\t\t\t// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.pendingMessages.push(this.initialMessages.shift()!);\n\t\t}\n\t}\n\n\t/**\n\t * Processes a local message once its ack'd by the server. It verifies that there was no data corruption and that\n\t * the batch information was preserved for batch messages.\n\t * @param message - The message that got ack'd and needs to be processed.\n\t */\n\tpublic processPendingLocalMessage(message: InboundSequencedContainerRuntimeMessage): unknown {\n\t\t// Pre-processing part - This may be the start of a batch.\n\t\tthis.maybeProcessBatchBegin(message);\n\n\t\t// Get the next message from the pending queue. Verify a message exists.\n\t\tconst pendingMessage = this.pendingMessages.peekFront();\n\t\tassert(\n\t\t\tpendingMessage !== undefined,\n\t\t\t0x169 /* \"No pending message found for this remote message\" */,\n\t\t);\n\t\tthis.savedOps.push(pendingMessage);\n\n\t\tthis.pendingMessages.shift();\n\n\t\tconst messageContent = buildPendingMessageContent(message);\n\n\t\t// Stringified content should match\n\t\tif (pendingMessage.content !== messageContent) {\n\t\t\tthis.stateHandler.close(\n\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\"pending local message content mismatch\",\n\t\t\t\t\t\"unexpectedAckReceived\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\texpectedMessageType: JSON.parse(pendingMessage.content).type,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Post-processing part - If we are processing a batch then this could be the last message in the batch.\n\t\tthis.maybeProcessBatchEnd(message);\n\n\t\treturn pendingMessage.localOpMetadata;\n\t}\n\n\t/**\n\t * This message could be the first message in batch. If so, set batch state marking the beginning of a batch.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchBegin(message: ISequencedDocumentMessage) {\n\t\t// This message is the first in a batch if the \"batch\" property on the metadata is set to true\n\t\tif ((message.metadata as IBatchMetadata | undefined)?.batch) {\n\t\t\t// We should not already be processing a batch and there should be no pending batch begin message.\n\t\t\tassert(\n\t\t\t\t!this.isProcessingBatch && this.pendingBatchBeginMessage === undefined,\n\t\t\t\t0x16b /* \"The pending batch state indicates we are already processing a batch\" */,\n\t\t\t);\n\n\t\t\t// Set the pending batch state indicating we have started processing a batch.\n\t\t\tthis.pendingBatchBeginMessage = message;\n\t\t\tthis.isProcessingBatch = true;\n\t\t}\n\t}\n\n\t/**\n\t * This message could be the last message in batch. If so, clear batch state since the batch is complete.\n\t * @param message - The message that is being processed.\n\t */\n\tprivate maybeProcessBatchEnd(message: ISequencedDocumentMessage) {\n\t\tif (!this.isProcessingBatch) {\n\t\t\treturn;\n\t\t}\n\n\t\t// There should be a pending batch begin message.\n\t\tassert(\n\t\t\tthis.pendingBatchBeginMessage !== undefined,\n\t\t\t0x16d /* \"There is no pending batch begin message\" */,\n\t\t);\n\n\t\tconst batchEndMetadata = (message.metadata as IBatchMetadata | undefined)?.batch;\n\t\tif (this.pendingMessages.isEmpty() || batchEndMetadata === false) {\n\t\t\t// Get the batch begin metadata from the first message in the batch.\n\t\t\tconst batchBeginMetadata = (\n\t\t\t\tthis.pendingBatchBeginMessage.metadata as IBatchMetadata | undefined\n\t\t\t)?.batch;\n\n\t\t\t// There could be just a single message in the batch. If so, it should not have any batch metadata. If there\n\t\t\t// are multiple messages in the batch, verify that we got the correct batch begin and end metadata.\n\t\t\tif (this.pendingBatchBeginMessage === message) {\n\t\t\t\tassert(\n\t\t\t\t\tbatchBeginMetadata === undefined,\n\t\t\t\t\t0x16e /* \"Batch with single message should not have batch metadata\" */,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (batchBeginMetadata !== true || batchEndMetadata !== false) {\n\t\t\t\t\tthis.stateHandler.close(\n\t\t\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\t\t\"Pending batch inconsistency\", // Formerly known as asserts 0x16f and 0x170\n\t\t\t\t\t\t\t\"processPendingLocalMessage\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\t\t\tthis.pendingBatchBeginMessage.clientId === null\n\t\t\t\t\t\t\t\t\t\t? \"null\"\n\t\t\t\t\t\t\t\t\t\t: this.pendingBatchBeginMessage.clientId,\n\t\t\t\t\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t\t\t\t\t\thasBatchStart: batchBeginMetadata === true,\n\t\t\t\t\t\t\t\thasBatchEnd: batchEndMetadata === false,\n\t\t\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t\t\t\tpendingMessagesCount: this.pendingMessagesCount,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Clear the pending batch state now that we have processed the entire batch.\n\t\t\tthis.pendingBatchBeginMessage = undefined;\n\t\t\tthis.isProcessingBatch = false;\n\t\t}\n\t}\n\n\t/**\n\t * Called when the Container's connection state changes. If the Container gets connected, it replays all the pending\n\t * states in its queue. This includes triggering resubmission of unacked ops.\n\t * ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)\n\t */\n\tpublic replayPendingStates() {\n\t\tassert(\n\t\t\tthis.stateHandler.connected(),\n\t\t\t0x172 /* \"The connection state is not consistent with the runtime\" */,\n\t\t);\n\n\t\t// This assert suggests we are about to send same ops twice, which will result in data loss.\n\t\tassert(\n\t\t\tthis.clientId !== this.stateHandler.clientId(),\n\t\t\t0x173 /* \"replayPendingStates called twice for same clientId!\" */,\n\t\t);\n\t\tthis.clientId = this.stateHandler.clientId();\n\n\t\tassert(\n\t\t\tthis.initialMessages.isEmpty(),\n\t\t\t0x174 /* \"initial states should be empty before replaying pending\" */,\n\t\t);\n\n\t\tconst initialPendingMessagesCount = this.pendingMessages.length;\n\t\tlet remainingPendingMessagesCount = this.pendingMessages.length;\n\n\t\t// Process exactly `pendingMessagesCount` items in the queue as it represents the number of messages that were\n\t\t// pending when we connected. This is important because the `reSubmitFn` might add more items in the queue\n\t\t// which must not be replayed.\n\t\twhile (remainingPendingMessagesCount > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tlet pendingMessage = this.pendingMessages.shift()!;\n\t\t\tremainingPendingMessagesCount--;\n\t\t\tassert(\n\t\t\t\tpendingMessage.opMetadata?.batch !== false,\n\t\t\t\t0x41b /* We cannot process batches in chunks */,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * We want to ensure grouped messages get processed in a batch.\n\t\t\t * Note: It is not possible for the PendingStateManager to receive a partially acked batch. It will\n\t\t\t * either receive the whole batch ack or nothing at all.\n\t\t\t */\n\t\t\tif (pendingMessage.opMetadata?.batch) {\n\t\t\t\tassert(\n\t\t\t\t\tremainingPendingMessagesCount > 0,\n\t\t\t\t\t0x554 /* Last pending message cannot be a batch begin */,\n\t\t\t\t);\n\n\t\t\t\tconst batch: IPendingBatchMessage[] = [];\n\n\t\t\t\t// check is >= because batch end may be last pending message\n\t\t\t\twhile (remainingPendingMessagesCount >= 0) {\n\t\t\t\t\tbatch.push({\n\t\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (pendingMessage.opMetadata?.batch === false) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tassert(remainingPendingMessagesCount > 0, 0x555 /* No batch end found */);\n\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tpendingMessage = this.pendingMessages.shift()!;\n\t\t\t\t\tremainingPendingMessagesCount--;\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingMessage.opMetadata?.batch !== true,\n\t\t\t\t\t\t0x556 /* Batch start needs a corresponding batch end */,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.stateHandler.reSubmitBatch(batch);\n\t\t\t} else {\n\t\t\t\tthis.stateHandler.reSubmit({\n\t\t\t\t\tcontent: pendingMessage.content,\n\t\t\t\t\tlocalOpMetadata: pendingMessage.localOpMetadata,\n\t\t\t\t\topMetadata: pendingMessage.opMetadata,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// pending ops should no longer depend on previous sequenced local ops after resubmit\n\t\tthis.savedOps = [];\n\n\t\t// We replayPendingStates on read connections too - we expect these to get nack'd though, and to then reconnect\n\t\t// on a write connection and replay again. This filters out the replay that happens on the read connection so\n\t\t// we only see the replays on write connections (that have a chance to go through).\n\t\tif (this.stateHandler.isActiveConnection()) {\n\t\t\tthis.logger?.sendTelemetryEvent({\n\t\t\t\teventName: \"PendingStatesReplayed\",\n\t\t\t\tcount: initialPendingMessagesCount,\n\t\t\t\tclientId: this.stateHandler.clientId(),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleManager.d.mts","sourceRoot":"","sources":["../src/scheduleManager.ts"],"names":[],"mappings":";OAIO,EAAE,YAAY,EAAE,MAAM,QAAQ;OAC9B,EAAE,aAAa,EAAE,MAAM,uCAAuC;OAC9D,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OAC3F,EAKN,mBAAmB,EACnB,MAAM,iCAAiC;AAcxC;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAM1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IARxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAS;gBAGP,YAAY,EAAE,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AAM,KAAK,CAAC,EAAE;gBAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;aAClB;SACD;aAAM,IAAI,aAAa,KAAK,KAAK,EAAE;YACnC,MAAM,CACL,IAAI,CAAC,mBAAmB,KAAK,SAAS,EACtC,KAAK,CAAC,0CAA0C,CAChD,CAAC;YACF,wCAAwC;YACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACrC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;SACtC;aAAM;YACN,4CAA4C;YAC5C,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;SAC3E;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"events\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { IDocumentMessage, ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tcreateChildLogger,\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\nimport { DeltaScheduler } from \"./deltaScheduler\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IBatchMetadata } from \"./metadata\";\n\ntype IRuntimeMessageMetadata =\n\t| undefined\n\t| {\n\t\t\tbatch?: boolean;\n\t };\n\n/**\n * This class has the following responsibilities:\n *\n * 1. It tracks batches as we process ops and raises \"batchBegin\" and \"batchEnd\" events.\n * As part of it, it validates batch correctness (i.e. no system ops in the middle of batch)\n *\n * 2. It creates instance of ScheduleManagerCore that ensures we never start processing ops from batch\n * unless all ops of the batch are in.\n */\nexport class ScheduleManager {\n\tprivate readonly deltaScheduler: DeltaScheduler;\n\tprivate batchClientId: string | undefined;\n\tprivate hitError = false;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly emitter: EventEmitter,\n\t\treadonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.deltaScheduler = new DeltaScheduler(\n\t\t\tthis.deltaManager,\n\t\t\tcreateChildLogger({ logger: this.logger, namespace: \"DeltaScheduler\" }),\n\t\t);\n\t\tvoid new ScheduleManagerCore(deltaManager, getClientId, logger);\n\t}\n\n\tpublic beforeOpProcessing(message: ISequencedDocumentMessage) {\n\t\tif (this.batchClientId !== message.clientId) {\n\t\t\tassert(\n\t\t\t\tthis.batchClientId === undefined,\n\t\t\t\t0x2a2 /* \"Batch is interrupted by other client op. Should be caught by trackPending()\" */,\n\t\t\t);\n\n\t\t\t// This could be the beginning of a new batch or an individual message.\n\t\t\tthis.emitter.emit(\"batchBegin\", message);\n\t\t\tthis.deltaScheduler.batchBegin(message);\n\n\t\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.batchClientId = batch ? (message.clientId as string) : undefined;\n\t\t}\n\t}\n\n\tpublic afterOpProcessing(error: any | undefined, message: ISequencedDocumentMessage) {\n\t\t// If this is no longer true, we need to revisit what we do where we set this.hitError.\n\t\tassert(!this.hitError, 0x2a3 /* \"container should be closed on any error\" */);\n\n\t\tif (error) {\n\t\t\t// We assume here that loader will close container and stop processing all future ops.\n\t\t\t// This is implicit dependency. If this flow changes, this code might no longer be correct.\n\t\t\tthis.hitError = true;\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", error, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\n\t\tconst batch = (message?.metadata as IRuntimeMessageMetadata)?.batch;\n\t\t// If no batchClientId has been set then we're in an individual batch. Else, if we get\n\t\t// batch end metadata, this is end of the current batch.\n\t\tif (this.batchClientId === undefined || batch === false) {\n\t\t\tthis.batchClientId = undefined;\n\t\t\tthis.emitter.emit(\"batchEnd\", undefined, message);\n\t\t\tthis.deltaScheduler.batchEnd(message);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/**\n * This class controls pausing and resuming of inbound queue to ensure that we never\n * start processing ops in a batch IF we do not have all ops in the batch.\n */\nclass ScheduleManagerCore {\n\tprivate pauseSequenceNumber: number | undefined;\n\tprivate currentBatchClientId: string | undefined;\n\tprivate localPaused = false;\n\tprivate timePaused = 0;\n\tprivate batchCount = 0;\n\n\tconstructor(\n\t\tprivate readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tprivate readonly getClientId: () => string | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\t// Listen for delta manager sends and add batch metadata to messages\n\t\tthis.deltaManager.on(\"prepareSend\", (messages: IDocumentMessage[]) => {\n\t\t\tif (messages.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// First message will have the batch flag set to true if doing a batched send\n\t\t\tconst firstMessageMetadata = messages[0].metadata as IRuntimeMessageMetadata;\n\t\t\tif (!firstMessageMetadata?.batch) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the batch contains only a single op, clear the batch flag.\n\t\t\tif (messages.length === 1) {\n\t\t\t\tdelete firstMessageMetadata.batch;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the batch flag to false on the last message to indicate the end of the send batch\n\t\t\tconst lastMessage = messages[messages.length - 1];\n\t\t\t// TODO: It's not clear if this shallow clone is required, as opposed to just setting \"batch\" to false.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tlastMessage.metadata = { ...(lastMessage.metadata as any), batch: false };\n\t\t});\n\n\t\t// Listen for updates and peek at the inbound\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tthis.trackPending(message);\n\t\t});\n\n\t\t// Start with baseline - empty inbound queue.\n\t\tassert(!this.localPaused, 0x293 /* \"initial state\" */);\n\n\t\tconst allPending = this.deltaManager.inbound.toArray();\n\t\tfor (const pending of allPending) {\n\t\t\tthis.trackPending(pending);\n\t\t}\n\n\t\t// We are intentionally directly listening to the \"op\" to inspect system ops as well.\n\t\t// If we do not observe system ops, we are likely to hit 0x296 assert when system ops\n\t\t// precedes start of incomplete batch.\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterOpProcessing(message));\n\t}\n\n\t/**\n\t * The only public function in this class - called when we processed an op,\n\t * to make decision if op processing should be paused or not after that.\n\t */\n\tpublic afterOpProcessing(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\t!this.localPaused,\n\t\t\t0x294 /* \"can't have op processing paused if we are processing an op\" */,\n\t\t);\n\n\t\t// If the inbound queue is ever empty, nothing to do!\n\t\tif (this.deltaManager.inbound.length === 0) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber === undefined,\n\t\t\t\t0x295 /* \"there should be no pending batch if we have no ops\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - here (processing ops until reaching start of incomplete batch)\n\t\t// - in trackPending(), when queue was empty and start of batch showed up.\n\t\t// 2. resumed when batch end comes in (in trackPending())\n\n\t\t// do we have incomplete batch to worry about?\n\t\tif (this.pauseSequenceNumber !== undefined) {\n\t\t\tif (message.sequenceNumber >= this.pauseSequenceNumber) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t// Former assert 0x296\n\t\t\t\t\t\"Incomplete batch\",\n\t\t\t\t\t\"ScheduleManager\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: message.type,\n\t\t\t\t\t\tcontentType: typeof message.contents,\n\t\t\t\t\t\tbatch: (message.metadata as IBatchMetadata | undefined)?.batch,\n\t\t\t\t\t\tcompression: message.compression,\n\t\t\t\t\t\tpauseSeqNum: this.pauseSequenceNumber,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// If the next op is the start of incomplete batch, then we can't process it until it's fully in - pause!\n\t\t\tif (message.sequenceNumber + 1 === this.pauseSequenceNumber) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate pauseQueue() {\n\t\tassert(!this.localPaused, 0x297 /* \"always called from resumed state\" */);\n\t\tthis.localPaused = true;\n\t\tthis.timePaused = performance.now();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis.deltaManager.inbound.pause();\n\t}\n\n\tprivate resumeQueue(startBatch: number, messageEndBatch: ISequencedDocumentMessage) {\n\t\tconst endBatch = messageEndBatch.sequenceNumber;\n\t\tconst duration = this.localPaused ? performance.now() - this.timePaused : undefined;\n\n\t\tthis.batchCount++;\n\t\tif (this.batchCount % 1000 === 1) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BatchStats\",\n\t\t\t\tsequenceNumber: endBatch,\n\t\t\t\tlength: endBatch - startBatch + 1,\n\t\t\t\tmsnDistance: endBatch - messageEndBatch.minimumSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tbatchCount: this.batchCount,\n\t\t\t\tinterrupted: this.localPaused,\n\t\t\t});\n\t\t}\n\n\t\t// Return early if no change in value\n\t\tif (!this.localPaused) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.localPaused = false;\n\n\t\tthis.deltaManager.inbound.resume();\n\t}\n\n\t/**\n\t * Called for each incoming op (i.e. inbound \"push\" notification)\n\t */\n\tprivate trackPending(message: ISequencedDocumentMessage) {\n\t\tassert(\n\t\t\tthis.deltaManager.inbound.length !== 0,\n\t\t\t0x298 /* \"we have something in the queue that generates this event\" */,\n\t\t);\n\n\t\tassert(\n\t\t\t(this.currentBatchClientId === undefined) === (this.pauseSequenceNumber === undefined),\n\t\t\t0x299 /* \"non-synchronized state\" */,\n\t\t);\n\n\t\tconst metadata = message.metadata as IRuntimeMessageMetadata;\n\t\t// batchMetadata will be true for the message that starts a batch, false for the one that ends it, and\n\t\t// undefined for all other messages.\n\t\tconst batchMetadata = metadata?.batch;\n\n\t\t// Protocol messages are never part of a runtime batch of messages\n\t\tif (!isRuntimeMessage(message)) {\n\t\t\t// Protocol messages should never show up in the middle of the batch!\n\t\t\tif (this.currentBatchClientId !== undefined) {\n\t\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\t\"Received a system message during batch processing\", // Formerly known as assert 0x29a\n\t\t\t\t\t\"trackPending\",\n\t\t\t\t\tmessage,\n\t\t\t\t\t{\n\t\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t\t\tbatchClientId:\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\t\t\tmessageType: message.type,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tassert(batchMetadata === undefined, 0x29b /* \"system op in a batch?\" */);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29c /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.currentBatchClientId === undefined && batchMetadata === undefined) {\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29d /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// If we got here, the message is part of a batch. Either starting, in progress, or ending.\n\n\t\t// If this is not the start of the batch, error out if the message was sent by a client other than the one that\n\t\t// started the current batch (it should not be possible for ops from other clients to get interleaved with a batch).\n\t\tif (\n\t\t\tthis.currentBatchClientId !== undefined &&\n\t\t\tthis.currentBatchClientId !== message.clientId\n\t\t) {\n\t\t\tthrow new DataCorruptionError(\"OpBatchIncomplete\", {\n\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\tbatchClientId:\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\t\t\t\t\tthis.currentBatchClientId === null ? \"null\" : this.currentBatchClientId,\n\t\t\t\tpauseSequenceNumber: this.pauseSequenceNumber,\n\t\t\t\tlocalBatch: this.currentBatchClientId === this.getClientId(),\n\t\t\t\tlocalMessage: message.clientId === this.getClientId(),\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\t// The queue is\n\t\t// 1. paused only when the next message to be processed is the beginning of a batch. Done in two places:\n\t\t// - in afterOpProcessing() - processing ops until reaching start of incomplete batch\n\t\t// - here, when queue was empty and start of batch showed up (batchMetadata === true below).\n\t\t// 2. resumed when batch end comes in (batchMetadata === false below)\n\n\t\tif (batchMetadata) {\n\t\t\tassert(\n\t\t\t\tthis.currentBatchClientId === undefined,\n\t\t\t\t0x29e /* \"there can't be active batch\" */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t!this.localPaused,\n\t\t\t\t0x29f /* \"we should be processing ops when there is no active batch\" */,\n\t\t\t);\n\t\t\tthis.pauseSequenceNumber = message.sequenceNumber;\n\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\tthis.currentBatchClientId = message.clientId as string;\n\t\t\t// Start of the batch\n\t\t\t// Only pause processing if queue has no other ops!\n\t\t\t// If there are any other ops in the queue, processing will be stopped when they are processed!\n\t\t\tif (this.deltaManager.inbound.length === 1) {\n\t\t\t\tthis.pauseQueue();\n\t\t\t}\n\t\t} else if (batchMetadata === false) {\n\t\t\tassert(\n\t\t\t\tthis.pauseSequenceNumber !== undefined,\n\t\t\t\t0x2a0 /* \"batch presence was validated above\" */,\n\t\t\t);\n\t\t\t// Batch is complete, we can process it!\n\t\t\tthis.resumeQueue(this.pauseSequenceNumber, message);\n\t\t\tthis.pauseSequenceNumber = undefined;\n\t\t\tthis.currentBatchClientId = undefined;\n\t\t} else {\n\t\t\t// Continuation of current batch. Do nothing\n\t\t\tassert(this.currentBatchClientId !== undefined, 0x2a1 /* \"logic error\" */);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storageServiceWithAttachBlobs.d.mts","sourceRoot":"","sources":["../src/storageServiceWithAttachBlobs.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,oCAAoC;OACpC,EAAE,2BAA2B,EAAE,MAAM,8BAA8B;AAE1E;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,2BAA2B;IAG5E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAD5B,sBAAsB,EAAE,uBAAuB,EAC9B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;IAK3D,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;IAEY,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAU3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storageServiceWithAttachBlobs.mjs","sourceRoot":"","sources":["../src/storageServiceWithAttachBlobs.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAMI,EAAE,2BAA2B,EAAE,MAAM,8BAA8B;AAE1E;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,2BAA2B;IAC7E,YACC,sBAA+C,EAC9B,WAAyC;QAE1D,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAFb,gBAAW,GAAX,WAAW,CAA8B;IAG3D,CAAC;IAED,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,IAAI,KAAK,SAAS,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QAED,8FAA8F;QAC9F,2EAA2E;QAC3E,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n} from \"@fluidframework/driver-definitions\";\nimport { DocumentStorageServiceProxy } from \"@fluidframework/driver-utils\";\n\n/**\n * IDocumentStorageService proxy which intercepts requests if they can be satisfied by the blobs received in the\n * attach message. We use this to avoid an unnecessary request to the storage service.\n */\nexport class StorageServiceWithAttachBlobs extends DocumentStorageServiceProxy {\n\tconstructor(\n\t\tinternalStorageService: IDocumentStorageService,\n\t\tprivate readonly attachBlobs: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(internalStorageService);\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.attachBlobs.get(id);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\n\t\t// Note that it is intentional not to cache the result of this readBlob - we'll trust the real\n\t\t// IDocumentStorageService to cache appropriately, no need to double-cache.\n\t\treturn this.internalStorageService.readBlob(id);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,qBAAqB,GACrB;OACM,EAAE,mCAAmC,EAAE,iBAAiB,EAAE;OAC1D,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,4BAA4B,GAC5B;OACM,EAAE,UAAU,EAAE;OACd,EACN,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,oBAAoB,GACpB;OACM,EAAE,sBAAsB,EAAE,wBAAwB,EAAE;OACpD,EACN,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,GACzB;OACM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,GACpB;OACM,EACN,aAAa,EACb,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,GACjB;OACM,EACN,aAAa,EACb,aAAa,EACb,cAAc,EACd,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,uBAAuB,EACvB,6BAA6B,EAC7B,yBAAyB,EACzB,oBAAoB,GACpB;OACM,EAAE,cAAc,EAAE,qBAAqB,EAAE,eAAe,EAAE;OAC1D,EACN,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,mBAAmB,GACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAKN,uBAAuB,EACvB,qBAAqB,GACrB;OACM,EAAE,mCAAmC,EAAE,iBAAiB,EAAE;OAC1D,EAEN,0BAA0B,EAC1B,4BAA4B,GAC5B;OACM,EAAE,UAAU,EAAE;OACd,EAGN,wBAAwB,EACxB,oBAAoB,GACpB;OACM,EAAE,sBAAsB,EAAE,wBAAwB,EAAE;OACpD,EACN,wBAAwB,EACxB,8BAA8B,GAI9B;OAmCM,EAIN,iBAAiB,GAOjB;OACM,EACN,aAAa,EACb,aAAa,EACb,cAAc,EACd,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EAInB,gBAAgB,EAChB,iBAAiB,EAEjB,uBAAuB,EAEvB,yBAAyB,EACzB,oBAAoB,GACpB;OACM,EAAE,cAAc,EAAE,qBAAqB,EAAmB;OAC1D,EAIN,cAAc,EACd,mBAAmB,GACnB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIOrderedClientCollection,\n\tIOrderedClientElection,\n\tISerializedElection,\n\tITrackedClient,\n\tOrderedClientCollection,\n\tOrderedClientElection,\n} from \"./orderedClientElection\";\nexport { defaultMaxAttemptsForSubmitFailures, RunningSummarizer } from \"./runningSummarizer\";\nexport {\n\tICancellableSummarizerController,\n\tneverCancelledSummaryToken,\n\tRunWhileConnectedCoordinator,\n} from \"./runWhileConnectedCoordinator\";\nexport { Summarizer } from \"./summarizer\";\nexport {\n\tISummarizerClientElection,\n\tISummarizerClientElectionEvents,\n\tSummarizerClientElection,\n\tsummarizerClientType,\n} from \"./summarizerClientElection\";\nexport { SummarizeHeuristicData, SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nexport {\n\tcreateRootSummarizerNode,\n\tcreateRootSummarizerNodeWithGC,\n\tIRefreshSummaryResult,\n\tIRootSummarizerNode,\n\tIRootSummarizerNodeWithGC,\n} from \"./summarizerNode\";\nexport {\n\tIConnectableRuntime,\n\tIGeneratedSummaryStats,\n\tIRefreshSummaryAckOptions,\n\tISubmitSummaryOptions,\n\tISummarizeAttempt,\n\tISummarizeHeuristicData,\n\tISummarizer,\n\tISummarizeResults,\n\tISummarizerEvents,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummaryCancellationToken,\n\tSubmitSummaryResult,\n\tSummarizerStopReason,\n\tEnqueueSummarizeResult,\n\tIAckSummaryResult,\n\tIBaseSummarizeResult,\n\tIBroadcastSummaryResult,\n\tICancellationToken,\n\tIEnqueueSummarizeOptions,\n\tIGenerateSummaryTreeResult,\n\tINackSummaryResult,\n\tIOnDemandSummarizeOptions,\n\tISubmitSummaryOpResult,\n\tISummarizeOptions,\n\tISummarizingWarning,\n\tIUploadSummaryResult,\n\tSummarizeResultPart,\n\tSubmitSummaryFailureData,\n\tSummaryStage,\n\tIRetriableFailureResult,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nexport {\n\tIAckedSummary,\n\tISummaryCollectionOpEvents,\n\tISummaryOpMessage,\n\tSummaryCollection,\n\tIClientSummaryWatcher,\n\tISummary,\n\tISummaryAckMessage,\n\tISummaryNackMessage,\n\tOpActionEventListener,\n\tOpActionEventName,\n} from \"./summaryCollection\";\nexport {\n\taliasBlobName,\n\tblobsTreeName,\n\tchunksBlobName,\n\tdataStoreAttributesBlobName,\n\telectedSummarizerBlobName,\n\textractSummaryMetadataMessage,\n\tgetAttributesFormatVersion,\n\tgetFluidDataStoreAttributes,\n\thasIsolatedChannels,\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tISummaryMetadataMessage,\n\tmetadataBlobName,\n\tnonDataStorePaths,\n\tReadFluidDataStoreAttributes,\n\trootHasIsolatedChannels,\n\tWriteFluidDataStoreAttributes,\n\twrapSummaryInChannelsTree,\n\tidCompressorBlobName,\n} from \"./summaryFormat\";\nexport { getFailMessage, RetriableSummaryError, SummarizeReason } from \"./summaryGenerator\";\nexport {\n\tIConnectedEvents,\n\tIConnectedState,\n\tISummaryManagerConfig,\n\tSummaryManager,\n\tSummaryManagerState,\n} from \"./summaryManager\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orderedClientElection.d.mts","sourceRoot":"","sources":["../../src/summary/orderedClientElection.ts"],"names":[],"mappings":"OAKO,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iCAAiC;OACvF,EACN,mBAAmB,EAGnB,MAAM,iCAAiC;OAEjC,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,aAAa,EAAE,MAAM,uCAAuC;OAC9D,EAAE,OAAO,EAAE,cAAc,EAAoB,MAAM,sCAAsC;AAKhG,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC1F,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,GACrD,CAAC,GACD,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACrB,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,GACvB,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,C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CAAC;SACpD;IACF,CAAC;IAEM,qBAAqB;QAC3B,OAAO,CACN,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC;YAChE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CACvE,CAAC;IACH,CAAC;IAEM,SAAS;QACf,OAAO;YACN,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;YAC7C,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;SAC7C,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @rushstack/no-new-null */\nimport { IEvent, IEventProvider, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { IClient, IQuorumClients, ISequencedClient } from \"@fluidframework/protocol-definitions\";\nimport { summarizerClientType } from \"./summarizerClientElection\";\n\n// helper types for recursive readonly.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ImmutablePrimitives = undefined | null | boolean | string | number | Function;\nexport type Immutable<T> = T extends ImmutablePrimitives\n\t? T\n\t: T extends (infer A)[]\n\t? readonly Immutable<A>[]\n\t: T extends Map<infer K, infer V>\n\t? ReadonlyMap<Immutable<K>, Immutable<V>>\n\t: T extends Set<infer V>\n\t? ReadonlySet<Immutable<V>>\n\t: { readonly [K in keyof T]: Immutable<T[K]> };\n\n/** Minimum information for a client tracked for election consideration. */\nexport interface ITrackedClient {\n\treadonly clientId: string;\n\treadonly sequenceNumber: number;\n\treadonly client: Immutable<IClient>;\n}\n\n/** Common contract for link nodes within an OrderedClientCollection. */\nexport interface ILinkNode {\n\treadonly sequenceNumber: number;\n\tyoungerClient: ILinkedClient | undefined;\n}\n\n/** Placeholder root node within an OrderedClientCollection; does not represent a client. */\nexport interface IRootLinkNode extends ILinkNode {\n\treadonly sequenceNumber: -1;\n\treadonly olderClient: undefined;\n}\n\n/** Additional information required to keep track of the client within the doubly-linked list. */\nexport interface ILinkedClient extends ILinkNode, ITrackedClient {\n\tolderClient: LinkNode;\n}\n\n/** Any link node within OrderedClientCollection including the placeholder root node. */\nexport type LinkNode = IRootLinkNode | ILinkedClient;\n\n/** Events raised by an OrderedClientCollection. */\nexport interface IOrderedClientCollectionEvents extends IEvent {\n\t/** Event fires when client is being added. */\n\t(\n\t\tevent: \"addClient\" | \"removeClient\",\n\t\tlistener: (client: ILinkedClient, sequenceNumber: number) => void,\n\t);\n}\n\n/** Contract for a sorted collection of all clients in the quorum. */\nexport interface IOrderedClientCollection extends IEventProvider<IOrderedClientCollectionEvents> {\n\t/** Count of clients in the collection. */\n\treadonly count: number;\n\t/** Pointer to the oldest client in the collection. */\n\treadonly oldestClient: ILinkedClient | undefined;\n\t/** Returns a sorted array of all the clients in the collection. */\n\tgetAllClients(): ILinkedClient[];\n}\n\n/**\n * Tracks clients in the Quorum. It maintains their order using their join op\n * sequence numbers.\n * Internally, the collection of clients is maintained in a doubly-linked list,\n * with pointers to both the first and last nodes.\n * The first (root) node is a placeholder to simplify logic and reduce null checking.\n */\nexport class OrderedClientCollection\n\textends TypedEventEmitter<IOrderedClientCollectionEvents>\n\timplements IOrderedClientCollection\n{\n\t/** Collection of ALL clients currently in the quorum, with client ids as keys. */\n\tprivate readonly clientMap = new Map<string, ILinkedClient>();\n\t/** Placeholder head node of linked list, for simplified null checking. */\n\tprivate readonly rootNode: IRootLinkNode = {\n\t\tsequenceNumber: -1,\n\t\tolderClient: undefined,\n\t\tyoungerClient: undefined,\n\t};\n\t/** Pointer to end of linked list, for optimized client adds. */\n\tprivate _youngestClient: LinkNode = this.rootNode;\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic get count() {\n\t\treturn this.clientMap.size;\n\t}\n\tpublic get oldestClient() {\n\t\treturn this.rootNode.youngerClient;\n\t}\n\n\tconstructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tdeltaManager: Pick<IDeltaManager<unknown, unknown>, \"lastSequenceNumber\">,\n\t\tquorum: Pick<IQuorumClients, \"getMembers\" | \"on\">,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OrderedClientCollection\" });\n\t\tconst members = quorum.getMembers();\n\t\tfor (const [clientId, client] of members) {\n\t\t\tthis.addClient(clientId, client);\n\t\t}\n\n\t\tquorum.on(\"addMember\", (clientId, client) => {\n\t\t\tconst newClient = this.addClient(clientId, client);\n\t\t\tthis.emit(\"addClient\", newClient, deltaManager.lastSequenceNumber);\n\t\t});\n\t\tquorum.on(\"removeMember\", (clientId) => {\n\t\t\tconst sequenceNumber = deltaManager.lastSequenceNumber;\n\t\t\tconst removeClient = this.removeClient(clientId);\n\t\t\tif (removeClient === undefined) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"ClientNotFound\",\n\t\t\t\t\tclientId,\n\t\t\t\t\tsequenceNumber,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.emit(\"removeClient\", removeClient, sequenceNumber);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate addClient(clientId: string, client: ISequencedClient): ITrackedClient {\n\t\t// Normal case is adding the latest client, which will bypass loop.\n\t\t// Find where it belongs otherwise (maybe possible during initial load?).\n\t\tassert(\n\t\t\tclient.sequenceNumber > -1,\n\t\t\t0x1f6 /* \"Negative client sequence number not allowed\" */,\n\t\t);\n\t\tlet currClient = this._youngestClient;\n\t\twhile (currClient.sequenceNumber > client.sequenceNumber) {\n\t\t\tassert(\n\t\t\t\tcurrClient.olderClient !== undefined,\n\t\t\t\t0x1f7 /* \"Previous client should always be defined\" */,\n\t\t\t);\n\t\t\t// Note: If adding a client older than the elected client, it will not be automatically elected.\n\t\t\tcurrClient = currClient.olderClient;\n\t\t}\n\n\t\t// Now currClient is the node right before where the new client node should be.\n\t\tconst newClient: ILinkedClient = {\n\t\t\tclientId,\n\t\t\tsequenceNumber: client.sequenceNumber,\n\t\t\tclient: { ...client.client }, // shallow clone\n\t\t\tolderClient: currClient,\n\t\t\tyoungerClient: currClient.youngerClient,\n\t\t};\n\n\t\t// Update prev node to point to this new node.\n\t\tnewClient.olderClient.youngerClient = newClient;\n\n\t\tif (newClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = newClient;\n\t\t} else {\n\t\t\t// Update next node to point back to this new node.\n\t\t\tnewClient.youngerClient.olderClient = newClient;\n\t\t}\n\n\t\tthis.clientMap.set(clientId, newClient);\n\t\treturn newClient;\n\t}\n\n\tprivate removeClient(clientId: string): ITrackedClient | undefined {\n\t\tconst removeClient = this.clientMap.get(clientId);\n\t\tif (removeClient === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update prev node to point to next node.\n\t\tremoveClient.olderClient.youngerClient = removeClient.youngerClient;\n\n\t\tif (removeClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = removeClient.olderClient;\n\t\t} else {\n\t\t\t// Update next node to point back to previous node.\n\t\t\tremoveClient.youngerClient.olderClient = removeClient.olderClient;\n\t\t}\n\n\t\tthis.clientMap.delete(clientId);\n\t\treturn removeClient;\n\t}\n\n\t/** Returns an array of all clients being tracked in order from oldest to newest. */\n\tpublic getAllClients(): ILinkedClient[] {\n\t\tconst result: ILinkedClient[] = [];\n\t\tlet currClient: LinkNode = this.rootNode;\n\t\twhile (currClient.youngerClient !== undefined) {\n\t\t\tresult.push(currClient.youngerClient);\n\t\t\tcurrClient = currClient.youngerClient;\n\t\t}\n\t\treturn result;\n\t}\n}\n\n/** Events raised by an OrderedClientElection. */\nexport interface IOrderedClientElectionEvents extends IEvent {\n\t/** Event fires when the currently elected client changes. */\n\t(\n\t\tevent: \"election\",\n\t\tlistener: (\n\t\t\t/** Newly elected client. */\n\t\t\tclient: ITrackedClient | undefined,\n\t\t\t/** Sequence number where election took place. */\n\t\t\tsequenceNumber: number,\n\t\t\t/** Previously elected client. */\n\t\t\tprevClient: ITrackedClient | undefined,\n\t\t) => void,\n\t);\n}\n\n/**\n * Serialized state of IOrderedClientElection.\n * @alpha\n */\nexport interface ISerializedElection {\n\t/** Sequence number at the time of the latest election. */\n\treadonly electionSequenceNumber: number;\n\n\t/**\n\t * Most recently elected client id. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClientId: string | undefined;\n\n\t/** Most recently elected parent client id. This is always an interactive client. */\n\treadonly electedParentId: string | undefined;\n}\n\n/** Contract for maintaining a deterministic client election based on eligibility. */\nexport interface IOrderedClientElection extends IEventProvider<IOrderedClientElectionEvents> {\n\t/** Count of eligible clients in the collection. */\n\treadonly eligibleCount: number;\n\n\t/**\n\t * Currently elected client. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClient: ITrackedClient | undefined;\n\t/** Currently elected parent client. This is always an interactive client. */\n\treadonly electedParent: ITrackedClient | undefined;\n\t/** Sequence number of most recent election. */\n\treadonly electionSequenceNumber: number;\n\t/** Marks the currently elected client as invalid, and elects the next eligible client. */\n\tincrementElectedClient(sequenceNumber: number): void;\n\t/** Resets the currently elected client back to the oldest eligible client. */\n\tresetElectedClient(sequenceNumber: number): void;\n\t/** Peeks at what the next elected client would be if incrementElectedClient were called. */\n\tpeekNextElectedClient(): ITrackedClient | undefined;\n\t/** Returns a sorted array of all the eligible clients in the collection. */\n\tgetAllEligibleClients(): ITrackedClient[];\n\t/** Serialize election data */\n\tserialize(): ISerializedElection;\n}\n\n/**\n * Adapter for OrderedClientCollection, with the purpose of deterministically maintaining\n * a currently elected client, excluding ineligible clients, in a distributed fashion.\n * This can be true as long as incrementElectedClient and resetElectedClient calls\n * are called under the same conditions for all clients.\n */\nexport class OrderedClientElection\n\textends TypedEventEmitter<IOrderedClientElectionEvents>\n\timplements IOrderedClientElection\n{\n\tprivate _eligibleCount: number = 0;\n\tprivate _electedClient: ILinkedClient | undefined;\n\tprivate _electedParent: ILinkedClient | undefined;\n\tprivate _electionSequenceNumber: number;\n\n\tpublic get eligibleCount() {\n\t\treturn this._eligibleCount;\n\t}\n\tpublic get electionSequenceNumber() {\n\t\treturn this._electionSequenceNumber;\n\t}\n\n\t/**\n\t * OrderedClientCollection tracks electedClient and electedParent separately. This allows us to handle the case\n\t * where a new interactive parent client has been elected, but the summarizer is still doing work, so\n\t * a new summarizer should not yet be spawned. In this case, changing electedParent will cause SummaryManager\n\t * to stop the current summarizer, but a new summarizer will not be spawned until the old summarizer client has\n\t * left the quorum.\n\t *\n\t * Details:\n\t *\n\t * electedParent is the interactive client that has been elected to spawn a summarizer. It is typically the oldest\n\t * eligible interactive client in the quorum. Only the electedParent is permitted to spawn a summarizer.\n\t * Once elected, this client will remain the electedParent until it leaves the quorum or the summarizer that\n\t * it spawned stops producing summaries, at which point a new electedParent will be chosen.\n\t *\n\t * electedClient is the non-interactive summarizer client if one exists. If not, then electedClient is equal to\n\t * electedParent. If electedParent === electedClient, this is the signal for electedParent to spawn a new\n\t * electedClient. Once a summarizer client becomes electedClient, a new summarizer will not be spawned until\n\t * electedClient leaves the quorum.\n\t *\n\t * A typical sequence looks like this:\n\t *\n\t * i. Begin by electing A. electedParent === A, electedClient === A.\n\t *\n\t * ii. SummaryManager running on A spawns a summarizer client, A'. electedParent === A, electedClient === A'\n\t *\n\t * iii. A' stops producing summaries. A new parent client, B, is elected. electedParent === B, electedClient === A'\n\t *\n\t * iv. SummaryManager running on A detects the change to electedParent and tells the summarizer to stop, but A'\n\t * is in mid-summarization. No new summarizer is spawned, as electedParent !== electedClient.\n\t *\n\t * v. A' completes its summary, and the summarizer and backing client are torn down.\n\t *\n\t * vi. A' leaves the quorum, and B takes its place as electedClient. electedParent === B, electedClient === B\n\t *\n\t * vii. SummaryManager running on B spawns a summarizer client, B'. electedParent === B, electedClient === B'\n\t */\n\tpublic get electedClient() {\n\t\treturn this._electedClient;\n\t}\n\tpublic get electedParent() {\n\t\treturn this._electedParent;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly orderedClientCollection: IOrderedClientCollection,\n\t\t/** Serialized state from summary or current sequence number at time of load if new. */\n\t\tinitialState: ISerializedElection | number,\n\t\tprivate readonly isEligibleFn: (c: ITrackedClient) => boolean,\n\t) {\n\t\tsuper();\n\t\tlet initialClient: ILinkedClient | undefined;\n\t\tlet initialParent: ILinkedClient | undefined;\n\t\tfor (const client of orderedClientCollection.getAllClients()) {\n\t\t\tthis.addClient(client, 0);\n\t\t\tif (typeof initialState !== \"number\") {\n\t\t\t\tif (client.clientId === initialState.electedClientId) {\n\t\t\t\t\tinitialClient = client;\n\t\t\t\t\tif (\n\t\t\t\t\t\tinitialState.electedParentId === undefined &&\n\t\t\t\t\t\tclient.client.details.type !== summarizerClientType\n\t\t\t\t\t) {\n\t\t\t\t\t\t// If there was no elected parent in the serialized data, use this one.\n\t\t\t\t\t\tinitialParent = client;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (client.clientId === initialState.electedParentId) {\n\t\t\t\t\tinitialParent = client;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\torderedClientCollection.on(\"addClient\", (client, seq) => this.addClient(client, seq));\n\t\torderedClientCollection.on(\"removeClient\", (client, seq) => this.removeClient(client, seq));\n\n\t\tif (typeof initialState === \"number\") {\n\t\t\tthis._electionSequenceNumber = initialState;\n\t\t} else {\n\t\t\t// Override the initially elected client with the initial state.\n\t\t\tif (initialClient?.clientId !== initialState.electedClientId) {\n\t\t\t\t// Cannot find initially elected client, so elect undefined.\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientNotFound\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t\tclientCount: orderedClientCollection.count,\n\t\t\t\t});\n\t\t\t} else if (initialClient !== undefined && !isEligibleFn(initialClient)) {\n\t\t\t\t// Initially elected client is ineligible, so elect next eligible client.\n\t\t\t\tinitialClient = initialParent = this.findFirstEligibleParent(initialParent);\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientIneligible\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._electedParent = initialParent;\n\t\t\tthis._electedClient = initialClient;\n\t\t\tthis._electionSequenceNumber = initialState.electionSequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * Tries changing the elected client, raising an event if it is different.\n\t * Note that this function does no eligibility or suitability checks. If we get here, then\n\t * we will set _electedClient, and we will set _electedParent if this is an interactive client.\n\t */\n\tprivate tryElectingClient(client: ILinkedClient | undefined, sequenceNumber: number): void {\n\t\tlet change = false;\n\t\tconst isSummarizerClient = client?.client.details.type === summarizerClientType;\n\t\tconst prevClient = this._electedClient;\n\t\tif (this._electedClient !== client) {\n\t\t\t// Changing the elected client. Record the sequence number and note that we have to fire an event.\n\t\t\tthis._electionSequenceNumber = sequenceNumber;\n\t\t\tthis._electedClient = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (this._electedParent !== client && !isSummarizerClient) {\n\t\t\t// Changing the elected parent as well.\n\t\t\tthis._electedParent = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (change) {\n\t\t\tthis.emit(\"election\", client, sequenceNumber, prevClient);\n\t\t}\n\t}\n\n\tprivate tryElectingParent(client: ILinkedClient | undefined, sequenceNumber: number): void {\n\t\tif (this._electedParent !== client) {\n\t\t\tthis._electedParent = client;\n\t\t\tthis.emit(\"election\", this._electedClient, sequenceNumber, this._electedClient);\n\t\t}\n\t}\n\n\t/**\n\t * Helper function to find the first eligible parent client starting with the passed in client,\n\t * or undefined if none are eligible.\n\t * @param client - client to start checking\n\t * @returns oldest eligible client starting with passed in client or undefined if none.\n\t */\n\tprivate findFirstEligibleParent(client: ILinkedClient | undefined): ILinkedClient | undefined {\n\t\tlet candidateClient = client;\n\t\twhile (\n\t\t\tcandidateClient !== undefined &&\n\t\t\t(!this.isEligibleFn(candidateClient) ||\n\t\t\t\tcandidateClient.client.details.type === summarizerClientType)\n\t\t) {\n\t\t\tcandidateClient = candidateClient.youngerClient;\n\t\t}\n\t\treturn candidateClient;\n\t}\n\n\t/**\n\t * Updates tracking for when a new client is added to the collection.\n\t * Will automatically elect that new client if none is elected currently.\n\t * @param client - client added to the collection\n\t * @param sequenceNumber - sequence number when client was added\n\t */\n\tprivate addClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount++;\n\t\t\tconst newClientIsSummarizer = client.client.details.type === summarizerClientType;\n\t\t\tconst electedClientIsSummarizer =\n\t\t\t\tthis._electedClient?.client.details.type === summarizerClientType;\n\t\t\t// Note that we allow a summarizer client to supersede an interactive client as elected client.\n\t\t\tif (\n\t\t\t\tthis._electedClient === undefined ||\n\t\t\t\t(!electedClientIsSummarizer && newClientIsSummarizer)\n\t\t\t) {\n\t\t\t\tthis.tryElectingClient(client, sequenceNumber);\n\t\t\t} else if (this._electedParent === undefined && !newClientIsSummarizer) {\n\t\t\t\t// This is an odd case. If the _electedClient is set, the _electedParent should be as well.\n\t\t\t\tthis.tryElectingParent(client, sequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates tracking for when an existing client is removed from the collection.\n\t * Will automatically elect next oldest client if currently elected is removed.\n\t * @param client - client removed from the collection\n\t * @param sequenceNumber - sequence number when client was removed\n\t */\n\tprivate removeClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount--;\n\t\t\tif (this._electedClient === client) {\n\t\t\t\t// Removing the _electedClient. There are 2 possible cases:\n\t\t\t\tif (this._electedParent !== client) {\n\t\t\t\t\t// 1. The _electedClient is a summarizer that we've been allowing to finish its work.\n\t\t\t\t\t// Let the _electedParent become the _electedClient so that it can start its own summarizer.\n\t\t\t\t\tif (this._electedClient.client.details.type !== summarizerClientType) {\n\t\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 1\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.tryElectingClient(this._electedParent, sequenceNumber);\n\t\t\t\t} else {\n\t\t\t\t\t// 2. The _electedClient is an interactive client that has left the quorum.\n\t\t\t\t\t// Automatically shift to next oldest client.\n\t\t\t\t\tconst nextClient =\n\t\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\t\tthis.tryElectingClient(nextClient, sequenceNumber);\n\t\t\t\t}\n\t\t\t} else if (this._electedParent === client) {\n\t\t\t\t// Removing the _electedParent (but not _electedClient).\n\t\t\t\t// Shift to the next oldest parent, but do not replace the _electedClient,\n\t\t\t\t// which is a summarizer that is still doing work.\n\t\t\t\tif (this._electedClient?.client.details.type !== summarizerClientType) {\n\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 2\");\n\t\t\t\t}\n\t\t\t\tconst nextParent =\n\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\tthis.tryElectingParent(nextParent, sequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getAllEligibleClients(): ITrackedClient[] {\n\t\treturn this.orderedClientCollection.getAllClients().filter(this.isEligibleFn);\n\t}\n\n\t/**\n\t * Advance election to the next-oldest client. This is called if the current parent is leaving the quorum,\n\t * or if the current summarizer is not responsive and we want to stop it and spawn a new one.\n\t */\n\tpublic incrementElectedClient(sequenceNumber: number): void {\n\t\tconst nextClient =\n\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\tif (this._electedClient === undefined || this._electedClient === this._electedParent) {\n\t\t\tthis.tryElectingClient(nextClient, sequenceNumber);\n\t\t} else {\n\t\t\t// The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n\t\t\t// Changing the _electedParent will stop the summarizer.\n\t\t\tthis.tryElectingParent(nextClient, sequenceNumber);\n\t\t}\n\t}\n\n\t/**\n\t * (Re-)start election with the oldest client in the quorum. This is called if we need to summarize\n\t * and no client has been elected.\n\t */\n\tpublic resetElectedClient(sequenceNumber: number): void {\n\t\tconst firstClient = this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\tif (this._electedClient === undefined || this._electedClient === this._electedParent) {\n\t\t\tthis.tryElectingClient(firstClient, sequenceNumber);\n\t\t} else {\n\t\t\t// The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n\t\t\t// Changing the _electedParent will stop the summarizer.\n\t\t\tthis.tryElectingParent(firstClient, sequenceNumber);\n\t\t}\n\t}\n\n\tpublic peekNextElectedClient(): ITrackedClient | undefined {\n\t\treturn (\n\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient)\n\t\t);\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\treturn {\n\t\t\telectionSequenceNumber: this.electionSequenceNumber,\n\t\t\telectedClientId: this.electedClient?.clientId,\n\t\t\telectedParentId: this.electedParent?.clientId,\n\t\t};\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runWhileConnectedCoordinator.d.mts","sourceRoot":"","sources":["../../src/summary/runWhileConnectedCoordinator.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;IAClF,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,yBAGxC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,gCAAgC;IAsCnF,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAtCxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwC;IAErE,IAAW,SAAS,YAkBnB;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAExD;WAEmB,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO;IAM9E,SAAS,aACS,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,OAAO;IAGvC;;;;;;;;;;;;OAYG;cACa,SAAS;IAiBzB;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;CAM/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runWhileConnectedCoordinator.mjs","sourceRoot":"","sources":["../../src/summary/runWhileConnectedCoordinator.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B;AAe7D;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AC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAE9E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YAC5B,MAAM,aAAa,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CACnD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CACvC,CAAC;YACF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;SACxD;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAA4B;QACvC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAClC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport {\n\tSummarizerStopReason,\n\tIConnectableRuntime,\n\tISummaryCancellationToken,\n} from \"./summarizerTypes\";\n\n/**\n * Similar to AbortController, but using promise instead of events\n * @alpha\n */\nexport interface ICancellableSummarizerController extends ISummaryCancellationToken {\n\tstop(reason: SummarizerStopReason): void;\n}\n\n/**\n * Can be useful in testing as well as in places where caller does not use cancellation.\n * This object implements ISummaryCancellationToken interface but cancellation is never leveraged.\n * @internal\n */\nexport const neverCancelledSummaryToken: ISummaryCancellationToken = {\n\tcancelled: false,\n\twaitCancelled: new Promise(() => {}),\n};\n\n/**\n * Helper class to coordinate something that needs to run only while connected.\n * This provides promises that resolve as it starts or stops. Stopping happens\n * when disconnected or if stop() is called.\n */\nexport class RunWhileConnectedCoordinator implements ICancellableSummarizerController {\n\tprivate _cancelled = false;\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tpublic get cancelled() {\n\t\tif (!this._cancelled) {\n\t\t\tassert(this.active(), 0x25d /* \"We should never connect as 'read'\" */);\n\n\t\t\t// This check can't be enabled in current design due to lastSummary flow, where\n\t\t\t// summarizer for closed container stays around and can produce one more summary.\n\t\t\t// Currently we solve the problem of overlapping summarizer by doing wait in\n\t\t\t// SummaryManager.createSummarizer()\n\t\t\t// Better solution would involve these steps:\n\t\t\t// 1. Summarizer selection logic should chose summarizing client (with clientType === \"summarizer\")\n\t\t\t// if such client exists.\n\t\t\t// 2. Summarizer should be updated about such changes (to update onBehalfOfClientId)\n\t\t\t//\n\t\t\t// assert(this.runtime.summarizerClientId === this.onBehalfOfClientId ||\n\t\t\t// this.runtime.summarizerClientId === this.runtime.clientId, \"onBehalfOfClientId\");\n\t\t}\n\n\t\treturn this._cancelled;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once stopped either externally or by disconnect.\n\t */\n\tpublic get waitCancelled(): Promise<SummarizerStopReason> {\n\t\treturn this.stopDeferred.promise;\n\t}\n\n\tpublic static async create(runtime: IConnectableRuntime, active: () => boolean) {\n\t\tconst obj = new RunWhileConnectedCoordinator(runtime, active);\n\t\tawait obj.waitStart();\n\t\treturn obj;\n\t}\n\n\tprotected constructor(\n\t\tprivate readonly runtime: IConnectableRuntime,\n\t\tprivate readonly active: () => boolean,\n\t) {}\n\n\t/**\n\t * Starts and waits for a promise which resolves when connected.\n\t * The promise will also resolve if stopped either externally or by disconnect.\n\t *\n\t * We only listen on disconnected event for clientType === \"summarizer\" container!\n\t * And only do it here - no other place should check it! That way we have only one place\n\t * that controls policy and it's easy to change policy in the future if we want to!\n\t * We do not listen for \"main\" (aka interactive) container disconnect here, as it's\n\t * responsibility of SummaryManager to decide if that's material or not. There are cases\n\t * like \"lastSummary\", or main client experiencing nacks / disconnects due to hitting limit\n\t * of non-summarized ops, where can make determination to continue with summary even if main\n\t * client is disconnected.\n\t */\n\tprotected async waitStart() {\n\t\tif (this.runtime.disposed) {\n\t\t\tthis.stop(\"summarizerClientDisconnected\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.runtime.once(\"dispose\", () => this.stop(\"summarizerClientDisconnected\"));\n\n\t\tif (!this.runtime.connected) {\n\t\t\tconst waitConnected = new Promise<void>((resolve) =>\n\t\t\t\tthis.runtime.once(\"connected\", resolve),\n\t\t\t);\n\t\t\tawait Promise.race([waitConnected, this.waitCancelled]);\n\t\t}\n\t\tthis.runtime.once(\"disconnected\", () => this.stop(\"summarizerClientDisconnected\"));\n\t}\n\n\t/**\n\t * Stops running.\n\t */\n\tpublic stop(reason: SummarizerStopReason): void {\n\t\tif (!this._cancelled) {\n\t\t\tthis._cancelled = true;\n\t\t\tthis.stopDeferred.resolve(reason);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runningSummarizer.d.mts","sourceRoot":"","sources":["../../src/summary/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iCAAiC;OAS5E,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAEzD,EAAE,yBAAyB,EAAe,MAAM,sCAAsC;OACtF,EAAE,qBAAqB,EAAE;OAGzB,EACN,wBAAwB,EAExB,uBAAuB,EAEvB,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EAEjB,kBAAkB,EAElB,yBAAyB,EACzB,iBAAiB,EAEjB;OACM,EAAiB,qBAAqB,EAAE,iBAAiB,EAAE;OAC3D,EAGN,sBAAsB,EAEtB;AAID;;;GAGG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAC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;gBACrB,UAAU,EAAE,IAAI;aACf;YACH,CAAC,CAAC,OAAO,CAAC;IACZ,CAAC;IAEO,qBAAqB;QAC5B,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;SACb;QACD,IACC,IAAI,CAAC,eAAe,KAAK,SAAS;YAClC,IAAI,CAAC,aAAa,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB;YAClF,IAAI,CAAC,eAAe,KAAK,SAAS,EACjC;YACD,uFAAuF;YACvF,OAAO,KAAK,CAAC;SACb;QACD,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;QAC1E,+FAA+F;QAC/F,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,gBAAgB,CACpB,EAAE,eAAe,EAAE,mBAAmB,MAAM,EAAE,EAAE,EAChD,gBAAgB,EAChB,cAAc,CACd,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAEO,sBAAsB;QAC7B,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACvC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CACvC,uCAAuC,EACvC,SAAS,CACT,CAAC;YACF,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SACjC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tisFluidError,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\tcreateChildLogger,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert, delay, Deferred, PromiseTimer } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { opSize } from \"../opProperties\";\nimport { SummarizeHeuristicRunner } from \"./summarizerHeuristics\";\nimport {\n\tIEnqueueSummarizeOptions,\n\tISummarizeOptions,\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tIOnDemandSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tSummarizerStopReason,\n\tISubmitSummaryOptions,\n\tSubmitSummaryResult,\n\tISummaryCancellationToken,\n\tISummarizeResults,\n\tISummarizeTelemetryProperties,\n\tISummarizerRuntime,\n\tISummarizeRunnerTelemetry,\n\tIRefreshSummaryAckOptions,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { IAckedSummary, IClientSummaryWatcher, SummaryCollection } from \"./summaryCollection\";\nimport {\n\traceTimer,\n\tSummarizeReason,\n\tSummarizeResultBuilder,\n\tSummaryGenerator,\n} from \"./summaryGenerator\";\n\nconst maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes\n\n/**\n * The maximum number of summarization attempts that will be done by default in case of failures\n * that can be retried.\n */\nexport const defaultMaxAttempts = 2;\n/**\n * The default value for maximum number of summarization attempts that will be done for summarization failures where\n * submit fails and the failure can be retried.\n */\nexport const defaultMaxAttemptsForSubmitFailures = 5;\n\n/**\n * An instance of RunningSummarizer manages the heuristics for summarizing.\n * Until disposed, the instance of RunningSummarizer can assume that it is\n * in a state of running, meaning it is connected and initialized. It keeps\n * track of summaries that it is generating as they are broadcast and acked/nacked.\n * This object is created and controlled by Summarizer object.\n */\nexport class RunningSummarizer extends TypedEventEmitter<ISummarizerEvents> implements IDisposable {\n\tpublic static async start(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tsummaryWatcher: IClientSummaryWatcher,\n\t\tconfiguration: ISummaryConfiguration,\n\t\tsubmitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>,\n\t\trefreshLatestSummaryAckCallback: (options: IRefreshSummaryAckOptions) => Promise<void>,\n\t\theuristicData: ISummarizeHeuristicData,\n\t\tsummaryCollection: SummaryCollection,\n\t\tcancellationToken: ISummaryCancellationToken,\n\t\tstopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\truntime: ISummarizerRuntime,\n\t): Promise<RunningSummarizer> {\n\t\tconst summarizer = new RunningSummarizer(\n\t\t\tlogger,\n\t\t\tsummaryWatcher,\n\t\t\tconfiguration,\n\t\t\tsubmitSummaryCallback,\n\t\t\trefreshLatestSummaryAckCallback,\n\t\t\theuristicData,\n\t\t\tsummaryCollection,\n\t\t\tcancellationToken,\n\t\t\tstopSummarizerCallback,\n\t\t\truntime,\n\t\t);\n\n\t\t// Before doing any heuristics or proceeding with its refreshing, if there is a summary ack received while\n\t\t// this summarizer catches up, let's refresh state before proceeding with the summarization.\n\t\tconst lastAckRefSeq = await summarizer.handleSummaryAck();\n\n\t\tawait summarizer.waitStart();\n\n\t\t// Handle summary acks asynchronously\n\t\t// Note: no exceptions are thrown from processIncomingSummaryAcks handler as it handles all exceptions\n\t\tsummarizer.processIncomingSummaryAcks(lastAckRefSeq).catch((error) => {\n\t\t\tcreateChildLogger({ logger }).sendErrorEvent(\n\t\t\t\t{ eventName: \"HandleSummaryAckFatalError\" },\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\t// Update heuristic counts\n\t\t// By the time we get here, there are potentially ops missing from the heuristic summary counts\n\t\t// Examples of where this could happen:\n\t\t// 1. Op is processed during the time that we are initiating the RunningSummarizer instance but before we\n\t\t// listen for the op events (will get missed by the handlers in the current workflow)\n\t\t// 2. Op was sequenced after the last time we summarized (op sequence number > summarize ref sequence number)\n\t\tconst diff =\n\t\t\truntime.deltaManager.lastSequenceNumber -\n\t\t\t(heuristicData.lastSuccessfulSummary.refSequenceNumber +\n\t\t\t\theuristicData.numNonRuntimeOps +\n\t\t\t\theuristicData.numRuntimeOps);\n\t\theuristicData.hasMissingOpData = diff > 0;\n\n\t\tif (heuristicData.hasMissingOpData) {\n\t\t\t// Split the diff 50-50 and increment the counts appropriately\n\t\t\theuristicData.numNonRuntimeOps += Math.ceil(diff / 2);\n\t\t\theuristicData.numRuntimeOps += Math.floor(diff / 2);\n\t\t}\n\n\t\t// Update last seq number (in case the handlers haven't processed anything yet)\n\t\theuristicData.lastOpSequenceNumber = runtime.deltaManager.lastSequenceNumber;\n\n\t\t// Start heuristics\n\t\tsummarizer.heuristicRunner?.start();\n\t\tsummarizer.heuristicRunner?.run();\n\n\t\treturn summarizer;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tprivate stopping = false;\n\tprivate _disposed = false;\n\tprivate summarizingLock: Promise<void> | undefined;\n\tprivate tryWhileSummarizing = false;\n\tprivate readonly pendingAckTimer: PromiseTimer;\n\tprivate heuristicRunner?: ISummarizeHeuristicRunner;\n\tprivate readonly generator: SummaryGenerator;\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate enqueuedSummary:\n\t\t| {\n\t\t\t\treason: SummarizeReason;\n\t\t\t\tafterSequenceNumber: number;\n\t\t\t\tsummarizeOptions: ISummarizeOptions;\n\t\t\t\treadonly resultsBuilder: SummarizeResultBuilder;\n\t\t }\n\t\t| undefined;\n\tprivate summarizeCount = 0;\n\tprivate totalSuccessfulAttempts = 0;\n\tprivate initialized = false;\n\n\tprivate readonly runtimeListener;\n\n\t/** The maximum number of summary attempts to do when submit summary fails. */\n\tprivate readonly maxAttemptsForSubmitFailures: number;\n\n\tprivate constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summaryWatcher: IClientSummaryWatcher,\n\t\tprivate readonly configuration: ISummaryConfiguration,\n\t\tprivate readonly submitSummaryCallback: (\n\t\t\toptions: ISubmitSummaryOptions,\n\t\t) => Promise<SubmitSummaryResult>,\n\t\tprivate readonly refreshLatestSummaryAckCallback: (\n\t\t\toptions: IRefreshSummaryAckOptions,\n\t\t) => Promise<void>,\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly cancellationToken: ISummaryCancellationToken,\n\t\tprivate readonly stopSummarizerCallback: (reason: SummarizerStopReason) => void,\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t) {\n\t\tsuper();\n\n\t\tconst telemetryProps: ISummarizeRunnerTelemetry = {\n\t\t\tsummarizeCount: () => this.summarizeCount,\n\t\t\tsummarizerSuccessfulAttempts: () => this.totalSuccessfulAttempts,\n\t\t};\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: baseLogger,\n\t\t\tnamespace: \"Running\",\n\t\t\tproperties: {\n\t\t\t\tall: telemetryProps,\n\t\t\t},\n\t\t});\n\n\t\tif (configuration.state !== \"disableHeuristics\") {\n\t\t\tassert(\n\t\t\t\tthis.configuration.state === \"enabled\",\n\t\t\t\t0x2ea /* \"Configuration state should be enabled\" */,\n\t\t\t);\n\t\t\tthis.heuristicRunner = new SummarizeHeuristicRunner(\n\t\t\t\theuristicData,\n\t\t\t\tthis.configuration,\n\t\t\t\t(reason) => this.trySummarize(reason),\n\t\t\t\tthis.mc.logger,\n\t\t\t);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.configuration.state !== \"disabled\",\n\t\t\t0x2eb /* \"Summary not supported with configuration disabled\" */,\n\t\t);\n\n\t\t// Cap the maximum amount of time client will wait for a summarize op ack to maxSummarizeAckWaitTime\n\t\t// configuration.maxAckWaitTime is composed from defaults, server values, and runtime overrides\n\n\t\tconst maxAckWaitTime = Math.min(this.configuration.maxAckWaitTime, maxSummarizeAckWaitTime);\n\n\t\tthis.pendingAckTimer = new PromiseTimer(maxAckWaitTime, () => {\n\t\t\t// Note: summarizeCount (from ChildLogger definition) may be 0,\n\t\t\t// since this code path is hit when RunningSummarizer first starts up,\n\t\t\t// before this instance has kicked off a new summarize run.\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"SummaryAckWaitTimeout\",\n\t\t\t\tmessage: \"Pending summary ack not received in time\",\n\t\t\t\tmaxAckWaitTime,\n\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\ttimePending: Date.now() - this.heuristicData.lastAttempt.summaryTime,\n\t\t\t});\n\t\t});\n\t\t// Set up pending ack timeout by op timestamp differences for previous summaries.\n\t\tsummaryCollection.setPendingAckTimerTimeoutCallback(maxAckWaitTime, () => {\n\t\t\tif (this.pendingAckTimer.hasTimer) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"MissingSummaryAckFoundByOps\",\n\t\t\t\t\treferenceSequenceNumber: this.heuristicData.lastAttempt.refSequenceNumber,\n\t\t\t\t\tsummarySequenceNumber: this.heuristicData.lastAttempt.summarySequenceNumber,\n\t\t\t\t});\n\t\t\t\tthis.pendingAckTimer.clear();\n\t\t\t}\n\t\t});\n\n\t\tthis.generator = new SummaryGenerator(\n\t\t\tthis.pendingAckTimer,\n\t\t\tthis.heuristicData,\n\t\t\tthis.submitSummaryCallback,\n\t\t\t() => {\n\t\t\t\tthis.totalSuccessfulAttempts++;\n\t\t\t},\n\t\t\tthis.summaryWatcher,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// Listen to runtime for ops\n\t\tthis.runtimeListener = (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => {\n\t\t\tthis.handleOp(op, runtimeMessage === true);\n\t\t};\n\t\tthis.runtime.on(\"op\", this.runtimeListener);\n\n\t\t// The max attempts for submit failures can be overridden via a feature flag. This allows us to\n\t\t// tweak this as per telemetry data until we arrive at a stable number.\n\t\t// If its set to a number higher than `defaultMaxAttemptsForSubmitFailures`, it will be ignored.\n\t\tconst overrideMaxAttempts = this.mc.config.getNumber(\n\t\t\t\"Fluid.Summarizer.AttemptsForSubmitFailures\",\n\t\t);\n\t\tthis.maxAttemptsForSubmitFailures =\n\t\t\toverrideMaxAttempts && overrideMaxAttempts < defaultMaxAttemptsForSubmitFailures\n\t\t\t\t? overrideMaxAttempts\n\t\t\t\t: defaultMaxAttemptsForSubmitFailures;\n\t}\n\n\tprivate async handleSummaryAck(): Promise<number> {\n\t\tconst lastAck: IAckedSummary | undefined = this.summaryCollection.latestAck;\n\t\tlet refSequenceNumber = -1;\n\t\t// In case we haven't received the lastestAck yet, just return.\n\t\tif (lastAck !== undefined) {\n\t\t\trefSequenceNumber = lastAck.summaryOp.referenceSequenceNumber;\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\t\t\tconst summaryOpHandle = lastAck.summaryOp.contents.handle;\n\t\t\tconst summaryAckHandle = lastAck.summaryAck.contents.handle;\n\t\t\twhile (this.summarizingLock !== undefined) {\n\t\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"RefreshAttemptWithSummarizerRunning\",\n\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t});\n\t\t\t\tawait this.summarizingLock;\n\t\t\t}\n\n\t\t\t// Make sure we block any summarizer from being executed/enqueued while\n\t\t\t// executing the refreshLatestSummaryAck.\n\t\t\t// https://dev.azure.com/fluidframework/internal/_workitems/edit/779\n\t\t\tawait this.lockedSummaryAction(\n\t\t\t\t() => {},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.refreshLatestSummaryAckCallback({\n\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\tsummaryRefSeq: refSequenceNumber,\n\t\t\t\t\t\tsummaryLogger,\n\t\t\t\t\t}).catch(async (error) => {\n\t\t\t\t\t\t// If the error is 404, so maybe the fetched version no longer exists on server. We just\n\t\t\t\t\t\t// ignore this error in that case, as that means we will have another summaryAck for the\n\t\t\t\t\t\t// latest version with which we will refresh the state. However in case of single commit\n\t\t\t\t\t\t// summary, we might me missing a summary ack, so in that case we are still fine as the\n\t\t\t\t\t\t// code in `submitSummary` function in container runtime, will refresh the latest state\n\t\t\t\t\t\t// by calling `prefetchLatestSummaryThenClose`. We will load the next summarizer from the\n\t\t\t\t\t\t// updated state and be fine.\n\t\t\t\t\t\tconst isIgnoredError =\n\t\t\t\t\t\t\tisFluidError(error) &&\n\t\t\t\t\t\t\terror.errorType === DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\n\t\t\t\t\t\tsummaryLogger.sendTelemetryEvent(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\teventName: isIgnoredError\n\t\t\t\t\t\t\t\t\t? \"HandleSummaryAckErrorIgnored\"\n\t\t\t\t\t\t\t\t\t: \"HandleLastSummaryAckError\",\n\t\t\t\t\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\t\t\t\t\tproposalHandle: summaryOpHandle,\n\t\t\t\t\t\t\t\tackHandle: summaryAckHandle,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t() => {},\n\t\t\t);\n\t\t\trefSequenceNumber++;\n\t\t}\n\t\treturn refSequenceNumber;\n\t}\n\n\t/**\n\t * Responsible for receiving and processing all the summaryAcks.\n\t * In case there was a summary ack processed by the running summarizer before processIncomingSummaryAcks is called,\n\t * it will wait for the summary ack that is newer than the one indicated by the lastAckRefSeq.\n\t * @param lastAckRefSeq - Identifies the minimum reference sequence number the summarizer needs to wait for.\n\t * In case of a negative number, the summarizer will wait for ANY summary ack that is greater than the deltaManager's initial sequence number,\n\t * and, in case of a positive one, it will wait for a summary ack that is greater than this current reference sequence number.\n\t */\n\tprivate async processIncomingSummaryAcks(lastAckRefSeq: number) {\n\t\tlet refSequenceNumber =\n\t\t\tlastAckRefSeq > 0 ? lastAckRefSeq : this.runtime.deltaManager.initialSequenceNumber;\n\t\twhile (!this.disposed) {\n\t\t\tconst summaryLogger = this.tryGetCorrelatedLogger(refSequenceNumber) ?? this.mc.logger;\n\n\t\t\t// Initialize ack with undefined if exception happens inside of waitSummaryAck on second iteration,\n\t\t\t// we record undefined, not previous handles.\n\t\t\tawait this.summaryCollection.waitSummaryAck(refSequenceNumber);\n\n\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"processIncomingSummaryAcks\",\n\t\t\t\treferenceSequenceNumber: refSequenceNumber,\n\t\t\t\tlastAckRefSeq,\n\t\t\t});\n\n\t\t\trefSequenceNumber = await this.handleSummaryAck();\n\t\t\t// A valid Summary Ack must have been processed.\n\t\t\tassert(refSequenceNumber >= 0, 0x58f /* Invalid ref sequence number */);\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.runtime.off(\"op\", this.runtimeListener);\n\t\tthis.summaryWatcher.dispose();\n\t\tthis.heuristicRunner?.dispose();\n\t\tthis.heuristicRunner = undefined;\n\t\tthis.generator.dispose();\n\t\tthis.pendingAckTimer.clear();\n\t\tthis.disposeEnqueuedSummary();\n\t\tthis._disposed = true;\n\t\tthis.stopping = true;\n\t}\n\n\t/**\n\t * RunningSummarizer's logger includes the sequenced index of the current summary on each event.\n\t * If some other Summarizer code wants that event on their logs they can get it here,\n\t * but only if they're logging about that same summary.\n\t * @param summaryOpRefSeq - RefSeq number of the summary op, to ensure the log correlation will be correct\n\t */\n\tpublic tryGetCorrelatedLogger = (summaryOpRefSeq) =>\n\t\tthis.heuristicData.lastAttempt.refSequenceNumber === summaryOpRefSeq\n\t\t\t? this.mc.logger\n\t\t\t: undefined;\n\n\t/** We only want a single heuristic runner micro-task (will provide better optimized grouping of ops) */\n\tprivate heuristicRunnerMicroTaskExists = false;\n\n\tpublic handleOp(op: ISequencedDocumentMessage, runtimeMessage: boolean) {\n\t\tthis.heuristicData.lastOpSequenceNumber = op.sequenceNumber;\n\n\t\tif (runtimeMessage) {\n\t\t\tthis.heuristicData.numRuntimeOps++;\n\t\t} else {\n\t\t\tthis.heuristicData.numNonRuntimeOps++;\n\t\t}\n\n\t\tthis.heuristicData.totalOpsSize += opSize(op);\n\n\t\t// Check for enqueued on-demand summaries; Intentionally do nothing otherwise\n\t\tif (\n\t\t\tthis.initialized &&\n\t\t\tthis.opCanTriggerSummary(op, runtimeMessage) &&\n\t\t\t!this.tryRunEnqueuedSummary() &&\n\t\t\t!this.heuristicRunnerMicroTaskExists\n\t\t) {\n\t\t\tthis.heuristicRunnerMicroTaskExists = true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.heuristicRunner?.run();\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.heuristicRunnerMicroTaskExists = false;\n\t\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Can the given op trigger a summary?\n\t * # Currently always prevents summaries for Summarize and SummaryAck/Nack ops\n\t * @param op - op to check\n\t * @returns true if this op can trigger a summary\n\t */\n\tprivate opCanTriggerSummary(op: ISequencedDocumentMessage, runtimeMessage: boolean): boolean {\n\t\tswitch (op.type) {\n\t\t\tcase MessageType.Summarize:\n\t\t\tcase MessageType.SummaryAck:\n\t\t\tcase MessageType.SummaryNack:\n\t\t\t\treturn false;\n\t\t\tdefault:\n\t\t\t\treturn runtimeMessage || this.nonRuntimeOpCanTriggerSummary();\n\t\t}\n\t}\n\n\tprivate nonRuntimeOpCanTriggerSummary(): boolean {\n\t\tconst opsSinceLastAck =\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber;\n\t\treturn (\n\t\t\tthis.configuration.state === \"enabled\" &&\n\t\t\t(this.configuration.nonRuntimeHeuristicThreshold === undefined ||\n\t\t\t\tthis.configuration.nonRuntimeHeuristicThreshold <= opsSinceLastAck)\n\t\t);\n\t}\n\n\tpublic async waitStop(allowLastSummary: boolean): Promise<void> {\n\t\tif (this.stopping) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stopping = true;\n\n\t\tthis.disposeEnqueuedSummary();\n\n\t\t// This will try to run lastSummary if needed.\n\t\tif (allowLastSummary && this.heuristicRunner?.shouldRunLastSummary()) {\n\t\t\tif (this.summarizingLock === undefined) {\n\t\t\t\tthis.trySummarizeOnce(\n\t\t\t\t\t// summarizeProps\n\t\t\t\t\t{ summarizeReason: \"lastSummary\" },\n\t\t\t\t\t// ISummarizeOptions, using defaults: { refreshLatestAck: false, fullTree: false }\n\t\t\t\t\t{},\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Note that trySummarizeOnce() call above returns right away, without waiting.\n\t\t// So we need to wait for its completion, otherwise it would be destroyed right away.\n\t\t// That said, if summary lock was taken upfront, this wait might wait on multiple retries to\n\t\t// submit summary. We should reconsider this flow and make summarizer move to exit faster.\n\t\t// This resolves when the current pending summary gets an ack or fails.\n\t\tawait this.summarizingLock;\n\t}\n\n\tprivate async waitStart() {\n\t\t// Wait no longer than ack timeout for all pending\n\t\tconst waitStartResult = await raceTimer(\n\t\t\tthis.summaryWatcher.waitFlushed(),\n\t\t\tthis.pendingAckTimer.start(),\n\t\t);\n\t\tthis.pendingAckTimer.clear();\n\n\t\t// Remove pending ack wait timeout by op timestamp comparison, because\n\t\t// it has race conditions with summaries submitted by this same client.\n\t\tthis.summaryCollection.unsetPendingAckTimerTimeoutCallback();\n\n\t\tif (waitStartResult.result === \"done\" && waitStartResult.value !== undefined) {\n\t\t\tthis.heuristicData.updateWithLastSummaryAckInfo({\n\t\t\t\trefSequenceNumber: waitStartResult.value.summaryOp.referenceSequenceNumber,\n\t\t\t\t// This will be the Summarizer starting point so only use timestamps from client's machine.\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t\tsummarySequenceNumber: waitStartResult.value.summaryOp.sequenceNumber,\n\t\t\t});\n\t\t}\n\t\tthis.initialized = true;\n\t}\n\n\tprivate beforeSummaryAction() {\n\t\tthis.summarizeCount++;\n\t}\n\n\tprivate afterSummaryAction() {\n\t\tconst retry = this.tryWhileSummarizing;\n\t\tthis.tryWhileSummarizing = false;\n\n\t\t// After summarizing, we should check to see if we need to summarize again.\n\t\t// Rerun the heuristics and check for enqueued summaries.\n\t\tif (!this.stopping && !this.tryRunEnqueuedSummary() && retry) {\n\t\t\tthis.heuristicRunner?.run();\n\t\t}\n\t}\n\n\t/**\n\t * Runs single summary action that prevents any other concurrent actions.\n\t * Assumes that caller checked upfront for lack of concurrent action (this.summarizingLock)\n\t * before calling this API. I.e. caller is responsible for either erroring out or waiting on this promise.\n\t * @param before - set of instructions to run before running the action.\n\t * @param action - action to perform.\n\t * @param after - set of instructions to run after running the action.\n\t * @returns The result of the action.\n\t */\n\tprivate async lockedSummaryAction<T>(\n\t\tbefore: () => void,\n\t\taction: () => Promise<T>,\n\t\tafter: () => void,\n\t) {\n\t\tassert(\n\t\t\tthis.summarizingLock === undefined,\n\t\t\t0x25b /* \"Caller is responsible for checking lock\" */,\n\t\t);\n\n\t\tconst summarizingLock = new Deferred<void>();\n\t\tthis.summarizingLock = summarizingLock.promise;\n\n\t\tbefore();\n\n\t\treturn action().finally(() => {\n\t\t\tsummarizingLock.resolve();\n\t\t\tthis.summarizingLock = undefined;\n\t\t\tafter();\n\t\t});\n\t}\n\n\t/**\n\t * Runs single summarize attempt\n\t * @param summarizeProps - props to log with each telemetry event associated with this attempt\n\t * @param options - summary options\n\t * @param cancellationToken - cancellation token to use to be able to cancel this summary, if needed\n\t * @param resultsBuilder - optional, result builder to use.\n\t * @returns ISummarizeResult - result of running a summary.\n\t */\n\tprivate trySummarizeOnce(\n\t\tsummarizeProps: ISummarizeTelemetryProperties,\n\t\toptions: ISummarizeOptions,\n\t\tresultsBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\t\tlogger: this.mc.logger,\n\t\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t\t});\n\t\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t\t...options,\n\t\t\t\t\tsummaryLogger,\n\t\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\t};\n\t\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions, resultsBuilder);\n\t\t\t\t// ensure we wait till the end of the process\n\t\t\t\treturn summarizeResult.receivedSummaryAckOrNack;\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\t// SummaryGenerator.summarize() does not throw exceptions - it converts them to failed result\n\t\t\t// on resultsBuilder\n\t\t\t// We do not care about exceptions on receivedSummaryAckOrNack - caller should check results\n\t\t\t// and take a appropriate action.\n\t\t});\n\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** Heuristics summarize attempt. */\n\tprivate trySummarize(reason: SummarizeReason): void {\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// lockedSummaryAction() will retry heuristic-based summary at the end of current attempt\n\t\t\t// if it's still needed\n\t\t\tthis.tryWhileSummarizing = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lockedSummaryAction(\n\t\t\t() => {\n\t\t\t\tthis.beforeSummaryAction();\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\treturn this.mc.config.getBoolean(\"Fluid.Summarizer.UseDynamicRetries\")\n\t\t\t\t\t? this.trySummarizeWithRetries(reason)\n\t\t\t\t\t: this.trySummarizeWithStaticAttempts(reason);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.afterSummaryAction();\n\t\t\t},\n\t\t).catch((error) => {\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"UnexpectedSummarizeError\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Tries to summarize 2 times with pre-defined summary options. If an attempt fails with \"retryAfterSeconds\"\n\t * param, that attempt is tried once more.\n\t */\n\tprivate async trySummarizeWithStaticAttempts(reason: SummarizeReason) {\n\t\tconst attemptOptions: ISummarizeOptions[] = [\n\t\t\t{ refreshLatestAck: false, fullTree: false },\n\t\t\t{ refreshLatestAck: true, fullTree: false },\n\t\t];\n\t\tlet summaryAttempts = 0;\n\t\tlet summaryAttemptsPerPhase = 0;\n\t\tlet summaryAttemptPhase = 0;\n\t\twhile (summaryAttemptPhase < attemptOptions.length) {\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We only want to attempt 1 summary when reason is \"lastSummary\"\n\t\t\tif (++summaryAttempts > 1 && reason === \"lastSummary\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsummaryAttemptsPerPhase++;\n\n\t\t\tconst summarizeOptions = attemptOptions[summaryAttemptPhase];\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts,\n\t\t\t\tsummaryAttemptsPerPhase,\n\t\t\t\tsummaryAttemptPhase: summaryAttemptPhase + 1, // make everything 1-based\n\t\t\t\t...summarizeOptions,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t};\n\n\t\t\t// Note: no need to account for cancellationToken.waitCancelled here, as\n\t\t\t// this is accounted SummaryGenerator.summarizeCore that controls receivedSummaryAckOrNack.\n\t\t\tconst resultSummarize = this.generator.summarize(summaryOptions);\n\t\t\tconst ackNackResult = await resultSummarize.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check for retryDelay that can come from summaryNack, upload summary or submit summary flows.\n\t\t\t// Retry the same step only once per retryAfter response.\n\t\t\tconst submitResult = await resultSummarize.summarySubmitted;\n\t\t\tconst delaySeconds = !submitResult.success\n\t\t\t\t? submitResult.data?.retryAfterSeconds\n\t\t\t\t: ackNackResult.data?.retryAfterSeconds;\n\t\t\tif (delaySeconds === undefined || summaryAttemptsPerPhase > 1) {\n\t\t\t\tsummaryAttemptPhase++;\n\t\t\t\tsummaryAttemptsPerPhase = 0;\n\t\t\t}\n\n\t\t\tif (delaySeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: delaySeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\t...summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(delaySeconds * 1000);\n\t\t\t}\n\t\t}\n\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t}\n\n\t/**\n\t * Tries to summarize with retries where retry is based on the failure params.\n\t * For example, summarization may be retried for failures with \"retryAfterSeconds\" param.\n\t */\n\tprivate async trySummarizeWithRetries(\n\t\treason: SummarizeReason,\n\t): Promise<ISummarizeResults | undefined> {\n\t\t// Helper to set summarize options, telemetry properties and call summarize.\n\t\tconst attemptSummarize = (attemptNumber: number, finalAttempt: boolean) => {\n\t\t\tconst summarizeOptions: ISummarizeOptions = {\n\t\t\t\tfullTree: false,\n\t\t\t};\n\t\t\tconst summarizeProps: ISummarizeTelemetryProperties = {\n\t\t\t\tsummarizeReason: reason,\n\t\t\t\tsummaryAttempts: attemptNumber,\n\t\t\t\t...summarizeOptions,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summaryLogger = createChildLogger({\n\t\t\t\tlogger: this.mc.logger,\n\t\t\t\tproperties: { all: summarizeProps },\n\t\t\t});\n\t\t\tconst summaryOptions: ISubmitSummaryOptions = {\n\t\t\t\t...summarizeOptions,\n\t\t\t\tsummaryLogger,\n\t\t\t\tcancellationToken: this.cancellationToken,\n\t\t\t\tfinalAttempt,\n\t\t\t};\n\t\t\tconst summarizeResult = this.generator.summarize(summaryOptions);\n\t\t\treturn { summarizeProps, summarizeResult };\n\t\t};\n\n\t\t// The max number of attempts are based on the stage at which summarization failed. If it fails before it is\n\t\t// submitted, a different value is used compared to if it fails after submission. Usually, in the former case,\n\t\t// we would retry more often as its cheaper and retries are likely to succeed.\n\t\t// This makes it harder to predict how many attempts would actually happen as that depends on how far an attempt\n\t\t// made. To keep things simple, the max attempts is reset after every attempt based on where it failed. This may\n\t\t// result in some failures not being retried depending on what happened before this attempt. That's fine because\n\t\t// such scenarios are very unlikely and even if it happens, it would resolve when a new summarizer starts over.\n\t\t// For example - When failure switches from one the submit failures to nack failure, only one more retry will\n\t\t// happen irrespective of the value of `defaultMaxAttempts`.\n\t\tlet maxAttempts = defaultMaxAttempts;\n\t\tlet currentAttempt = 0;\n\t\tlet retryAfterSeconds: number | undefined;\n\t\tlet done = false;\n\t\tlet status: \"success\" | \"failure\" | \"canceled\" = \"success\";\n\t\tlet results: ISummarizeResults | undefined;\n\t\tdo {\n\t\t\tcurrentAttempt++;\n\t\t\tif (this.cancellationToken.cancelled) {\n\t\t\t\tstatus = \"canceled\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst attemptResult = attemptSummarize(currentAttempt, false /* finalAttempt */);\n\t\t\tresults = attemptResult.summarizeResult;\n\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await results.receivedSummaryAckOrNack;\n\t\t\tif (ackNackResult.success) {\n\t\t\t\tstatus = \"success\";\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Update max attempts and retry params from the failure result.\n\t\t\t// If submit summary failed, use the params from \"summarySubmitted\" result. Else, use the params\n\t\t\t// from \"receivedSummaryAckOrNack\" result.\n\t\t\t// Note: Check \"summarySubmitted\" result first because if it fails, ack nack would fail as well.\n\t\t\tconst submitSummaryResult = await results.summarySubmitted;\n\t\t\tif (!submitSummaryResult.success) {\n\t\t\t\tmaxAttempts = this.maxAttemptsForSubmitFailures;\n\t\t\t\tretryAfterSeconds = submitSummaryResult.data?.retryAfterSeconds;\n\t\t\t} else {\n\t\t\t\tmaxAttempts = defaultMaxAttempts;\n\t\t\t\tretryAfterSeconds = ackNackResult.data?.retryAfterSeconds;\n\t\t\t}\n\n\t\t\t// Emit \"summarize\" event for this failed attempt.\n\t\t\tstatus = \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult: status,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\n\t\t\t// If the failure doesn't have \"retryAfterSeconds\" or the max number of attempts have been done, we're done.\n\t\t\tif (retryAfterSeconds === undefined || currentAttempt >= maxAttempts - 1) {\n\t\t\t\tdone = true;\n\t\t\t}\n\n\t\t\t// If the failure has \"retryAfterSeconds\", add a delay of that time. In this case, a final attempt will\n\t\t\t// take place and we need to wait for \"retryAfterSeconds\" before that.\n\t\t\tif (retryAfterSeconds !== undefined) {\n\t\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"SummarizeAttemptDelay\",\n\t\t\t\t\tduration: retryAfterSeconds,\n\t\t\t\t\tsummaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,\n\t\t\t\t\tstage: submitSummaryResult.data?.stage,\n\t\t\t\t\tdynamicRetries: true, // To differentiate this telemetry from regular retry logic\n\t\t\t\t\t...attemptResult.summarizeProps,\n\t\t\t\t});\n\t\t\t\tawait delay(retryAfterSeconds * 1000);\n\t\t\t}\n\t\t} while (!done);\n\n\t\t// If summarize attempt did not fail, emit \"summarize\" event and return. A failed attempt may be retried below.\n\t\tif (status !== \"failure\") {\n\t\t\tthis.emit(\"summarize\", { result: status, currentAttempt, maxAttempts });\n\t\t\treturn results;\n\t\t}\n\n\t\t// If summarization wasn't successful above and the failure contains \"retryAfterSeconds\", perform one last\n\t\t// attempt. This gives a chance to the runtime to perform additional steps in the last attempt.\n\t\tif (retryAfterSeconds !== undefined) {\n\t\t\tconst { summarizeResult } = attemptSummarize(++currentAttempt, true /* finalAttempt */);\n\t\t\t// Ack / nack is the final step, so if it succeeds we're done.\n\t\t\tconst ackNackResult = await summarizeResult.receivedSummaryAckOrNack;\n\t\t\tstatus = ackNackResult.success ? \"success\" : \"failure\";\n\t\t\tconst eventProps: ISummarizeEventProps = {\n\t\t\t\tresult: status,\n\t\t\t\tcurrentAttempt,\n\t\t\t\tmaxAttempts,\n\t\t\t\terror: ackNackResult.success ? undefined : ackNackResult.error,\n\t\t\t};\n\t\t\tthis.emit(\"summarize\", eventProps);\n\t\t\tresults = summarizeResult;\n\t\t}\n\n\t\t// If summarization is still unsuccessful, stop the summarizer.\n\t\tif (status === \"failure\") {\n\t\t\tthis.stopSummarizerCallback(\"failToSummarize\");\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Attempts to generate a summary on demand with retries in case of failures. The retry logic is the same\n\t * as heuristics based summaries.\n\t */\n\tprivate async summarizeOnDemandWithRetries(\n\t\treason: SummarizeReason,\n\t\tresultsBuilder: SummarizeResultBuilder,\n\t) {\n\t\tconst results = await this.trySummarizeWithRetries(reason);\n\t\tif (results === undefined) {\n\t\t\tresultsBuilder.fail(\"Summarization was canceled\", undefined);\n\t\t\treturn resultsBuilder.build();\n\t\t}\n\t\tconst submitResult = await results.summarySubmitted;\n\t\tconst summaryOpBroadcastedResult = await results.summaryOpBroadcasted;\n\t\tconst ackNackResult = await results.receivedSummaryAckOrNack;\n\t\tresultsBuilder.summarySubmitted.resolve(submitResult);\n\t\tresultsBuilder.summaryOpBroadcasted.resolve(summaryOpBroadcastedResult);\n\t\tresultsBuilder.receivedSummaryAckOrNack.resolve(ackNackResult);\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */\n\tpublic summarizeOnDemand(\n\t\toptions: IOnDemandSummarizeOptions,\n\t\tresultsBuilder: SummarizeResultBuilder = new SummarizeResultBuilder(),\n\t): ISummarizeResults {\n\t\tif (this.stopping) {\n\t\t\tresultsBuilder.fail(\"RunningSummarizer stopped or disposed\", undefined);\n\t\t\treturn resultsBuilder.build();\n\t\t}\n\t\t// Check for concurrent summary attempts. If one is found,\n\t\t// return a promise that caller can await before trying again.\n\t\tif (this.summarizingLock !== undefined) {\n\t\t\t// The heuristics are blocking concurrent summarize attempts.\n\t\t\tthrow new UsageError(\"Attempted to run an already-running summarizer on demand\");\n\t\t}\n\n\t\tconst { reason, ...summarizeOptions } = options;\n\t\tif (options.retryOnFailure === true) {\n\t\t\tthis.summarizeOnDemandWithRetries(`onDemand;${reason}`, resultsBuilder).catch(\n\t\t\t\t(error) => {\n\t\t\t\t\tresultsBuilder.fail(\"summarize failed\", error);\n\t\t\t\t},\n\t\t\t);\n\t\t} else {\n\t\t\tthis.trySummarizeOnce(\n\t\t\t\t{ summarizeReason: `onDemand/${reason}` },\n\t\t\t\tsummarizeOptions,\n\t\t\t\tresultsBuilder,\n\t\t\t);\n\t\t}\n\t\treturn resultsBuilder.build();\n\t}\n\n\t/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tconst { reason, afterSequenceNumber = 0, override = false, ...summarizeOptions } = options;\n\t\tlet overridden = false;\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tif (!override) {\n\t\t\t\treturn { alreadyEnqueued: true };\n\t\t\t}\n\t\t\t// Override existing enqueued summarize attempt.\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"Aborted; overridden by another enqueue summarize attempt\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t\toverridden = true;\n\t\t}\n\n\t\tthis.enqueuedSummary = {\n\t\t\treason: `enqueue;${reason}`,\n\t\t\tafterSequenceNumber,\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder: new SummarizeResultBuilder(),\n\t\t};\n\t\tconst results = this.enqueuedSummary.resultsBuilder.build();\n\t\tthis.tryRunEnqueuedSummary();\n\t\treturn overridden\n\t\t\t? {\n\t\t\t\t\t...results,\n\t\t\t\t\talreadyEnqueued: true,\n\t\t\t\t\toverridden: true,\n\t\t\t }\n\t\t\t: results;\n\t}\n\n\tprivate tryRunEnqueuedSummary() {\n\t\tif (this.stopping) {\n\t\t\tthis.disposeEnqueuedSummary();\n\t\t\treturn false;\n\t\t}\n\t\tif (\n\t\t\tthis.enqueuedSummary === undefined ||\n\t\t\tthis.heuristicData.lastOpSequenceNumber < this.enqueuedSummary.afterSequenceNumber ||\n\t\t\tthis.summarizingLock !== undefined\n\t\t) {\n\t\t\t// If no enqueued summary is ready or a summary is already in progress, take no action.\n\t\t\treturn false;\n\t\t}\n\t\tconst { reason, resultsBuilder, summarizeOptions } = this.enqueuedSummary;\n\t\t// Set to undefined first, so that subsequent enqueue attempt while summarize will occur later.\n\t\tthis.enqueuedSummary = undefined;\n\t\tthis.trySummarizeOnce(\n\t\t\t{ summarizeReason: `enqueuedSummary/${reason}` },\n\t\t\tsummarizeOptions,\n\t\t\tresultsBuilder,\n\t\t);\n\t\treturn true;\n\t}\n\n\tprivate disposeEnqueuedSummary() {\n\t\tif (this.enqueuedSummary !== undefined) {\n\t\t\tthis.enqueuedSummary.resultsBuilder.fail(\n\t\t\t\t\"RunningSummarizer stopped or disposed\",\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tthis.enqueuedSummary = undefined;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summarizer.d.mts","sourceRoot":"","sources":["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AK,EAAE;YACf,MAAM,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACtE;IACF,CAAC;IAEM,gBAAgB,CAAC,OAAiC;QACxD,IACC,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,iBAAiB,KAAK,SAAS;YACpC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAC9B;YACD,MAAM,IAAI,UAAU,CAAC,gDAAgD,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB,CAAE,gBAAyB;QACrD,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Deferred } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n\tIFluidErrorBase,\n\tLoggingError,\n\tUsageError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { ISummaryConfiguration } from \"../containerRuntime\";\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator\";\nimport { SummaryCollection } from \"./summaryCollection\";\nimport { RunningSummarizer } from \"./runningSummarizer\";\nimport {\n\tIConnectableRuntime,\n\tISummarizer,\n\tISummarizeHeuristicData,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tSummarizerStopReason,\n\tIOnDemandSummarizeOptions,\n\tISummarizeResults,\n\tIEnqueueSummarizeOptions,\n\tEnqueueSummarizeResult,\n\tISummarizerEvents,\n\tISummarizeEventProps,\n} from \"./summarizerTypes\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {\n\t\tconst newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (errorMessage: string, logged: boolean) =>\n\tnew SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @alpha\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer() {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/** Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/** Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger: this.runtime.logger, namespace: \"Summarizer\" });\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\treturn await this.runCore(onBehalfOf);\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason) {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close() {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/** summary attempt baseline for heuristics */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.runningSummarizer.on(\"summarize\", this.handleSummarizeEvent);\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\tprivate readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {\n\t\tthis.emit(\"summarize\", eventProps);\n\t};\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose() {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.runningSummarizer.off(\"summarize\", this.handleSummarizeEvent);\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((reason) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", reason);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((reason) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", reason);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number) {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerClientElection.d.mts","sourceRoot":"","sources":["../../src/summary/summarizerClientElection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iCAAiC;OACjE,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,cAAc,EAAe,MAAM,sCAAsC;OAC3E,EACN,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd;OACM,EAAE,0BAA0B,EAAE;AAErC,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,MAAM,WAAW,+BAAgC,SAAQ,MAAM;IAC9D,CAAC,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc,CAAC,+BAA+B,CAAC;IACjG,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,qBAAa,wBACZ,SAAQ,iBAAiB,CAAC,+BAA+B,CACzD,YAAW,yBAAyB;IAwBnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;aAClB,cAAc,EAAE,sBAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAzBxC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B,CAAqB;IACvD;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAK;IAE5B,IAAW,eAAe,uBAEzB;I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AAE,EAAE;YAC7D,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;YAC5C,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG,CAAC,EAAE;gBAClE,iEAAiE;gBACjE,kEAAkE;gBAClE,mEAAmE;gBACnE,4BAA4B;gBAC5B,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;aACvD;YACD,yDAAyD;YACzD,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACJ,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;YAC1B,+BAA+B;YAC/B,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,wBAAwB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;;AAEsB,oDAA2B,GAAG,CAAC,OAAuB,EAAW,EAAE,CACzF,OAAO,CAAC,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAoB,AADxB,CACyB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IClientDetails, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIOrderedClientElection,\n\tISerializedElection,\n\tITrackedClient,\n} from \"./orderedClientElection\";\nimport { ISummaryCollectionOpEvents } from \"./summaryCollection\";\n\nexport const summarizerClientType = \"summarizer\";\n\nexport interface ISummarizerClientElectionEvents extends IEvent {\n\t(event: \"electedSummarizerChanged\", handler: () => void): void;\n}\n\nexport interface ISummarizerClientElection extends 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() {\n\t\treturn this.clientElection.electedClient?.clientId;\n\t}\n\tpublic get electedParentId() {\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerHeuristics.d.mts","sourceRoot":"","sources":["../../src/summary/summarizerHeuristics.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAE9D,EAAE,+BAA+B,EAAE;OACnC,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB;OACM,EAAE,eAAe,EAAE;AAE1B,4EAA4E;AAC5E,qBAAa,sBAAuB,YAAW,uBAAuB;IAuC7D,oBAAoB,EAAE,MAAM;IAtCpC,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC;IAC1C,IAAW,WAAW,IAAI,iBAAiB,CAE1C;IAED,SAAS,CAAC,sBAAsB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC9D,IAAW,q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,MAAM,CAAC;IAChD,CAAC;CACD;AAED,SAAS,oCAAoC;IAC5C,OAAO,CAAC,IAAI,+BAA+B,EAAE,EAAE,IAAI,mCAAmC,EAAE,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { Timer } from \"@fluidframework/core-utils\";\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime\";\nimport {\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tISummarizeAttempt,\n\tISummaryHeuristicStrategy,\n} from \"./summarizerTypes\";\nimport { SummarizeReason } from \"./summaryGenerator\";\n\n/** Simple implementation of class for tracking summarize heuristic data. */\nexport class SummarizeHeuristicData implements ISummarizeHeuristicData {\n\tprotected _lastAttempt: ISummarizeAttempt;\n\tpublic get lastAttempt(): ISummarizeAttempt {\n\t\treturn this._lastAttempt;\n\t}\n\n\tprotected _lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\tpublic get lastSuccessfulSummary(): Readonly<ISummarizeAttempt> {\n\t\treturn this._lastSuccessfulSummary;\n\t}\n\n\tpublic get opsSinceLastSummary(): number {\n\t\treturn this.numNonRuntimeOpsBefore + this.numRuntimeOpsBefore;\n\t}\n\n\tpublic hasMissingOpData: boolean = false;\n\n\tpublic totalOpsSize: number = 0;\n\t/**\n\t * Cumulative size in bytes of all the ops at the beginning of the summarization attempt.\n\t * Is used to adjust totalOpsSize appropriately after successful summarization.\n\t */\n\tprivate totalOpsSizeBefore: number = 0;\n\n\tpublic numNonRuntimeOps: number = 0;\n\t/**\n\t * Number of non-runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numNonRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numNonRuntimeOpsBefore: number = 0;\n\n\tpublic numRuntimeOps: number = 0;\n\t/**\n\t * Number of runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numRuntimeOpsBefore: number = 0;\n\n\tconstructor(\n\t\tpublic lastOpSequenceNumber: number,\n\t\t/** Baseline attempt data used for comparisons with subsequent attempts/calculations. */\n\t\tattemptBaseline: ISummarizeAttempt,\n\t) {\n\t\tthis._lastAttempt = attemptBaseline;\n\t\tthis._lastSuccessfulSummary = { ...attemptBaseline };\n\t}\n\n\tpublic updateWithLastSummaryAckInfo(lastSummary: Readonly<ISummarizeAttempt>) {\n\t\tthis._lastAttempt = lastSummary;\n\t\tthis._lastSuccessfulSummary = { ...lastSummary };\n\t}\n\n\tpublic recordAttempt(refSequenceNumber?: number) {\n\t\tthis._lastAttempt = {\n\t\t\trefSequenceNumber: refSequenceNumber ?? this.lastOpSequenceNumber,\n\t\t\tsummaryTime: Date.now(),\n\t\t};\n\n\t\tthis.numNonRuntimeOpsBefore = this.numNonRuntimeOps;\n\t\tthis.numRuntimeOpsBefore = this.numRuntimeOps;\n\t\tthis.totalOpsSizeBefore = this.totalOpsSize;\n\t}\n\n\tpublic markLastAttemptAsSuccessful() {\n\t\tthis._lastSuccessfulSummary = { ...this.lastAttempt };\n\n\t\tthis.numNonRuntimeOps -= this.numNonRuntimeOpsBefore;\n\t\tthis.numNonRuntimeOpsBefore = 0;\n\n\t\tthis.numRuntimeOps -= this.numRuntimeOpsBefore;\n\t\tthis.numRuntimeOpsBefore = 0;\n\n\t\tthis.totalOpsSize -= this.totalOpsSizeBefore;\n\t\tthis.totalOpsSizeBefore = 0;\n\t}\n}\n\n/**\n * This class contains the heuristics for when to summarize.\n */\nexport class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {\n\tprivate readonly idleTimer: Timer | undefined;\n\tprivate readonly runSummarize: (reason: SummarizeReason) => void;\n\n\tpublic constructor(\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly configuration: ISummaryConfigurationHeuristics,\n\t\ttrySummarize: (reason: SummarizeReason) => void,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summarizeStrategies: ISummaryHeuristicStrategy[] = getDefaultSummaryHeuristicStrategies(),\n\t) {\n\t\tthis.idleTimer = new Timer(this.idleTime, () => this.runSummarize(\"idle\"));\n\n\t\tthis.runSummarize = (reason: SummarizeReason) => {\n\t\t\tthis.idleTimer?.clear();\n\n\t\t\t// We shouldn't attempt a summary if there are no new processed ops\n\t\t\tconst opsSinceLastAck = this.opsSinceLastAck;\n\t\t\tif (opsSinceLastAck > 0) {\n\t\t\t\ttrySummarize(reason);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic get idleTime(): number {\n\t\tconst maxIdleTime = this.configuration.maxIdleTime;\n\t\tconst minIdleTime = this.configuration.minIdleTime;\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst pToMaxOps = (weightedNumOfOps * 1.0) / this.configuration.maxOps;\n\n\t\tif (pToMaxOps >= 1) {\n\t\t\treturn minIdleTime;\n\t\t}\n\n\t\t// Return a ratioed idle time based on the percentage of ops\n\t\treturn maxIdleTime - (maxIdleTime - minIdleTime) * pToMaxOps;\n\t}\n\n\tpublic get opsSinceLastAck(): number {\n\t\treturn (\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber\n\t\t);\n\t}\n\n\tpublic start() {\n\t\tthis.idleTimer?.start(this.idleTime);\n\t}\n\n\tpublic run() {\n\t\tfor (const strategy of this.summarizeStrategies) {\n\t\t\tif (strategy.shouldRunSummary(this.configuration, this.heuristicData)) {\n\t\t\t\treturn this.runSummarize(strategy.summarizeReason);\n\t\t\t}\n\t\t}\n\n\t\tthis.idleTimer?.restart(this.idleTime);\n\t}\n\n\tpublic shouldRunLastSummary(): boolean {\n\t\tconst weightedOpsSinceLastAck = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ShouldRunLastSummary\",\n\t\t\tweightedOpsSinceLastAck,\n\t\t\tminOpsForLastSummaryAttempt,\n\t\t});\n\n\t\treturn weightedOpsSinceLastAck >= minOpsForLastSummaryAttempt;\n\t}\n\n\tpublic dispose() {\n\t\tthis.idleTimer?.clear();\n\t}\n}\n\n/** Strategy used to run a summary when it's been a while since our last successful summary */\nclass MaxTimeSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxTime\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst timeSinceLastSummary = Date.now() - heuristicData.lastSuccessfulSummary.summaryTime;\n\t\treturn timeSinceLastSummary > configuration.maxTime;\n\t}\n}\n\nfunction getWeightedNumberOfOps(\n\truntimeOpCount: number,\n\tnonRuntimeOpCount: number,\n\truntimeOpWeight: number,\n\tnonRuntimeOpWeight: number,\n): number {\n\treturn runtimeOpWeight * runtimeOpCount + nonRuntimeOpWeight * nonRuntimeOpCount;\n}\n\n/** Strategy used to do a weighted analysis on the ops we've processed since the last successful summary */\nclass WeightedOpsSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxOps\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\theuristicData.numRuntimeOps,\n\t\t\theuristicData.numNonRuntimeOps,\n\t\t\tconfiguration.runtimeOpWeight,\n\t\t\tconfiguration.nonRuntimeOpWeight,\n\t\t);\n\t\treturn weightedNumOfOps > configuration.maxOps;\n\t}\n}\n\nfunction getDefaultSummaryHeuristicStrategies() {\n\treturn [new MaxTimeSummaryHeuristicStrategy(), new WeightedOpsSummaryHeuristicStrategy()];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,GACrB;OACM,EAAE,mBAAmB,EAAE,wBAAwB,EAAE;OACjD,EAAE,yBAAyB,EAAE,8BAA8B,EAAE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { createRootSummarizerNode } from "./summarizerNode.mjs";
|
|
6
|
-
export { createRootSummarizerNodeWithGC } from "./summarizerNodeWithGc.mjs";
|
|
7
|
-
//# sourceMappingURL=index.mjs.map
|