@fluidframework/container-runtime 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.eslintrc.js → .eslintrc.cjs} +5 -5
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +54 -0
- package/README.md +45 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/container-runtime.api.md +68 -30
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +223 -0
- package/dist/channelCollection.d.ts.map +1 -0
- package/dist/{dataStores.js → channelCollection.js} +399 -83
- package/dist/channelCollection.js.map +1 -0
- package/dist/connectionTelemetry.d.ts +11 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +42 -4
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/container-runtime-alpha.d.ts +98 -40
- package/dist/container-runtime-beta.d.ts +27 -9
- package/dist/container-runtime-public.d.ts +27 -9
- package/dist/container-runtime-untrimmed.d.ts +123 -40
- package/dist/containerHandleContext.d.ts +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +79 -55
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +541 -411
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +2 -3
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +12 -11
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +71 -30
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +182 -141
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts +29 -4
- package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/dist/deltaManagerSummarizerProxy.js +91 -5
- package/dist/deltaManagerSummarizerProxy.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +22 -5
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +134 -75
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts +2 -2
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +21 -21
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +29 -6
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +5 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +2 -2
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -1
- package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +12 -5
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +18 -6
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +7 -7
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +20 -20
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts +6 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +22 -11
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +8 -8
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +40 -38
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +8 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -40
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +4 -4
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +2 -2
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +2 -2
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +8 -8
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +18 -18
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +4 -4
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +3 -3
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +1 -10
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +5 -5
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +7 -7
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +20 -12
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +4 -4
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +2 -2
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +2 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +18 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts +1 -2
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +5 -5
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +12 -12
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +43 -43
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.js +8 -8
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +11 -10
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +114 -81
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +4 -4
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +6 -6
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +2 -2
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +3 -3
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/index.d.ts +3 -3
- package/dist/summary/summarizerNode/index.d.ts.map +1 -1
- package/dist/summary/summarizerNode/index.js +4 -4
- package/dist/summary/summarizerNode/index.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +17 -7
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +45 -57
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +10 -19
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +1 -21
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +16 -16
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +10 -21
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +15 -2
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +6 -5
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +10 -1
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +5 -6
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +4 -5
- package/dist/summary/summaryManager.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/{batchTracker.d.mts → batchTracker.d.ts} +2 -3
- package/lib/batchTracker.d.ts.map +1 -0
- package/lib/{batchTracker.mjs → batchTracker.js} +1 -1
- package/lib/batchTracker.js.map +1 -0
- package/lib/{blobManager.d.mts → blobManager.d.ts} +1 -1
- package/lib/blobManager.d.ts.map +1 -0
- package/lib/{blobManager.mjs → blobManager.js} +1 -1
- package/lib/blobManager.js.map +1 -0
- package/lib/channelCollection.d.ts +223 -0
- package/lib/channelCollection.d.ts.map +1 -0
- package/lib/{dataStores.mjs → channelCollection.js} +384 -71
- package/lib/channelCollection.js.map +1 -0
- package/lib/{connectionTelemetry.d.mts → connectionTelemetry.d.ts} +12 -2
- package/lib/connectionTelemetry.d.ts.map +1 -0
- package/lib/{connectionTelemetry.mjs → connectionTelemetry.js} +43 -5
- package/lib/connectionTelemetry.js.map +1 -0
- package/lib/{container-runtime-alpha.d.mts → container-runtime-alpha.d.ts} +98 -40
- package/lib/{container-runtime-public.d.mts → container-runtime-beta.d.ts} +27 -9
- package/lib/{container-runtime-beta.d.mts → container-runtime-public.d.ts} +27 -9
- package/lib/{container-runtime-untrimmed.d.mts → container-runtime-untrimmed.d.ts} +123 -40
- package/lib/{containerHandleContext.d.mts → containerHandleContext.d.ts} +2 -2
- package/lib/containerHandleContext.d.ts.map +1 -0
- package/lib/{containerHandleContext.mjs → containerHandleContext.js} +1 -1
- package/lib/containerHandleContext.js.map +1 -0
- package/lib/{containerRuntime.d.mts → containerRuntime.d.ts} +84 -56
- package/lib/containerRuntime.d.ts.map +1 -0
- package/lib/{containerRuntime.mjs → containerRuntime.js} +460 -332
- package/lib/containerRuntime.js.map +1 -0
- package/lib/{dataStore.d.mts → dataStore.d.ts} +3 -4
- package/lib/dataStore.d.ts.map +1 -0
- package/lib/{dataStore.mjs → dataStore.js} +13 -12
- package/lib/dataStore.js.map +1 -0
- package/lib/{dataStoreContext.d.mts → dataStoreContext.d.ts} +72 -31
- package/lib/dataStoreContext.d.ts.map +1 -0
- package/lib/{dataStoreContext.mjs → dataStoreContext.js} +174 -133
- package/lib/dataStoreContext.js.map +1 -0
- package/lib/{dataStoreContexts.d.mts → dataStoreContexts.d.ts} +2 -2
- package/lib/dataStoreContexts.d.ts.map +1 -0
- package/lib/{dataStoreContexts.mjs → dataStoreContexts.js} +1 -1
- package/lib/dataStoreContexts.js.map +1 -0
- package/lib/{dataStoreRegistry.d.mts → dataStoreRegistry.d.ts} +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -0
- package/lib/{dataStoreRegistry.mjs → dataStoreRegistry.js} +5 -1
- package/lib/dataStoreRegistry.js.map +1 -0
- package/{dist/deltaManagerProxyBase.d.ts → lib/deltaManagerSummarizerProxy.d.ts} +16 -7
- package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
- package/lib/deltaManagerSummarizerProxy.js +124 -0
- package/lib/deltaManagerSummarizerProxy.js.map +1 -0
- package/lib/{deltaScheduler.d.mts → deltaScheduler.d.ts} +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -0
- package/lib/{deltaScheduler.mjs → deltaScheduler.js} +1 -1
- package/lib/deltaScheduler.js.map +1 -0
- package/lib/{error.d.mts → error.d.ts} +1 -1
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +1 -1
- package/lib/error.js.map +1 -0
- package/lib/gc/{garbageCollection.d.mts → garbageCollection.d.ts} +23 -6
- package/lib/gc/garbageCollection.d.ts.map +1 -0
- package/lib/gc/{garbageCollection.mjs → garbageCollection.js} +103 -44
- package/lib/gc/garbageCollection.js.map +1 -0
- package/lib/gc/{gcConfigs.d.mts → gcConfigs.d.ts} +3 -3
- package/lib/gc/gcConfigs.d.ts.map +1 -0
- package/lib/gc/{gcConfigs.mjs → gcConfigs.js} +3 -3
- package/lib/gc/gcConfigs.js.map +1 -0
- package/lib/gc/{gcDefinitions.d.mts → gcDefinitions.d.ts} +30 -7
- package/lib/gc/gcDefinitions.d.ts.map +1 -0
- package/lib/gc/{gcDefinitions.mjs → gcDefinitions.js} +5 -1
- package/lib/gc/gcDefinitions.js.map +1 -0
- package/lib/gc/{gcHelpers.d.mts → gcHelpers.d.ts} +3 -3
- package/lib/gc/{gcHelpers.d.mts.map → gcHelpers.d.ts.map} +1 -1
- package/lib/gc/{gcHelpers.mjs → gcHelpers.js} +1 -1
- package/lib/gc/gcHelpers.js.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.d.mts → gcReferenceGraphAlgorithm.d.ts} +2 -2
- package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
- package/lib/gc/{gcReferenceGraphAlgorithm.mjs → gcReferenceGraphAlgorithm.js} +1 -1
- package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.d.mts → gcSummaryDefinitions.d.ts} +1 -1
- package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
- package/lib/gc/{gcSummaryDefinitions.mjs → gcSummaryDefinitions.js} +1 -1
- package/lib/gc/gcSummaryDefinitions.js.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.d.mts → gcSummaryStateTracker.d.ts} +13 -6
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
- package/lib/gc/{gcSummaryStateTracker.mjs → gcSummaryStateTracker.js} +17 -5
- package/lib/gc/gcSummaryStateTracker.js.map +1 -0
- package/lib/gc/{gcTelemetry.d.mts → gcTelemetry.d.ts} +8 -8
- package/lib/gc/gcTelemetry.d.ts.map +1 -0
- package/lib/gc/{gcTelemetry.mjs → gcTelemetry.js} +5 -5
- package/lib/gc/gcTelemetry.js.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.d.mts → gcUnreferencedStateTracker.d.ts} +7 -2
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
- package/lib/gc/{gcUnreferencedStateTracker.mjs → gcUnreferencedStateTracker.js} +12 -2
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
- package/lib/gc/{index.d.mts → index.d.ts} +9 -9
- package/lib/gc/index.d.ts.map +1 -0
- package/lib/gc/{index.mjs → index.js} +8 -8
- package/lib/gc/index.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +9 -21
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/{messageTypes.d.mts → messageTypes.d.ts} +5 -5
- package/lib/messageTypes.d.ts.map +1 -0
- package/lib/{messageTypes.mjs → messageTypes.js} +1 -1
- package/lib/messageTypes.js.map +1 -0
- package/lib/{metadata.d.mts → metadata.d.ts} +1 -1
- package/lib/metadata.d.ts.map +1 -0
- package/lib/{metadata.mjs → metadata.js} +1 -1
- package/lib/metadata.js.map +1 -0
- package/lib/opLifecycle/{batchManager.d.mts → batchManager.d.ts} +3 -3
- package/lib/opLifecycle/batchManager.d.ts.map +1 -0
- package/lib/opLifecycle/{batchManager.mjs → batchManager.js} +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -0
- package/lib/opLifecycle/{definitions.d.mts → definitions.d.ts} +3 -3
- package/lib/opLifecycle/definitions.d.ts.map +1 -0
- package/lib/opLifecycle/{definitions.mjs → definitions.js} +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -0
- package/lib/opLifecycle/index.d.ts +13 -0
- package/lib/opLifecycle/index.d.ts.map +1 -0
- package/lib/opLifecycle/index.js +12 -0
- package/lib/opLifecycle/index.js.map +1 -0
- package/lib/opLifecycle/{opCompressor.d.mts → opCompressor.d.ts} +2 -2
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
- package/lib/opLifecycle/{opCompressor.mjs → opCompressor.js} +3 -3
- package/lib/opLifecycle/opCompressor.js.map +1 -0
- package/lib/opLifecycle/{opDecompressor.d.mts → opDecompressor.d.ts} +2 -2
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
- package/lib/opLifecycle/{opDecompressor.mjs → opDecompressor.js} +2 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.d.mts → opGroupingManager.d.ts} +2 -2
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -0
- package/lib/opLifecycle/{opGroupingManager.mjs → opGroupingManager.js} +2 -11
- package/lib/opLifecycle/opGroupingManager.js.map +1 -0
- package/lib/opLifecycle/{opSplitter.d.mts → opSplitter.d.ts} +2 -2
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
- package/lib/opLifecycle/{opSplitter.mjs → opSplitter.js} +3 -3
- package/lib/opLifecycle/opSplitter.js.map +1 -0
- package/lib/opLifecycle/{outbox.d.mts → outbox.d.ts} +8 -8
- package/lib/opLifecycle/outbox.d.ts.map +1 -0
- package/lib/opLifecycle/{outbox.mjs → outbox.js} +12 -4
- package/lib/opLifecycle/outbox.js.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.d.mts → remoteMessageProcessor.d.ts} +5 -5
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
- package/lib/opLifecycle/{remoteMessageProcessor.mjs → remoteMessageProcessor.js} +2 -2
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
- package/lib/{opProperties.d.mts → opProperties.d.ts} +1 -1
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/{opProperties.mjs → opProperties.js} +1 -1
- package/lib/opProperties.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{pendingStateManager.d.mts → pendingStateManager.d.ts} +3 -2
- package/lib/pendingStateManager.d.ts.map +1 -0
- package/lib/{pendingStateManager.mjs → pendingStateManager.js} +18 -10
- package/lib/pendingStateManager.js.map +1 -0
- package/lib/{scheduleManager.d.mts → scheduleManager.d.ts} +6 -3
- package/lib/scheduleManager.d.ts.map +1 -0
- package/lib/{scheduleManager.mjs → scheduleManager.js} +3 -3
- package/lib/scheduleManager.js.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.d.mts → storageServiceWithAttachBlobs.d.ts} +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
- package/lib/{storageServiceWithAttachBlobs.mjs → storageServiceWithAttachBlobs.js} +1 -1
- package/lib/storageServiceWithAttachBlobs.js.map +1 -0
- package/lib/summary/{index.d.mts → index.d.ts} +13 -13
- package/lib/summary/index.d.ts.map +1 -0
- package/lib/summary/{index.mjs → index.js} +12 -12
- package/lib/summary/index.js.map +1 -0
- package/lib/summary/{orderedClientElection.d.mts → orderedClientElection.d.ts} +5 -1
- package/lib/summary/orderedClientElection.d.ts.map +1 -0
- package/lib/summary/{orderedClientElection.mjs → orderedClientElection.js} +2 -2
- package/lib/summary/orderedClientElection.js.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.d.mts → runWhileConnectedCoordinator.d.ts} +2 -2
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
- package/lib/summary/{runWhileConnectedCoordinator.mjs → runWhileConnectedCoordinator.js} +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
- package/lib/summary/{runningSummarizer.d.mts → runningSummarizer.d.ts} +12 -11
- package/lib/summary/runningSummarizer.d.ts.map +1 -0
- package/lib/summary/{runningSummarizer.mjs → runningSummarizer.js} +108 -75
- package/lib/summary/runningSummarizer.js.map +1 -0
- package/lib/summary/{summarizer.d.mts → summarizer.d.ts} +5 -5
- package/lib/summary/summarizer.d.ts.map +1 -0
- package/lib/summary/{summarizer.mjs → summarizer.js} +4 -4
- package/lib/summary/summarizer.js.map +1 -0
- package/lib/summary/{summarizerClientElection.d.mts → summarizerClientElection.d.ts} +3 -3
- package/lib/summary/summarizerClientElection.d.ts.map +1 -0
- package/lib/summary/{summarizerClientElection.mjs → summarizerClientElection.js} +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -0
- package/lib/summary/{summarizerHeuristics.d.mts → summarizerHeuristics.d.ts} +4 -4
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
- package/lib/summary/{summarizerHeuristics.mjs → summarizerHeuristics.js} +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -0
- package/lib/summary/summarizerNode/{index.d.mts → index.d.ts} +4 -4
- package/lib/summary/summarizerNode/index.d.ts.map +1 -0
- package/lib/summary/summarizerNode/index.js +7 -0
- package/lib/summary/summarizerNode/index.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.d.mts → summarizerNode.d.ts} +18 -8
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNode.mjs → summarizerNode.js} +41 -53
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.d.mts → summarizerNodeUtils.d.ts} +11 -20
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeUtils.mjs → summarizerNodeUtils.js} +1 -20
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.mts → summarizerNodeWithGc.d.ts} +6 -7
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
- package/lib/summary/summarizerNode/{summarizerNodeWithGc.mjs → summarizerNodeWithGc.js} +12 -12
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
- package/lib/summary/{summarizerTypes.d.mts → summarizerTypes.d.ts} +11 -22
- package/lib/summary/summarizerTypes.d.ts.map +1 -0
- package/lib/summary/{summarizerTypes.mjs → summarizerTypes.js} +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -0
- package/lib/summary/{summaryCollection.d.mts → summaryCollection.d.ts} +1 -1
- package/lib/summary/summaryCollection.d.ts.map +1 -0
- package/lib/summary/{summaryCollection.mjs → summaryCollection.js} +1 -1
- package/lib/summary/summaryCollection.js.map +1 -0
- package/lib/summary/{summaryFormat.d.mts → summaryFormat.d.ts} +16 -3
- package/lib/summary/summaryFormat.d.ts.map +1 -0
- package/lib/summary/{summaryFormat.mjs → summaryFormat.js} +1 -1
- package/lib/summary/summaryFormat.js.map +1 -0
- package/lib/summary/{summaryGenerator.d.mts → summaryGenerator.d.ts} +7 -6
- package/lib/summary/summaryGenerator.d.ts.map +1 -0
- package/lib/summary/{summaryGenerator.mjs → summaryGenerator.js} +11 -2
- package/lib/summary/summaryGenerator.js.map +1 -0
- package/lib/summary/{summaryManager.d.mts → summaryManager.d.ts} +6 -7
- package/lib/summary/summaryManager.d.ts.map +1 -0
- package/lib/summary/{summaryManager.mjs → summaryManager.js} +4 -5
- package/lib/summary/summaryManager.js.map +1 -0
- package/lib/test/batchTracker.spec.js +88 -0
- package/lib/test/batchTracker.spec.js.map +1 -0
- package/lib/test/blobManager.spec.js +835 -0
- package/lib/test/blobManager.spec.js.map +1 -0
- package/lib/test/channelCollection.spec.js +141 -0
- package/lib/test/channelCollection.spec.js.map +1 -0
- package/lib/test/containerRuntime.spec.js +1748 -0
- package/lib/test/containerRuntime.spec.js.map +1 -0
- package/lib/test/dataStoreContext.spec.js +801 -0
- package/lib/test/dataStoreContext.spec.js.map +1 -0
- package/lib/test/dataStoreCreation.spec.js +312 -0
- package/lib/test/dataStoreCreation.spec.js.map +1 -0
- package/lib/test/dataStoreRegistry.spec.js +26 -0
- package/lib/test/dataStoreRegistry.spec.js.map +1 -0
- package/lib/test/fuzz/fuzzUtils.js +66 -0
- package/lib/test/fuzz/fuzzUtils.js.map +1 -0
- package/lib/test/fuzz/summarizer.fuzz.spec.js +31 -0
- package/lib/test/fuzz/summarizer.fuzz.spec.js.map +1 -0
- package/lib/test/fuzz/summarizerFuzzMocks.js +162 -0
- package/lib/test/fuzz/summarizerFuzzMocks.js.map +1 -0
- package/lib/test/fuzz/summarizerFuzzSuite.js +106 -0
- package/lib/test/fuzz/summarizerFuzzSuite.js.map +1 -0
- package/lib/test/gc/garbageCollection.spec.js +1465 -0
- package/lib/test/gc/garbageCollection.spec.js.map +1 -0
- package/lib/test/gc/gcConfigs.spec.js +690 -0
- package/lib/test/gc/gcConfigs.spec.js.map +1 -0
- package/lib/test/gc/gcHelpers.spec.js +110 -0
- package/lib/test/gc/gcHelpers.spec.js.map +1 -0
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +68 -0
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +1 -0
- package/lib/test/gc/gcStats.spec.js +391 -0
- package/lib/test/gc/gcStats.spec.js.map +1 -0
- package/lib/test/gc/gcSummaryStateTracker.spec.js +228 -0
- package/lib/test/gc/gcSummaryStateTracker.spec.js.map +1 -0
- package/lib/test/gc/gcTelemetry.spec.js +530 -0
- package/lib/test/gc/gcTelemetry.spec.js.map +1 -0
- package/lib/test/gc/gcUnitTestHelpers.js +29 -0
- package/lib/test/gc/gcUnitTestHelpers.js.map +1 -0
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js +192 -0
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +1 -0
- package/lib/test/getPendingBlobs.spec.js +193 -0
- package/lib/test/getPendingBlobs.spec.js.map +1 -0
- package/lib/test/hardwareStats.spec.js +93 -0
- package/lib/test/hardwareStats.spec.js.map +1 -0
- package/lib/test/index.js +6 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/opLifecycle/OpGroupingManager.spec.js +225 -0
- package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +1 -0
- package/lib/test/opLifecycle/batchManager.spec.js +189 -0
- package/lib/test/opLifecycle/batchManager.spec.js.map +1 -0
- package/lib/test/opLifecycle/opCompressor.spec.js +74 -0
- package/lib/test/opLifecycle/opCompressor.spec.js.map +1 -0
- package/lib/test/opLifecycle/opDecompressor.spec.js +218 -0
- package/lib/test/opLifecycle/opDecompressor.spec.js.map +1 -0
- package/lib/test/opLifecycle/opSplitter.spec.js +272 -0
- package/lib/test/opLifecycle/opSplitter.spec.js.map +1 -0
- package/lib/test/opLifecycle/outbox.spec.js +675 -0
- package/lib/test/opLifecycle/outbox.spec.js.map +1 -0
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +196 -0
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +1 -0
- package/lib/test/pendingStateManager.spec.js +329 -0
- package/lib/test/pendingStateManager.spec.js.map +1 -0
- package/lib/test/scheduleManager.spec.js +270 -0
- package/lib/test/scheduleManager.spec.js.map +1 -0
- package/lib/test/summarizerNode.spec.js +326 -0
- package/lib/test/summarizerNode.spec.js.map +1 -0
- package/lib/test/summarizerNodeWithGc.spec.js +318 -0
- package/lib/test/summarizerNodeWithGc.spec.js.map +1 -0
- package/lib/test/summary/orderedClientElection.spec.js +535 -0
- package/lib/test/summary/orderedClientElection.spec.js.map +1 -0
- package/lib/test/summary/runningSummarizer.spec.js +1349 -0
- package/lib/test/summary/runningSummarizer.spec.js.map +1 -0
- package/lib/test/summary/summarizer.spec.js +29 -0
- package/lib/test/summary/summarizer.spec.js.map +1 -0
- package/lib/test/summary/summarizerClientElection.spec.js +436 -0
- package/lib/test/summary/summarizerClientElection.spec.js.map +1 -0
- package/lib/test/summary/summarizerHeuristics.spec.js +289 -0
- package/lib/test/summary/summarizerHeuristics.spec.js.map +1 -0
- package/lib/test/summary/summaryCollection.spec.js +200 -0
- package/lib/test/summary/summaryCollection.spec.js.map +1 -0
- package/lib/test/summary/summaryManager.spec.js +430 -0
- package/lib/test/summary/summaryManager.spec.js.map +1 -0
- package/lib/test/summary/testQuorumClients.js +34 -0
- package/lib/test/summary/testQuorumClients.js.map +1 -0
- package/lib/test/throttler.spec.js +175 -0
- package/lib/test/throttler.spec.js.map +1 -0
- package/lib/test/types/validateContainerRuntimePrevious.generated.js +180 -0
- package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +1 -0
- package/lib/{throttler.d.mts → throttler.d.ts} +1 -1
- package/lib/throttler.d.ts.map +1 -0
- package/lib/{throttler.mjs → throttler.js} +1 -1
- package/lib/throttler.js.map +1 -0
- package/package.json +99 -88
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +1 -1
- package/src/{dataStores.ts → channelCollection.ts} +520 -84
- package/src/connectionTelemetry.ts +42 -3
- package/src/containerHandleContext.ts +1 -1
- package/src/containerRuntime.ts +661 -464
- package/src/dataStore.ts +13 -15
- package/src/dataStoreContext.ts +257 -184
- package/src/dataStoreContexts.ts +1 -1
- package/src/deltaManagerSummarizerProxy.ts +132 -7
- package/src/gc/garbageCollection.ts +121 -46
- package/src/gc/gcConfigs.ts +3 -3
- package/src/gc/gcDefinitions.ts +30 -7
- package/src/gc/gcHelpers.ts +2 -2
- package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
- package/src/gc/gcSummaryStateTracker.ts +19 -7
- package/src/gc/gcTelemetry.ts +10 -9
- package/src/gc/gcUnreferencedStateTracker.ts +12 -1
- package/src/gc/index.ts +10 -8
- package/src/index.ts +16 -27
- package/src/messageTypes.ts +4 -4
- package/src/opLifecycle/README.md +2 -4
- package/src/opLifecycle/batchManager.ts +2 -2
- package/src/opLifecycle/definitions.ts +2 -2
- package/src/opLifecycle/index.ts +8 -8
- package/src/opLifecycle/opCompressor.ts +3 -3
- package/src/opLifecycle/opDecompressor.ts +3 -3
- package/src/opLifecycle/opGroupingManager.ts +3 -12
- package/src/opLifecycle/opSplitter.ts +3 -3
- package/src/opLifecycle/outbox.ts +29 -9
- package/src/opLifecycle/remoteMessageProcessor.ts +4 -4
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +19 -13
- package/src/scheduleManager.ts +4 -4
- package/src/summary/index.ts +13 -12
- package/src/summary/orderedClientElection.ts +1 -1
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +141 -93
- package/src/summary/summarizer.ts +7 -7
- package/src/summary/summarizerClientElection.ts +2 -2
- package/src/summary/summarizerHeuristics.ts +3 -3
- package/src/summary/summarizerNode/index.ts +6 -3
- package/src/summary/summarizerNode/summarizerNode.ts +54 -69
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +16 -34
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +11 -17
- package/src/summary/summarizerTypes.ts +12 -24
- package/src/summary/summaryFormat.ts +16 -2
- package/src/summary/summaryGenerator.ts +16 -4
- package/src/summary/summaryManager.ts +6 -7
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/dist/dataStores.d.ts +0 -149
- package/dist/dataStores.d.ts.map +0 -1
- package/dist/dataStores.js.map +0 -1
- package/dist/deltaManagerProxyBase.d.ts.map +0 -1
- package/dist/deltaManagerProxyBase.js +0 -77
- package/dist/deltaManagerProxyBase.js.map +0 -1
- package/lib/batchTracker.d.mts.map +0 -1
- package/lib/batchTracker.mjs.map +0 -1
- package/lib/blobManager.d.mts.map +0 -1
- package/lib/blobManager.mjs.map +0 -1
- package/lib/connectionTelemetry.d.mts.map +0 -1
- package/lib/connectionTelemetry.mjs.map +0 -1
- package/lib/containerHandleContext.d.mts.map +0 -1
- package/lib/containerHandleContext.mjs.map +0 -1
- package/lib/containerRuntime.d.mts.map +0 -1
- package/lib/containerRuntime.mjs.map +0 -1
- package/lib/dataStore.d.mts.map +0 -1
- package/lib/dataStore.mjs.map +0 -1
- package/lib/dataStoreContext.d.mts.map +0 -1
- package/lib/dataStoreContext.mjs.map +0 -1
- package/lib/dataStoreContexts.d.mts.map +0 -1
- package/lib/dataStoreContexts.mjs.map +0 -1
- package/lib/dataStoreRegistry.d.mts.map +0 -1
- package/lib/dataStoreRegistry.mjs.map +0 -1
- package/lib/dataStores.d.mts +0 -149
- package/lib/dataStores.d.mts.map +0 -1
- package/lib/dataStores.mjs.map +0 -1
- package/lib/deltaManagerProxyBase.d.mts +0 -35
- package/lib/deltaManagerProxyBase.d.mts.map +0 -1
- package/lib/deltaManagerProxyBase.mjs +0 -73
- package/lib/deltaManagerProxyBase.mjs.map +0 -1
- package/lib/deltaManagerSummarizerProxy.d.mts +0 -19
- package/lib/deltaManagerSummarizerProxy.d.mts.map +0 -1
- package/lib/deltaManagerSummarizerProxy.mjs +0 -38
- package/lib/deltaManagerSummarizerProxy.mjs.map +0 -1
- package/lib/deltaScheduler.d.mts.map +0 -1
- package/lib/deltaScheduler.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/gc/garbageCollection.d.mts.map +0 -1
- package/lib/gc/garbageCollection.mjs.map +0 -1
- package/lib/gc/gcConfigs.d.mts.map +0 -1
- package/lib/gc/gcConfigs.mjs.map +0 -1
- package/lib/gc/gcDefinitions.d.mts.map +0 -1
- package/lib/gc/gcDefinitions.mjs.map +0 -1
- package/lib/gc/gcHelpers.mjs.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +0 -1
- package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +0 -1
- package/lib/gc/gcSummaryDefinitions.d.mts.map +0 -1
- package/lib/gc/gcSummaryDefinitions.mjs.map +0 -1
- package/lib/gc/gcSummaryStateTracker.d.mts.map +0 -1
- package/lib/gc/gcSummaryStateTracker.mjs.map +0 -1
- package/lib/gc/gcTelemetry.d.mts.map +0 -1
- package/lib/gc/gcTelemetry.mjs.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.d.mts.map +0 -1
- package/lib/gc/gcUnreferencedStateTracker.mjs.map +0 -1
- package/lib/gc/index.d.mts.map +0 -1
- package/lib/gc/index.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -24
- package/lib/index.mjs.map +0 -1
- package/lib/messageTypes.d.mts.map +0 -1
- package/lib/messageTypes.mjs.map +0 -1
- package/lib/metadata.d.mts.map +0 -1
- package/lib/metadata.mjs.map +0 -1
- package/lib/opLifecycle/batchManager.d.mts.map +0 -1
- package/lib/opLifecycle/batchManager.mjs.map +0 -1
- package/lib/opLifecycle/definitions.d.mts.map +0 -1
- package/lib/opLifecycle/definitions.mjs.map +0 -1
- package/lib/opLifecycle/index.d.mts +0 -13
- package/lib/opLifecycle/index.d.mts.map +0 -1
- package/lib/opLifecycle/index.mjs +0 -12
- package/lib/opLifecycle/index.mjs.map +0 -1
- package/lib/opLifecycle/opCompressor.d.mts.map +0 -1
- package/lib/opLifecycle/opCompressor.mjs.map +0 -1
- package/lib/opLifecycle/opDecompressor.d.mts.map +0 -1
- package/lib/opLifecycle/opDecompressor.mjs.map +0 -1
- package/lib/opLifecycle/opGroupingManager.d.mts.map +0 -1
- package/lib/opLifecycle/opGroupingManager.mjs.map +0 -1
- package/lib/opLifecycle/opSplitter.d.mts.map +0 -1
- package/lib/opLifecycle/opSplitter.mjs.map +0 -1
- package/lib/opLifecycle/outbox.d.mts.map +0 -1
- package/lib/opLifecycle/outbox.mjs.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +0 -1
- package/lib/opLifecycle/remoteMessageProcessor.mjs.map +0 -1
- package/lib/opProperties.d.mts.map +0 -1
- package/lib/opProperties.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/pendingStateManager.d.mts.map +0 -1
- package/lib/pendingStateManager.mjs.map +0 -1
- package/lib/scheduleManager.d.mts.map +0 -1
- package/lib/scheduleManager.mjs.map +0 -1
- package/lib/storageServiceWithAttachBlobs.d.mts.map +0 -1
- package/lib/storageServiceWithAttachBlobs.mjs.map +0 -1
- package/lib/summary/index.d.mts.map +0 -1
- package/lib/summary/index.mjs.map +0 -1
- package/lib/summary/orderedClientElection.d.mts.map +0 -1
- package/lib/summary/orderedClientElection.mjs.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.d.mts.map +0 -1
- package/lib/summary/runWhileConnectedCoordinator.mjs.map +0 -1
- package/lib/summary/runningSummarizer.d.mts.map +0 -1
- package/lib/summary/runningSummarizer.mjs.map +0 -1
- package/lib/summary/summarizer.d.mts.map +0 -1
- package/lib/summary/summarizer.mjs.map +0 -1
- package/lib/summary/summarizerClientElection.d.mts.map +0 -1
- package/lib/summary/summarizerClientElection.mjs.map +0 -1
- package/lib/summary/summarizerHeuristics.d.mts.map +0 -1
- package/lib/summary/summarizerHeuristics.mjs.map +0 -1
- package/lib/summary/summarizerNode/index.d.mts.map +0 -1
- package/lib/summary/summarizerNode/index.mjs +0 -7
- package/lib/summary/summarizerNode/index.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNode.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +0 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +0 -1
- package/lib/summary/summarizerTypes.d.mts.map +0 -1
- package/lib/summary/summarizerTypes.mjs.map +0 -1
- package/lib/summary/summaryCollection.d.mts.map +0 -1
- package/lib/summary/summaryCollection.mjs.map +0 -1
- package/lib/summary/summaryFormat.d.mts.map +0 -1
- package/lib/summary/summaryFormat.mjs.map +0 -1
- package/lib/summary/summaryGenerator.d.mts.map +0 -1
- package/lib/summary/summaryGenerator.mjs.map +0 -1
- package/lib/summary/summaryManager.d.mts.map +0 -1
- package/lib/summary/summaryManager.mjs.map +0 -1
- package/lib/throttler.d.mts.map +0 -1
- package/lib/throttler.mjs.map +0 -1
- package/src/deltaManagerProxyBase.ts +0 -111
package/dist/blobManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAQlC,iEAKuC;AACvC,2DAA8D;AAC9D,+DAAiG;AAKjG,iFAA6F;AAC7F,qEAOyC;AAOzC,+DAA6E;AAG7E;;;;;;GAMG;AACH,MAAa,UAAU;IAGtB,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;IACtD,CAAC;IAID,YACiB,IAA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AC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport { bufferToString, stringToBuffer, TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState, ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n\tcreateChildMonitoringContext,\n\tGenericError,\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\n\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils\";\nimport { IBlobMetadata } from \"./metadata\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle implements IFluidHandle<ArrayBufferLike> {\n\tprivate attached: boolean = false;\n\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<any>,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph() {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n\n\tpublic bind(handle: IFluidHandle) {\n\t\tthrow new Error(\"Cannot bind to blob handle\");\n\t}\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n * @alpha\n */\nexport interface IBlobManagerLoadInfo {\n\tids?: string[];\n\tredirectTable?: [string, string][];\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"logger\" | \"clientDetails\"\n> &\n\tTypedEventEmitter<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse & Partial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\tuploading?: boolean;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n\tpendingStashed?: boolean;\n}\n\nexport interface IPendingBlobs {\n\t[id: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tattached?: boolean;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents {\n\t(event: \"noPendingBlobs\", listener: () => void);\n}\n\nexport class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {\n\tpublic static readonly basePath = \"_blobs\";\n\tprivate static readonly redirectTableBlobName = \".redirectTable\";\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (id → id) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, string[]> = new Map();\n\n\t/**\n\t * This stores IDs of tombstoned blobs.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t */\n\tprivate readonly tombstonedBlobs: Set<string> = new Set();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId?: string) => void;\n\tprivate stopAttaching: boolean = false;\n\n\tconstructor(\n\t\tprivate readonly routeContext: IFluidHandleContext,\n\t\tsnapshot: IBlobManagerLoadInfo,\n\t\tprivate readonly getStorage: () => IDocumentStorageService,\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId?: string) => void,\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<BlobManager.basePath>/<blobId>`.\n\t\tprivate readonly blobRequested: (blobPath: string) => void,\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<BlobManager.basePath>/<blobId>`.\n\t\tprivate readonly isBlobDeleted: (blobPath: string) => boolean,\n\t\tprivate readonly runtime: IBlobManagerRuntime,\n\t\tstashedBlobs: IPendingBlobs = {},\n\t\tprivate readonly closeContainer: (error?: ICriticalContainerError) => void,\n\t) {\n\t\tsuper();\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.logger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = this.load(snapshot);\n\n\t\t// Begin uploading stashed blobs from previous container instance\n\t\tObject.entries(stashedBlobs).forEach(([localId, entry]) => {\n\t\t\tconst blob = stringToBuffer(entry.blob, \"base64\");\n\t\t\tconst attached = entry.attached;\n\t\t\tconst acked = entry.acked;\n\t\t\tconst storageId = entry.storageId; // entry.storageId = response.id\n\t\t\tif (entry.minTTLInSeconds && entry.uploadTime) {\n\t\t\t\tconst timeLapseSinceLocalUpload = (Date.now() - entry.uploadTime) / 1000;\n\t\t\t\t// stashed entries with more than half-life in storage will not be reuploaded\n\t\t\t\tif (entry.minTTLInSeconds - timeLapseSinceLocalUpload > entry.minTTLInSeconds / 2) {\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\tblob,\n\t\t\t\t\t\tuploading: false,\n\t\t\t\t\t\topsent: true,\n\t\t\t\t\t\thandleP: new Deferred(),\n\t\t\t\t\t\tstorageId,\n\t\t\t\t\t\tuploadP: undefined,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tattached,\n\t\t\t\t\t\tacked,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\tblob,\n\t\t\t\tuploading: true,\n\t\t\t\thandleP: new Deferred(),\n\t\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\t\tattached,\n\t\t\t\tacked,\n\t\t\t\topsent: true,\n\t\t\t\tpendingStashed: true,\n\t\t\t});\n\t\t});\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId?: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// we want to avoid submitting ops with broken handles\n\t\t\t\t\tthis.closeContainer(\n\t\t\t\t\t\tnew GenericError(\n\t\t\t\t\t\t\t\"Trying to submit a BlobAttach for expired blob\",\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlocalId,\n\t\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\treturn sendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const [, entry] of this.pendingBlobs) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob) {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasPendingStashedBlobs(): boolean {\n\t\treturn Array.from(this.pendingBlobs.values()).some((e) => e.pendingStashed === true);\n\t}\n\t/**\n\t * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.\n\t */\n\tpublic async processStashedChanges() {\n\t\tconst pendingUploads = Array.from(this.pendingBlobs.values())\n\t\t\t.filter((e) => e.pendingStashed === true)\n\t\t\t.map(async (e) => e.uploadP);\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"BlobUploadProcessStashedChanges\",\n\t\t\t\tcount: pendingUploads.length,\n\t\t\t},\n\t\t\tasync () => Promise.all(pendingUploads),\n\t\t\t{ start: true, end: true },\n\t\t);\n\t}\n\n\t/**\n\t * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is\n\t * detached or there are no (non-pending) attachment blobs in the document\n\t */\n\tprivate get storageIds(): Set<string> {\n\t\tconst ids = new Set<string | undefined>(this.redirectTable.values());\n\n\t\t// If we are detached, we will not have storage IDs, only undefined\n\t\tconst undefinedValueInTable = ids.delete(undefined);\n\n\t\t// For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n\t\t// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n\t\tassert(\n\t\t\t!undefinedValueInTable ||\n\t\t\t\t(this.runtime.attachState === AttachState.Detached && ids.size === 0),\n\t\t\t0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */,\n\t\t);\n\n\t\treturn ids as Set<string>;\n\t}\n\n\tpublic async getBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!attachedStorageId, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\tstorageId = attachedStorageId;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync () => {\n\t\t\t\treturn this.getStorage().readBlob(storageId);\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(id: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(id) || this.pendingBlobs.has(id),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(id);\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\tthis.emit(\"blobAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(id);\n\t\t\t }\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\t`${BlobManager.basePath}/${id}`,\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(id),\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.getStorage().createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = uuid();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\tuploading: true,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = () => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.getStorage().createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined) {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(id: string) {\n\t\tif (this.pendingBlobs.has(id)) {\n\t\t\tconst entry = this.pendingBlobs.get(id);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string) {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(localId: string, response: ICreateBlobResponseWithTTL) {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.uploading === true,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 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\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tif (this.storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tthis.opsInFlight.set(\n\t\t\t\tresponse.id,\n\t\t\t\t(this.opsInFlight.get(response.id) ?? []).concat(localId),\n\t\t\t);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined) {\n\t\tassert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n\t\tconst { localId, blobId }: { localId?: string; blobId?: string } = metadata;\n\t\tassert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\n\t\tif (!blobId) {\n\t\t\t// We submitted this op while offline. The blob should have been uploaded by now.\n\t\t\tassert(\n\t\t\t\tpendingEntry?.opsent === true && !!pendingEntry?.storageId,\n\t\t\t\t0x38d /* blob must be uploaded before resubmitting BlobAttach op */,\n\t\t\t);\n\t\t\treturn this.sendBlobAttachOp(localId, pendingEntry?.storageId);\n\t\t}\n\t\treturn this.sendBlobAttachOp(localId, blobId);\n\t}\n\n\tpublic processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst localId = (message.metadata as IBlobMetadata | undefined)?.localId;\n\t\tconst blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;\n\n\t\tif (localId) {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (pendingEntry?.pendingStashed) {\n\t\t\t\tpendingEntry.pendingStashed = false;\n\t\t\t}\n\t\t}\n\t\tassert(blobId !== undefined, 0x12a /* \"Missing blob id on metadata\" */);\n\n\t\t// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be\n\t\t// requested from the server.\n\t\t// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that\n\t\t// was sent when online.\n\t\tif (localId !== undefined) {\n\t\t\tthis.setRedirection(localId, blobId);\n\t\t}\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tif (local) {\n\t\t\tassert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\twaitingBlobs.forEach((pendingLocalId) => {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(pendingLocalId));\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t});\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tlocalEntry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Reads blobs needed to load BlobManager from storage.\n\t * @param blobsTree - Tree containing IDs of previously attached blobs. We\n\t * look for the IDs in the blob entries of the tree since the both the r11s\n\t * and SPO drivers replace the attachment types returned in snapshot() with blobs.\n\t */\n\tpublic static async load(\n\t\tblobsTree: ISnapshotTree | undefined,\n\t\ttryFetchBlob: (id: string) => Promise<[string, string][]>,\n\t): Promise<IBlobManagerLoadInfo> {\n\t\tif (!blobsTree) {\n\t\t\treturn {};\n\t\t}\n\t\tlet redirectTable;\n\t\tconst tableId = blobsTree.blobs[this.redirectTableBlobName];\n\t\tif (tableId) {\n\t\t\tredirectTable = await tryFetchBlob(tableId);\n\t\t}\n\t\tconst ids = Object.entries(blobsTree.blobs)\n\t\t\t.filter(([k, _]) => k !== this.redirectTableBlobName)\n\t\t\t.map(([_, v]) => v);\n\t\treturn { ids, redirectTable };\n\t}\n\n\t/**\n\t * Load a set of previously attached blob IDs and redirect table from a previous snapshot.\n\t */\n\tprivate load(snapshot: IBlobManagerLoadInfo): Map<string, string | undefined> {\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"AttachmentBlobsLoaded\",\n\t\t\tcount: snapshot.ids?.length ?? 0,\n\t\t\tredirectTable: snapshot.redirectTable?.length,\n\t\t});\n\t\tconst table = new Map<string, string | undefined>(snapshot.redirectTable);\n\t\tif (snapshot.ids) {\n\t\t\tconst detached = this.runtime.attachState === AttachState.Detached;\n\t\t\t// If we are detached, we don't have storage IDs yet, so set to undefined\n\t\t\t// Otherwise, set identity (id -> id) entries\n\t\t\tsnapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));\n\t\t}\n\t\treturn table;\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\t// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n\t\tconst blobIds =\n\t\t\tthis.storageIds.size > 0\n\t\t\t\t? Array.from(this.storageIds)\n\t\t\t\t: Array.from(this.redirectTable.keys());\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tblobIds.forEach((blobId) => {\n\t\t\tbuilder.addAttachment(blobId);\n\t\t});\n\n\t\t// Any non-identity entries in the table need to be saved in the summary\n\t\tif (this.redirectTable.size > blobIds.length) {\n\t\t\tbuilder.addBlob(\n\t\t\t\tBlobManager.redirectTableBlobName,\n\t\t\t\t// filter out identity entries\n\t\t\t\tJSON.stringify(\n\t\t\t\t\tArray.from(this.redirectTable.entries()).filter(\n\t\t\t\t\t\t([localId, storageId]) => localId !== storageId,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * This is called to update blobs whose routes are unused. The unused blobs are deleted.\n\t * @param unusedRoutes - The routes of the blob nodes that are unused. These routes will be based off of local ids.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: readonly string[]): void {\n\t\tthis.deleteBlobsFromRedirectTable(unusedRoutes);\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn Array.from(sweepReadyBlobRoutes);\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t * The routes are GC nodes paths of format -`/<BlobManager.basePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t * 1. The redirect table entry for the local ids are deleted.\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]) {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update blobs whose routes are tombstones.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t *\n\t * @param tombstonedRoutes - The routes of blob nodes that are tombstones.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {\n\t\tconst tombstonedBlobsSet: Set<string> = new Set();\n\t\t// The routes or blob node paths are in the same format as returned in getGCData -\n\t\t// `/<BlobManager.basePath>/<blobId>`.\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\ttombstonedBlobsSet.add(blobId);\n\t\t}\n\n\t\t// Remove blobs from the tombstone list that were tombstoned but aren't anymore as per the tombstoneRoutes.\n\t\tfor (const blobId of this.tombstonedBlobs) {\n\t\t\tif (!tombstonedBlobsSet.has(blobId)) {\n\t\t\t\tthis.tombstonedBlobs.delete(blobId);\n\t\t\t}\n\t\t}\n\n\t\t// Mark blobs that are now tombstoned by adding them to the tombstone list.\n\t\tfor (const blobId of tombstonedBlobsSet) {\n\t\t\tthis.tombstonedBlobs.add(blobId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string) {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: BlobManager.basePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>) {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(\n\t\t\t\tthis.redirectTable.has(localId),\n\t\t\t\t0x254 /* \"unrecognized id in redirect table\" */,\n\t\t\t);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"GetPendingBlobs\" },\n\t\t\tasync () => {\n\t\t\t\tif (this.pendingBlobs.size === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst blobs = {};\n\t\t\t\tconst localBlobs = new Set<PendingBlob>();\n\t\t\t\twhile (localBlobs.size < this.pendingBlobs.size) {\n\t\t\t\t\tconst attachBlobsP: Promise<void>[] = [];\n\t\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\t\tif (!localBlobs.has(entry)) {\n\t\t\t\t\t\t\tlocalBlobs.add(entry);\n\t\t\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(id));\n\t\t\t\t\t\t\tattachBlobsP.push(\n\t\t\t\t\t\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\t\t\tstopBlobAttachingSignal?.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\"abort\",\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.stopAttaching = true;\n\t\t\t\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{ once: true },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst onBlobAttached = (attachedEntry) => {\n\t\t\t\t\t\t\t\t\t\tif (attachedEntry === entry) {\n\t\t\t\t\t\t\t\t\t\t\tthis.off(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif (!entry.attached) {\n\t\t\t\t\t\t\t\t\t\tthis.on(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tawait Promise.allSettled(attachBlobsP).catch(() => {});\n\t\t\t\t}\n\n\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\tif (stopBlobAttachingSignal?.aborted && !entry.attached) {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"UnableToStashBlob\",\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tassert(entry.attached === true, 0x790 /* stashed blob should be attached */);\n\t\t\t\t\tif (!entry.opsent) {\n\t\t\t\t\t\tthis.sendBlobAttachOp(id, entry.storageId);\n\t\t\t\t\t}\n\t\t\t\t\tblobs[id] = {\n\t\t\t\t\t\tblob: bufferToString(entry.blob, \"base64\"),\n\t\t\t\t\t\tstorageId: entry.storageId,\n\t\t\t\t\t\tattached: entry.attached,\n\t\t\t\t\t\tacked: entry.acked,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn Object.keys(blobs).length > 0 ? blobs : undefined;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nfunction getGCNodePathFromBlobId(blobId: string) {\n\treturn `/${BlobManager.basePath}/${blobId}`;\n}\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<BlobManager.basePath>/<blobId>`.\n */\nfunction getBlobIdFromGCNodePath(nodePath: string) {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(\n\t\tpathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n\t\t0x5bd /* Invalid blob node path */,\n\t);\n\treturn pathParts[2];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobManager.js","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,IAAI,WAAW,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,QAAgB;IAChD,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,IAAA,mBAAM,EACL,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,QAAQ,EAC/D,KAAK,CAAC,4BAA4B,CAClC,CAAC;IACF,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n\tSummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport { bufferToString, stringToBuffer, TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState, ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n\tcreateChildMonitoringContext,\n\tGenericError,\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\n\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils\";\nimport { IBlobMetadata } from \"./metadata.js\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle implements IFluidHandle<ArrayBufferLike> {\n\tprivate attached: boolean = false;\n\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<any>,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph() {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n\n\tpublic bind(handle: IFluidHandle) {\n\t\tthrow new Error(\"Cannot bind to blob handle\");\n\t}\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n * @alpha\n */\nexport interface IBlobManagerLoadInfo {\n\tids?: string[];\n\tredirectTable?: [string, string][];\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"logger\" | \"clientDetails\"\n> &\n\tTypedEventEmitter<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse & Partial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\tuploading?: boolean;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n\tpendingStashed?: boolean;\n}\n\nexport interface IPendingBlobs {\n\t[id: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tattached?: boolean;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents {\n\t(event: \"noPendingBlobs\", listener: () => void);\n}\n\nexport class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {\n\tpublic static readonly basePath = \"_blobs\";\n\tprivate static readonly redirectTableBlobName = \".redirectTable\";\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (id → id) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, string[]> = new Map();\n\n\t/**\n\t * This stores IDs of tombstoned blobs.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t */\n\tprivate readonly tombstonedBlobs: Set<string> = new Set();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId?: string) => void;\n\tprivate stopAttaching: boolean = false;\n\n\tconstructor(\n\t\tprivate readonly routeContext: IFluidHandleContext,\n\t\tsnapshot: IBlobManagerLoadInfo,\n\t\tprivate readonly getStorage: () => IDocumentStorageService,\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId?: string) => void,\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<BlobManager.basePath>/<blobId>`.\n\t\tprivate readonly blobRequested: (blobPath: string) => void,\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<BlobManager.basePath>/<blobId>`.\n\t\tprivate readonly isBlobDeleted: (blobPath: string) => boolean,\n\t\tprivate readonly runtime: IBlobManagerRuntime,\n\t\tstashedBlobs: IPendingBlobs = {},\n\t\tprivate readonly closeContainer: (error?: ICriticalContainerError) => void,\n\t) {\n\t\tsuper();\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.logger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = this.load(snapshot);\n\n\t\t// Begin uploading stashed blobs from previous container instance\n\t\tObject.entries(stashedBlobs).forEach(([localId, entry]) => {\n\t\t\tconst blob = stringToBuffer(entry.blob, \"base64\");\n\t\t\tconst attached = entry.attached;\n\t\t\tconst acked = entry.acked;\n\t\t\tconst storageId = entry.storageId; // entry.storageId = response.id\n\t\t\tif (entry.minTTLInSeconds && entry.uploadTime) {\n\t\t\t\tconst timeLapseSinceLocalUpload = (Date.now() - entry.uploadTime) / 1000;\n\t\t\t\t// stashed entries with more than half-life in storage will not be reuploaded\n\t\t\t\tif (entry.minTTLInSeconds - timeLapseSinceLocalUpload > entry.minTTLInSeconds / 2) {\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\tblob,\n\t\t\t\t\t\tuploading: false,\n\t\t\t\t\t\topsent: true,\n\t\t\t\t\t\thandleP: new Deferred(),\n\t\t\t\t\t\tstorageId,\n\t\t\t\t\t\tuploadP: undefined,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tattached,\n\t\t\t\t\t\tacked,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\tblob,\n\t\t\t\tuploading: true,\n\t\t\t\thandleP: new Deferred(),\n\t\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\t\tattached,\n\t\t\t\tacked,\n\t\t\t\topsent: true,\n\t\t\t\tpendingStashed: true,\n\t\t\t});\n\t\t});\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId?: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// we want to avoid submitting ops with broken handles\n\t\t\t\t\tthis.closeContainer(\n\t\t\t\t\t\tnew GenericError(\n\t\t\t\t\t\t\t\"Trying to submit a BlobAttach for expired blob\",\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlocalId,\n\t\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\treturn sendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const [, entry] of this.pendingBlobs) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob) {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasPendingStashedBlobs(): boolean {\n\t\treturn Array.from(this.pendingBlobs.values()).some((e) => e.pendingStashed === true);\n\t}\n\t/**\n\t * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.\n\t */\n\tpublic async processStashedChanges() {\n\t\tconst pendingUploads = Array.from(this.pendingBlobs.values())\n\t\t\t.filter((e) => e.pendingStashed === true)\n\t\t\t.map(async (e) => e.uploadP);\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"BlobUploadProcessStashedChanges\",\n\t\t\t\tcount: pendingUploads.length,\n\t\t\t},\n\t\t\tasync () => Promise.all(pendingUploads),\n\t\t\t{ start: true, end: true },\n\t\t);\n\t}\n\n\t/**\n\t * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is\n\t * detached or there are no (non-pending) attachment blobs in the document\n\t */\n\tprivate get storageIds(): Set<string> {\n\t\tconst ids = new Set<string | undefined>(this.redirectTable.values());\n\n\t\t// If we are detached, we will not have storage IDs, only undefined\n\t\tconst undefinedValueInTable = ids.delete(undefined);\n\n\t\t// For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n\t\t// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n\t\tassert(\n\t\t\t!undefinedValueInTable ||\n\t\t\t\t(this.runtime.attachState === AttachState.Detached && ids.size === 0),\n\t\t\t0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */,\n\t\t);\n\n\t\treturn ids as Set<string>;\n\t}\n\n\tpublic async getBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!attachedStorageId, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\tstorageId = attachedStorageId;\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync () => {\n\t\t\t\treturn this.getStorage().readBlob(storageId);\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(id: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(id) || this.pendingBlobs.has(id),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(id);\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\tthis.emit(\"blobAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(id);\n\t\t\t }\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\t`${BlobManager.basePath}/${id}`,\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(id),\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.getStorage().createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandle<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = uuid();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\tuploading: true,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = () => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.getStorage().createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined) {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(id: string) {\n\t\tif (this.pendingBlobs.has(id)) {\n\t\t\tconst entry = this.pendingBlobs.get(id);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(id);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string) {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(localId: string, response: ICreateBlobResponseWithTTL) {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.uploading === true,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 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\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tif (this.storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tthis.opsInFlight.set(\n\t\t\t\tresponse.id,\n\t\t\t\t(this.opsInFlight.get(response.id) ?? []).concat(localId),\n\t\t\t);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined) {\n\t\tassert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n\t\tconst { localId, blobId }: { localId?: string; blobId?: string } = metadata;\n\t\tassert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\n\t\tif (!blobId) {\n\t\t\t// We submitted this op while offline. The blob should have been uploaded by now.\n\t\t\tassert(\n\t\t\t\tpendingEntry?.opsent === true && !!pendingEntry?.storageId,\n\t\t\t\t0x38d /* blob must be uploaded before resubmitting BlobAttach op */,\n\t\t\t);\n\t\t\treturn this.sendBlobAttachOp(localId, pendingEntry?.storageId);\n\t\t}\n\t\treturn this.sendBlobAttachOp(localId, blobId);\n\t}\n\n\tpublic processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst localId = (message.metadata as IBlobMetadata | undefined)?.localId;\n\t\tconst blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;\n\n\t\tif (localId) {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (pendingEntry?.pendingStashed) {\n\t\t\t\tpendingEntry.pendingStashed = false;\n\t\t\t}\n\t\t}\n\t\tassert(blobId !== undefined, 0x12a /* \"Missing blob id on metadata\" */);\n\n\t\t// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be\n\t\t// requested from the server.\n\t\t// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that\n\t\t// was sent when online.\n\t\tif (localId !== undefined) {\n\t\t\tthis.setRedirection(localId, blobId);\n\t\t}\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tif (local) {\n\t\t\tassert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\twaitingBlobs.forEach((pendingLocalId) => {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(pendingLocalId));\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t});\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tlocalEntry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Reads blobs needed to load BlobManager from storage.\n\t * @param blobsTree - Tree containing IDs of previously attached blobs. We\n\t * look for the IDs in the blob entries of the tree since the both the r11s\n\t * and SPO drivers replace the attachment types returned in snapshot() with blobs.\n\t */\n\tpublic static async load(\n\t\tblobsTree: ISnapshotTree | undefined,\n\t\ttryFetchBlob: (id: string) => Promise<[string, string][]>,\n\t): Promise<IBlobManagerLoadInfo> {\n\t\tif (!blobsTree) {\n\t\t\treturn {};\n\t\t}\n\t\tlet redirectTable;\n\t\tconst tableId = blobsTree.blobs[this.redirectTableBlobName];\n\t\tif (tableId) {\n\t\t\tredirectTable = await tryFetchBlob(tableId);\n\t\t}\n\t\tconst ids = Object.entries(blobsTree.blobs)\n\t\t\t.filter(([k, _]) => k !== this.redirectTableBlobName)\n\t\t\t.map(([_, v]) => v);\n\t\treturn { ids, redirectTable };\n\t}\n\n\t/**\n\t * Load a set of previously attached blob IDs and redirect table from a previous snapshot.\n\t */\n\tprivate load(snapshot: IBlobManagerLoadInfo): Map<string, string | undefined> {\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"AttachmentBlobsLoaded\",\n\t\t\tcount: snapshot.ids?.length ?? 0,\n\t\t\tredirectTable: snapshot.redirectTable?.length,\n\t\t});\n\t\tconst table = new Map<string, string | undefined>(snapshot.redirectTable);\n\t\tif (snapshot.ids) {\n\t\t\tconst detached = this.runtime.attachState === AttachState.Detached;\n\t\t\t// If we are detached, we don't have storage IDs yet, so set to undefined\n\t\t\t// Otherwise, set identity (id -> id) entries\n\t\t\tsnapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));\n\t\t}\n\t\treturn table;\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\t// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n\t\tconst blobIds =\n\t\t\tthis.storageIds.size > 0\n\t\t\t\t? Array.from(this.storageIds)\n\t\t\t\t: Array.from(this.redirectTable.keys());\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tblobIds.forEach((blobId) => {\n\t\t\tbuilder.addAttachment(blobId);\n\t\t});\n\n\t\t// Any non-identity entries in the table need to be saved in the summary\n\t\tif (this.redirectTable.size > blobIds.length) {\n\t\t\tbuilder.addBlob(\n\t\t\t\tBlobManager.redirectTableBlobName,\n\t\t\t\t// filter out identity entries\n\t\t\t\tJSON.stringify(\n\t\t\t\t\tArray.from(this.redirectTable.entries()).filter(\n\t\t\t\t\t\t([localId, storageId]) => localId !== storageId,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * This is called to update blobs whose routes are unused. The unused blobs are deleted.\n\t * @param unusedRoutes - The routes of the blob nodes that are unused. These routes will be based off of local ids.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: readonly string[]): void {\n\t\tthis.deleteBlobsFromRedirectTable(unusedRoutes);\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn Array.from(sweepReadyBlobRoutes);\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t * The routes are GC nodes paths of format -`/<BlobManager.basePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t * 1. The redirect table entry for the local ids are deleted.\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]) {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update blobs whose routes are tombstones.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t *\n\t * @param tombstonedRoutes - The routes of blob nodes that are tombstones.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {\n\t\tconst tombstonedBlobsSet: Set<string> = new Set();\n\t\t// The routes or blob node paths are in the same format as returned in getGCData -\n\t\t// `/<BlobManager.basePath>/<blobId>`.\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\ttombstonedBlobsSet.add(blobId);\n\t\t}\n\n\t\t// Remove blobs from the tombstone list that were tombstoned but aren't anymore as per the tombstoneRoutes.\n\t\tfor (const blobId of this.tombstonedBlobs) {\n\t\t\tif (!tombstonedBlobsSet.has(blobId)) {\n\t\t\t\tthis.tombstonedBlobs.delete(blobId);\n\t\t\t}\n\t\t}\n\n\t\t// Mark blobs that are now tombstoned by adding them to the tombstone list.\n\t\tfor (const blobId of tombstonedBlobsSet) {\n\t\t\tthis.tombstonedBlobs.add(blobId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string) {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: BlobManager.basePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>) {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(\n\t\t\t\tthis.redirectTable.has(localId),\n\t\t\t\t0x254 /* \"unrecognized id in redirect table\" */,\n\t\t\t);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"GetPendingBlobs\" },\n\t\t\tasync () => {\n\t\t\t\tif (this.pendingBlobs.size === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst blobs = {};\n\t\t\t\tconst localBlobs = new Set<PendingBlob>();\n\t\t\t\twhile (localBlobs.size < this.pendingBlobs.size) {\n\t\t\t\t\tconst attachBlobsP: Promise<void>[] = [];\n\t\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\t\tif (!localBlobs.has(entry)) {\n\t\t\t\t\t\t\tlocalBlobs.add(entry);\n\t\t\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(id));\n\t\t\t\t\t\t\tattachBlobsP.push(\n\t\t\t\t\t\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\t\t\tstopBlobAttachingSignal?.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\"abort\",\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.stopAttaching = true;\n\t\t\t\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{ once: true },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst onBlobAttached = (attachedEntry) => {\n\t\t\t\t\t\t\t\t\t\tif (attachedEntry === entry) {\n\t\t\t\t\t\t\t\t\t\t\tthis.off(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif (!entry.attached) {\n\t\t\t\t\t\t\t\t\t\tthis.on(\"blobAttached\", onBlobAttached);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tawait Promise.allSettled(attachBlobsP).catch(() => {});\n\t\t\t\t}\n\n\t\t\t\tfor (const [id, entry] of this.pendingBlobs) {\n\t\t\t\t\tif (stopBlobAttachingSignal?.aborted && !entry.attached) {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"UnableToStashBlob\",\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tassert(entry.attached === true, 0x790 /* stashed blob should be attached */);\n\t\t\t\t\tif (!entry.opsent) {\n\t\t\t\t\t\tthis.sendBlobAttachOp(id, entry.storageId);\n\t\t\t\t\t}\n\t\t\t\t\tblobs[id] = {\n\t\t\t\t\t\tblob: bufferToString(entry.blob, \"base64\"),\n\t\t\t\t\t\tstorageId: entry.storageId,\n\t\t\t\t\t\tattached: entry.attached,\n\t\t\t\t\t\tacked: entry.acked,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn Object.keys(blobs).length > 0 ? blobs : undefined;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nfunction getGCNodePathFromBlobId(blobId: string) {\n\treturn `/${BlobManager.basePath}/${blobId}`;\n}\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<BlobManager.basePath>/<blobId>`.\n */\nfunction getBlobIdFromGCNodePath(nodePath: string) {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(\n\t\tpathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n\t\t0x5bd /* Invalid blob node path */,\n\t);\n\treturn pathParts[2];\n}\n"]}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryBaseLogger, IDisposable, IFluidHandle, IRequest, FluidObject, IResponse } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
7
|
+
import { AliasResult, IEnvelope, IFluidDataStoreChannel, IFluidDataStoreContextDetached, IGarbageCollectionData, IInboundSignalMessage, IFluidParentContext, ISummaryTreeWithStats, ITelemetryContext, IFluidDataStoreFactory, IFluidDataStoreContext, NamedFluidDataStoreRegistryEntries, IFluidDataStoreRegistry } from "@fluidframework/runtime-definitions";
|
|
8
|
+
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
|
+
import { RuntimeHeaderData } from "./containerRuntime.js";
|
|
10
|
+
import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreContext.js";
|
|
11
|
+
import { IDataStoreAliasMessage } from "./dataStore.js";
|
|
12
|
+
import { GCNodeType } from "./gc/index.js";
|
|
13
|
+
import { IContainerRuntimeMetadata } from "./summary/index.js";
|
|
14
|
+
/**
|
|
15
|
+
* Accepted header keys for requests coming to the runtime.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare enum RuntimeHeaders {
|
|
19
|
+
/** True to wait for a data store to be created and loaded before returning it. */
|
|
20
|
+
wait = "wait",
|
|
21
|
+
/** True if the request is coming from an IFluidHandle. */
|
|
22
|
+
viaHandle = "viaHandle"
|
|
23
|
+
}
|
|
24
|
+
/** True if a tombstoned object should be returned without erroring
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare const AllowTombstoneRequestHeaderKey = "allowTombstone";
|
|
28
|
+
/**
|
|
29
|
+
* [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare const AllowInactiveRequestHeaderKey = "allowInactive";
|
|
33
|
+
/**
|
|
34
|
+
* Creates a shallow wrapper of {@link IFluidParentContext}. The wrapper can then have its methods overwritten as needed
|
|
35
|
+
*/
|
|
36
|
+
export declare function wrapContext(context: IFluidParentContext): IFluidParentContext;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a wrapper of a {@link IFluidParentContext} to be provided to the inner datastore channels.
|
|
39
|
+
* The wrapper will have the submit methods overwritten with the appropriate id as the destination address.
|
|
40
|
+
*
|
|
41
|
+
* @param id - the id of the channel
|
|
42
|
+
* @param parentContext - the {@link IFluidParentContext} to wrap
|
|
43
|
+
* @returns A wrapped {@link IFluidParentContext}
|
|
44
|
+
*/
|
|
45
|
+
export declare function wrapContextForInnerChannel(id: string, parentContext: IFluidParentContext): IFluidParentContext;
|
|
46
|
+
/**
|
|
47
|
+
* This class encapsulates data store handling. Currently it is only used by the container runtime,
|
|
48
|
+
* but eventually could be hosted on any channel once we formalize the channel api boundary.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
52
|
+
private readonly baseSnapshot;
|
|
53
|
+
readonly parentContext: IFluidParentContext;
|
|
54
|
+
private readonly gcNodeUpdated;
|
|
55
|
+
private readonly isDataStoreDeleted;
|
|
56
|
+
private readonly aliasMap;
|
|
57
|
+
private readonly pendingAttach;
|
|
58
|
+
readonly attachOpFiredForDataStore: Set<string>;
|
|
59
|
+
private readonly mc;
|
|
60
|
+
private readonly disposeOnce;
|
|
61
|
+
readonly entryPoint: IFluidHandle<FluidObject>;
|
|
62
|
+
readonly containerLoadStats: {
|
|
63
|
+
readonly containerLoadDataStoreCount: number;
|
|
64
|
+
readonly referencedDataStoreCount: number;
|
|
65
|
+
};
|
|
66
|
+
private dataStoresSinceLastGC;
|
|
67
|
+
private readonly containerRuntimeHandle;
|
|
68
|
+
private readonly pendingAliasMap;
|
|
69
|
+
private readonly contexts;
|
|
70
|
+
constructor(baseSnapshot: ISnapshotTree | undefined, parentContext: IFluidParentContext, baseLogger: ITelemetryBaseLogger, gcNodeUpdated: (nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], request?: IRequest, headerData?: RuntimeHeaderData) => void, isDataStoreDeleted: (nodePath: string) => boolean, aliasMap: Map<string, string>, provideEntryPoint: (runtime: ChannelCollection) => Promise<FluidObject>);
|
|
71
|
+
get aliases(): ReadonlyMap<string, string>;
|
|
72
|
+
get pendingAliases(): Map<string, Promise<AliasResult>>;
|
|
73
|
+
waitIfPendingAlias(maybeAlias: string): Promise<AliasResult>;
|
|
74
|
+
/** For sampling. Only log once per container */
|
|
75
|
+
private shouldSendAttachLog;
|
|
76
|
+
private wrapContextForInnerChannel;
|
|
77
|
+
/**
|
|
78
|
+
* IFluidDataStoreChannel.makeVisibleAndAttachGraph implementation
|
|
79
|
+
* Not clear when it would be called and what it should do.
|
|
80
|
+
* Currently this API is called by context only for root data stores.
|
|
81
|
+
*/
|
|
82
|
+
makeVisibleAndAttachGraph(): void;
|
|
83
|
+
private processAttachMessage;
|
|
84
|
+
private processAliasMessage;
|
|
85
|
+
processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean;
|
|
86
|
+
private alreadyProcessed;
|
|
87
|
+
/** Package up the context's attach summary etc into an IAttachMessage */
|
|
88
|
+
private generateAttachMessage;
|
|
89
|
+
/**
|
|
90
|
+
* Make the data store locally visible in the container graph by moving the data store context from unbound to
|
|
91
|
+
* bound list and submitting the attach message. This data store can now be reached from the root.
|
|
92
|
+
* @param id - The id of the data store context to make visible.
|
|
93
|
+
*/
|
|
94
|
+
private makeDataStoreLocallyVisible;
|
|
95
|
+
/**
|
|
96
|
+
* Generate compact internal DataStore ID.
|
|
97
|
+
*
|
|
98
|
+
* A note about namespace and name collisions:
|
|
99
|
+
* This code assumes that that's the only way to generate internal IDs, and that it's Ok for this namespace to overlap with
|
|
100
|
+
* user-provided alias names namespace.
|
|
101
|
+
* There are two scenarios where it could cause trouble:
|
|
102
|
+
* 1) Old files, where (already removed) CreateRoot*DataStore*() API was used, and thus internal name of data store
|
|
103
|
+
* was provided by user. Such files may experience name collision with future data stores that receive a name generated
|
|
104
|
+
* by this function.
|
|
105
|
+
* 2) Much less likely, but if it happen that internal ID (generated by this function) is exactly the same as alias name
|
|
106
|
+
* that user might use in the future, them ContainerRuntime.getAliasedDataStoreEntryPoint() or
|
|
107
|
+
* ContainerRuntime.getDataStoreFromRequest() could return a data store with internalID matching user request, even though
|
|
108
|
+
* user expected some other data store (that would receive alias later).
|
|
109
|
+
* Please note that above mentioned functions have the implementation they have (allowing #2) due to #1.
|
|
110
|
+
*/
|
|
111
|
+
protected createDataStoreId(): string;
|
|
112
|
+
createDetachedDataStoreCore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;
|
|
113
|
+
_createFluidDataStoreContext(pkg: Readonly<string[]>, props?: any, loadingGroupId?: string): LocalFluidDataStoreContext;
|
|
114
|
+
get disposed(): boolean;
|
|
115
|
+
readonly dispose: () => void;
|
|
116
|
+
reSubmit(type: string, content: any, localOpMetadata: unknown): void;
|
|
117
|
+
rollback(type: string, content: any, localOpMetadata: unknown): void;
|
|
118
|
+
applyStashedOp(content: unknown): Promise<unknown>;
|
|
119
|
+
private applyStashedAttachOp;
|
|
120
|
+
process(message: ISequencedDocumentMessage, local: boolean, localMessageMetadata: unknown, addedOutboundReference?: (fromNodePath: string, toNodePath: string) => void): void;
|
|
121
|
+
getDataStore(id: string, requestHeaderData: RuntimeHeaderData): Promise<FluidDataStoreContext>;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the data store requested with the given id if available. Otherwise, returns undefined.
|
|
124
|
+
*/
|
|
125
|
+
getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<FluidDataStoreContext | undefined>;
|
|
126
|
+
/**
|
|
127
|
+
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
128
|
+
* @param id - The data store's id.
|
|
129
|
+
* @param context - The data store context.
|
|
130
|
+
* @param callSite - The function name this is called from.
|
|
131
|
+
* @param requestHeaderData - The request header information to log if the data store is deleted.
|
|
132
|
+
* @returns true if the data store is deleted. Otherwise, returns false.
|
|
133
|
+
*/
|
|
134
|
+
private checkAndLogIfDeleted;
|
|
135
|
+
processSignal(messageArg: IInboundSignalMessage, local: boolean): void;
|
|
136
|
+
setConnectionState(connected: boolean, clientId?: string): void;
|
|
137
|
+
setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
|
|
138
|
+
get size(): number;
|
|
139
|
+
summarize(fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
140
|
+
/**
|
|
141
|
+
* Create a summary. Used when attaching or serializing a detached container.
|
|
142
|
+
*/
|
|
143
|
+
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
144
|
+
/**
|
|
145
|
+
* Before GC runs, called by the garbage collector to update any pending GC state.
|
|
146
|
+
* The garbage collector needs to know all outbound references that are added. Since root data stores are not
|
|
147
|
+
* explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.
|
|
148
|
+
*/
|
|
149
|
+
updateStateBeforeGC(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Generates data used for garbage collection. It does the following:
|
|
152
|
+
*
|
|
153
|
+
* 1. Calls into each child data store context to get its GC data.
|
|
154
|
+
*
|
|
155
|
+
* 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be
|
|
156
|
+
* identified as belonging to the child.
|
|
157
|
+
*
|
|
158
|
+
* 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent
|
|
159
|
+
* the GC data of this channel.
|
|
160
|
+
*
|
|
161
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
162
|
+
*/
|
|
163
|
+
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
164
|
+
/**
|
|
165
|
+
* After GC has run, called to notify this Container's data stores of routes that are used in it.
|
|
166
|
+
* @param usedRoutes - The routes that are used in all data stores in this Container.
|
|
167
|
+
*/
|
|
168
|
+
updateUsedRoutes(usedRoutes: readonly string[]): void;
|
|
169
|
+
/**
|
|
170
|
+
* This is called to update objects whose routes are unused. The unused objects are deleted.
|
|
171
|
+
* @param unusedRoutes - The routes that are unused in all data stores in this Container.
|
|
172
|
+
*/
|
|
173
|
+
updateUnusedRoutes(unusedRoutes: readonly string[]): void;
|
|
174
|
+
/**
|
|
175
|
+
* Delete data stores and its objects that are sweep ready.
|
|
176
|
+
* @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should
|
|
177
|
+
* be deleted.
|
|
178
|
+
* @returns The routes of data stores and its objects that were deleted.
|
|
179
|
+
*/
|
|
180
|
+
deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[];
|
|
181
|
+
/**
|
|
182
|
+
* This is called to update objects whose routes are tombstones.
|
|
183
|
+
*
|
|
184
|
+
* A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
|
|
185
|
+
* Tombstoned objects are eventually deleted by GC.
|
|
186
|
+
*
|
|
187
|
+
* @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.
|
|
188
|
+
*/
|
|
189
|
+
updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void;
|
|
190
|
+
/**
|
|
191
|
+
* Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are
|
|
192
|
+
* part of outbound routes.
|
|
193
|
+
*/
|
|
194
|
+
private getOutboundRoutes;
|
|
195
|
+
/**
|
|
196
|
+
* Called by GC to retrieve the package path of a data store node with the given path.
|
|
197
|
+
*/
|
|
198
|
+
getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined>;
|
|
199
|
+
/**
|
|
200
|
+
* Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).
|
|
201
|
+
* @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.
|
|
202
|
+
*/
|
|
203
|
+
getGCNodeType(nodePath: string): GCNodeType | undefined;
|
|
204
|
+
internalId(maybeAlias: string): string;
|
|
205
|
+
request(request: IRequest): Promise<IResponse>;
|
|
206
|
+
}
|
|
207
|
+
export declare function getSummaryForDatastores(snapshot: ISnapshotTree | undefined, metadata?: IContainerRuntimeMetadata): ISnapshotTree | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Traverse this op's contents and detect any outbound routes that were added by this op.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
export declare function detectOutboundReferences(envelope: IEnvelope, addedOutboundReference: (fromNodePath: string, toNodePath: string) => void): void;
|
|
214
|
+
/** @internal */
|
|
215
|
+
export declare class ChannelCollectionFactory implements IFluidDataStoreFactory {
|
|
216
|
+
private readonly provideEntryPoint;
|
|
217
|
+
readonly type = "ChannelCollectionChannel";
|
|
218
|
+
IFluidDataStoreRegistry: IFluidDataStoreRegistry;
|
|
219
|
+
constructor(registryEntries: NamedFluidDataStoreRegistryEntries, provideEntryPoint: (runtime: IFluidDataStoreChannel) => Promise<FluidObject>);
|
|
220
|
+
get IFluidDataStoreFactory(): this;
|
|
221
|
+
instantiateDataStore(context: IFluidDataStoreContext, _existing: boolean): Promise<IFluidDataStoreChannel>;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=channelCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelCollection.d.ts","sourceRoot":"","sources":["../src/channelCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,WAAW,EAIX,SAAS,EACT,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAGnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,kCAAkC,EAClC,uBAAuB,EACvB,MAAM,qCAAqC,CAAC;AAyB7C,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAIpE,OAAO,EAA4B,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACN,qBAAqB,EAErB,0BAA0B,EAG1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,sBAAsB,EAGtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,UAAU,EAGV,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,yBAAyB,EAGzB,MAAM,oBAAoB,CAAC;AAI5B;;;GAGG;AACH,oBAAY,cAAc;IACzB,kFAAkF;IAClF,IAAI,SAAS;IACb,0DAA0D;IAC1D,SAAS,cAAc;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAC/D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAS7D;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAgE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACzC,EAAE,EAAE,MAAM,EACV,aAAa,EAAE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