@fluidframework/container-runtime 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +19 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +15 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +109 -37
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +11 -9
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +3 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +23 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +225 -132
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +11 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +27 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +95 -56
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -3
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +28 -4
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +122 -44
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +27 -203
- package/dist/gc/garbageCollection.d.ts.map +1 -0
- package/dist/{garbageCollection.js → gc/garbageCollection.js} +210 -400
- package/dist/gc/garbageCollection.js.map +1 -0
- package/dist/gc/gcDefinitions.d.ts +189 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -0
- package/dist/{garbageCollectionConstants.js → gc/gcDefinitions.js} +27 -2
- package/dist/gc/gcDefinitions.js.map +1 -0
- package/dist/gc/gcHelpers.d.ts +30 -0
- package/dist/gc/gcHelpers.d.ts.map +1 -0
- package/dist/gc/gcHelpers.js +65 -0
- package/dist/gc/gcHelpers.js.map +1 -0
- package/dist/gc/gcSummaryStateTracker.d.ts +86 -0
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/dist/gc/gcSummaryStateTracker.js +246 -0
- package/dist/gc/gcSummaryStateTracker.js.map +1 -0
- package/{lib → dist/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
- package/dist/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
- package/dist/gc/gcSweepReadyUsageDetection.js.map +1 -0
- package/dist/gc/gcUnreferencedStateTracker.d.ts +34 -0
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/dist/gc/gcUnreferencedStateTracker.js +94 -0
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/dist/gc/index.d.ts +11 -0
- package/dist/gc/index.d.ts.map +1 -0
- package/dist/gc/index.js +40 -0
- package/dist/gc/index.js.map +1 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +2 -13
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +19 -41
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +4 -0
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -0
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +5 -2
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +24 -13
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +19 -3
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +78 -45
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.js +1 -3
- package/dist/opProperties.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +8 -2
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +21 -13
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +3 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +2 -2
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +5 -3
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summary/index.d.ts +17 -0
- package/dist/summary/index.d.ts.map +1 -0
- package/dist/summary/index.js +47 -0
- package/dist/summary/index.js.map +1 -0
- package/dist/summary/orderedClientElection.d.ts.map +1 -0
- package/dist/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
- package/dist/summary/orderedClientElection.js.map +1 -0
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/{lib → dist/summary}/runningSummarizer.d.ts +19 -18
- package/dist/summary/runningSummarizer.d.ts.map +1 -0
- package/dist/{runningSummarizer.js → summary/runningSummarizer.js} +191 -76
- package/dist/summary/runningSummarizer.js.map +1 -0
- package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +4 -6
- package/dist/summary/summarizer.d.ts.map +1 -0
- package/dist/{summarizer.js → summary/summarizer.js} +31 -71
- package/dist/summary/summarizer.js.map +1 -0
- package/dist/summary/summarizerClientElection.d.ts.map +1 -0
- package/dist/summary/summarizerClientElection.js.map +1 -0
- package/dist/summary/summarizerHandle.d.ts.map +1 -0
- package/dist/summary/summarizerHandle.js.map +1 -0
- package/{lib → dist/summary}/summarizerHeuristics.d.ts +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
- package/dist/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +6 -9
- package/dist/summary/summarizerHeuristics.js.map +1 -0
- package/{lib → dist/summary}/summarizerTypes.d.ts +22 -22
- package/dist/summary/summarizerTypes.d.ts.map +1 -0
- package/dist/summary/summarizerTypes.js.map +1 -0
- package/dist/summary/summaryCollection.d.ts.map +1 -0
- package/dist/{summaryCollection.js → summary/summaryCollection.js} +18 -8
- package/dist/summary/summaryCollection.js.map +1 -0
- package/{lib → dist/summary}/summaryFormat.d.ts +1 -40
- package/dist/summary/summaryFormat.d.ts.map +1 -0
- package/dist/{summaryFormat.js → summary/summaryFormat.js} +19 -20
- package/dist/summary/summaryFormat.js.map +1 -0
- package/dist/summary/summaryGenerator.d.ts.map +1 -0
- package/dist/{summaryGenerator.js → summary/summaryGenerator.js} +33 -15
- package/dist/summary/summaryGenerator.js.map +1 -0
- package/dist/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -0
- package/dist/{summaryManager.js → summary/summaryManager.js} +21 -9
- package/dist/summary/summaryManager.js.map +1 -0
- package/dist/throttler.d.ts +2 -2
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +4 -4
- package/dist/throttler.js.map +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +15 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +109 -37
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +11 -9
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +3 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +23 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +201 -108
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +11 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +27 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +84 -45
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -3
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +28 -4
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +120 -42
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/{garbageCollection.d.ts → gc/garbageCollection.d.ts} +27 -203
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/{garbageCollection.js → gc/garbageCollection.js} +190 -379
- package/lib/gc/garbageCollection.js.map +1 -0
- package/lib/gc/gcDefinitions.d.ts +189 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -0
- package/lib/{garbageCollectionConstants.js → gc/gcDefinitions.js} +26 -1
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/lib/gc/gcHelpers.d.ts +30 -0
- package/lib/gc/gcHelpers.d.ts.map +1 -0
- package/lib/gc/gcHelpers.js +58 -0
- package/lib/gc/gcHelpers.js.map +1 -0
- package/lib/gc/gcSummaryStateTracker.d.ts +86 -0
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/lib/gc/gcSummaryStateTracker.js +242 -0
- package/lib/gc/gcSummaryStateTracker.js.map +1 -0
- package/{dist → lib/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
- package/lib/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
- package/lib/gc/gcSweepReadyUsageDetection.js.map +1 -0
- package/lib/gc/gcUnreferencedStateTracker.d.ts +34 -0
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/lib/gc/gcUnreferencedStateTracker.js +90 -0
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/lib/gc/index.d.ts +11 -0
- package/lib/gc/index.d.ts.map +1 -0
- package/lib/gc/index.js +11 -0
- package/lib/gc/index.js.map +1 -0
- package/lib/index.d.ts +2 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +2 -13
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +19 -41
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +4 -0
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -0
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +5 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +25 -14
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +19 -3
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +79 -46
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.js +1 -3
- package/lib/opProperties.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +8 -2
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -13
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +2 -2
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +5 -3
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summary/index.d.ts +17 -0
- package/lib/summary/index.d.ts.map +1 -0
- package/lib/summary/index.js +16 -0
- package/lib/summary/index.js.map +1 -0
- package/lib/summary/orderedClientElection.d.ts.map +1 -0
- package/lib/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
- package/lib/summary/orderedClientElection.js.map +1 -0
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/{dist → lib/summary}/runningSummarizer.d.ts +19 -18
- package/lib/summary/runningSummarizer.d.ts.map +1 -0
- package/lib/{runningSummarizer.js → summary/runningSummarizer.js} +193 -78
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/{summarizer.d.ts → summary/summarizer.d.ts} +4 -6
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/{summarizer.js → summary/summarizer.js} +33 -73
- package/lib/summary/summarizer.js.map +1 -0
- package/lib/summary/summarizerClientElection.d.ts.map +1 -0
- package/lib/summary/summarizerClientElection.js.map +1 -0
- package/lib/summary/summarizerHandle.d.ts.map +1 -0
- package/lib/summary/summarizerHandle.js.map +1 -0
- package/{dist → lib/summary}/summarizerHeuristics.d.ts +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +6 -9
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/{dist → lib/summary}/summarizerTypes.d.ts +22 -22
- package/lib/summary/summarizerTypes.d.ts.map +1 -0
- package/lib/summary/summarizerTypes.js.map +1 -0
- package/lib/summary/summaryCollection.d.ts.map +1 -0
- package/lib/{summaryCollection.js → summary/summaryCollection.js} +18 -8
- package/lib/summary/summaryCollection.js.map +1 -0
- package/{dist → lib/summary}/summaryFormat.d.ts +1 -40
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/{summaryFormat.js → summary/summaryFormat.js} +20 -20
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/{summaryGenerator.js → summary/summaryGenerator.js} +33 -15
- package/lib/summary/summaryGenerator.js.map +1 -0
- package/lib/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -0
- package/lib/{summaryManager.js → summary/summaryManager.js} +21 -9
- package/lib/summary/summaryManager.js.map +1 -0
- package/lib/throttler.d.ts +2 -2
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +4 -4
- package/lib/throttler.js.map +1 -1
- package/package.json +60 -51
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +54 -49
- package/src/blobManager.ts +825 -674
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3249 -2978
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1141 -1057
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +880 -731
- package/src/deltaScheduler.ts +158 -150
- package/{garbageCollection.md → src/gc/garbageCollection.md} +16 -3
- package/src/gc/garbageCollection.ts +1506 -0
- package/src/gc/gcDefinitions.ts +244 -0
- package/src/gc/gcHelpers.ts +86 -0
- package/src/gc/gcSummaryStateTracker.ts +339 -0
- package/src/gc/gcSweepReadyUsageDetection.ts +145 -0
- package/src/gc/gcUnreferencedStateTracker.ts +114 -0
- package/src/gc/index.ts +40 -0
- package/src/index.ts +67 -70
- package/src/opLifecycle/README.md +152 -0
- package/src/opLifecycle/batchManager.ts +101 -144
- package/src/opLifecycle/definitions.ts +33 -29
- package/src/opLifecycle/index.ts +5 -5
- package/src/opLifecycle/opCompressor.ts +55 -53
- package/src/opLifecycle/opDecompressor.ts +100 -81
- package/src/opLifecycle/opSplitter.ts +233 -188
- package/src/opLifecycle/outbox.ts +251 -195
- package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
- package/src/opProperties.ts +11 -9
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +396 -338
- package/src/scheduleManager.ts +299 -269
- package/src/serializedSnapshotStorage.ts +126 -112
- package/src/summary/index.ts +99 -0
- package/src/summary/orderedClientElection.ts +564 -0
- package/src/summary/runWhileConnectedCoordinator.ts +113 -0
- package/src/summary/runningSummarizer.ts +788 -0
- package/src/summary/summarizer.ts +386 -0
- package/src/summary/summarizerClientElection.ts +139 -0
- package/src/{summarizerHandle.ts → summary/summarizerHandle.ts} +11 -9
- package/src/summary/summarizerHeuristics.ts +219 -0
- package/src/summary/summarizerTypes.ts +521 -0
- package/src/summary/summaryCollection.ts +450 -0
- package/src/summary/summaryFormat.ts +226 -0
- package/src/summary/summaryGenerator.ts +505 -0
- package/src/summary/summaryManager.ts +423 -0
- package/src/throttler.ts +131 -122
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/garbageCollection.d.ts.map +0 -1
- package/dist/garbageCollection.js.map +0 -1
- package/dist/garbageCollectionConstants.d.ts +0 -25
- package/dist/garbageCollectionConstants.d.ts.map +0 -1
- package/dist/garbageCollectionConstants.js.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.js +0 -23
- package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
- package/dist/gcSweepReadyUsageDetection.d.ts.map +0 -1
- package/dist/gcSweepReadyUsageDetection.js.map +0 -1
- package/dist/orderedClientElection.d.ts.map +0 -1
- package/dist/orderedClientElection.js.map +0 -1
- package/dist/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/dist/runWhileConnectedCoordinator.js.map +0 -1
- package/dist/runningSummarizer.d.ts.map +0 -1
- package/dist/runningSummarizer.js.map +0 -1
- package/dist/summarizer.d.ts.map +0 -1
- package/dist/summarizer.js.map +0 -1
- package/dist/summarizerClientElection.d.ts.map +0 -1
- package/dist/summarizerClientElection.js.map +0 -1
- package/dist/summarizerHandle.d.ts.map +0 -1
- package/dist/summarizerHandle.js.map +0 -1
- package/dist/summarizerHeuristics.d.ts.map +0 -1
- package/dist/summarizerHeuristics.js.map +0 -1
- package/dist/summarizerTypes.d.ts.map +0 -1
- package/dist/summarizerTypes.js.map +0 -1
- package/dist/summaryCollection.d.ts.map +0 -1
- package/dist/summaryCollection.js.map +0 -1
- package/dist/summaryFormat.d.ts.map +0 -1
- package/dist/summaryFormat.js.map +0 -1
- package/dist/summaryGenerator.d.ts.map +0 -1
- package/dist/summaryGenerator.js.map +0 -1
- package/dist/summaryManager.d.ts.map +0 -1
- package/dist/summaryManager.js.map +0 -1
- package/lib/garbageCollection.d.ts.map +0 -1
- package/lib/garbageCollection.js.map +0 -1
- package/lib/garbageCollectionConstants.d.ts +0 -25
- package/lib/garbageCollectionConstants.d.ts.map +0 -1
- package/lib/garbageCollectionConstants.js.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.js +0 -19
- package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
- package/lib/gcSweepReadyUsageDetection.d.ts.map +0 -1
- package/lib/gcSweepReadyUsageDetection.js.map +0 -1
- package/lib/orderedClientElection.d.ts.map +0 -1
- package/lib/orderedClientElection.js.map +0 -1
- package/lib/runWhileConnectedCoordinator.d.ts.map +0 -1
- package/lib/runWhileConnectedCoordinator.js.map +0 -1
- package/lib/runningSummarizer.d.ts.map +0 -1
- package/lib/runningSummarizer.js.map +0 -1
- package/lib/summarizer.d.ts.map +0 -1
- package/lib/summarizer.js.map +0 -1
- package/lib/summarizerClientElection.d.ts.map +0 -1
- package/lib/summarizerClientElection.js.map +0 -1
- package/lib/summarizerHandle.d.ts.map +0 -1
- package/lib/summarizerHandle.js.map +0 -1
- package/lib/summarizerHeuristics.d.ts.map +0 -1
- package/lib/summarizerHeuristics.js.map +0 -1
- package/lib/summarizerTypes.d.ts.map +0 -1
- package/lib/summarizerTypes.js.map +0 -1
- package/lib/summaryCollection.d.ts.map +0 -1
- package/lib/summaryCollection.js.map +0 -1
- package/lib/summaryFormat.d.ts.map +0 -1
- package/lib/summaryFormat.js.map +0 -1
- package/lib/summaryGenerator.d.ts.map +0 -1
- package/lib/summaryGenerator.js.map +0 -1
- package/lib/summaryManager.d.ts.map +0 -1
- package/lib/summaryManager.js.map +0 -1
- package/src/garbageCollection.ts +0 -1800
- package/src/garbageCollectionConstants.ts +0 -41
- package/src/garbageCollectionTombstoneUtils.ts +0 -28
- package/src/gcSweepReadyUsageDetection.ts +0 -139
- package/src/orderedClientElection.ts +0 -532
- package/src/runWhileConnectedCoordinator.ts +0 -106
- package/src/runningSummarizer.ts +0 -610
- package/src/summarizer.ts +0 -421
- package/src/summarizerClientElection.ts +0 -132
- package/src/summarizerHeuristics.ts +0 -222
- package/src/summarizerTypes.ts +0 -507
- package/src/summaryCollection.ts +0 -421
- package/src/summaryFormat.ts +0 -256
- package/src/summaryGenerator.ts +0 -450
- package/src/summaryManager.ts +0 -394
- /package/dist/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/dist/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts} +0 -0
- /package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +0 -0
- /package/dist/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +0 -0
- /package/dist/{summarizerClientElection.js → summary/summarizerClientElection.js} +0 -0
- /package/dist/{summarizerHandle.d.ts → summary/summarizerHandle.d.ts} +0 -0
- /package/dist/{summarizerHandle.js → summary/summarizerHandle.js} +0 -0
- /package/dist/{summarizerTypes.js → summary/summarizerTypes.js} +0 -0
- /package/dist/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
- /package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
- /package/lib/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
- /package/lib/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts} +0 -0
- /package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +0 -0
- /package/lib/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +0 -0
- /package/lib/{summarizerClientElection.js → summary/summarizerClientElection.js} +0 -0
- /package/lib/{summarizerHandle.d.ts → summary/summarizerHandle.d.ts} +0 -0
- /package/lib/{summarizerHandle.js → summary/summarizerHandle.js} +0 -0
- /package/lib/{summarizerTypes.js → summary/summarizerTypes.js} +0 -0
- /package/lib/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
- /package/lib/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
package/src/summaryManager.ts
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IDisposable, IEvent, IEventProvider, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import { assert } from "@fluidframework/common-utils";
|
|
8
|
-
import { ChildLogger, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
10
|
-
import { ISummarizerClientElection } from "./summarizerClientElection";
|
|
11
|
-
import { IThrottler } from "./throttler";
|
|
12
|
-
import {
|
|
13
|
-
ISummarizer,
|
|
14
|
-
SummarizerStopReason,
|
|
15
|
-
} from "./summarizerTypes";
|
|
16
|
-
import { SummaryCollection } from "./summaryCollection";
|
|
17
|
-
import { Summarizer } from "./summarizer";
|
|
18
|
-
|
|
19
|
-
const defaultInitialDelayMs = 5000;
|
|
20
|
-
const defaultOpsToBypassInitialDelay = 4000;
|
|
21
|
-
|
|
22
|
-
export enum SummaryManagerState {
|
|
23
|
-
Off = 0,
|
|
24
|
-
Starting = 1,
|
|
25
|
-
Running = 2,
|
|
26
|
-
Stopping = 3,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Please note that all reasons in this list are not errors,
|
|
30
|
-
// and thus they are not raised today to parent container as error.
|
|
31
|
-
// If this needs to be changed in future, we should re-evaluate what and how we raise to summarizer
|
|
32
|
-
type StopReason = Extract<SummarizerStopReason,
|
|
33
|
-
"parentNotConnected" | "notElectedParent" | "notElectedClient">;
|
|
34
|
-
type ShouldSummarizeState =
|
|
35
|
-
| { shouldSummarize: true; }
|
|
36
|
-
| { shouldSummarize: false; stopReason: StopReason; };
|
|
37
|
-
|
|
38
|
-
export interface IConnectedEvents extends IEvent {
|
|
39
|
-
(event: "connected", listener: (clientId: string) => void);
|
|
40
|
-
(event: "disconnected", listener: () => void);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* IConnectedState describes an object that SummaryManager can watch to observe connection/disconnection.
|
|
45
|
-
*
|
|
46
|
-
* Under current implementation, its role will be fulfilled by the ContainerRuntime, but this could be replaced
|
|
47
|
-
* with anything else that fulfills the contract if we want to shift the layer that the SummaryManager lives at.
|
|
48
|
-
*/
|
|
49
|
-
export interface IConnectedState extends IEventProvider<IConnectedEvents> {
|
|
50
|
-
readonly connected: boolean;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Under current implementation this is undefined if we've never connected, otherwise it's the clientId from our
|
|
54
|
-
* latest connection (even if we've since disconnected!). Although this happens to be the behavior we want in
|
|
55
|
-
* SummaryManager, I suspect that globally we may eventually want to modify this behavior (e.g. make clientId
|
|
56
|
-
* undefined while disconnected). To protect against this, let's assume this field can't be trusted while
|
|
57
|
-
* disconnected and instead separately track "latest clientId" in SummaryManager.
|
|
58
|
-
*/
|
|
59
|
-
readonly clientId: string | undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface ISummaryManagerConfig {
|
|
63
|
-
initialDelayMs: number;
|
|
64
|
-
opsToBypassInitialDelay: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* SummaryManager is created by parent container (i.e. interactive container with clientType !== "summarizer") only.
|
|
69
|
-
* It observes changes in calculated summarizer and reacts to changes by either creating summarizer client or
|
|
70
|
-
* stopping existing summarizer client.
|
|
71
|
-
*/
|
|
72
|
-
export class SummaryManager implements IDisposable {
|
|
73
|
-
private readonly logger: ITelemetryLogger;
|
|
74
|
-
private readonly opsToBypassInitialDelay: number;
|
|
75
|
-
private readonly initialDelayMs: number;
|
|
76
|
-
private latestClientId: string | undefined;
|
|
77
|
-
private state = SummaryManagerState.Off;
|
|
78
|
-
private summarizer?: ISummarizer;
|
|
79
|
-
private _disposed = false;
|
|
80
|
-
|
|
81
|
-
public get disposed() {
|
|
82
|
-
return this._disposed;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public get currentState() { return this.state; }
|
|
86
|
-
|
|
87
|
-
constructor(
|
|
88
|
-
private readonly clientElection: ISummarizerClientElection,
|
|
89
|
-
private readonly connectedState: IConnectedState,
|
|
90
|
-
private readonly summaryCollection:
|
|
91
|
-
Pick<SummaryCollection, "opsSinceLastAck" | "addOpListener" | "removeOpListener">,
|
|
92
|
-
parentLogger: ITelemetryLogger,
|
|
93
|
-
/** Creates summarizer by asking interactive container to spawn summarizing container and
|
|
94
|
-
* get back its Summarizer instance. */
|
|
95
|
-
private readonly requestSummarizerFn: () => Promise<ISummarizer>,
|
|
96
|
-
private readonly startThrottler: IThrottler,
|
|
97
|
-
{
|
|
98
|
-
initialDelayMs = defaultInitialDelayMs,
|
|
99
|
-
opsToBypassInitialDelay = defaultOpsToBypassInitialDelay,
|
|
100
|
-
}: Readonly<Partial<ISummaryManagerConfig>> = {},
|
|
101
|
-
private readonly disableHeuristics?: boolean,
|
|
102
|
-
) {
|
|
103
|
-
this.logger = ChildLogger.create(
|
|
104
|
-
parentLogger,
|
|
105
|
-
"SummaryManager",
|
|
106
|
-
{ all: { clientId: () => this.latestClientId } });
|
|
107
|
-
|
|
108
|
-
this.connectedState.on("connected", this.handleConnected);
|
|
109
|
-
this.connectedState.on("disconnected", this.handleDisconnected);
|
|
110
|
-
this.latestClientId = this.connectedState.clientId;
|
|
111
|
-
|
|
112
|
-
this.opsToBypassInitialDelay = opsToBypassInitialDelay;
|
|
113
|
-
this.initialDelayMs = initialDelayMs;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Until start is called, the SummaryManager won't begin attempting to start summarization. This ensures there's
|
|
118
|
-
* a window between construction and starting where the caller can attach listeners.
|
|
119
|
-
*/
|
|
120
|
-
public start(): void {
|
|
121
|
-
this.clientElection.on("electedSummarizerChanged", this.refreshSummarizer);
|
|
122
|
-
this.refreshSummarizer();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private readonly handleConnected = (clientId: string) => {
|
|
126
|
-
this.latestClientId = clientId;
|
|
127
|
-
// If we have a summarizer, it should have been either cancelled on disconnected by now.
|
|
128
|
-
// But because of lastSummary process, it can still hang around, so there is not much we can
|
|
129
|
-
// check or assert.
|
|
130
|
-
this.refreshSummarizer();
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
private readonly handleDisconnected = () => {
|
|
134
|
-
this.refreshSummarizer();
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
private static readonly isStartingOrRunning = (state: SummaryManagerState) =>
|
|
138
|
-
state === SummaryManagerState.Starting || state === SummaryManagerState.Running;
|
|
139
|
-
|
|
140
|
-
private getShouldSummarizeState(): ShouldSummarizeState {
|
|
141
|
-
// Note that if we're in the Running state, the electedClient may be a summarizer client, so we can't
|
|
142
|
-
// enforce connectedState.clientId === clientElection.electedClientId. But once we're Running, we should
|
|
143
|
-
// only transition to Stopping when the electedParentId changes. Stopping the summarizer without
|
|
144
|
-
// changing the electedParent will just cause us to transition to Starting again.
|
|
145
|
-
|
|
146
|
-
// New Parent has been elected and it is not the current client, or
|
|
147
|
-
if (this.connectedState.clientId !== this.clientElection.electedParentId) {
|
|
148
|
-
return { shouldSummarize: false, stopReason: "notElectedParent" };
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// We are not already running the summarizer and we are not the current elected client id.
|
|
152
|
-
if (this.state !== SummaryManagerState.Running &&
|
|
153
|
-
this.connectedState.clientId !== this.clientElection.electedClientId) {
|
|
154
|
-
return { shouldSummarize: false, stopReason: "notElectedClient" };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (!this.connectedState.connected) {
|
|
158
|
-
return { shouldSummarize: false, stopReason: "parentNotConnected" };
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (this.disposed) {
|
|
162
|
-
assert(false, 0x260 /* "Disposed should mean disconnected!" */);
|
|
163
|
-
} else {
|
|
164
|
-
return { shouldSummarize: true };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private readonly refreshSummarizer = () => {
|
|
169
|
-
// Transition states depending on shouldSummarize, which is a calculated property
|
|
170
|
-
// that is only true if this client is connected and is the elected summarizer.
|
|
171
|
-
const shouldSummarizeState = this.getShouldSummarizeState();
|
|
172
|
-
switch (this.state) {
|
|
173
|
-
case SummaryManagerState.Off: {
|
|
174
|
-
if (shouldSummarizeState.shouldSummarize) {
|
|
175
|
-
this.startSummarization();
|
|
176
|
-
}
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
case SummaryManagerState.Starting: {
|
|
180
|
-
// Cannot take any action until summarizer is created
|
|
181
|
-
// state transition will occur after creation
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
case SummaryManagerState.Running: {
|
|
185
|
-
if (shouldSummarizeState.shouldSummarize === false) {
|
|
186
|
-
this.stop(shouldSummarizeState.stopReason);
|
|
187
|
-
}
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
case SummaryManagerState.Stopping: {
|
|
191
|
-
// Cannot take any action until running summarizer finishes
|
|
192
|
-
// state transition will occur after it stops
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
default: {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
private startSummarization() {
|
|
202
|
-
assert(this.state === SummaryManagerState.Off, 0x261 /* "Expected: off" */);
|
|
203
|
-
this.state = SummaryManagerState.Starting;
|
|
204
|
-
|
|
205
|
-
assert(this.summarizer === undefined, 0x262 /* "Old summarizer is still working!" */);
|
|
206
|
-
|
|
207
|
-
this.delayBeforeCreatingSummarizer().then(async (startWithInitialDelay: boolean) => {
|
|
208
|
-
// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore
|
|
209
|
-
// but only if creation was delayed. If it was not, then we want to ensure we always create
|
|
210
|
-
// a summarizer to kick off lastSummary. Without that, we would not be able to summarize and get
|
|
211
|
-
// document out of broken state if it has too many ops and ordering service keeps nacking main
|
|
212
|
-
// container (and thus it goes into cycle of reconnects)
|
|
213
|
-
// If we can't run the LastSummary, simply return as to avoid paying the cost of launching
|
|
214
|
-
// the summarizer at all.
|
|
215
|
-
const shouldSummarizeStateEarlyStage = this.getShouldSummarizeState();
|
|
216
|
-
if (startWithInitialDelay &&
|
|
217
|
-
shouldSummarizeStateEarlyStage.shouldSummarize === false) {
|
|
218
|
-
return `early exit ${shouldSummarizeStateEarlyStage.stopReason}`;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// We transition to Running before requesting the summarizer, because after requesting we can't predict
|
|
222
|
-
// when the electedClient will be replaced with the new summarizer client.
|
|
223
|
-
// The alternative would be to let connectedState.clientId !== clientElection.electedClientId when
|
|
224
|
-
// state === Starting || state === Running.
|
|
225
|
-
assert(this.state === SummaryManagerState.Starting, 0x263 /* "Expected: starting" */);
|
|
226
|
-
this.state = SummaryManagerState.Running;
|
|
227
|
-
|
|
228
|
-
const summarizer = await this.requestSummarizerFn();
|
|
229
|
-
this.summarizer = summarizer;
|
|
230
|
-
|
|
231
|
-
// Re-validate that it need to be running. Due to asynchrony, it may be not the case anymore
|
|
232
|
-
// If we can't run the LastSummary, simply return as to avoid paying the cost of launching
|
|
233
|
-
// the summarizer at all.
|
|
234
|
-
const shouldSummarizeState = this.getShouldSummarizeState();
|
|
235
|
-
if (shouldSummarizeState.shouldSummarize === false) {
|
|
236
|
-
// In order to allow the last summary to run, we not only need a stop reason that would
|
|
237
|
-
// allow it but also, startWithInitialDelay to be false (start the summarization immediately),
|
|
238
|
-
// which would happen when we have a high enough number of unsummarized ops.
|
|
239
|
-
if (startWithInitialDelay || !Summarizer.stopReasonCanRunLastSummary(shouldSummarizeState.stopReason)) {
|
|
240
|
-
this.state = SummaryManagerState.Starting;
|
|
241
|
-
summarizer.stop(shouldSummarizeState.stopReason);
|
|
242
|
-
return `early exit after starting summarizer ${shouldSummarizeState.stopReason}`;
|
|
243
|
-
}
|
|
244
|
-
this.logger.sendTelemetryEvent({
|
|
245
|
-
eventName: "LastAttemptToSummarize",
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
250
|
-
const clientId = this.latestClientId!;
|
|
251
|
-
|
|
252
|
-
return PerformanceEvent.timedExecAsync(
|
|
253
|
-
this.logger,
|
|
254
|
-
{ eventName: "RunningSummarizer", attempt: this.startThrottler.numAttempts },
|
|
255
|
-
async () => summarizer.run(clientId, this.disableHeuristics),
|
|
256
|
-
);
|
|
257
|
-
}).then((reason: string) => {
|
|
258
|
-
this.logger.sendTelemetryEvent({
|
|
259
|
-
eventName: "EndingSummarizer",
|
|
260
|
-
reason,
|
|
261
|
-
});
|
|
262
|
-
}).catch((error) => {
|
|
263
|
-
this.logger.sendTelemetryEvent(
|
|
264
|
-
{
|
|
265
|
-
eventName: "EndingSummarizer",
|
|
266
|
-
reason: "exception",
|
|
267
|
-
},
|
|
268
|
-
error);
|
|
269
|
-
|
|
270
|
-
// Most of exceptions happen due to container being closed while loading it, due to
|
|
271
|
-
// summarizer container loosing connection while load.
|
|
272
|
-
// Not worth reporting such errors as errors. That said, we might miss some real errors if
|
|
273
|
-
// we ignore blindly, so try to narrow signature we are looking for - skip logging
|
|
274
|
-
// error only if this client should no longer be a summarizer (which in practice
|
|
275
|
-
// means it also lost connection), and error happened on load (we do not have summarizer).
|
|
276
|
-
// We could annotate the error raised in Container.load where the container closed during load with no error
|
|
277
|
-
// and check for that case here, but that does not seem to be necessary.
|
|
278
|
-
if (this.getShouldSummarizeState().shouldSummarize || this.summarizer !== undefined) {
|
|
279
|
-
// Report any failure as an error unless it was due to cancellation (like "disconnected" error)
|
|
280
|
-
// If failure happened on container load, we may not yet realized that socket disconnected, so check
|
|
281
|
-
// offlineError.
|
|
282
|
-
const category = error?.errorType === DriverErrorType.offlineError ? "generic" : "error";
|
|
283
|
-
this.logger.sendTelemetryEvent(
|
|
284
|
-
{
|
|
285
|
-
eventName: "SummarizerException",
|
|
286
|
-
category,
|
|
287
|
-
},
|
|
288
|
-
error);
|
|
289
|
-
}
|
|
290
|
-
}).finally(() => {
|
|
291
|
-
assert(this.state !== SummaryManagerState.Off, 0x264 /* "Expected: Not Off" */);
|
|
292
|
-
this.state = SummaryManagerState.Off;
|
|
293
|
-
|
|
294
|
-
this.summarizer?.close();
|
|
295
|
-
this.summarizer = undefined;
|
|
296
|
-
|
|
297
|
-
if (this.getShouldSummarizeState().shouldSummarize) {
|
|
298
|
-
this.startSummarization();
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private stop(reason: SummarizerStopReason) {
|
|
304
|
-
if (!SummaryManager.isStartingOrRunning(this.state)) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
this.state = SummaryManagerState.Stopping;
|
|
308
|
-
|
|
309
|
-
// Stopping the running summarizer client should trigger a change
|
|
310
|
-
// in states when the running summarizer closes
|
|
311
|
-
this.summarizer?.stop(reason);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Implements initial delay before creating summarizer
|
|
316
|
-
* @returns `true`, if creation is delayed due to heuristics (not many ops to summarize).
|
|
317
|
-
* `false` if summarizer should start immediately due to too many unsummarized ops.
|
|
318
|
-
*/
|
|
319
|
-
private async delayBeforeCreatingSummarizer(): Promise<boolean> {
|
|
320
|
-
// throttle creation of new summarizer containers to prevent spamming the server with websocket connections
|
|
321
|
-
let delayMs = this.startThrottler.getDelay();
|
|
322
|
-
|
|
323
|
-
// We have been elected the summarizer. Some day we may be able to summarize with a live document but for
|
|
324
|
-
// now we play it safe and launch a second copy.
|
|
325
|
-
this.logger.sendTelemetryEvent({
|
|
326
|
-
eventName: "CreatingSummarizer",
|
|
327
|
-
throttlerDelay: delayMs,
|
|
328
|
-
initialDelay: this.initialDelayMs,
|
|
329
|
-
startThrottlerMaxDelayMs: this.startThrottler.maxDelayMs,
|
|
330
|
-
opsSinceLastAck: this.summaryCollection.opsSinceLastAck,
|
|
331
|
-
opsToBypassInitialDelay: this.opsToBypassInitialDelay,
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
// This delay helps ensure that last summarizer that might be left from previous client
|
|
335
|
-
// has enough time to complete its last summary and thus new summarizer not conflict with previous one.
|
|
336
|
-
// If, however, there are too many unsummarized ops, try to resolve it as quickly as possible, with
|
|
337
|
-
// understanding that we may see nacks because of such quick action.
|
|
338
|
-
// A better design would be for summarizer election logic to always select current summarizer as
|
|
339
|
-
// summarizing client (i.e. clientType === "summarizer" can be elected) to ensure that nobody else can
|
|
340
|
-
// summarizer while it finishes its work and moves to exit.
|
|
341
|
-
// It also helps with pure boot scenario (single client) to offset expensive work a bit out from
|
|
342
|
-
// critical boot sequence.
|
|
343
|
-
let startWithInitialDelay = false;
|
|
344
|
-
if (this.summaryCollection.opsSinceLastAck < this.opsToBypassInitialDelay) {
|
|
345
|
-
startWithInitialDelay = true;
|
|
346
|
-
delayMs = Math.max(delayMs, this.initialDelayMs);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (delayMs > 0) {
|
|
350
|
-
let timer;
|
|
351
|
-
let resolveOpPromiseFn;
|
|
352
|
-
// Create a listener that will break the delay if we've exceeded the initial delay ops count.
|
|
353
|
-
const opsListenerFn = () => {
|
|
354
|
-
if (this.summaryCollection.opsSinceLastAck >= this.opsToBypassInitialDelay) {
|
|
355
|
-
clearTimeout(timer);
|
|
356
|
-
resolveOpPromiseFn();
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
// Create a Promise that will resolve when the delay expires.
|
|
360
|
-
const delayPromise = new Promise<void>((resolve) => {
|
|
361
|
-
timer = setTimeout(() => resolve(), delayMs);
|
|
362
|
-
});
|
|
363
|
-
// Create a Promise that will resolve if the ops count passes the threshold.
|
|
364
|
-
const opPromise = new Promise<void>((resolve) => { resolveOpPromiseFn = resolve; });
|
|
365
|
-
this.summaryCollection.addOpListener(opsListenerFn);
|
|
366
|
-
await Promise.race([delayPromise, opPromise]);
|
|
367
|
-
this.summaryCollection.removeOpListener(opsListenerFn);
|
|
368
|
-
}
|
|
369
|
-
return startWithInitialDelay;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
public readonly summarizeOnDemand: ISummarizer["summarizeOnDemand"] = (...args) => {
|
|
373
|
-
if (this.summarizer === undefined) {
|
|
374
|
-
throw Error("No running summarizer client");
|
|
375
|
-
// TODO: could spawn a summarizer client temporarily.
|
|
376
|
-
}
|
|
377
|
-
return this.summarizer.summarizeOnDemand(...args);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
public readonly enqueueSummarize: ISummarizer["enqueueSummarize"] = (...args) => {
|
|
381
|
-
if (this.summarizer === undefined) {
|
|
382
|
-
throw Error("No running summarizer client");
|
|
383
|
-
// TODO: could spawn a summarizer client temporarily.
|
|
384
|
-
}
|
|
385
|
-
return this.summarizer.enqueueSummarize(...args);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
public dispose() {
|
|
389
|
-
this.clientElection.off("electedSummarizerChanged", this.refreshSummarizer);
|
|
390
|
-
this.connectedState.off("connected", this.handleConnected);
|
|
391
|
-
this.connectedState.off("disconnected", this.handleDisconnected);
|
|
392
|
-
this._disposed = true;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
File without changes
|
/package/dist/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/{runWhileConnectedCoordinator.d.ts → summary/runWhileConnectedCoordinator.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|