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