@fluidframework/container-runtime 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +1 -7
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/container-runtime.api.md +18 -17
- package/dist/blobManager.d.ts +8 -3
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +15 -4
- package/dist/blobManager.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +265 -17
- package/dist/container-runtime-beta.d.ts +0 -42
- package/dist/container-runtime-public.d.ts +0 -42
- package/dist/container-runtime-untrimmed.d.ts +32 -17
- package/dist/containerRuntime.d.ts +8 -4
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +15 -29
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +5 -2
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +10 -3
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +10 -3
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +51 -8
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +15 -4
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +26 -19
- 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 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +13 -6
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +18 -9
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +2 -1
- package/dist/gc/index.js.map +1 -1
- package/dist/messageTypes.d.ts +1 -1
- package/dist/messageTypes.js +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +4 -4
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +4 -1
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +5 -0
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +46 -17
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -1
- package/dist/summary/summarizer.js +1 -1
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +3 -1
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +7 -7
- package/dist/summary/summaryCollection.js +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/lib/{batchTracker.d.ts → batchTracker.d.mts} +1 -1
- package/lib/batchTracker.d.mts.map +1 -0
- package/lib/{batchTracker.js → batchTracker.mjs} +1 -1
- package/lib/batchTracker.mjs.map +1 -0
- package/lib/{blobManager.d.ts → blobManager.d.mts} +9 -4
- package/lib/blobManager.d.mts.map +1 -0
- package/lib/{blobManager.js → blobManager.mjs} +17 -6
- package/lib/blobManager.mjs.map +1 -0
- package/lib/{connectionTelemetry.d.ts → connectionTelemetry.d.mts} +1 -1
- package/lib/connectionTelemetry.d.mts.map +1 -0
- package/lib/{connectionTelemetry.js → connectionTelemetry.mjs} +1 -1
- package/lib/connectionTelemetry.mjs.map +1 -0
- package/lib/{container-runtime-alpha.d.ts → container-runtime-alpha.d.mts} +265 -17
- package/lib/{container-runtime-beta.d.ts → container-runtime-beta.d.mts} +0 -42
- package/lib/{container-runtime-public.d.ts → container-runtime-public.d.mts} +0 -42
- package/lib/{container-runtime-untrimmed.d.ts → container-runtime-untrimmed.d.mts} +32 -17
- package/lib/{containerHandleContext.d.ts → containerHandleContext.d.mts} +2 -2
- package/lib/containerHandleContext.d.mts.map +1 -0
- package/lib/{containerHandleContext.js → containerHandleContext.mjs} +1 -1
- package/lib/containerHandleContext.mjs.map +1 -0
- package/lib/{containerRuntime.d.ts → containerRuntime.d.mts} +14 -14
- package/lib/containerRuntime.d.mts.map +1 -0
- package/lib/{containerRuntime.js → containerRuntime.mjs} +31 -22
- package/lib/containerRuntime.mjs.map +1 -0
- package/lib/{dataStore.d.ts → dataStore.d.mts} +3 -3
- package/lib/dataStore.d.mts.map +1 -0
- package/lib/{dataStore.js → dataStore.mjs} +1 -1
- package/lib/dataStore.mjs.map +1 -0
- package/lib/{dataStoreContext.d.ts → dataStoreContext.d.mts} +7 -4
- package/lib/dataStoreContext.d.mts.map +1 -0
- package/lib/{dataStoreContext.js → dataStoreContext.mjs} +13 -6
- package/lib/dataStoreContext.mjs.map +1 -0
- package/lib/{dataStoreContexts.d.ts → dataStoreContexts.d.mts} +2 -2
- package/lib/dataStoreContexts.d.mts.map +1 -0
- package/lib/{dataStoreContexts.js → dataStoreContexts.mjs} +1 -1
- package/lib/dataStoreContexts.mjs.map +1 -0
- package/lib/{dataStoreRegistry.d.ts → dataStoreRegistry.d.mts} +1 -1
- package/lib/dataStoreRegistry.d.mts.map +1 -0
- package/lib/{dataStoreRegistry.js → dataStoreRegistry.mjs} +1 -5
- package/lib/dataStoreRegistry.mjs.map +1 -0
- package/lib/{dataStores.d.ts → dataStores.d.mts} +17 -10
- package/lib/dataStores.d.mts.map +1 -0
- package/lib/{dataStores.js → dataStores.mjs} +58 -16
- package/lib/dataStores.mjs.map +1 -0
- package/lib/{deltaManagerProxyBase.d.ts → deltaManagerProxyBase.d.mts} +1 -1
- package/lib/deltaManagerProxyBase.d.mts.map +1 -0
- package/lib/{deltaManagerProxyBase.js → deltaManagerProxyBase.mjs} +1 -1
- package/lib/deltaManagerProxyBase.mjs.map +1 -0
- package/lib/{deltaManagerSummarizerProxy.d.ts → deltaManagerSummarizerProxy.d.mts} +2 -2
- package/lib/deltaManagerSummarizerProxy.d.mts.map +1 -0
- package/lib/{deltaManagerSummarizerProxy.js → deltaManagerSummarizerProxy.mjs} +3 -3
- package/lib/deltaManagerSummarizerProxy.mjs.map +1 -0
- package/lib/{deltaScheduler.d.ts → deltaScheduler.d.mts} +1 -1
- package/lib/deltaScheduler.d.mts.map +1 -0
- package/lib/{deltaScheduler.js → deltaScheduler.mjs} +1 -1
- package/lib/deltaScheduler.mjs.map +1 -0
- package/lib/{error.d.ts → error.d.mts} +1 -1
- package/lib/error.d.mts.map +1 -0
- package/lib/{error.js → error.mjs} +1 -1
- package/lib/error.mjs.map +1 -0
- package/lib/gc/{garbageCollection.d.ts → garbageCollection.d.mts} +5 -5
- package/lib/gc/garbageCollection.d.mts.map +1 -0
- package/lib/gc/{garbageCollection.js → garbageCollection.mjs} +28 -17
- package/lib/gc/garbageCollection.mjs.map +1 -0
- package/lib/gc/{gcConfigs.d.ts → gcConfigs.d.mts} +3 -3
- package/lib/gc/gcConfigs.d.mts.map +1 -0
- package/lib/gc/{gcConfigs.js → gcConfigs.mjs} +29 -22
- package/lib/gc/gcConfigs.mjs.map +1 -0
- package/lib/gc/{gcDefinitions.d.ts → gcDefinitions.d.mts} +33 -10
- package/lib/gc/gcDefinitions.d.mts.map +1 -0
- package/lib/gc/{gcDefinitions.js → gcDefinitions.mjs} +5 -3
- package/lib/gc/gcDefinitions.mjs.map +1 -0
- package/lib/gc/{gcHelpers.d.ts → gcHelpers.d.mts} +3 -3
- package/lib/gc/{gcHelpers.d.ts.map → gcHelpers.d.mts.map} +1 -1
- package/lib/gc/{gcHelpers.js → gcHelpers.mjs} +1 -1
- package/lib/gc/gcHelpers.mjs.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.d.ts → gcReferenceGraphAlgorithm.d.mts} +2 -2
- package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.js → gcReferenceGraphAlgorithm.mjs} +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.d.ts → gcSummaryDefinitions.d.mts} +1 -1
- package/lib/gc/gcSummaryDefinitions.d.mts.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.js → gcSummaryDefinitions.mjs} +1 -1
- package/lib/gc/gcSummaryDefinitions.mjs.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.d.ts → gcSummaryStateTracker.d.mts} +4 -4
- package/lib/gc/gcSummaryStateTracker.d.mts.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.js → gcSummaryStateTracker.mjs} +2 -2
- package/lib/gc/gcSummaryStateTracker.mjs.map +1 -0
- package/lib/gc/{gcTelemetry.d.ts → gcTelemetry.d.mts} +18 -11
- package/lib/gc/gcTelemetry.d.mts.map +1 -0
- package/lib/gc/{gcTelemetry.js → gcTelemetry.mjs} +20 -11
- package/lib/gc/gcTelemetry.mjs.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.d.ts → gcUnreferencedStateTracker.d.mts} +2 -2
- package/lib/gc/gcUnreferencedStateTracker.d.mts.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.js → gcUnreferencedStateTracker.mjs} +2 -2
- package/lib/gc/gcUnreferencedStateTracker.mjs.map +1 -0
- package/lib/gc/{index.d.ts → index.d.mts} +9 -9
- package/lib/gc/index.d.mts.map +1 -0
- package/lib/gc/{index.js → index.mjs} +8 -8
- package/lib/gc/index.mjs.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +8 -8
- package/lib/index.d.mts.map +1 -0
- package/lib/{index.js → index.mjs} +7 -9
- package/lib/index.mjs.map +1 -0
- package/lib/{messageTypes.d.ts → messageTypes.d.mts} +5 -5
- package/lib/messageTypes.d.mts.map +1 -0
- package/lib/{messageTypes.js → messageTypes.mjs} +2 -2
- package/lib/messageTypes.mjs.map +1 -0
- package/lib/{metadata.d.ts → metadata.d.mts} +1 -1
- package/lib/metadata.d.mts.map +1 -0
- package/lib/{metadata.js → metadata.mjs} +1 -1
- package/lib/metadata.mjs.map +1 -0
- package/lib/opLifecycle/{batchManager.d.ts → batchManager.d.mts} +3 -3
- package/lib/opLifecycle/batchManager.d.mts.map +1 -0
- package/lib/opLifecycle/{batchManager.js → batchManager.mjs} +1 -1
- package/lib/opLifecycle/batchManager.mjs.map +1 -0
- package/lib/opLifecycle/{definitions.d.ts → definitions.d.mts} +3 -3
- package/lib/opLifecycle/definitions.d.mts.map +1 -0
- package/lib/opLifecycle/{definitions.js → definitions.mjs} +1 -1
- package/lib/opLifecycle/definitions.mjs.map +1 -0
- package/lib/opLifecycle/index.d.mts +13 -0
- package/lib/opLifecycle/index.d.mts.map +1 -0
- package/lib/opLifecycle/index.mjs +12 -0
- package/lib/opLifecycle/index.mjs.map +1 -0
- package/lib/opLifecycle/{opCompressor.d.ts → opCompressor.d.mts} +2 -2
- package/lib/opLifecycle/opCompressor.d.mts.map +1 -0
- package/lib/opLifecycle/{opCompressor.js → opCompressor.mjs} +3 -3
- package/lib/opLifecycle/opCompressor.mjs.map +1 -0
- package/lib/opLifecycle/{opDecompressor.d.ts → opDecompressor.d.mts} +2 -2
- package/lib/opLifecycle/opDecompressor.d.mts.map +1 -0
- package/lib/opLifecycle/{opDecompressor.js → opDecompressor.mjs} +2 -2
- package/lib/opLifecycle/opDecompressor.mjs.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.d.ts → opGroupingManager.d.mts} +2 -2
- package/lib/opLifecycle/opGroupingManager.d.mts.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.js → opGroupingManager.mjs} +1 -1
- package/lib/opLifecycle/opGroupingManager.mjs.map +1 -0
- package/lib/opLifecycle/{opSplitter.d.ts → opSplitter.d.mts} +2 -2
- package/lib/opLifecycle/opSplitter.d.mts.map +1 -0
- package/lib/opLifecycle/{opSplitter.js → opSplitter.mjs} +3 -3
- package/lib/opLifecycle/opSplitter.mjs.map +1 -0
- package/lib/opLifecycle/{outbox.d.ts → outbox.d.mts} +11 -11
- package/lib/opLifecycle/outbox.d.mts.map +1 -0
- package/lib/opLifecycle/{outbox.js → outbox.mjs} +6 -3
- package/lib/opLifecycle/outbox.mjs.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.d.ts → remoteMessageProcessor.d.mts} +5 -5
- package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.js → remoteMessageProcessor.mjs} +2 -2
- package/lib/opLifecycle/remoteMessageProcessor.mjs.map +1 -0
- package/lib/{opProperties.d.ts → opProperties.d.mts} +1 -1
- package/lib/opProperties.d.mts.map +1 -0
- package/lib/{opProperties.js → opProperties.mjs} +1 -1
- package/lib/opProperties.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{pendingStateManager.d.ts → pendingStateManager.d.mts} +2 -2
- package/lib/pendingStateManager.d.mts.map +1 -0
- package/lib/{pendingStateManager.js → pendingStateManager.mjs} +2 -2
- package/lib/pendingStateManager.mjs.map +1 -0
- package/lib/{scheduleManager.d.ts → scheduleManager.d.mts} +1 -5
- package/lib/scheduleManager.d.mts.map +1 -0
- package/lib/{scheduleManager.js → scheduleManager.mjs} +3 -3
- package/lib/scheduleManager.mjs.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.d.ts → storageServiceWithAttachBlobs.d.mts} +1 -1
- package/lib/storageServiceWithAttachBlobs.d.mts.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.js → storageServiceWithAttachBlobs.mjs} +1 -1
- package/lib/storageServiceWithAttachBlobs.mjs.map +1 -0
- package/lib/summary/{index.d.ts → index.d.mts} +13 -13
- package/lib/summary/index.d.mts.map +1 -0
- package/lib/summary/{index.js → index.mjs} +12 -12
- package/lib/summary/index.mjs.map +1 -0
- package/lib/summary/{orderedClientElection.d.ts → orderedClientElection.d.mts} +1 -5
- package/lib/summary/orderedClientElection.d.mts.map +1 -0
- package/lib/summary/{orderedClientElection.js → orderedClientElection.mjs} +2 -2
- package/lib/summary/orderedClientElection.mjs.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.d.ts → runWhileConnectedCoordinator.d.mts} +3 -3
- package/lib/summary/runWhileConnectedCoordinator.d.mts.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.js → runWhileConnectedCoordinator.mjs} +1 -1
- package/lib/summary/runWhileConnectedCoordinator.mjs.map +1 -0
- package/lib/summary/{runningSummarizer.d.ts → runningSummarizer.d.mts} +10 -5
- package/lib/summary/runningSummarizer.d.mts.map +1 -0
- package/lib/summary/{runningSummarizer.js → runningSummarizer.mjs} +50 -21
- package/lib/summary/runningSummarizer.mjs.map +1 -0
- package/lib/summary/{summarizer.d.ts → summarizer.d.mts} +6 -6
- package/lib/summary/summarizer.d.mts.map +1 -0
- package/lib/summary/{summarizer.js → summarizer.mjs} +5 -5
- package/lib/summary/summarizer.mjs.map +1 -0
- package/lib/summary/{summarizerClientElection.d.ts → summarizerClientElection.d.mts} +3 -3
- package/lib/summary/summarizerClientElection.d.mts.map +1 -0
- package/lib/summary/{summarizerClientElection.js → summarizerClientElection.mjs} +1 -1
- package/lib/summary/summarizerClientElection.mjs.map +1 -0
- package/lib/summary/{summarizerHeuristics.d.ts → summarizerHeuristics.d.mts} +4 -4
- package/lib/summary/summarizerHeuristics.d.mts.map +1 -0
- package/lib/summary/{summarizerHeuristics.js → summarizerHeuristics.mjs} +1 -1
- package/lib/summary/summarizerHeuristics.mjs.map +1 -0
- package/lib/summary/summarizerNode/{index.d.ts → index.d.mts} +4 -4
- package/lib/summary/summarizerNode/index.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{index.js → index.mjs} +3 -3
- package/lib/summary/summarizerNode/index.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.d.ts → summarizerNode.d.mts} +2 -2
- package/lib/summary/summarizerNode/summarizerNode.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.js → summarizerNode.mjs} +2 -2
- package/lib/summary/summarizerNode/summarizerNode.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.d.ts → summarizerNodeUtils.d.mts} +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.js → summarizerNodeUtils.mjs} +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.ts → summarizerNodeWithGc.d.mts} +3 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.js → summarizerNodeWithGc.mjs} +4 -4
- package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +1 -0
- package/lib/summary/{summarizerTypes.d.ts → summarizerTypes.d.mts} +7 -5
- package/lib/summary/summarizerTypes.d.mts.map +1 -0
- package/lib/summary/{summarizerTypes.js → summarizerTypes.mjs} +1 -1
- package/lib/summary/summarizerTypes.mjs.map +1 -0
- package/lib/summary/{summaryCollection.d.ts → summaryCollection.d.mts} +8 -8
- package/lib/summary/summaryCollection.d.mts.map +1 -0
- package/lib/summary/{summaryCollection.js → summaryCollection.mjs} +2 -2
- package/lib/summary/summaryCollection.mjs.map +1 -0
- package/lib/summary/{summaryFormat.d.ts → summaryFormat.d.mts} +2 -2
- package/lib/summary/summaryFormat.d.mts.map +1 -0
- package/lib/summary/{summaryFormat.js → summaryFormat.mjs} +1 -1
- package/lib/summary/summaryFormat.mjs.map +1 -0
- package/lib/summary/{summaryGenerator.d.ts → summaryGenerator.d.mts} +3 -3
- package/lib/summary/summaryGenerator.d.mts.map +1 -0
- package/lib/summary/{summaryGenerator.js → summaryGenerator.mjs} +1 -1
- package/lib/summary/summaryGenerator.mjs.map +1 -0
- package/lib/summary/{summaryManager.d.ts → summaryManager.d.mts} +5 -5
- package/lib/summary/summaryManager.d.mts.map +1 -0
- package/lib/summary/{summaryManager.js → summaryManager.mjs} +2 -2
- package/lib/summary/summaryManager.mjs.map +1 -0
- package/lib/{throttler.d.ts → throttler.d.mts} +1 -1
- package/lib/throttler.d.mts.map +1 -0
- package/lib/{throttler.js → throttler.mjs} +1 -1
- package/lib/throttler.mjs.map +1 -0
- package/package.json +145 -39
- package/src/blobManager.ts +15 -4
- package/src/containerRuntime.ts +15 -4
- package/src/dataStoreContext.ts +11 -4
- package/src/dataStores.ts +61 -7
- package/src/gc/garbageCollection.ts +18 -4
- package/src/gc/gcConfigs.ts +28 -20
- package/src/gc/gcDefinitions.ts +30 -6
- package/src/gc/gcTelemetry.ts +19 -9
- package/src/gc/index.ts +3 -0
- package/src/messageTypes.ts +1 -1
- package/src/opLifecycle/definitions.ts +1 -1
- package/src/opLifecycle/outbox.ts +5 -2
- package/src/packageVersion.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +58 -25
- package/src/summary/summarizer.ts +1 -1
- package/src/summary/summarizerTypes.ts +3 -1
- package/src/summary/summaryCollection.ts +7 -7
- package/tsconfig.json +6 -4
- package/lib/batchTracker.d.ts.map +0 -1
- package/lib/batchTracker.js.map +0 -1
- package/lib/blobManager.d.ts.map +0 -1
- package/lib/blobManager.js.map +0 -1
- package/lib/connectionTelemetry.d.ts.map +0 -1
- package/lib/connectionTelemetry.js.map +0 -1
- package/lib/containerHandleContext.d.ts.map +0 -1
- package/lib/containerHandleContext.js.map +0 -1
- package/lib/containerRuntime.d.ts.map +0 -1
- package/lib/containerRuntime.js.map +0 -1
- package/lib/dataStore.d.ts.map +0 -1
- package/lib/dataStore.js.map +0 -1
- package/lib/dataStoreContext.d.ts.map +0 -1
- package/lib/dataStoreContext.js.map +0 -1
- package/lib/dataStoreContexts.d.ts.map +0 -1
- package/lib/dataStoreContexts.js.map +0 -1
- package/lib/dataStoreRegistry.d.ts.map +0 -1
- package/lib/dataStoreRegistry.js.map +0 -1
- package/lib/dataStores.d.ts.map +0 -1
- package/lib/dataStores.js.map +0 -1
- package/lib/deltaManagerProxyBase.d.ts.map +0 -1
- package/lib/deltaManagerProxyBase.js.map +0 -1
- package/lib/deltaManagerSummarizerProxy.d.ts.map +0 -1
- package/lib/deltaManagerSummarizerProxy.js.map +0 -1
- package/lib/deltaScheduler.d.ts.map +0 -1
- package/lib/deltaScheduler.js.map +0 -1
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js.map +0 -1
- package/lib/gc/garbageCollection.d.ts.map +0 -1
- package/lib/gc/garbageCollection.js.map +0 -1
- package/lib/gc/gcConfigs.d.ts.map +0 -1
- package/lib/gc/gcConfigs.js.map +0 -1
- package/lib/gc/gcDefinitions.d.ts.map +0 -1
- package/lib/gc/gcDefinitions.js.map +0 -1
- package/lib/gc/gcHelpers.js.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +0 -1
- package/lib/gc/gcSummaryDefinitions.d.ts.map +0 -1
- package/lib/gc/gcSummaryDefinitions.js.map +0 -1
- package/lib/gc/gcSummaryStateTracker.d.ts.map +0 -1
- package/lib/gc/gcSummaryStateTracker.js.map +0 -1
- package/lib/gc/gcTelemetry.d.ts.map +0 -1
- package/lib/gc/gcTelemetry.js.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.js.map +0 -1
- package/lib/gc/index.d.ts.map +0 -1
- package/lib/gc/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/messageTypes.d.ts.map +0 -1
- package/lib/messageTypes.js.map +0 -1
- package/lib/metadata.d.ts.map +0 -1
- package/lib/metadata.js.map +0 -1
- package/lib/opLifecycle/batchManager.d.ts.map +0 -1
- package/lib/opLifecycle/batchManager.js.map +0 -1
- package/lib/opLifecycle/definitions.d.ts.map +0 -1
- package/lib/opLifecycle/definitions.js.map +0 -1
- package/lib/opLifecycle/index.d.ts +0 -13
- package/lib/opLifecycle/index.d.ts.map +0 -1
- package/lib/opLifecycle/index.js +0 -12
- package/lib/opLifecycle/index.js.map +0 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +0 -1
- package/lib/opLifecycle/opCompressor.js.map +0 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +0 -1
- package/lib/opLifecycle/opDecompressor.js.map +0 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +0 -1
- package/lib/opLifecycle/opGroupingManager.js.map +0 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +0 -1
- package/lib/opLifecycle/opSplitter.js.map +0 -1
- package/lib/opLifecycle/outbox.d.ts.map +0 -1
- package/lib/opLifecycle/outbox.js.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +0 -1
- package/lib/opProperties.d.ts.map +0 -1
- package/lib/opProperties.js.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/pendingStateManager.d.ts.map +0 -1
- package/lib/pendingStateManager.js.map +0 -1
- package/lib/scheduleManager.d.ts.map +0 -1
- package/lib/scheduleManager.js.map +0 -1
- package/lib/storageServiceWithAttachBlobs.d.ts.map +0 -1
- package/lib/storageServiceWithAttachBlobs.js.map +0 -1
- package/lib/summary/index.d.ts.map +0 -1
- package/lib/summary/index.js.map +0 -1
- package/lib/summary/orderedClientElection.d.ts.map +0 -1
- package/lib/summary/orderedClientElection.js.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +0 -1
- package/lib/summary/runningSummarizer.d.ts.map +0 -1
- package/lib/summary/runningSummarizer.js.map +0 -1
- package/lib/summary/summarizer.d.ts.map +0 -1
- package/lib/summary/summarizer.js.map +0 -1
- package/lib/summary/summarizerClientElection.d.ts.map +0 -1
- package/lib/summary/summarizerClientElection.js.map +0 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +0 -1
- package/lib/summary/summarizerHeuristics.js.map +0 -1
- package/lib/summary/summarizerNode/index.d.ts.map +0 -1
- package/lib/summary/summarizerNode/index.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +0 -1
- package/lib/summary/summarizerTypes.d.ts.map +0 -1
- package/lib/summary/summarizerTypes.js.map +0 -1
- package/lib/summary/summaryCollection.d.ts.map +0 -1
- package/lib/summary/summaryCollection.js.map +0 -1
- package/lib/summary/summaryFormat.d.ts.map +0 -1
- package/lib/summary/summaryFormat.js.map +0 -1
- package/lib/summary/summaryGenerator.d.ts.map +0 -1
- package/lib/summary/summaryGenerator.js.map +0 -1
- package/lib/summary/summaryManager.d.ts.map +0 -1
- package/lib/summary/summaryManager.js.map +0 -1
- package/lib/throttler.d.ts.map +0 -1
- package/lib/throttler.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderedClientElection.mjs","sourceRoot":"","sources":["../../src/summary/orderedClientElection.ts"],"names":[],"mappings":"OAMO,EAEN,iBAAiB,EACjB,UAAU,GACV,MAAM,iCAAiC;OACjC,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAGzD,EAAE,oBAAoB,EAAE;AA6D/B;;;;;;GAMG;AACH,MAAM,OAAO,uBACZ,SAAQ,iBAAiD;IAezD,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;IACpC,CAAC;IAED,YACC,MAA4B,EAC5B,YAAyE,EACzE,MAAiD;QAEjD,KAAK,EAAE,CAAC;QAxBT,kFAAkF;QACjE,cAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;QAC9D,0EAA0E;QACzD,aAAQ,GAAkB;YAC1C,cAAc,EAAE,CAAC,CAAC;YAClB,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;SACxB,CAAC;QACF,gEAAgE;QACxD,oBAAe,GAAa,IAAI,CAAC,QAAQ,CAAC;QAgBjD,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC,CAAC;QAClF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACpC,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE;YACzC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SACjC;QAED,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,E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C;QACzE,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,EAAE;YACrF,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;SACnD;aAAM;YACN,4FAA4F;YAC5F,wDAAwD;YACxD,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;SACnD;IACF,CAAC;IAED;;;OAGG;IACI,kBAAkB,CAAC,cAAsB;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC5F,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,EAAE;YACrF,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;SACpD;aAAM;YACN,4FAA4F;YAC5F,wDAAwD;YACxD,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,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"]}
|
package/lib/summary/{runWhileConnectedCoordinator.d.ts → runWhileConnectedCoordinator.d.mts}
RENAMED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { SummarizerStopReason, IConnectableRuntime, ISummaryCancellationToken } from "./summarizerTypes";
|
|
5
|
+
import { SummarizerStopReason, IConnectableRuntime, ISummaryCancellationToken } from "./summarizerTypes.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Similar to AbortController, but using promise instead of events
|
|
8
|
-
* @
|
|
8
|
+
* @alpha
|
|
9
9
|
*/
|
|
10
10
|
export interface ICancellableSummarizerController extends ISummaryCancellationToken {
|
|
11
11
|
stop(reason: SummarizerStopReason): void;
|
|
@@ -52,4 +52,4 @@ export declare class RunWhileConnectedCoordinator implements ICancellableSummari
|
|
|
52
52
|
*/
|
|
53
53
|
stop(reason: SummarizerStopReason): void;
|
|
54
54
|
}
|
|
55
|
-
//# sourceMappingURL=runWhileConnectedCoordinator.d.
|
|
55
|
+
//# sourceMappingURL=runWhileConnectedCoordinator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA8B;IACpE,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAIxC,IAAW,SAAS;QACnB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACrB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAEvE,+EAA+E;YAC/E,iFAAiF;YACjF,4EAA4E;YAC5E,oCAAoC;YACpC,6CAA6C;YAC7C,mGAAmG;YACnG,yBAAyB;YACzB,oFAAoF;YACpF,EAAE;YACF,wEAAwE;YACxE,uFAAuF;SACvF;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAA4B,EAAE,MAAqB;QAC7E,MAAM,GAAG,GAAG,IAAI,4BAA4B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,YACkB,OAA4B,EAC5B,MAAqB;QADrB,YAAO,GAAP,OAAO,CAAqB;QAC5B,WAAM,GAAN,MAAM,CAAe;QAtC/B,eAAU,GAAG,KAAK,CAAC;QACV,iBAAY,GAAG,IAAI,QAAQ,EAAwB,CAAC;IAsClE,CAAC;IAEJ;;;;;;;;;;;;OAYG;IACO,KAAK,CAAC,SAAS;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YAC1C,OAAO;SACP;QAED,IAAI,CAAC,OAAO,CAAC,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"]}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { ISummaryConfiguration } from "../containerRuntime";
|
|
9
|
-
import { IEnqueueSummarizeOptions, ISummarizeHeuristicData, IOnDemandSummarizeOptions, EnqueueSummarizeResult, SummarizerStopReason, ISubmitSummaryOptions, SubmitSummaryResult, ISummaryCancellationToken, ISummarizeResults, ISummarizerRuntime, IRefreshSummaryAckOptions, ISummarizerEvents } from "./summarizerTypes";
|
|
10
|
-
import { IClientSummaryWatcher, SummaryCollection } from "./summaryCollection";
|
|
11
|
-
import { SummarizeResultBuilder } from "./summaryGenerator";
|
|
8
|
+
import { ISummaryConfiguration } from "../containerRuntime.mjs";
|
|
9
|
+
import { IEnqueueSummarizeOptions, ISummarizeHeuristicData, IOnDemandSummarizeOptions, EnqueueSummarizeResult, SummarizerStopReason, ISubmitSummaryOptions, SubmitSummaryResult, ISummaryCancellationToken, ISummarizeResults, ISummarizerRuntime, IRefreshSummaryAckOptions, ISummarizerEvents } from "./summarizerTypes.mjs";
|
|
10
|
+
import { IClientSummaryWatcher, SummaryCollection } from "./summaryCollection.mjs";
|
|
11
|
+
import { SummarizeResultBuilder } from "./summaryGenerator.mjs";
|
|
12
12
|
/**
|
|
13
13
|
* The maximum number of summarization attempts that will be done by default in case of failures
|
|
14
14
|
* that can be retried.
|
|
@@ -118,6 +118,11 @@ export declare class RunningSummarizer extends TypedEventEmitter<ISummarizerEven
|
|
|
118
118
|
* For example, summarization may be retried for failures with "retryAfterSeconds" param.
|
|
119
119
|
*/
|
|
120
120
|
private trySummarizeWithRetries;
|
|
121
|
+
/**
|
|
122
|
+
* Attempts to generate a summary on demand with retries in case of failures. The retry logic is the same
|
|
123
|
+
* as heuristics based summaries.
|
|
124
|
+
*/
|
|
125
|
+
private summarizeOnDemandWithRetries;
|
|
121
126
|
/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */
|
|
122
127
|
summarizeOnDemand(options: IOnDemandSummarizeOptions, resultsBuilder?: SummarizeResultBuilder): ISummarizeResults;
|
|
123
128
|
/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */
|
|
@@ -125,4 +130,4 @@ export declare class RunningSummarizer extends TypedEventEmitter<ISummarizerEven
|
|
|
125
130
|
private tryRunEnqueuedSummary;
|
|
126
131
|
private disposeEnqueuedSummary;
|
|
127
132
|
}
|
|
128
|
-
//# sourceMappingURL=runningSummarizer.d.
|
|
133
|
+
//# sourceMappingURL=runningSummarizer.d.mts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GAAG,OAAO,CAAC,IAAI,CAAC;YA6BjD,SAAS;IAuBvB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,kBAAkB;IAW1B;;;;;;;;OAQG;YACW,mBAAmB;IAsBjC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAoCxB,oCAAoC;IACpC,OAAO,CAAC,YAAY;IAyBpB;;;OAGG;YACW,8BAA8B;IAsE5C;;;OAGG;YACW,uBAAuB;IAuIrC;;;OAGG;YACW,4BAA4B;IAkB1C,8DAA8D;IACvD,iBAAiB,CACvB,OAAO,EAAE,yBAAyB,EAClC,cAAc,GAAE,sBAAqD,GACnE,iBAAiB;IA6BpB,6DAA6D;IACtD,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB;IAiClF,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,sBAAsB;CAS9B"}
|
|
@@ -7,9 +7,9 @@ import { assert, delay, Deferred, PromiseTimer } from "@fluidframework/core-util
|
|
|
7
7
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
8
|
import { DriverErrorTypes } from "@fluidframework/driver-definitions";
|
|
9
9
|
import { MessageType } from "@fluidframework/protocol-definitions";
|
|
10
|
-
import { opSize } from "../opProperties";
|
|
11
|
-
import { SummarizeHeuristicRunner } from "./summarizerHeuristics";
|
|
12
|
-
import { raceTimer, SummarizeResultBuilder, SummaryGenerator, } from "./summaryGenerator";
|
|
10
|
+
import { opSize } from "../opProperties.mjs";
|
|
11
|
+
import { SummarizeHeuristicRunner } from "./summarizerHeuristics.mjs";
|
|
12
|
+
import { raceTimer, SummarizeResultBuilder, SummaryGenerator, } from "./summaryGenerator.mjs";
|
|
13
13
|
const maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes
|
|
14
14
|
/**
|
|
15
15
|
* The maximum number of summarization attempts that will be done by default in case of failures
|
|
@@ -522,19 +522,21 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
522
522
|
let currentAttempt = 0;
|
|
523
523
|
let retryAfterSeconds;
|
|
524
524
|
let done = false;
|
|
525
|
-
let
|
|
525
|
+
let status = "success";
|
|
526
|
+
let results;
|
|
526
527
|
do {
|
|
527
528
|
currentAttempt++;
|
|
528
529
|
if (this.cancellationToken.cancelled) {
|
|
529
|
-
|
|
530
|
+
status = "canceled";
|
|
530
531
|
done = true;
|
|
531
532
|
break;
|
|
532
533
|
}
|
|
533
|
-
const
|
|
534
|
+
const attemptResult = attemptSummarize(currentAttempt, false /* finalAttempt */);
|
|
535
|
+
results = attemptResult.summarizeResult;
|
|
534
536
|
// Ack / nack is the final step, so if it succeeds we're done.
|
|
535
|
-
const ackNackResult = await
|
|
537
|
+
const ackNackResult = await results.receivedSummaryAckOrNack;
|
|
536
538
|
if (ackNackResult.success) {
|
|
537
|
-
|
|
539
|
+
status = "success";
|
|
538
540
|
done = true;
|
|
539
541
|
break;
|
|
540
542
|
}
|
|
@@ -542,7 +544,7 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
542
544
|
// If submit summary failed, use the params from "summarySubmitted" result. Else, use the params
|
|
543
545
|
// from "receivedSummaryAckOrNack" result.
|
|
544
546
|
// Note: Check "summarySubmitted" result first because if it fails, ack nack would fail as well.
|
|
545
|
-
const submitSummaryResult = await
|
|
547
|
+
const submitSummaryResult = await results.summarySubmitted;
|
|
546
548
|
if (!submitSummaryResult.success) {
|
|
547
549
|
maxAttempts = this.maxAttemptsForSubmitFailures;
|
|
548
550
|
retryAfterSeconds = submitSummaryResult.data?.retryAfterSeconds;
|
|
@@ -552,9 +554,9 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
552
554
|
retryAfterSeconds = ackNackResult.data?.retryAfterSeconds;
|
|
553
555
|
}
|
|
554
556
|
// Emit "summarize" event for this failed attempt.
|
|
555
|
-
|
|
557
|
+
status = "failure";
|
|
556
558
|
const eventProps = {
|
|
557
|
-
result,
|
|
559
|
+
result: status,
|
|
558
560
|
currentAttempt,
|
|
559
561
|
maxAttempts,
|
|
560
562
|
error: ackNackResult.error,
|
|
@@ -573,15 +575,15 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
573
575
|
summaryNackDelay: ackNackResult.data?.retryAfterSeconds !== undefined,
|
|
574
576
|
stage: submitSummaryResult.data?.stage,
|
|
575
577
|
dynamicRetries: true,
|
|
576
|
-
...summarizeProps,
|
|
578
|
+
...attemptResult.summarizeProps,
|
|
577
579
|
});
|
|
578
580
|
await delay(retryAfterSeconds * 1000);
|
|
579
581
|
}
|
|
580
582
|
} while (!done);
|
|
581
583
|
// If summarize attempt did not fail, emit "summarize" event and return. A failed attempt may be retried below.
|
|
582
|
-
if (
|
|
583
|
-
this.emit("summarize", { result, currentAttempt, maxAttempts });
|
|
584
|
-
return;
|
|
584
|
+
if (status !== "failure") {
|
|
585
|
+
this.emit("summarize", { result: status, currentAttempt, maxAttempts });
|
|
586
|
+
return results;
|
|
585
587
|
}
|
|
586
588
|
// If summarization wasn't successful above and the failure contains "retryAfterSeconds", perform one last
|
|
587
589
|
// attempt. This gives a chance to the runtime to perform additional steps in the last attempt.
|
|
@@ -589,19 +591,39 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
589
591
|
const { summarizeResult } = attemptSummarize(++currentAttempt, true /* finalAttempt */);
|
|
590
592
|
// Ack / nack is the final step, so if it succeeds we're done.
|
|
591
593
|
const ackNackResult = await summarizeResult.receivedSummaryAckOrNack;
|
|
592
|
-
|
|
594
|
+
status = ackNackResult.success ? "success" : "failure";
|
|
593
595
|
const eventProps = {
|
|
594
|
-
result,
|
|
596
|
+
result: status,
|
|
595
597
|
currentAttempt,
|
|
596
598
|
maxAttempts,
|
|
597
599
|
error: ackNackResult.success ? undefined : ackNackResult.error,
|
|
598
600
|
};
|
|
599
601
|
this.emit("summarize", eventProps);
|
|
602
|
+
results = summarizeResult;
|
|
600
603
|
}
|
|
601
604
|
// If summarization is still unsuccessful, stop the summarizer.
|
|
602
|
-
if (
|
|
605
|
+
if (status === "failure") {
|
|
603
606
|
this.stopSummarizerCallback("failToSummarize");
|
|
604
607
|
}
|
|
608
|
+
return results;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Attempts to generate a summary on demand with retries in case of failures. The retry logic is the same
|
|
612
|
+
* as heuristics based summaries.
|
|
613
|
+
*/
|
|
614
|
+
async summarizeOnDemandWithRetries(reason, resultsBuilder) {
|
|
615
|
+
const results = await this.trySummarizeWithRetries(reason);
|
|
616
|
+
if (results === undefined) {
|
|
617
|
+
resultsBuilder.fail("Summarization was canceled", undefined);
|
|
618
|
+
return resultsBuilder.build();
|
|
619
|
+
}
|
|
620
|
+
const submitResult = await results.summarySubmitted;
|
|
621
|
+
const summaryOpBroadcastedResult = await results.summaryOpBroadcasted;
|
|
622
|
+
const ackNackResult = await results.receivedSummaryAckOrNack;
|
|
623
|
+
resultsBuilder.summarySubmitted.resolve(submitResult);
|
|
624
|
+
resultsBuilder.summaryOpBroadcasted.resolve(summaryOpBroadcastedResult);
|
|
625
|
+
resultsBuilder.receivedSummaryAckOrNack.resolve(ackNackResult);
|
|
626
|
+
return resultsBuilder.build();
|
|
605
627
|
}
|
|
606
628
|
/** {@inheritdoc (ISummarizer:interface).summarizeOnDemand} */
|
|
607
629
|
summarizeOnDemand(options, resultsBuilder = new SummarizeResultBuilder()) {
|
|
@@ -616,8 +638,15 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
616
638
|
throw new UsageError("Attempted to run an already-running summarizer on demand");
|
|
617
639
|
}
|
|
618
640
|
const { reason, ...summarizeOptions } = options;
|
|
619
|
-
|
|
620
|
-
|
|
641
|
+
if (options.retryOnFailure === true) {
|
|
642
|
+
this.summarizeOnDemandWithRetries(`onDemand;${reason}`, resultsBuilder).catch((error) => {
|
|
643
|
+
resultsBuilder.fail("summarize failed", error);
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
this.trySummarizeOnce({ summarizeReason: `onDemand/${reason}` }, summarizeOptions, resultsBuilder);
|
|
648
|
+
}
|
|
649
|
+
return resultsBuilder.build();
|
|
621
650
|
}
|
|
622
651
|
/** {@inheritdoc (ISummarizer:interface).enqueueSummarize} */
|
|
623
652
|
enqueueSummarize(options) {
|
|
@@ -672,4 +701,4 @@ export class RunningSummarizer extends TypedEventEmitter {
|
|
|
672
701
|
}
|
|
673
702
|
}
|
|
674
703
|
}
|
|
675
|
-
//# sourceMappingURL=runningSummarizer.
|
|
704
|
+
//# sourceMappingURL=runningSummarizer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runningSummarizer.mjs","sourceRoot":"","sources":["../../src/summary/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,YAAY,EAEZ,4BAA4B,EAC5B,iBAAiB,EACjB,UAAU,GACV,MAAM,iCAAiC;OACjC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B;OAC3E,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,gBAAgB,EAAE,MAAM,oCAAoC;OAC9D,EAA6B,WAAW,EAAE,MAAM,sCAAsC;OAEtF,EAAE,MAAM,EAAE;OACV,EAAE,wBAAwB,EAAE;OAqB5B,EACN,SAAS,EAET,sBAAsB,EACtB,gBAAgB,GAChB;AAED,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,OAAO,iBAAkB,SAAQ,iBAAoC;IACnE,MAAM,CAAC,KAAK,CAAC,KAAK,CACxB,MAA4B,EAC5B,cAAqC,EACrC,aAAoC,EACpC,qBAAuF,EACvF,+BAAsF,EACtF,aAAsC,EACtC,iBAAoC,EACpC,i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Ae,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"]}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
6
|
import { ITelemetryLoggerExt, IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { IFluidHandleContext } from "@fluidframework/core-interfaces";
|
|
8
|
-
import { ISummaryConfiguration } from "../containerRuntime";
|
|
9
|
-
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator";
|
|
10
|
-
import { SummaryCollection } from "./summaryCollection";
|
|
11
|
-
import { IConnectableRuntime, ISummarizer, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, SummarizerStopReason, IOnDemandSummarizeOptions, ISummarizeResults, IEnqueueSummarizeOptions, EnqueueSummarizeResult, ISummarizerEvents } from "./summarizerTypes";
|
|
8
|
+
import { ISummaryConfiguration } from "../containerRuntime.mjs";
|
|
9
|
+
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator.mjs";
|
|
10
|
+
import { SummaryCollection } from "./summaryCollection.mjs";
|
|
11
|
+
import { IConnectableRuntime, ISummarizer, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, SummarizerStopReason, IOnDemandSummarizeOptions, ISummarizeResults, IEnqueueSummarizeOptions, EnqueueSummarizeResult, ISummarizerEvents } from "./summarizerTypes.mjs";
|
|
12
12
|
export declare class SummarizingWarning extends LoggingError implements ISummarizingWarning, IFluidErrorBase {
|
|
13
13
|
readonly logged: boolean;
|
|
14
14
|
readonly errorType = "summarizingError";
|
|
@@ -21,7 +21,7 @@ export declare const createSummarizingWarning: (errorMessage: string, logged: bo
|
|
|
21
21
|
* Summarizer is responsible for coordinating when to generate and send summaries.
|
|
22
22
|
* It is the main entry point for summary work.
|
|
23
23
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
24
|
-
* @
|
|
24
|
+
* @alpha
|
|
25
25
|
*/
|
|
26
26
|
export declare class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
|
|
27
27
|
/** Reference to runtime that created this object.
|
|
@@ -89,4 +89,4 @@ export declare class Summarizer extends TypedEventEmitter<ISummarizerEvents> imp
|
|
|
89
89
|
enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
|
|
90
90
|
recordSummaryAttempt?(summaryRefSeqNum?: number): void;
|
|
91
91
|
}
|
|
92
|
-
//# sourceMappingURL=summarizer.d.
|
|
92
|
+
//# sourceMappingURL=summarizer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarizer.d.mts","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EACN,mBAAmB,EAEnB,eAAe,EACf,YAAY,EAGZ,MAAM,iCAAiC;OACjC,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EAAE,qBAAqB,EAAE;OACzB,EAAE,gCAAgC,EAAE;OACpC,EAAE,iBAAiB,EAAE;OAErB,EACN,mBAAmB,EACnB,WAAW,EAEX,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EAEjB;AAMD,qBAAa,kBACZ,SAAQ,YACR,YAAW,mBAAmB,EAAE,eAAe;IAO9C,QAAQ,CAAC,MAAM,EAAE,OAAO;IALzB,QAAQ,CAAC,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oBAAoB,GAAG,OAAO;IAIpF,OAAO,CAAC,cAAc,CAAsC;IAE5D;;;;;;;;OAQG;YACW,KAAK;IAuDnB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAEnC;IAEF;;;;;OAKG;IACI,OAAO;IAYP,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,iBAAiB;IA4DxE,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB;IAW3E,oBAAoB,CAAC,CAAC,gBAAgB,CAAC,EAAE,MAAM;CAGtD"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { Deferred } from "@fluidframework/core-utils";
|
|
6
6
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import { createChildLogger, LoggingError, UsageError, wrapErrorAndLog, } from "@fluidframework/telemetry-utils";
|
|
8
|
-
import { RunningSummarizer } from "./runningSummarizer";
|
|
9
|
-
import { SummarizeHeuristicData } from "./summarizerHeuristics";
|
|
10
|
-
import { SummarizeResultBuilder } from "./summaryGenerator";
|
|
8
|
+
import { RunningSummarizer } from "./runningSummarizer.mjs";
|
|
9
|
+
import { SummarizeHeuristicData } from "./summarizerHeuristics.mjs";
|
|
10
|
+
import { SummarizeResultBuilder } from "./summaryGenerator.mjs";
|
|
11
11
|
const summarizingError = "summarizingError";
|
|
12
12
|
export class SummarizingWarning extends LoggingError {
|
|
13
13
|
constructor(errorMessage, logged = false) {
|
|
@@ -26,7 +26,7 @@ export const createSummarizingWarning = (errorMessage, logged) => new Summarizin
|
|
|
26
26
|
* Summarizer is responsible for coordinating when to generate and send summaries.
|
|
27
27
|
* It is the main entry point for summary work.
|
|
28
28
|
* It is created only by summarizing container (i.e. one with clientType === "summarizer")
|
|
29
|
-
* @
|
|
29
|
+
* @alpha
|
|
30
30
|
*/
|
|
31
31
|
export class Summarizer extends TypedEventEmitter {
|
|
32
32
|
get ISummarizer() {
|
|
@@ -254,4 +254,4 @@ export class Summarizer extends TypedEventEmitter {
|
|
|
254
254
|
this._heuristicData?.recordAttempt(summaryRefSeqNum);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
//# sourceMappingURL=summarizer.
|
|
257
|
+
//# sourceMappingURL=summarizer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarizer.mjs","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,MAAM,4BAA4B;OAC9C,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAEN,iBAAiB,EAEjB,YAAY,EACZ,UAAU,EACV,eAAe,GACf,MAAM,iCAAiC;OAKjC,EAAE,iBAAiB,EAAE;OAgBrB,EAAE,sBAAsB,EAAE;OAC1B,EAAE,sBAAsB,EAAE;AAEjC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAM,OAAO,kBACZ,SAAQ,YAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,cAAS,GAAG,gBAAgB,CAAC;QAC7B,aAAQ,GAAG,IAAI,CAAC;IAOzB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAU,EAAE,SAAkB,KAAK,EAAE,MAA2B;QAC3E,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9E,OAAO,eAAe,CAAqB,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;CACD;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,YAAoB,EAAE,MAAe,EAAE,EAAE,CACjF,IAAI,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAoC;IACnE,IA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,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACxC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAChC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACd,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;oBACjB,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,MAAM,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAEJ,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;SACvB;QAAC,OAAO,KAAK,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"]}
|
|
@@ -6,8 +6,8 @@ import { IEvent, IEventProvider } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
8
8
|
import { IClientDetails } from "@fluidframework/protocol-definitions";
|
|
9
|
-
import { IOrderedClientElection, ISerializedElection, ITrackedClient } from "./orderedClientElection";
|
|
10
|
-
import { ISummaryCollectionOpEvents } from "./summaryCollection";
|
|
9
|
+
import { IOrderedClientElection, ISerializedElection, ITrackedClient } from "./orderedClientElection.mjs";
|
|
10
|
+
import { ISummaryCollectionOpEvents } from "./summaryCollection.mjs";
|
|
11
11
|
export declare const summarizerClientType = "summarizer";
|
|
12
12
|
export interface ISummarizerClientElectionEvents extends IEvent {
|
|
13
13
|
(event: "electedSummarizerChanged", handler: () => void): void;
|
|
@@ -46,4 +46,4 @@ export declare class SummarizerClientElection extends TypedEventEmitter<ISummari
|
|
|
46
46
|
static isClientEligible(client: ITrackedClient): boolean;
|
|
47
47
|
static readonly clientDetailsPermitElection: (details: IClientDetails) => boolean;
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=summarizerClientElection.d.
|
|
49
|
+
//# sourceMappingURL=summarizerClientElection.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,C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