@fluidframework/container-runtime 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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 +21 -10
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts +1 -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 +74 -42
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +321 -152
- 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 +148 -114
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +534 -342
- 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 +40 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +146 -66
- 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 +39 -12
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +164 -76
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts +19 -0
- package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -0
- package/dist/deltaManagerSummarizerProxy.js +40 -0
- package/dist/deltaManagerSummarizerProxy.js.map +1 -0
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +204 -0
- package/dist/gc/garbageCollection.d.ts.map +1 -0
- package/dist/gc/garbageCollection.js +926 -0
- package/dist/gc/garbageCollection.js.map +1 -0
- package/dist/gc/gcConfigs.d.ts +22 -0
- package/dist/gc/gcConfigs.d.ts.map +1 -0
- package/dist/gc/gcConfigs.js +143 -0
- package/dist/gc/gcConfigs.js.map +1 -0
- package/dist/gc/gcDefinitions.d.ts +320 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -0
- package/dist/gc/gcDefinitions.js +81 -0
- package/dist/gc/gcDefinitions.js.map +1 -0
- package/dist/gc/gcHelpers.d.ts +86 -0
- package/dist/gc/gcHelpers.d.ts.map +1 -0
- package/dist/gc/gcHelpers.js +268 -0
- package/dist/gc/gcHelpers.js.map +1 -0
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
- package/dist/gc/gcReferenceGraphAlgorithm.js +49 -0
- package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -0
- package/dist/gc/gcSummaryDefinitions.d.ts +52 -0
- package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -0
- package/dist/gc/gcSummaryDefinitions.js +7 -0
- package/dist/gc/gcSummaryDefinitions.js.map +1 -0
- package/dist/gc/gcSummaryStateTracker.d.ts +93 -0
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/dist/gc/gcSummaryStateTracker.js +239 -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 +13 -0
- package/dist/gc/index.d.ts.map +1 -0
- package/dist/gc/index.js +50 -0
- package/dist/gc/index.js.map +1 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -13
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +10 -0
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +37 -8
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +29 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +3 -3
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +3 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +46 -17
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +6 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +72 -18
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +46 -2
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +142 -5
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +23 -2
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +101 -51
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +17 -2
- 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 +6 -15
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +137 -165
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +0 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +11 -21
- package/dist/scheduleManager.js.map +1 -1
- package/dist/storageServiceWithAttachBlobs.d.ts +17 -0
- package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -0
- package/dist/storageServiceWithAttachBlobs.js +32 -0
- package/dist/storageServiceWithAttachBlobs.js.map +1 -0
- package/dist/summary/index.d.ts +17 -0
- package/dist/summary/index.d.ts.map +1 -0
- package/dist/summary/index.js +46 -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/{lib → dist/summary}/runWhileConnectedCoordinator.d.ts +3 -2
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +5 -4
- 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 -77
- package/dist/summary/runningSummarizer.js.map +1 -0
- package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +6 -12
- package/dist/summary/summarizer.d.ts.map +1 -0
- package/dist/{summarizer.js → summary/summarizer.js} +32 -76
- package/dist/summary/summarizer.js.map +1 -0
- package/dist/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +1 -2
- package/dist/summary/summarizerClientElection.d.ts.map +1 -0
- package/dist/{summarizerClientElection.js → summary/summarizerClientElection.js} +3 -30
- package/dist/summary/summarizerClientElection.js.map +1 -0
- package/dist/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
- package/dist/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +9 -12
- package/dist/summary/summarizerHeuristics.js.map +1 -0
- package/dist/summary/summarizerNode/index.d.ts +8 -0
- package/dist/summary/summarizerNode/index.d.ts.map +1 -0
- package/dist/summary/summarizerNode/index.js +12 -0
- package/dist/summary/summarizerNode/index.js.map +1 -0
- package/dist/summary/summarizerNode/summarizerNode.d.ts +149 -0
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
- package/dist/summary/summarizerNode/summarizerNode.js +531 -0
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -0
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +125 -0
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +132 -0
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +22 -0
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +423 -0
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
- package/{lib → dist/summary}/summarizerTypes.d.ts +29 -42
- package/dist/summary/summarizerTypes.d.ts.map +1 -0
- package/dist/{summarizerTypes.js → summary/summarizerTypes.js} +0 -5
- 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 +3 -21
- package/dist/summary/summaryFormat.d.ts.map +1 -0
- package/dist/{summaryFormat.js → summary/summaryFormat.js} +19 -21
- package/dist/summary/summaryFormat.js.map +1 -0
- package/dist/summary/summaryGenerator.d.ts.map +1 -0
- package/dist/{summaryGenerator.js → summary/summaryGenerator.js} +34 -16
- 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 +1 -2
- 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 +74 -42
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +322 -153
- 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 +148 -114
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +506 -314
- 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 +40 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +136 -56
- 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 +39 -12
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +162 -74
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaManagerSummarizerProxy.d.ts +19 -0
- package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
- package/lib/deltaManagerSummarizerProxy.js +36 -0
- package/lib/deltaManagerSummarizerProxy.js.map +1 -0
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +204 -0
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/gc/garbageCollection.js +922 -0
- package/lib/gc/garbageCollection.js.map +1 -0
- package/lib/gc/gcConfigs.d.ts +22 -0
- package/lib/gc/gcConfigs.d.ts.map +1 -0
- package/lib/gc/gcConfigs.js +139 -0
- package/lib/gc/gcConfigs.js.map +1 -0
- package/lib/gc/gcDefinitions.d.ts +320 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -0
- package/lib/gc/gcDefinitions.js +78 -0
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/lib/gc/gcHelpers.d.ts +86 -0
- package/lib/gc/gcHelpers.d.ts.map +1 -0
- package/lib/gc/gcHelpers.js +254 -0
- package/lib/gc/gcHelpers.js.map +1 -0
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
- package/lib/gc/gcReferenceGraphAlgorithm.js +45 -0
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
- package/lib/gc/gcSummaryDefinitions.d.ts +52 -0
- package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
- package/lib/gc/gcSummaryDefinitions.js +6 -0
- package/lib/gc/gcSummaryDefinitions.js.map +1 -0
- package/lib/gc/gcSummaryStateTracker.d.ts +93 -0
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/lib/gc/gcSummaryStateTracker.js +235 -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 +13 -0
- package/lib/gc/index.d.ts.map +1 -0
- package/lib/gc/index.js +12 -0
- package/lib/gc/index.js.map +1 -0
- package/lib/index.d.ts +3 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -6
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +10 -0
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +35 -7
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +29 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +3 -3
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js +2 -2
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +47 -18
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +6 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +72 -18
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +46 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +141 -5
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +23 -2
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +103 -53
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +17 -2
- 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 +6 -15
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +137 -165
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts +0 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +11 -21
- package/lib/scheduleManager.js.map +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts +17 -0
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
- package/lib/storageServiceWithAttachBlobs.js +28 -0
- package/lib/storageServiceWithAttachBlobs.js.map +1 -0
- package/lib/summary/index.d.ts +17 -0
- package/lib/summary/index.d.ts.map +1 -0
- package/lib/summary/index.js +15 -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/{dist → lib/summary}/runWhileConnectedCoordinator.d.ts +3 -2
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +5 -4
- 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 -79
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/{summarizer.d.ts → summary/summarizer.d.ts} +6 -12
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/{summarizer.js → summary/summarizer.js} +34 -78
- package/lib/summary/summarizer.js.map +1 -0
- package/lib/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +1 -2
- package/lib/summary/summarizerClientElection.d.ts.map +1 -0
- package/lib/{summarizerClientElection.js → summary/summarizerClientElection.js} +3 -30
- package/lib/summary/summarizerClientElection.js.map +1 -0
- package/lib/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +9 -12
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/lib/summary/summarizerNode/index.d.ts +8 -0
- package/lib/summary/summarizerNode/index.d.ts.map +1 -0
- package/lib/summary/summarizerNode/index.js +7 -0
- package/lib/summary/summarizerNode/index.js.map +1 -0
- package/lib/summary/summarizerNode/summarizerNode.d.ts +149 -0
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
- package/lib/summary/summarizerNode/summarizerNode.js +526 -0
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +125 -0
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
- package/lib/summary/summarizerNode/summarizerNodeUtils.js +125 -0
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +22 -0
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +419 -0
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
- package/{dist → lib/summary}/summarizerTypes.d.ts +29 -42
- package/lib/summary/summarizerTypes.d.ts.map +1 -0
- package/lib/summary/summarizerTypes.js +6 -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 +3 -21
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/{summaryFormat.js → summary/summaryFormat.js} +20 -21
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/{summaryGenerator.js → summary/summaryGenerator.js} +34 -16
- 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 +67 -61
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +55 -50
- package/src/blobManager.ts +863 -594
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3174 -2805
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1141 -993
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +887 -716
- package/src/deltaManagerSummarizerProxy.ts +46 -0
- package/src/deltaScheduler.ts +158 -150
- package/{garbageCollection.md → src/gc/garbageCollection.md} +16 -3
- package/src/gc/garbageCollection.ts +1250 -0
- package/src/gc/gcConfigs.ts +193 -0
- package/src/gc/gcDefinitions.ts +387 -0
- package/src/gc/gcHelpers.ts +332 -0
- package/src/gc/gcReferenceGraphAlgorithm.ts +52 -0
- package/src/gc/gcSummaryDefinitions.ts +54 -0
- package/src/gc/gcSummaryStateTracker.ts +329 -0
- package/src/gc/gcSweepReadyUsageDetection.ts +145 -0
- package/src/gc/gcUnreferencedStateTracker.ts +114 -0
- package/src/gc/index.ts +65 -0
- package/src/index.ts +61 -75
- package/src/opLifecycle/README.md +157 -0
- package/src/opLifecycle/batchManager.ts +119 -86
- package/src/opLifecycle/definitions.ts +49 -19
- package/src/opLifecycle/index.ts +7 -6
- package/src/opLifecycle/opCompressor.ts +78 -40
- package/src/opLifecycle/opDecompressor.ts +148 -64
- package/src/opLifecycle/opSplitter.ts +269 -66
- package/src/opLifecycle/outbox.ts +268 -184
- package/src/opLifecycle/remoteMessageProcessor.ts +63 -47
- package/src/opProperties.ts +11 -9
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +386 -381
- package/src/scheduleManager.ts +299 -280
- package/src/storageServiceWithAttachBlobs.ts +38 -0
- package/src/summary/index.ts +105 -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 +372 -0
- package/src/summary/summarizerClientElection.ts +139 -0
- package/src/summary/summarizerHeuristics.ts +224 -0
- package/src/summary/summarizerNode/index.ts +12 -0
- package/src/summary/summarizerNode/summarizerNode.ts +766 -0
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +214 -0
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +644 -0
- package/src/summary/summarizerTypes.ts +507 -0
- package/src/summary/summaryCollection.ts +450 -0
- package/src/summary/summaryFormat.ts +228 -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 +0 -387
- package/dist/garbageCollection.d.ts.map +0 -1
- package/dist/garbageCollection.js +0 -1138
- package/dist/garbageCollection.js.map +0 -1
- package/dist/garbageCollectionConstants.d.ts +0 -19
- package/dist/garbageCollectionConstants.d.ts.map +0 -1
- package/dist/garbageCollectionConstants.js +0 -34
- package/dist/garbageCollectionConstants.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/serializedSnapshotStorage.d.ts +0 -58
- package/dist/serializedSnapshotStorage.d.ts.map +0 -1
- package/dist/serializedSnapshotStorage.js +0 -108
- package/dist/serializedSnapshotStorage.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 +0 -12
- package/dist/summarizerHandle.d.ts.map +0 -1
- package/dist/summarizerHandle.js +0 -22
- 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 +0 -387
- package/lib/garbageCollection.d.ts.map +0 -1
- package/lib/garbageCollection.js +0 -1133
- package/lib/garbageCollection.js.map +0 -1
- package/lib/garbageCollectionConstants.d.ts +0 -19
- package/lib/garbageCollectionConstants.d.ts.map +0 -1
- package/lib/garbageCollectionConstants.js +0 -31
- package/lib/garbageCollectionConstants.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/serializedSnapshotStorage.d.ts +0 -58
- package/lib/serializedSnapshotStorage.d.ts.map +0 -1
- package/lib/serializedSnapshotStorage.js +0 -104
- package/lib/serializedSnapshotStorage.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 +0 -12
- package/lib/summarizerHandle.d.ts.map +0 -1
- package/lib/summarizerHandle.js +0 -18
- 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 +0 -9
- 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 -1646
- package/src/garbageCollectionConstants.ts +0 -35
- package/src/gcSweepReadyUsageDetection.ts +0 -139
- package/src/orderedClientElection.ts +0 -532
- package/src/runWhileConnectedCoordinator.ts +0 -106
- package/src/runningSummarizer.ts +0 -611
- package/src/serializedSnapshotStorage.ts +0 -146
- package/src/summarizer.ts +0 -421
- package/src/summarizerClientElection.ts +0 -161
- package/src/summarizerHandle.ts +0 -21
- package/src/summarizerHeuristics.ts +0 -222
- package/src/summarizerTypes.ts +0 -510
- package/src/summaryCollection.ts +0 -421
- package/src/summaryFormat.ts +0 -235
- package/src/summaryGenerator.ts +0 -446
- package/src/summaryManager.ts +0 -394
- /package/dist/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +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/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
- /package/lib/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
package/dist/blobManager.js
CHANGED
|
@@ -10,9 +10,10 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
|
10
10
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
11
11
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
12
12
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
13
|
+
const containerRuntime_1 = require("./containerRuntime");
|
|
14
|
+
const gc_1 = require("./gc");
|
|
13
15
|
const throttler_1 = require("./throttler");
|
|
14
|
-
const
|
|
15
|
-
const garbageCollectionConstants_1 = require("./garbageCollectionConstants");
|
|
16
|
+
const summary_1 = require("./summary");
|
|
16
17
|
/**
|
|
17
18
|
* This class represents blob (long string)
|
|
18
19
|
* This object is used only when creating (writing) new blob and serialization purposes.
|
|
@@ -28,7 +29,9 @@ class BlobHandle {
|
|
|
28
29
|
this.attached = false;
|
|
29
30
|
this.absolutePath = (0, runtime_utils_1.generateHandleContextPath)(path, this.routeContext);
|
|
30
31
|
}
|
|
31
|
-
get IFluidHandle() {
|
|
32
|
+
get IFluidHandle() {
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
32
35
|
get isAttached() {
|
|
33
36
|
return this.attached;
|
|
34
37
|
}
|
|
@@ -65,27 +68,33 @@ var PendingBlobStatus;
|
|
|
65
68
|
PendingBlobStatus[PendingBlobStatus["OfflinePendingUpload"] = 2] = "OfflinePendingUpload";
|
|
66
69
|
PendingBlobStatus[PendingBlobStatus["OfflinePendingOp"] = 3] = "OfflinePendingOp";
|
|
67
70
|
})(PendingBlobStatus || (PendingBlobStatus = {}));
|
|
68
|
-
class BlobManager {
|
|
71
|
+
class BlobManager extends common_utils_1.TypedEventEmitter {
|
|
69
72
|
constructor(routeContext, snapshot, getStorage,
|
|
70
73
|
/**
|
|
71
|
-
* Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
74
|
+
* Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is
|
|
75
|
+
* deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the
|
|
76
|
+
* the blob as long as it is listed as referenced in future summaries. The summarizing client will know to
|
|
77
|
+
* include the storage ID in the summary when it sees the op.
|
|
75
78
|
*
|
|
76
|
-
* The op
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
+
* The op will also include a local ID to inform all clients of the relation to the storage ID, without
|
|
80
|
+
* knowledge of which they cannot request the blob from storage. It's important that this op is sequenced
|
|
81
|
+
* before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.
|
|
79
82
|
*/
|
|
80
83
|
sendBlobAttachOp,
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
+
// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.
|
|
85
|
+
// blobPath's format - `/<BlobManager.basePath>/<blobId>`.
|
|
86
|
+
blobRequested,
|
|
87
|
+
// Called to check if a blob has been deleted by GC.
|
|
88
|
+
// blobPath's format - `/<BlobManager.basePath>/<blobId>`.
|
|
89
|
+
isBlobDeleted, runtime, stashedBlobs = {}, getCurrentReferenceTimestampMs) {
|
|
90
|
+
super();
|
|
84
91
|
this.routeContext = routeContext;
|
|
85
92
|
this.getStorage = getStorage;
|
|
86
93
|
this.sendBlobAttachOp = sendBlobAttachOp;
|
|
87
|
-
this.
|
|
94
|
+
this.blobRequested = blobRequested;
|
|
95
|
+
this.isBlobDeleted = isBlobDeleted;
|
|
88
96
|
this.runtime = runtime;
|
|
97
|
+
this.getCurrentReferenceTimestampMs = getCurrentReferenceTimestampMs;
|
|
89
98
|
/**
|
|
90
99
|
* Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.
|
|
91
100
|
* Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so
|
|
@@ -93,8 +102,9 @@ class BlobManager {
|
|
|
93
102
|
*/
|
|
94
103
|
this.pendingBlobs = new Map();
|
|
95
104
|
/**
|
|
96
|
-
* Track ops in flight for online flow.
|
|
97
|
-
*
|
|
105
|
+
* Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,
|
|
106
|
+
* we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's
|
|
107
|
+
* because we know that the server will not delete the blob corresponding to that storage ID.
|
|
98
108
|
*/
|
|
99
109
|
this.opsInFlight = new Map();
|
|
100
110
|
this.retryThrottler = new CancellableThrottler(new throttler_1.Throttler(60 * 1000, // 60 sec delay window
|
|
@@ -102,15 +112,16 @@ class BlobManager {
|
|
|
102
112
|
// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)
|
|
103
113
|
(0, throttler_1.formExponentialFn)({ coefficient: 20, initialDelay: 0 })));
|
|
104
114
|
/**
|
|
105
|
-
* This stores
|
|
115
|
+
* This stores IDs of tombstoned blobs.
|
|
106
116
|
* Tombstone is a temporary feature that imitates a blob getting swept by garbage collection.
|
|
107
117
|
*/
|
|
108
118
|
this.tombstonedBlobs = new Set();
|
|
109
119
|
this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(this.runtime.logger, "BlobManager"));
|
|
110
120
|
// Read the feature flag that tells whether to throw when a tombstone blob is requested.
|
|
111
|
-
this.
|
|
112
|
-
this.mc.config.getBoolean(
|
|
113
|
-
this.runtime.
|
|
121
|
+
this.throwOnTombstoneLoad =
|
|
122
|
+
this.mc.config.getBoolean(gc_1.throwOnTombstoneLoadKey) === true &&
|
|
123
|
+
this.runtime.gcTombstoneEnforcementAllowed &&
|
|
124
|
+
this.runtime.clientDetails.type !== summary_1.summarizerClientType;
|
|
114
125
|
this.runtime.on("disconnected", () => this.onDisconnected());
|
|
115
126
|
this.redirectTable = this.load(snapshot);
|
|
116
127
|
// Begin uploading stashed blobs from previous container instance
|
|
@@ -125,12 +136,15 @@ class BlobManager {
|
|
|
125
136
|
});
|
|
126
137
|
}
|
|
127
138
|
get pendingOfflineUploads() {
|
|
128
|
-
return Array.from(this.pendingBlobs.values())
|
|
129
|
-
.filter((e) => e.status === PendingBlobStatus.OfflinePendingUpload);
|
|
139
|
+
return Array.from(this.pendingBlobs.values()).filter((e) => e.status === PendingBlobStatus.OfflinePendingUpload);
|
|
130
140
|
}
|
|
131
141
|
get hasPendingOfflineUploads() {
|
|
132
142
|
return this.pendingOfflineUploads.length > 0;
|
|
133
143
|
}
|
|
144
|
+
get hasPendingBlobs() {
|
|
145
|
+
return ((this.runtime.attachState !== container_definitions_1.AttachState.Attached && this.redirectTable.size > 0) ||
|
|
146
|
+
this.pendingBlobs.size > 0);
|
|
147
|
+
}
|
|
134
148
|
/**
|
|
135
149
|
* Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
|
|
136
150
|
*/
|
|
@@ -155,14 +169,6 @@ class BlobManager {
|
|
|
155
169
|
}
|
|
156
170
|
}
|
|
157
171
|
}
|
|
158
|
-
/**
|
|
159
|
-
* For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<blobId>`
|
|
160
|
-
* This path must match the path of the blob handle returned by the createBlob API because blobs are marked
|
|
161
|
-
* referenced by storing these handles in a referenced DDS.
|
|
162
|
-
*/
|
|
163
|
-
getBlobGCNodePath(blobId) {
|
|
164
|
-
return `/${BlobManager.basePath}/${blobId}`;
|
|
165
|
-
}
|
|
166
172
|
/**
|
|
167
173
|
* Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is
|
|
168
174
|
* detached or there are no (non-pending) attachment blobs in the document
|
|
@@ -173,21 +179,14 @@ class BlobManager {
|
|
|
173
179
|
const undefinedValueInTable = ids.delete(undefined);
|
|
174
180
|
// For a detached container, entries are inserted into the redirect table with an undefined storage ID.
|
|
175
181
|
// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.
|
|
176
|
-
(0, common_utils_1.assert)(!undefinedValueInTable ||
|
|
182
|
+
(0, common_utils_1.assert)(!undefinedValueInTable ||
|
|
183
|
+
(this.runtime.attachState === container_definitions_1.AttachState.Detached && ids.size === 0), 0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */);
|
|
177
184
|
return ids;
|
|
178
185
|
}
|
|
179
186
|
async getBlob(blobId) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.mc.logger.sendErrorEvent({
|
|
184
|
-
eventName: "GC_Tombstone_Blob_Requested",
|
|
185
|
-
url: request.url,
|
|
186
|
-
}, error);
|
|
187
|
-
if (this.throwOnTombstoneUsage) {
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
187
|
+
// Verify that the blob is valid, i.e., it has not been garbage collected. If it is, this will throw an error,
|
|
188
|
+
// failing the call.
|
|
189
|
+
this.verifyBlobValidity(blobId);
|
|
191
190
|
const pending = this.pendingBlobs.get(blobId);
|
|
192
191
|
if (pending) {
|
|
193
192
|
return pending.blob;
|
|
@@ -200,11 +199,12 @@ class BlobManager {
|
|
|
200
199
|
storageId = blobId;
|
|
201
200
|
}
|
|
202
201
|
else {
|
|
203
|
-
|
|
204
|
-
(0, common_utils_1.assert)(!!
|
|
202
|
+
const attachedStorageId = this.redirectTable.get(blobId);
|
|
203
|
+
(0, common_utils_1.assert)(!!attachedStorageId, 0x11f /* "requesting unknown blobs" */);
|
|
204
|
+
storageId = attachedStorageId;
|
|
205
205
|
}
|
|
206
|
-
//
|
|
207
|
-
this.
|
|
206
|
+
// Let runtime know that the corresponding GC node was requested.
|
|
207
|
+
this.blobRequested(getGCNodePathFromBlobId(blobId));
|
|
208
208
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "AttachmentReadBlob", id: storageId }, async () => {
|
|
209
209
|
return this.getStorage().readBlob(storageId);
|
|
210
210
|
}, { end: true, cancel: "error" });
|
|
@@ -217,7 +217,7 @@ class BlobManager {
|
|
|
217
217
|
// Blobs created while the container is detached are stored in IDetachedBlobStorage.
|
|
218
218
|
// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.
|
|
219
219
|
const response = await this.getStorage().createBlob(blob);
|
|
220
|
-
this.
|
|
220
|
+
this.setRedirection(response.id, undefined);
|
|
221
221
|
return this.getBlobHandle(response.id);
|
|
222
222
|
}
|
|
223
223
|
async createBlob(blob) {
|
|
@@ -230,8 +230,8 @@ class BlobManager {
|
|
|
230
230
|
await new Promise((resolve) => this.runtime.once("attached", resolve));
|
|
231
231
|
}
|
|
232
232
|
(0, common_utils_1.assert)(this.runtime.attachState === container_definitions_1.AttachState.Attached, 0x385 /* For clarity and paranoid defense against adding future attachment states */);
|
|
233
|
-
// Create a local ID for
|
|
234
|
-
//
|
|
233
|
+
// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to
|
|
234
|
+
// storage ID mapping is created.
|
|
235
235
|
const localId = (0, uuid_1.v4)();
|
|
236
236
|
const pendingEntry = {
|
|
237
237
|
blob,
|
|
@@ -245,25 +245,51 @@ class BlobManager {
|
|
|
245
245
|
async uploadBlob(localId, blob) {
|
|
246
246
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: "createBlob" }, async () => this.getStorage().createBlob(blob), { end: true, cancel: this.runtime.connected ? "error" : "generic" }).then((response) => this.onUploadResolve(localId, response), async (err) => this.onUploadReject(localId, err));
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added
|
|
250
|
+
* which is required for GC.
|
|
251
|
+
*/
|
|
252
|
+
setRedirection(fromId, toId) {
|
|
253
|
+
this.redirectTable.set(fromId, toId);
|
|
254
|
+
}
|
|
255
|
+
deleteAndEmitsIfEmpty(id) {
|
|
256
|
+
if (this.pendingBlobs.has(id)) {
|
|
257
|
+
this.pendingBlobs.delete(id);
|
|
258
|
+
if (!this.hasPendingBlobs) {
|
|
259
|
+
this.emit("noPendingBlobs");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
248
263
|
onUploadResolve(localId, response) {
|
|
249
264
|
var _a;
|
|
250
265
|
const entry = this.pendingBlobs.get(localId);
|
|
251
266
|
(0, common_utils_1.assert)((entry === null || entry === void 0 ? void 0 : entry.status) === PendingBlobStatus.OnlinePendingUpload ||
|
|
252
267
|
(entry === null || entry === void 0 ? void 0 : entry.status) === PendingBlobStatus.OfflinePendingUpload, 0x386 /* Must have pending blob entry for uploaded blob */);
|
|
253
268
|
entry.storageId = response.id;
|
|
269
|
+
entry.localUploadTime = Date.now();
|
|
270
|
+
entry.minTTLInSeconds = response.minTTLInSeconds;
|
|
271
|
+
entry.serverUploadTime = this.getCurrentReferenceTimestampMs();
|
|
254
272
|
if (this.runtime.connected) {
|
|
255
273
|
if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
|
|
274
|
+
// Send a blob attach op. This serves two purposes:
|
|
275
|
+
// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op
|
|
276
|
+
// until its storage ID is added to the next summary.
|
|
277
|
+
// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the
|
|
278
|
+
// blob from the server via the storage ID.
|
|
279
|
+
this.logTimeInfo(entry, "sendBlobAttachResolveTTL");
|
|
280
|
+
this.sendBlobAttachOp(localId, response.id);
|
|
256
281
|
if (this.storageIds.has(response.id)) {
|
|
257
|
-
//
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
this.
|
|
282
|
+
// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
|
|
283
|
+
// an existing blob, we don't have to wait for the op to be ack'd since this step has already
|
|
284
|
+
// happened before and so, the server won't delete it.
|
|
285
|
+
this.setRedirection(localId, response.id);
|
|
286
|
+
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
287
|
+
this.deleteAndEmitsIfEmpty(localId);
|
|
261
288
|
}
|
|
262
289
|
else {
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
290
|
+
// If there is already an op for this storage ID, append the local ID to the list. Once any op for
|
|
291
|
+
// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
|
|
292
|
+
// blob alive in storage.
|
|
267
293
|
this.opsInFlight.set(response.id, ((_a = this.opsInFlight.get(response.id)) !== null && _a !== void 0 ? _a : []).concat(localId));
|
|
268
294
|
entry.status = PendingBlobStatus.OnlinePendingOp;
|
|
269
295
|
}
|
|
@@ -291,7 +317,9 @@ class BlobManager {
|
|
|
291
317
|
this.transitionToOffline(localId);
|
|
292
318
|
}
|
|
293
319
|
// we are probably not connected to storage but start another upload request in case we are
|
|
294
|
-
entry.uploadP = this.retryThrottler
|
|
320
|
+
entry.uploadP = this.retryThrottler
|
|
321
|
+
.getDelay()
|
|
322
|
+
.then(async () => this.uploadBlob(localId, entry.blob));
|
|
295
323
|
return entry.uploadP;
|
|
296
324
|
}
|
|
297
325
|
else {
|
|
@@ -304,15 +332,21 @@ class BlobManager {
|
|
|
304
332
|
const entry = this.pendingBlobs.get(localId);
|
|
305
333
|
(0, common_utils_1.assert)(!!entry, 0x389 /* No pending blob entry */);
|
|
306
334
|
(0, common_utils_1.assert)([PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(entry.status), 0x38a /* Blob must be in online flow to transition to offline flow */);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
335
|
+
/**
|
|
336
|
+
* If we haven't already submitted a BlobAttach op for this entry, send it before returning the blob handle.
|
|
337
|
+
* This will make sure that the BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise,
|
|
338
|
+
* an invalid handle could be added to the document.
|
|
339
|
+
* storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()
|
|
340
|
+
* is called on reconnection.
|
|
341
|
+
*/
|
|
342
|
+
if (entry.status !== PendingBlobStatus.OnlinePendingOp) {
|
|
343
|
+
this.logTimeInfo(entry, "sendBlobAttachTransitionOfflineTTL");
|
|
344
|
+
this.sendBlobAttachOp(localId, entry.storageId);
|
|
345
|
+
}
|
|
346
|
+
entry.status =
|
|
347
|
+
entry.status === PendingBlobStatus.OnlinePendingUpload
|
|
348
|
+
? PendingBlobStatus.OfflinePendingUpload
|
|
349
|
+
: PendingBlobStatus.OfflinePendingOp;
|
|
316
350
|
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
317
351
|
}
|
|
318
352
|
/**
|
|
@@ -322,45 +356,81 @@ class BlobManager {
|
|
|
322
356
|
*/
|
|
323
357
|
reSubmit(metadata) {
|
|
324
358
|
(0, common_utils_1.assert)(!!metadata, 0x38b /* Resubmitted ops must have metadata */);
|
|
325
|
-
const {
|
|
359
|
+
const { localId, blobId } = metadata;
|
|
360
|
+
(0, common_utils_1.assert)(localId !== undefined, 0x50d /* local ID not available on reSubmit */);
|
|
361
|
+
const pendingEntry = this.pendingBlobs.get(localId);
|
|
362
|
+
if (pendingEntry) {
|
|
363
|
+
this.logTimeInfo(pendingEntry, "sendBlobAttachResubmitTTL");
|
|
364
|
+
}
|
|
326
365
|
if (!blobId) {
|
|
327
|
-
(0, common_utils_1.assert)(!!localId, 0x38c /* Submitted BlobAttach ops must have a blobId or localId */);
|
|
328
366
|
// We submitted this op while offline. The blob should have been uploaded by now.
|
|
329
|
-
const pendingEntry = this.pendingBlobs.get(localId);
|
|
330
367
|
(0, common_utils_1.assert)((pendingEntry === null || pendingEntry === void 0 ? void 0 : pendingEntry.status) === PendingBlobStatus.OfflinePendingOp &&
|
|
331
368
|
!!(pendingEntry === null || pendingEntry === void 0 ? void 0 : pendingEntry.storageId), 0x38d /* blob must be uploaded before resubmitting BlobAttach op */);
|
|
332
|
-
return this.sendBlobAttachOp(pendingEntry.storageId
|
|
369
|
+
return this.sendBlobAttachOp(localId, pendingEntry.storageId);
|
|
333
370
|
}
|
|
334
|
-
return this.sendBlobAttachOp(
|
|
371
|
+
return this.sendBlobAttachOp(localId, blobId);
|
|
372
|
+
}
|
|
373
|
+
logTimeInfo(pendingEntry, eventName) {
|
|
374
|
+
var _a, _b;
|
|
375
|
+
let timeLapseSinceLocalUpload = 0;
|
|
376
|
+
let timeLapseSinceServerUpload = 0;
|
|
377
|
+
let expiredUsingLocalTime;
|
|
378
|
+
let expiredUsingServerTime;
|
|
379
|
+
if (pendingEntry.localUploadTime) {
|
|
380
|
+
timeLapseSinceLocalUpload = (Date.now() - pendingEntry.localUploadTime) / 1000;
|
|
381
|
+
expiredUsingLocalTime =
|
|
382
|
+
((_a = pendingEntry.minTTLInSeconds) !== null && _a !== void 0 ? _a : 0) - timeLapseSinceLocalUpload < 0 ? true : false;
|
|
383
|
+
}
|
|
384
|
+
if (pendingEntry.serverUploadTime) {
|
|
385
|
+
timeLapseSinceServerUpload = (Date.now() - pendingEntry.serverUploadTime) / 1000;
|
|
386
|
+
expiredUsingServerTime =
|
|
387
|
+
((_b = pendingEntry.minTTLInSeconds) !== null && _b !== void 0 ? _b : 0) - timeLapseSinceServerUpload < 0 ? true : false;
|
|
388
|
+
}
|
|
389
|
+
this.mc.logger.sendTelemetryEvent({
|
|
390
|
+
eventName,
|
|
391
|
+
entryStatus: pendingEntry.status,
|
|
392
|
+
timeLapseSinceLocalUpload,
|
|
393
|
+
timeLapseSinceServerUpload,
|
|
394
|
+
minTTLInSeconds: pendingEntry.minTTLInSeconds,
|
|
395
|
+
expiredUsingLocalTime,
|
|
396
|
+
expiredUsingServerTime,
|
|
397
|
+
});
|
|
335
398
|
}
|
|
336
399
|
processBlobAttachOp(message, local) {
|
|
337
400
|
var _a, _b;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
401
|
+
const localId = (_a = message.metadata) === null || _a === void 0 ? void 0 : _a.localId;
|
|
402
|
+
const blobId = (_b = message.metadata) === null || _b === void 0 ? void 0 : _b.blobId;
|
|
403
|
+
(0, common_utils_1.assert)(blobId !== undefined, 0x12a /* "Missing blob id on metadata" */);
|
|
404
|
+
// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be
|
|
405
|
+
// requested from the server.
|
|
406
|
+
// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that
|
|
407
|
+
// was sent when online.
|
|
408
|
+
if (localId !== undefined) {
|
|
409
|
+
this.setRedirection(localId, blobId);
|
|
341
410
|
}
|
|
342
411
|
// set identity (id -> id) entry
|
|
343
|
-
this.
|
|
412
|
+
this.setRedirection(blobId, blobId);
|
|
344
413
|
if (local) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
414
|
+
(0, common_utils_1.assert)(localId !== undefined, 0x50e /* local ID not present in blob attach message */);
|
|
415
|
+
const waitingBlobs = this.opsInFlight.get(blobId);
|
|
416
|
+
if (waitingBlobs !== undefined) {
|
|
417
|
+
// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.
|
|
418
|
+
// This is safe because the server will keep the blob alive and the op containing the local ID to
|
|
419
|
+
// storage ID is already in flight and any op containing this local ID will be sequenced after that.
|
|
420
|
+
waitingBlobs.forEach((pendingLocalId) => {
|
|
421
|
+
const pendingBlobEntry = this.pendingBlobs.get(pendingLocalId);
|
|
422
|
+
(0, common_utils_1.assert)(pendingBlobEntry !== undefined, 0x38f /* local online BlobAttach op with no pending blob entry */);
|
|
352
423
|
// It's possible we transitioned to offline flow while waiting for this op.
|
|
353
424
|
if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {
|
|
354
|
-
|
|
355
|
-
|
|
425
|
+
this.setRedirection(pendingLocalId, blobId);
|
|
426
|
+
pendingBlobEntry.handleP.resolve(this.getBlobHandle(pendingLocalId));
|
|
427
|
+
this.deleteAndEmitsIfEmpty(pendingLocalId);
|
|
356
428
|
}
|
|
357
429
|
});
|
|
430
|
+
this.opsInFlight.delete(blobId);
|
|
358
431
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
(0, common_utils_1.assert)(((_b = this.pendingBlobs.get(message.metadata.localId)) === null || _b === void 0 ? void 0 : _b.status) === PendingBlobStatus.OfflinePendingOp, 0x1f8 /* "local BlobAttach op with no pending blob" */);
|
|
362
|
-
this.pendingBlobs.delete(message.metadata.localId);
|
|
363
|
-
}
|
|
432
|
+
// For blobs that were transitioned to offline flow while waiting for this op, the entry should be deleted.
|
|
433
|
+
this.deleteAndEmitsIfEmpty(localId);
|
|
364
434
|
}
|
|
365
435
|
}
|
|
366
436
|
/**
|
|
@@ -379,7 +449,8 @@ class BlobManager {
|
|
|
379
449
|
redirectTable = await tryFetchBlob(tableId);
|
|
380
450
|
}
|
|
381
451
|
const ids = Object.entries(blobsTree.blobs)
|
|
382
|
-
.filter(([k, _]) => k !== this.redirectTableBlobName)
|
|
452
|
+
.filter(([k, _]) => k !== this.redirectTableBlobName)
|
|
453
|
+
.map(([_, v]) => v);
|
|
383
454
|
return { ids, redirectTable };
|
|
384
455
|
}
|
|
385
456
|
/**
|
|
@@ -401,6 +472,23 @@ class BlobManager {
|
|
|
401
472
|
}
|
|
402
473
|
return table;
|
|
403
474
|
}
|
|
475
|
+
summarize(telemetryContext) {
|
|
476
|
+
// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached
|
|
477
|
+
const blobIds = this.storageIds.size > 0
|
|
478
|
+
? Array.from(this.storageIds)
|
|
479
|
+
: Array.from(this.redirectTable.keys());
|
|
480
|
+
const builder = new runtime_utils_1.SummaryTreeBuilder();
|
|
481
|
+
blobIds.forEach((blobId) => {
|
|
482
|
+
builder.addAttachment(blobId);
|
|
483
|
+
});
|
|
484
|
+
// Any non-identity entries in the table need to be saved in the summary
|
|
485
|
+
if (this.redirectTable.size > blobIds.length) {
|
|
486
|
+
builder.addBlob(BlobManager.redirectTableBlobName,
|
|
487
|
+
// filter out identity entries
|
|
488
|
+
JSON.stringify(Array.from(this.redirectTable.entries()).filter(([localId, storageId]) => localId !== storageId)));
|
|
489
|
+
}
|
|
490
|
+
return builder.getSummaryTree();
|
|
491
|
+
}
|
|
404
492
|
/**
|
|
405
493
|
* Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be
|
|
406
494
|
* individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.
|
|
@@ -409,90 +497,155 @@ class BlobManager {
|
|
|
409
497
|
*/
|
|
410
498
|
getGCData(fullGC = false) {
|
|
411
499
|
const gcData = { gcNodes: {} };
|
|
412
|
-
/**
|
|
413
|
-
* The node path is of the format `/_blobs/blobId`. This path must match the path of the blob handle returned
|
|
414
|
-
* by the createBlob API because blobs are marked referenced by storing these handles in a referenced DDS.
|
|
415
|
-
*/
|
|
416
|
-
this.storageIds.forEach((blobId) => {
|
|
417
|
-
gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];
|
|
418
|
-
});
|
|
419
|
-
// For some blobs, the handle returned on creation is based off of the localId. So, these
|
|
420
|
-
// nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node
|
|
421
|
-
// must also be marked referenced. So, we add a route from the localId node to the storageId node.
|
|
422
|
-
// Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or
|
|
423
|
-
// a blob may be referenced via its storageId handle.
|
|
424
500
|
for (const [localId, storageId] of this.redirectTable) {
|
|
425
501
|
(0, common_utils_1.assert)(!!storageId, 0x390 /* Must be attached to get GC data */);
|
|
426
|
-
//
|
|
427
|
-
//
|
|
428
|
-
|
|
502
|
+
// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage
|
|
503
|
+
// id entries have the same key and value, ignore them.
|
|
504
|
+
// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced
|
|
505
|
+
// by adding its handle to a referenced DDS.
|
|
506
|
+
if (localId !== storageId) {
|
|
507
|
+
gcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];
|
|
508
|
+
}
|
|
429
509
|
}
|
|
430
510
|
return gcData;
|
|
431
511
|
}
|
|
432
512
|
/**
|
|
433
|
-
* This is called to update blobs whose routes are
|
|
434
|
-
* @param
|
|
513
|
+
* This is called to update blobs whose routes are unused. The unused blobs are deleted.
|
|
514
|
+
* @param unusedRoutes - The routes of the blob nodes that are unused. These routes will be based off of local ids.
|
|
435
515
|
*/
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
516
|
+
updateUnusedRoutes(unusedRoutes) {
|
|
517
|
+
this.deleteBlobsFromRedirectTable(unusedRoutes);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Delete attachment blobs that are sweep ready.
|
|
521
|
+
* @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will
|
|
522
|
+
* be based off of local ids.
|
|
523
|
+
* @returns - The routes of blobs that were deleted.
|
|
524
|
+
*/
|
|
525
|
+
deleteSweepReadyNodes(sweepReadyBlobRoutes) {
|
|
526
|
+
// If sweep for attachment blobs is not enabled, return empty list indicating nothing is deleted.
|
|
527
|
+
if (this.mc.config.getBoolean(gc_1.sweepAttachmentBlobsKey) !== true) {
|
|
528
|
+
return [];
|
|
529
|
+
}
|
|
530
|
+
this.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);
|
|
531
|
+
return Array.from(sweepReadyBlobRoutes);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Delete blobs with the given routes from the redirect table.
|
|
535
|
+
* The routes are GC nodes paths of format -`/<BlobManager.basePath>/<blobId>`. The blob ids are all local ids.
|
|
536
|
+
* Deleting the blobs involves 2 steps:
|
|
537
|
+
* 1. The redirect table entry for the local ids are deleted.
|
|
538
|
+
* 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries
|
|
539
|
+
* for the storage ids are deleted as well.
|
|
540
|
+
*
|
|
541
|
+
* Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table
|
|
542
|
+
* will remove them the next summary. The service would them delete them some time in the future.
|
|
543
|
+
*/
|
|
544
|
+
deleteBlobsFromRedirectTable(blobRoutes) {
|
|
545
|
+
if (blobRoutes.length === 0) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of
|
|
549
|
+
// these storage ids are unused, they will be deleted as well.
|
|
550
|
+
const maybeUnusedStorageIds = new Set();
|
|
551
|
+
for (const route of blobRoutes) {
|
|
552
|
+
const blobId = getBlobIdFromGCNodePath(route);
|
|
553
|
+
if (!this.redirectTable.has(blobId)) {
|
|
554
|
+
this.mc.logger.sendErrorEvent({
|
|
555
|
+
eventName: "DeletedAttachmentBlobNotFound",
|
|
556
|
+
blobId,
|
|
557
|
+
});
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
const storageId = this.redirectTable.get(blobId);
|
|
561
|
+
(0, common_utils_1.assert)(!!storageId, 0x5bb /* Must be attached to run GC */);
|
|
562
|
+
maybeUnusedStorageIds.add(storageId);
|
|
563
|
+
this.redirectTable.delete(blobId);
|
|
564
|
+
}
|
|
565
|
+
// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if
|
|
566
|
+
// the redirect table has a local id -> storage id entry for it.
|
|
567
|
+
for (const [localId, storageId] of this.redirectTable.entries()) {
|
|
568
|
+
(0, common_utils_1.assert)(!!storageId, 0x5bc /* Must be attached to run GC */);
|
|
569
|
+
// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.
|
|
570
|
+
if (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {
|
|
571
|
+
maybeUnusedStorageIds.delete(storageId);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
// For unused storage ids, delete their id -> id entries from the redirect table.
|
|
575
|
+
// This way they'll be absent from the next summary, and the service is free to delete them from storage.
|
|
576
|
+
for (const storageId of maybeUnusedStorageIds) {
|
|
577
|
+
this.redirectTable.delete(storageId);
|
|
445
578
|
}
|
|
446
579
|
}
|
|
447
580
|
/**
|
|
448
|
-
* This is called to update blobs whose routes are
|
|
449
|
-
*
|
|
450
|
-
* @param
|
|
451
|
-
* @param tombstone - if true, the objects corresponding to unused routes are marked tombstones. Otherwise, they
|
|
452
|
-
* are deleted.
|
|
581
|
+
* This is called to update blobs whose routes are tombstones. Tombstoned blobs enable testing scenarios with
|
|
582
|
+
* accessing deleted content without actually deleting content from summaries.
|
|
583
|
+
* @param tombstonedRoutes - The routes of blob nodes that are tombstones.
|
|
453
584
|
*/
|
|
454
|
-
|
|
585
|
+
updateTombstonedRoutes(tombstonedRoutes) {
|
|
586
|
+
const tombstonedBlobsSet = new Set();
|
|
455
587
|
// The routes or blob node paths are in the same format as returned in getGCData -
|
|
456
588
|
// `/<BlobManager.basePath>/<blobId>`.
|
|
457
|
-
for (const route of
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
else {
|
|
466
|
-
// The unused blobId could be a localId. If so, remove it from the redirect table and continue. The
|
|
467
|
-
// corresponding storageId may still be used either directly or via other localIds.
|
|
468
|
-
this.redirectTable.delete(blobId);
|
|
589
|
+
for (const route of tombstonedRoutes) {
|
|
590
|
+
const blobId = getBlobIdFromGCNodePath(route);
|
|
591
|
+
tombstonedBlobsSet.add(blobId);
|
|
592
|
+
}
|
|
593
|
+
// Remove blobs from the tombstone list that were tombstoned but aren't anymore as per the tombstoneRoutes.
|
|
594
|
+
for (const blobId of this.tombstonedBlobs) {
|
|
595
|
+
if (!tombstonedBlobsSet.has(blobId)) {
|
|
596
|
+
this.tombstonedBlobs.delete(blobId);
|
|
469
597
|
}
|
|
470
598
|
}
|
|
599
|
+
// Mark blobs that are now tombstoned by adding them to the tombstone list.
|
|
600
|
+
for (const blobId of tombstonedBlobsSet) {
|
|
601
|
+
this.tombstonedBlobs.add(blobId);
|
|
602
|
+
}
|
|
471
603
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
604
|
+
/**
|
|
605
|
+
* Verifies that the blob with given id is valid, i.e., it has not been garbage collected. If the blob is GC'd,
|
|
606
|
+
* log an error and throw if necessary.
|
|
607
|
+
*/
|
|
608
|
+
verifyBlobValidity(blobId) {
|
|
609
|
+
/**
|
|
610
|
+
* A blob can be in one of the following states:
|
|
611
|
+
* 1. "deleted" - It has been deleted by garbage collection sweep phase.
|
|
612
|
+
* 2. "tombstoned" - It is ready for deletion but sweep phase isn't enabled and tombstone feature is enabled.
|
|
613
|
+
* 3. "valid" - It has not been deleted or tombstoned.
|
|
614
|
+
*/
|
|
615
|
+
let state = "valid";
|
|
616
|
+
if (this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {
|
|
617
|
+
state = "deleted";
|
|
618
|
+
}
|
|
619
|
+
else if (this.tombstonedBlobs.has(blobId)) {
|
|
620
|
+
state = "tombstoned";
|
|
621
|
+
}
|
|
622
|
+
if (state === "valid") {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
// If the blob is deleted or throw on tombstone load is enabled, throw an error which will fail any attempt
|
|
626
|
+
// to load the blob.
|
|
627
|
+
const shouldFail = state === "deleted" || this.throwOnTombstoneLoad;
|
|
628
|
+
const request = { url: blobId };
|
|
629
|
+
const error = (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, "Blob was deleted", request, state === "tombstoned" ? { [containerRuntime_1.TombstoneResponseHeaderKey]: true } : undefined), request);
|
|
630
|
+
(0, gc_1.sendGCUnexpectedUsageEvent)(this.mc, {
|
|
631
|
+
eventName: state === "tombstoned"
|
|
632
|
+
? "GC_Tombstone_Blob_Requested"
|
|
633
|
+
: "GC_Deleted_Blob_Requested",
|
|
634
|
+
category: shouldFail ? "error" : "generic",
|
|
635
|
+
gcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,
|
|
636
|
+
}, [BlobManager.basePath], error);
|
|
637
|
+
if (shouldFail) {
|
|
638
|
+
throw error;
|
|
485
639
|
}
|
|
486
|
-
return builder.getSummaryTree();
|
|
487
640
|
}
|
|
488
641
|
setRedirectTable(table) {
|
|
489
642
|
(0, common_utils_1.assert)(this.runtime.attachState === container_definitions_1.AttachState.Detached, 0x252 /* "redirect table can only be set in detached container" */);
|
|
490
643
|
(0, common_utils_1.assert)(this.redirectTable.size === table.size, 0x391 /* Redirect table size must match BlobManager's local ID count */);
|
|
491
644
|
for (const [localId, storageId] of table) {
|
|
492
645
|
(0, common_utils_1.assert)(this.redirectTable.has(localId), 0x254 /* "unrecognized id in redirect table" */);
|
|
493
|
-
this.
|
|
646
|
+
this.setRedirection(localId, storageId);
|
|
494
647
|
// set identity (id -> id) entry
|
|
495
|
-
this.
|
|
648
|
+
this.setRedirection(storageId, storageId);
|
|
496
649
|
}
|
|
497
650
|
}
|
|
498
651
|
getPendingBlobs() {
|
|
@@ -506,4 +659,20 @@ class BlobManager {
|
|
|
506
659
|
exports.BlobManager = BlobManager;
|
|
507
660
|
BlobManager.basePath = "_blobs";
|
|
508
661
|
BlobManager.redirectTableBlobName = ".redirectTable";
|
|
662
|
+
/**
|
|
663
|
+
* For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<blobId>`.
|
|
664
|
+
* This path must match the path of the blob handle returned by the createBlob API because blobs are marked
|
|
665
|
+
* referenced by storing these handles in a referenced DDS.
|
|
666
|
+
*/
|
|
667
|
+
function getGCNodePathFromBlobId(blobId) {
|
|
668
|
+
return `/${BlobManager.basePath}/${blobId}`;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* For a given GC node path, return the blobId. The node path is of the format `/<BlobManager.basePath>/<blobId>`.
|
|
672
|
+
*/
|
|
673
|
+
function getBlobIdFromGCNodePath(nodePath) {
|
|
674
|
+
const pathParts = nodePath.split("/");
|
|
675
|
+
(0, common_utils_1.assert)(pathParts.length === 3 && pathParts[1] === BlobManager.basePath, 0x5bd /* Invalid blob node path */);
|
|
676
|
+
return pathParts[2];
|
|
677
|
+
}
|
|
509
678
|
//# sourceMappingURL=blobManager.js.map
|