@fluidframework/container-runtime 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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/CHANGELOG.md +23 -0
- package/api-report/container-runtime.api.md +471 -52
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +4 -4
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +33 -30
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +82 -107
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +27 -22
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +155 -165
- package/dist/channelCollection.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +3 -3
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +17 -17
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +2 -2
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +42 -39
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +425 -292
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +8 -8
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +58 -19
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +169 -114
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -0
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +12 -11
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts +5 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +4 -4
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts +1 -1
- package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/dist/deltaManagerSummarizerProxy.js.map +1 -1
- package/dist/deltaScheduler.d.ts +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +6 -6
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +4 -4
- package/dist/error.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +3 -2
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +23 -23
- 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 +4 -5
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +4 -5
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +5 -1
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +21 -12
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +2 -2
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +11 -11
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +2 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +11 -9
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +6 -6
- package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +2 -1
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +91 -0
- package/dist/messageTypes.d.ts +11 -5
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +4 -0
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts +2 -20
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts +3 -3
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js +3 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +5 -6
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts +15 -4
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +62 -63
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.d.ts +2 -1
- package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +14 -16
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts +12 -4
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +63 -53
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +2 -1
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +30 -29
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +8 -0
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +36 -32
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +1 -1
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +18 -18
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/public.d.ts +12 -0
- package/dist/scheduleManager.d.ts +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +28 -24
- package/dist/scheduleManager.js.map +1 -1
- package/dist/storageServiceWithAttachBlobs.d.ts +2 -2
- package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/dist/storageServiceWithAttachBlobs.js +2 -2
- package/dist/storageServiceWithAttachBlobs.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +209 -0
- package/dist/summary/documentSchema.d.ts.map +1 -0
- package/dist/summary/documentSchema.js +390 -0
- package/dist/summary/documentSchema.js.map +1 -0
- package/dist/summary/index.d.ts +2 -1
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +4 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +2 -2
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +12 -7
- 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 +3 -3
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +3 -3
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +16 -16
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +3 -2
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +13 -13
- 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 +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js +2 -2
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +3 -2
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +28 -28
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -3
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +14 -14
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +5 -3
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +2 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +7 -7
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +6 -17
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js +8 -8
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +4 -3
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +17 -17
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +1 -1
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +15 -14
- package/dist/summary/summaryManager.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +33 -30
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +48 -73
- package/lib/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +27 -22
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +96 -106
- package/lib/channelCollection.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +3 -3
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +3 -3
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +1 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +42 -39
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +276 -141
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +3 -3
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +58 -19
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +107 -52
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +1 -0
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +3 -2
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts +5 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/deltaManagerSummarizerProxy.d.ts +1 -1
- package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -1
- package/lib/deltaManagerSummarizerProxy.js.map +1 -1
- package/lib/deltaScheduler.d.ts +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/error.d.ts +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +2 -2
- package/lib/error.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +3 -2
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +8 -8
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts +2 -2
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +4 -5
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +4 -5
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +5 -1
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +10 -2
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts +2 -2
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +2 -2
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +2 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +4 -2
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +2 -2
- package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +91 -0
- package/lib/messageTypes.d.ts +11 -5
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +4 -0
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts +2 -20
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts +3 -3
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js +2 -2
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +2 -3
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts +15 -4
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +61 -62
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.d.ts +2 -1
- package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +9 -12
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts +12 -4
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +47 -38
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +2 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +19 -18
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +8 -0
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +36 -32
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +1 -1
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +2 -2
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/public.d.ts +12 -0
- package/lib/scheduleManager.d.ts +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +7 -3
- package/lib/scheduleManager.js.map +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts +2 -2
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/lib/storageServiceWithAttachBlobs.js +1 -1
- package/lib/storageServiceWithAttachBlobs.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +209 -0
- package/lib/summary/documentSchema.d.ts.map +1 -0
- package/lib/summary/documentSchema.js +386 -0
- package/lib/summary/documentSchema.js.map +1 -0
- package/lib/summary/index.d.ts +2 -1
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -0
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +2 -2
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +7 -2
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +3 -3
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +3 -3
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +3 -2
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +3 -3
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +2 -2
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.d.ts +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summarizerHeuristics.js +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +3 -2
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +5 -5
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -3
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +5 -3
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +2 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +6 -17
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js +3 -3
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +4 -3
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +4 -4
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +1 -1
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +9 -8
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +57 -65
- package/src/batchTracker.ts +4 -3
- package/src/blobManager.ts +100 -77
- package/src/channelCollection.ts +180 -165
- package/src/connectionTelemetry.ts +12 -12
- package/src/containerHandleContext.ts +3 -2
- package/src/containerRuntime.ts +481 -277
- package/src/dataStore.ts +9 -4
- package/src/dataStoreContext.ts +195 -93
- package/src/dataStoreContexts.ts +5 -2
- package/src/dataStoreRegistry.ts +3 -2
- package/src/deltaManagerSummarizerProxy.ts +1 -1
- package/src/deltaScheduler.ts +2 -1
- package/src/error.ts +2 -2
- package/src/gc/garbageCollection.ts +21 -20
- package/src/gc/gcConfigs.ts +15 -18
- package/src/gc/gcDefinitions.ts +6 -8
- package/src/gc/gcHelpers.ts +22 -5
- package/src/gc/gcSummaryStateTracker.ts +7 -5
- package/src/gc/gcTelemetry.ts +13 -7
- package/src/gc/gcUnreferencedStateTracker.ts +3 -2
- package/src/gc/index.ts +1 -0
- package/src/index.ts +22 -1
- package/src/messageTypes.ts +20 -6
- package/src/opLifecycle/README.md +89 -0
- package/src/opLifecycle/batchManager.ts +1 -0
- package/src/opLifecycle/definitions.ts +3 -21
- package/src/opLifecycle/index.ts +3 -9
- package/src/opLifecycle/opCompressor.ts +6 -5
- package/src/opLifecycle/opDecompressor.ts +90 -100
- package/src/opLifecycle/opGroupingManager.ts +12 -14
- package/src/opLifecycle/opSplitter.ts +76 -48
- package/src/opLifecycle/outbox.ts +30 -38
- package/src/opLifecycle/remoteMessageProcessor.ts +43 -55
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +6 -6
- package/src/scheduleManager.ts +10 -8
- package/src/storageServiceWithAttachBlobs.ts +2 -2
- package/src/summary/documentSchema.ts +631 -0
- package/src/summary/index.ts +10 -1
- package/src/summary/orderedClientElection.ts +7 -7
- package/src/summary/runWhileConnectedCoordinator.ts +3 -2
- package/src/summary/runningSummarizer.ts +22 -20
- package/src/summary/summarizer.ts +17 -15
- package/src/summary/summarizerClientElection.ts +3 -2
- package/src/summary/summarizerHeuristics.ts +4 -2
- package/src/summary/summarizerNode/summarizerNode.ts +20 -18
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -2
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +16 -8
- package/src/summary/summarizerTypes.ts +7 -3
- package/src/summary/summaryCollection.ts +3 -3
- package/src/summary/summaryFormat.ts +14 -26
- package/src/summary/summaryGenerator.ts +12 -15
- package/src/summary/summaryManager.ts +16 -13
- package/api-extractor-cjs.json +0 -8
- package/dist/container-runtime-alpha.d.ts +0 -1753
- package/dist/container-runtime-beta.d.ts +0 -268
- package/dist/container-runtime-public.d.ts +0 -268
- package/dist/container-runtime-untrimmed.d.ts +0 -1893
- package/lib/container-runtime-alpha.d.ts +0 -1753
- package/lib/container-runtime-beta.d.ts +0 -268
- package/lib/container-runtime-public.d.ts +0 -268
- package/lib/container-runtime-untrimmed.d.ts +0 -1893
- package/lib/test/batchTracker.spec.js +0 -88
- package/lib/test/batchTracker.spec.js.map +0 -1
- package/lib/test/blobManager.spec.js +0 -835
- package/lib/test/blobManager.spec.js.map +0 -1
- package/lib/test/channelCollection.spec.js +0 -141
- package/lib/test/channelCollection.spec.js.map +0 -1
- package/lib/test/containerRuntime.spec.js +0 -1748
- package/lib/test/containerRuntime.spec.js.map +0 -1
- package/lib/test/dataStoreContext.spec.js +0 -801
- package/lib/test/dataStoreContext.spec.js.map +0 -1
- package/lib/test/dataStoreCreation.spec.js +0 -312
- package/lib/test/dataStoreCreation.spec.js.map +0 -1
- package/lib/test/dataStoreRegistry.spec.js +0 -26
- package/lib/test/dataStoreRegistry.spec.js.map +0 -1
- package/lib/test/fuzz/fuzzUtils.js +0 -66
- package/lib/test/fuzz/fuzzUtils.js.map +0 -1
- package/lib/test/fuzz/summarizer.fuzz.spec.js +0 -31
- package/lib/test/fuzz/summarizer.fuzz.spec.js.map +0 -1
- package/lib/test/fuzz/summarizerFuzzMocks.js +0 -162
- package/lib/test/fuzz/summarizerFuzzMocks.js.map +0 -1
- package/lib/test/fuzz/summarizerFuzzSuite.js +0 -106
- package/lib/test/fuzz/summarizerFuzzSuite.js.map +0 -1
- package/lib/test/gc/garbageCollection.spec.js +0 -1465
- package/lib/test/gc/garbageCollection.spec.js.map +0 -1
- package/lib/test/gc/gcConfigs.spec.js +0 -690
- package/lib/test/gc/gcConfigs.spec.js.map +0 -1
- package/lib/test/gc/gcHelpers.spec.js +0 -110
- package/lib/test/gc/gcHelpers.spec.js.map +0 -1
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +0 -68
- package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +0 -1
- package/lib/test/gc/gcStats.spec.js +0 -391
- package/lib/test/gc/gcStats.spec.js.map +0 -1
- package/lib/test/gc/gcSummaryStateTracker.spec.js +0 -228
- package/lib/test/gc/gcSummaryStateTracker.spec.js.map +0 -1
- package/lib/test/gc/gcTelemetry.spec.js +0 -530
- package/lib/test/gc/gcTelemetry.spec.js.map +0 -1
- package/lib/test/gc/gcUnitTestHelpers.js +0 -29
- package/lib/test/gc/gcUnitTestHelpers.js.map +0 -1
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js +0 -192
- package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +0 -1
- package/lib/test/getPendingBlobs.spec.js +0 -193
- package/lib/test/getPendingBlobs.spec.js.map +0 -1
- package/lib/test/hardwareStats.spec.js +0 -93
- package/lib/test/hardwareStats.spec.js.map +0 -1
- package/lib/test/index.js +0 -6
- package/lib/test/index.js.map +0 -1
- package/lib/test/opLifecycle/OpGroupingManager.spec.js +0 -225
- package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +0 -1
- package/lib/test/opLifecycle/batchManager.spec.js +0 -189
- package/lib/test/opLifecycle/batchManager.spec.js.map +0 -1
- package/lib/test/opLifecycle/opCompressor.spec.js +0 -74
- package/lib/test/opLifecycle/opCompressor.spec.js.map +0 -1
- package/lib/test/opLifecycle/opDecompressor.spec.js +0 -218
- package/lib/test/opLifecycle/opDecompressor.spec.js.map +0 -1
- package/lib/test/opLifecycle/opSplitter.spec.js +0 -272
- package/lib/test/opLifecycle/opSplitter.spec.js.map +0 -1
- package/lib/test/opLifecycle/outbox.spec.js +0 -675
- package/lib/test/opLifecycle/outbox.spec.js.map +0 -1
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +0 -196
- package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +0 -1
- package/lib/test/pendingStateManager.spec.js +0 -329
- package/lib/test/pendingStateManager.spec.js.map +0 -1
- package/lib/test/scheduleManager.spec.js +0 -270
- package/lib/test/scheduleManager.spec.js.map +0 -1
- package/lib/test/summarizerNode.spec.js +0 -326
- package/lib/test/summarizerNode.spec.js.map +0 -1
- package/lib/test/summarizerNodeWithGc.spec.js +0 -318
- package/lib/test/summarizerNodeWithGc.spec.js.map +0 -1
- package/lib/test/summary/orderedClientElection.spec.js +0 -535
- package/lib/test/summary/orderedClientElection.spec.js.map +0 -1
- package/lib/test/summary/runningSummarizer.spec.js +0 -1349
- package/lib/test/summary/runningSummarizer.spec.js.map +0 -1
- package/lib/test/summary/summarizer.spec.js +0 -29
- package/lib/test/summary/summarizer.spec.js.map +0 -1
- package/lib/test/summary/summarizerClientElection.spec.js +0 -436
- package/lib/test/summary/summarizerClientElection.spec.js.map +0 -1
- package/lib/test/summary/summarizerHeuristics.spec.js +0 -289
- package/lib/test/summary/summarizerHeuristics.spec.js.map +0 -1
- package/lib/test/summary/summaryCollection.spec.js +0 -200
- package/lib/test/summary/summaryCollection.spec.js.map +0 -1
- package/lib/test/summary/summaryManager.spec.js +0 -430
- package/lib/test/summary/summaryManager.spec.js.map +0 -1
- package/lib/test/summary/testQuorumClients.js +0 -34
- package/lib/test/summary/testQuorumClients.js.map +0 -1
- package/lib/test/throttler.spec.js +0 -175
- package/lib/test/throttler.spec.js.map +0 -1
- package/lib/test/types/validateContainerRuntimePrevious.generated.js +0 -180
- package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,801 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { strict as assert } from "assert";
|
|
6
|
-
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
|
-
import { LazyPromise } from "@fluidframework/core-utils";
|
|
8
|
-
import { AttachState, ContainerErrorTypes } from "@fluidframework/container-definitions";
|
|
9
|
-
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
10
|
-
import { CreateSummarizerNodeSource, channelsTreeName, } from "@fluidframework/runtime-definitions";
|
|
11
|
-
import { GCDataBuilder, convertSummaryTreeToITree } from "@fluidframework/runtime-utils";
|
|
12
|
-
import { isFluidError, MockLogger, TelemetryDataTag, createChildLogger, } from "@fluidframework/telemetry-utils";
|
|
13
|
-
import { MockFluidDataStoreRuntime, validateAssertionError, } from "@fluidframework/test-runtime-utils";
|
|
14
|
-
import { DataStoreMessageType, FluidObjectHandle } from "@fluidframework/datastore";
|
|
15
|
-
import { wrapContextForInnerChannel } from "../channelCollection.js";
|
|
16
|
-
import { LocalDetachedFluidDataStoreContext, LocalFluidDataStoreContext, RemoteFluidDataStoreContext, } from "../dataStoreContext.js";
|
|
17
|
-
import { StorageServiceWithAttachBlobs } from "../storageServiceWithAttachBlobs.js";
|
|
18
|
-
import { createRootSummarizerNodeWithGC, dataStoreAttributesBlobName, summarizerClientType, } from "../summary/index.js";
|
|
19
|
-
import { channelToDataStore } from "../dataStore.js";
|
|
20
|
-
describe("Data Store Context Tests", () => {
|
|
21
|
-
const dataStoreId = "Test1";
|
|
22
|
-
const emptyGCData = { gcNodes: {} };
|
|
23
|
-
let createSummarizerNodeFn;
|
|
24
|
-
describe("LocalFluidDataStoreContext", () => {
|
|
25
|
-
let localDataStoreContext;
|
|
26
|
-
let storage;
|
|
27
|
-
let scope;
|
|
28
|
-
const makeLocallyVisibleFn = () => { };
|
|
29
|
-
let containerRuntime;
|
|
30
|
-
let summarizerNode;
|
|
31
|
-
function createContainerRuntime(logger = createChildLogger(), clientDetails = {}, submitMessage = (type, contents, localOpMetadata) => { }) {
|
|
32
|
-
const factory = {
|
|
33
|
-
type: "store-type",
|
|
34
|
-
get IFluidDataStoreFactory() {
|
|
35
|
-
return factory;
|
|
36
|
-
},
|
|
37
|
-
instantiateDataStore: async (context) => new MockFluidDataStoreRuntime(),
|
|
38
|
-
};
|
|
39
|
-
const registry = {
|
|
40
|
-
get IFluidDataStoreRegistry() {
|
|
41
|
-
return registry;
|
|
42
|
-
},
|
|
43
|
-
get: async (pkg) => (pkg === "BOGUS" ? undefined : factory),
|
|
44
|
-
};
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
46
|
-
return {
|
|
47
|
-
IFluidDataStoreRegistry: registry,
|
|
48
|
-
on: (event, listener) => { },
|
|
49
|
-
logger,
|
|
50
|
-
clientDetails,
|
|
51
|
-
submitMessage,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
beforeEach(async () => {
|
|
55
|
-
summarizerNode = createRootSummarizerNodeWithGC(createChildLogger(), (() => undefined), 0, 0);
|
|
56
|
-
summarizerNode.startSummary(0, createChildLogger(), 0);
|
|
57
|
-
createSummarizerNodeFn = (summarizeInternal, getGCDataFn) => summarizerNode.createChild(summarizeInternal, dataStoreId, { type: CreateSummarizerNodeSource.Local }, undefined, getGCDataFn);
|
|
58
|
-
containerRuntime = createContainerRuntime();
|
|
59
|
-
});
|
|
60
|
-
describe("Initialization", () => {
|
|
61
|
-
it("rejects ids with forward slashes", async () => {
|
|
62
|
-
const invalidId = "beforeSlash/afterSlash";
|
|
63
|
-
const codeBlock = () => new LocalFluidDataStoreContext({
|
|
64
|
-
id: invalidId,
|
|
65
|
-
pkg: ["TestDataStore1"],
|
|
66
|
-
parentContext: wrapContextForInnerChannel(invalidId, containerRuntime),
|
|
67
|
-
storage,
|
|
68
|
-
scope,
|
|
69
|
-
createSummarizerNodeFn,
|
|
70
|
-
makeLocallyVisibleFn,
|
|
71
|
-
snapshotTree: undefined,
|
|
72
|
-
isRootDataStore: true,
|
|
73
|
-
});
|
|
74
|
-
assert.throws(codeBlock, (e) => validateAssertionError(e, "Data store ID contains slash"));
|
|
75
|
-
});
|
|
76
|
-
it("Errors thrown during realize are wrapped as DataProcessingError", async () => {
|
|
77
|
-
const fullPackageName = ["BOGUS1", "BOGUS2"];
|
|
78
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
79
|
-
id: dataStoreId,
|
|
80
|
-
pkg: fullPackageName,
|
|
81
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
82
|
-
storage,
|
|
83
|
-
scope,
|
|
84
|
-
createSummarizerNodeFn,
|
|
85
|
-
makeLocallyVisibleFn,
|
|
86
|
-
snapshotTree: undefined,
|
|
87
|
-
isRootDataStore: true,
|
|
88
|
-
});
|
|
89
|
-
try {
|
|
90
|
-
await localDataStoreContext.realize();
|
|
91
|
-
assert.fail("realize should have thrown an error due to empty pkg array");
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
assert(isFluidError(e), "Expected a valid Fluid Error to be thrown");
|
|
95
|
-
assert.equal(e.errorType, ContainerErrorTypes.dataProcessingError, "Error should be a DataProcessingError");
|
|
96
|
-
const props = e.getTelemetryProperties();
|
|
97
|
-
assert.strictEqual(props.fullPackageName?.value, fullPackageName.join("/"), "The error should have the full package name in its telemetry properties");
|
|
98
|
-
assert.equal(props.failedPkgPath?.value, "BOGUS1", "The error should have the failed package path in its telemetry properties");
|
|
99
|
-
assert.equal(props.fluidDataStoreId?.value, "Test1", "The error should have the fluidDataStoreId in its telemetry properties");
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
it("can initialize correctly and generate attributes", async () => {
|
|
103
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
104
|
-
id: dataStoreId,
|
|
105
|
-
pkg: ["TestDataStore1"],
|
|
106
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
107
|
-
storage,
|
|
108
|
-
scope,
|
|
109
|
-
createSummarizerNodeFn,
|
|
110
|
-
makeLocallyVisibleFn,
|
|
111
|
-
snapshotTree: undefined,
|
|
112
|
-
isRootDataStore: true,
|
|
113
|
-
});
|
|
114
|
-
await localDataStoreContext.realize();
|
|
115
|
-
const { attachSummary: { summary }, type, } = localDataStoreContext.getAttachData(/* includeGCData: */ false);
|
|
116
|
-
const snapshot = convertSummaryTreeToITree(summary);
|
|
117
|
-
const attributesEntry = snapshot.entries.find((e) => e.path === dataStoreAttributesBlobName);
|
|
118
|
-
assert(attributesEntry !== undefined, "There is no attributes blob in the summary tree");
|
|
119
|
-
// Assume that it is in write format, will see errors if not.
|
|
120
|
-
const contents = JSON.parse(attributesEntry.value.contents);
|
|
121
|
-
const dataStoreAttributes = {
|
|
122
|
-
pkg: JSON.stringify(["TestDataStore1"]),
|
|
123
|
-
summaryFormatVersion: 2,
|
|
124
|
-
isRootDataStore: true,
|
|
125
|
-
};
|
|
126
|
-
assert.strictEqual(contents.pkg, dataStoreAttributes.pkg, "Local DataStore package does not match.");
|
|
127
|
-
assert.strictEqual(contents.summaryFormatVersion, dataStoreAttributes.summaryFormatVersion, "Local DataStore snapshot version does not match.");
|
|
128
|
-
assert.strictEqual(contents.isRootDataStore, dataStoreAttributes.isRootDataStore, "Local DataStore root state does not match");
|
|
129
|
-
assert.strictEqual(type, "TestDataStore1", "Attach message type does not match.");
|
|
130
|
-
});
|
|
131
|
-
it("should generate exception when incorrectly created with array of packages", async () => {
|
|
132
|
-
let exception = false;
|
|
133
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
134
|
-
id: dataStoreId,
|
|
135
|
-
pkg: ["TestComp", "SubComp"],
|
|
136
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
137
|
-
storage,
|
|
138
|
-
scope,
|
|
139
|
-
createSummarizerNodeFn,
|
|
140
|
-
makeLocallyVisibleFn,
|
|
141
|
-
snapshotTree: undefined,
|
|
142
|
-
isRootDataStore: false,
|
|
143
|
-
});
|
|
144
|
-
await localDataStoreContext.realize().catch((error) => {
|
|
145
|
-
exception = true;
|
|
146
|
-
});
|
|
147
|
-
assert.strictEqual(exception, true, "Exception did not occur.");
|
|
148
|
-
});
|
|
149
|
-
it("can initialize and generate attributes when correctly created with array of packages", async () => {
|
|
150
|
-
const registryWithSubRegistries = {};
|
|
151
|
-
registryWithSubRegistries.IFluidDataStoreFactory = registryWithSubRegistries;
|
|
152
|
-
registryWithSubRegistries.IFluidDataStoreRegistry = registryWithSubRegistries;
|
|
153
|
-
registryWithSubRegistries.get = async (pkg) => Promise.resolve(registryWithSubRegistries);
|
|
154
|
-
registryWithSubRegistries.instantiateDataStore = async (context) => new MockFluidDataStoreRuntime();
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
156
|
-
containerRuntime = {
|
|
157
|
-
IFluidDataStoreRegistry: registryWithSubRegistries,
|
|
158
|
-
on: (event, listener) => { },
|
|
159
|
-
clientDetails: {},
|
|
160
|
-
};
|
|
161
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
162
|
-
id: dataStoreId,
|
|
163
|
-
pkg: ["TestComp", "SubComp"],
|
|
164
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
165
|
-
storage,
|
|
166
|
-
scope,
|
|
167
|
-
createSummarizerNodeFn,
|
|
168
|
-
makeLocallyVisibleFn,
|
|
169
|
-
snapshotTree: undefined,
|
|
170
|
-
isRootDataStore: false,
|
|
171
|
-
});
|
|
172
|
-
await localDataStoreContext.realize();
|
|
173
|
-
const { attachSummary: { summary }, type, } = localDataStoreContext.getAttachData(/* includeGCData: */ false);
|
|
174
|
-
const snapshot = convertSummaryTreeToITree(summary);
|
|
175
|
-
const attributesEntry = snapshot.entries.find((e) => e.path === dataStoreAttributesBlobName);
|
|
176
|
-
assert(attributesEntry !== undefined, "There is no attributes blob in the summary tree");
|
|
177
|
-
const contents = JSON.parse(attributesEntry.value.contents);
|
|
178
|
-
const dataStoreAttributes = {
|
|
179
|
-
pkg: JSON.stringify(["TestComp", "SubComp"]),
|
|
180
|
-
summaryFormatVersion: 2,
|
|
181
|
-
isRootDataStore: false,
|
|
182
|
-
};
|
|
183
|
-
assert.strictEqual(contents.pkg, dataStoreAttributes.pkg, "Local DataStore package does not match.");
|
|
184
|
-
assert.strictEqual(contents.summaryFormatVersion, dataStoreAttributes.summaryFormatVersion, "Local DataStore snapshot version does not match.");
|
|
185
|
-
assert.strictEqual(contents.isRootDataStore, dataStoreAttributes.isRootDataStore, "Local DataStore root state does not match");
|
|
186
|
-
assert.strictEqual(type, "SubComp", "Attach message type does not match.");
|
|
187
|
-
});
|
|
188
|
-
it("can correctly initialize root context", async () => {
|
|
189
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
190
|
-
id: dataStoreId,
|
|
191
|
-
pkg: ["TestDataStore1"],
|
|
192
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
193
|
-
storage,
|
|
194
|
-
scope,
|
|
195
|
-
createSummarizerNodeFn,
|
|
196
|
-
makeLocallyVisibleFn,
|
|
197
|
-
snapshotTree: undefined,
|
|
198
|
-
isRootDataStore: true,
|
|
199
|
-
});
|
|
200
|
-
const isRootNode = await localDataStoreContext.isRoot();
|
|
201
|
-
assert.strictEqual(isRootNode, true, "The data store should be root.");
|
|
202
|
-
});
|
|
203
|
-
it("can correctly initialize non-root context", async () => {
|
|
204
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
205
|
-
id: dataStoreId,
|
|
206
|
-
pkg: ["TestDataStore1"],
|
|
207
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
208
|
-
storage,
|
|
209
|
-
scope,
|
|
210
|
-
createSummarizerNodeFn,
|
|
211
|
-
makeLocallyVisibleFn,
|
|
212
|
-
snapshotTree: undefined,
|
|
213
|
-
isRootDataStore: false,
|
|
214
|
-
});
|
|
215
|
-
const isRootNode = await localDataStoreContext.isRoot();
|
|
216
|
-
assert.strictEqual(isRootNode, false, "The data store should not be root.");
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
describe("Local data stores in summarizer client", () => {
|
|
220
|
-
let mockLogger;
|
|
221
|
-
const packageName = ["TestDataStore1"];
|
|
222
|
-
beforeEach(async () => {
|
|
223
|
-
// Change the container runtime's logger to MockLogger and its type to be a summarizer client.
|
|
224
|
-
mockLogger = new MockLogger();
|
|
225
|
-
const clientDetails = {
|
|
226
|
-
capabilities: {
|
|
227
|
-
interactive: false,
|
|
228
|
-
},
|
|
229
|
-
type: summarizerClientType,
|
|
230
|
-
};
|
|
231
|
-
containerRuntime = createContainerRuntime(mockLogger, clientDetails);
|
|
232
|
-
});
|
|
233
|
-
it("logs when local data store is created in summarizer", async () => {
|
|
234
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
235
|
-
id: dataStoreId,
|
|
236
|
-
pkg: packageName,
|
|
237
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
238
|
-
storage,
|
|
239
|
-
scope,
|
|
240
|
-
createSummarizerNodeFn,
|
|
241
|
-
makeLocallyVisibleFn,
|
|
242
|
-
snapshotTree: undefined,
|
|
243
|
-
isRootDataStore: false,
|
|
244
|
-
});
|
|
245
|
-
const expectedEvents = [
|
|
246
|
-
{
|
|
247
|
-
eventName: "FluidDataStoreContext:DataStoreCreatedInSummarizer",
|
|
248
|
-
fullPackageName: {
|
|
249
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
250
|
-
value: packageName.join("/"),
|
|
251
|
-
},
|
|
252
|
-
fluidDataStoreId: {
|
|
253
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
254
|
-
value: dataStoreId,
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
];
|
|
258
|
-
mockLogger.assertMatch(expectedEvents, "data store create event not generated as expected");
|
|
259
|
-
});
|
|
260
|
-
it("logs when local data store sends op in summarizer", async () => {
|
|
261
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
262
|
-
id: dataStoreId,
|
|
263
|
-
pkg: packageName,
|
|
264
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
265
|
-
storage,
|
|
266
|
-
scope,
|
|
267
|
-
createSummarizerNodeFn,
|
|
268
|
-
makeLocallyVisibleFn,
|
|
269
|
-
snapshotTree: undefined,
|
|
270
|
-
isRootDataStore: false,
|
|
271
|
-
});
|
|
272
|
-
await localDataStoreContext.realize();
|
|
273
|
-
localDataStoreContext.submitMessage(DataStoreMessageType.ChannelOp, "summarizer message", {});
|
|
274
|
-
const expectedEvents = [
|
|
275
|
-
{
|
|
276
|
-
eventName: "FluidDataStoreContext:DataStoreMessageSubmittedInSummarizer",
|
|
277
|
-
type: DataStoreMessageType.ChannelOp,
|
|
278
|
-
fluidDataStoreId: {
|
|
279
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
280
|
-
value: dataStoreId,
|
|
281
|
-
},
|
|
282
|
-
fullPackageName: {
|
|
283
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
284
|
-
value: packageName.join("/"),
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
];
|
|
288
|
-
mockLogger.assertMatch(expectedEvents, "data store message submitted event not generated as expected");
|
|
289
|
-
});
|
|
290
|
-
it("logs maximum of 10 local summarizer events per data store", async () => {
|
|
291
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
292
|
-
id: dataStoreId,
|
|
293
|
-
pkg: packageName,
|
|
294
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
295
|
-
storage,
|
|
296
|
-
scope,
|
|
297
|
-
createSummarizerNodeFn,
|
|
298
|
-
makeLocallyVisibleFn,
|
|
299
|
-
snapshotTree: undefined,
|
|
300
|
-
isRootDataStore: false,
|
|
301
|
-
});
|
|
302
|
-
await localDataStoreContext.realize();
|
|
303
|
-
let eventCount = 0;
|
|
304
|
-
for (let i = 0; i < 15; i++) {
|
|
305
|
-
localDataStoreContext.submitMessage(DataStoreMessageType.ChannelOp, `summarizer message ${i}`, {});
|
|
306
|
-
}
|
|
307
|
-
for (const event of mockLogger.events) {
|
|
308
|
-
if (event.eventName ===
|
|
309
|
-
"FluidDataStoreContext:DataStoreMessageSubmittedInSummarizer" ||
|
|
310
|
-
event.eventName === "FluidDataStoreContext:DataStoreCreatedInSummarizer") {
|
|
311
|
-
eventCount++;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
assert.strictEqual(eventCount, 10, "There should be only 10 events per data store");
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
describe("Garbage Collection", () => {
|
|
318
|
-
it("can generate correct GC data", async () => {
|
|
319
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
320
|
-
id: dataStoreId,
|
|
321
|
-
pkg: ["TestDataStore1"],
|
|
322
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
323
|
-
storage,
|
|
324
|
-
scope,
|
|
325
|
-
createSummarizerNodeFn,
|
|
326
|
-
makeLocallyVisibleFn,
|
|
327
|
-
snapshotTree: undefined,
|
|
328
|
-
isRootDataStore: true,
|
|
329
|
-
});
|
|
330
|
-
const gcData = await localDataStoreContext.getGCData();
|
|
331
|
-
assert.deepStrictEqual(gcData, emptyGCData, "GC data from getGCData should be empty.");
|
|
332
|
-
});
|
|
333
|
-
it("can successfully update referenced state", () => {
|
|
334
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
335
|
-
id: dataStoreId,
|
|
336
|
-
pkg: ["TestComp", "SubComp"],
|
|
337
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
338
|
-
storage,
|
|
339
|
-
scope,
|
|
340
|
-
createSummarizerNodeFn,
|
|
341
|
-
makeLocallyVisibleFn,
|
|
342
|
-
snapshotTree: undefined,
|
|
343
|
-
isRootDataStore: false,
|
|
344
|
-
});
|
|
345
|
-
// Get the summarizer node for this data store which tracks its referenced state.
|
|
346
|
-
const dataStoreSummarizerNode = summarizerNode.getChild(dataStoreId);
|
|
347
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), true, "Data store should be referenced by default");
|
|
348
|
-
// Update the used routes to not include route to the data store.
|
|
349
|
-
localDataStoreContext.updateUsedRoutes([]);
|
|
350
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), false, "Data store should now be unreferenced");
|
|
351
|
-
// Add the data store's route (empty string) to its used routes.
|
|
352
|
-
localDataStoreContext.updateUsedRoutes([""]);
|
|
353
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), true, "Data store should now be referenced");
|
|
354
|
-
});
|
|
355
|
-
it("can tombstone a local datastore", async () => {
|
|
356
|
-
localDataStoreContext = new LocalFluidDataStoreContext({
|
|
357
|
-
id: dataStoreId,
|
|
358
|
-
pkg: ["TestComp", "SubComp"],
|
|
359
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
360
|
-
storage,
|
|
361
|
-
scope,
|
|
362
|
-
createSummarizerNodeFn,
|
|
363
|
-
makeLocallyVisibleFn,
|
|
364
|
-
snapshotTree: undefined,
|
|
365
|
-
isRootDataStore: false,
|
|
366
|
-
});
|
|
367
|
-
localDataStoreContext.setTombstone(true);
|
|
368
|
-
assert(localDataStoreContext.tombstoned, `Local data store should be tombstoned!`);
|
|
369
|
-
localDataStoreContext.setTombstone(false);
|
|
370
|
-
assert(!localDataStoreContext.tombstoned, `Local data store should not be tombstoned!`);
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
describe("RemoteDataStoreContext", () => {
|
|
375
|
-
let remoteDataStoreContext;
|
|
376
|
-
let dataStoreAttributes;
|
|
377
|
-
const storage = {};
|
|
378
|
-
let scope;
|
|
379
|
-
let summarizerNode;
|
|
380
|
-
let containerRuntime;
|
|
381
|
-
beforeEach(async () => {
|
|
382
|
-
const factory = {};
|
|
383
|
-
factory.IFluidDataStoreFactory = factory;
|
|
384
|
-
factory.instantiateDataStore = (context) => new MockFluidDataStoreRuntime();
|
|
385
|
-
const registry = {};
|
|
386
|
-
registry.IFluidDataStoreRegistry = registry;
|
|
387
|
-
registry.get = async (pkg) => Promise.resolve(factory);
|
|
388
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
389
|
-
containerRuntime = {
|
|
390
|
-
IFluidDataStoreRegistry: registry,
|
|
391
|
-
on: (event, listener) => { },
|
|
392
|
-
clientDetails: {},
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
describe("Initialization - can correctly initialize and generate attributes", () => {
|
|
396
|
-
beforeEach(() => {
|
|
397
|
-
summarizerNode = createRootSummarizerNodeWithGC(createChildLogger(), (() => undefined), 0, 0);
|
|
398
|
-
summarizerNode.startSummary(0, createChildLogger(), 0);
|
|
399
|
-
createSummarizerNodeFn = (summarizeInternal, getGCDataFn) => summarizerNode.createChild(summarizeInternal, dataStoreId, { type: CreateSummarizerNodeSource.FromSummary },
|
|
400
|
-
// Disable GC for initialization tests.
|
|
401
|
-
{ gcDisabled: true }, getGCDataFn);
|
|
402
|
-
});
|
|
403
|
-
const pkgName = "TestDataStore1";
|
|
404
|
-
/**
|
|
405
|
-
* Runs the initialization and generate datastore attributes tests with the given write-mode preferences
|
|
406
|
-
* and expectations.
|
|
407
|
-
* This runs the same test with various summary write and read preferences. Specifically each call of this
|
|
408
|
-
* function will run the test 4 times, one for each possible summary format we could be reading from.
|
|
409
|
-
* @param expected - the expected datastore attributes to be generated given the write preference
|
|
410
|
-
*/
|
|
411
|
-
function testGenerateAttributes(expected) {
|
|
412
|
-
/**
|
|
413
|
-
* This function is called for each possible base snapshot format version. We want to cover all
|
|
414
|
-
* summary format read/write combinations. We only write in latest or -1 version, but we can
|
|
415
|
-
* need to be able to read old summary format versions forever.
|
|
416
|
-
* @param hasIsolatedChannels - whether we expect to read a snapshot tree with isolated channels or not
|
|
417
|
-
* @param attributes - datastore attributes that are in the base snapshot we load from
|
|
418
|
-
*/
|
|
419
|
-
async function testGenerateAttributesCore(attributes) {
|
|
420
|
-
const buffer = stringToBuffer(JSON.stringify(attributes), "utf8");
|
|
421
|
-
const attachBlobs = new Map([
|
|
422
|
-
["fluidDataStoreAttributes", buffer],
|
|
423
|
-
]);
|
|
424
|
-
const snapshotTree = {
|
|
425
|
-
blobs: { [dataStoreAttributesBlobName]: "fluidDataStoreAttributes" },
|
|
426
|
-
trees: {},
|
|
427
|
-
};
|
|
428
|
-
// If we are expecting to read isolated channels as intended by the test, then make sure
|
|
429
|
-
// it exists on the snapshot. Otherwise, make sure it doesn't to most closely resemble
|
|
430
|
-
// real loading use cases.
|
|
431
|
-
snapshotTree.trees[channelsTreeName] = {
|
|
432
|
-
blobs: {},
|
|
433
|
-
trees: {},
|
|
434
|
-
};
|
|
435
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
436
|
-
id: dataStoreId,
|
|
437
|
-
snapshotTree,
|
|
438
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
439
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
440
|
-
scope,
|
|
441
|
-
createSummarizerNodeFn,
|
|
442
|
-
});
|
|
443
|
-
const isRootNode = await remoteDataStoreContext.isRoot();
|
|
444
|
-
assert.strictEqual(isRootNode, true, "The data store should be root.");
|
|
445
|
-
const summarizeResult = await remoteDataStoreContext.summarize(true /* fullTree */);
|
|
446
|
-
assert(summarizeResult.summary.type === SummaryType.Tree, "summarize should always return a tree when fullTree is true");
|
|
447
|
-
const blob = summarizeResult.summary.tree[dataStoreAttributesBlobName];
|
|
448
|
-
const contents = JSON.parse(blob.content);
|
|
449
|
-
// Validate that generated attributes are as expected.
|
|
450
|
-
assert.deepStrictEqual(contents, expected, "Unexpected datastore attributes written");
|
|
451
|
-
}
|
|
452
|
-
it("can read from latest with isolated channels", async () => testGenerateAttributesCore({
|
|
453
|
-
pkg: JSON.stringify([pkgName]),
|
|
454
|
-
summaryFormatVersion: 2,
|
|
455
|
-
isRootDataStore: true,
|
|
456
|
-
}));
|
|
457
|
-
}
|
|
458
|
-
it("rejects ids with forward slashes", async () => {
|
|
459
|
-
const invalidId = "beforeSlash/afterSlash";
|
|
460
|
-
const codeBlock = () => new RemoteFluidDataStoreContext({
|
|
461
|
-
id: invalidId,
|
|
462
|
-
pkg: ["TestDataStore1"],
|
|
463
|
-
parentContext: wrapContextForInnerChannel(invalidId, containerRuntime),
|
|
464
|
-
storage: storage,
|
|
465
|
-
scope,
|
|
466
|
-
createSummarizerNodeFn,
|
|
467
|
-
snapshotTree: undefined,
|
|
468
|
-
});
|
|
469
|
-
assert.throws(codeBlock, (e) => validateAssertionError(e, "Data store ID contains slash"));
|
|
470
|
-
});
|
|
471
|
-
describe("writing with isolated channels enabled", () => testGenerateAttributes({
|
|
472
|
-
pkg: JSON.stringify([pkgName]),
|
|
473
|
-
summaryFormatVersion: 2,
|
|
474
|
-
isRootDataStore: true,
|
|
475
|
-
}));
|
|
476
|
-
});
|
|
477
|
-
describe("Garbage Collection", () => {
|
|
478
|
-
// The base GC details of the root summarizer node. The child base GC details from this is passed on to the
|
|
479
|
-
// child summarizer node during its creation.
|
|
480
|
-
let rootBaseGCDetails;
|
|
481
|
-
const getRootBaseGCDetails = async () => rootBaseGCDetails;
|
|
482
|
-
/**
|
|
483
|
-
* Given the GC data of a data store, build the GC data of the root (parent) node.
|
|
484
|
-
*/
|
|
485
|
-
function buildRootGCData(dataStoreGCData, id) {
|
|
486
|
-
const builder = new GCDataBuilder();
|
|
487
|
-
builder.prefixAndAddNodes(id, dataStoreGCData.gcNodes);
|
|
488
|
-
return builder.getGCData();
|
|
489
|
-
}
|
|
490
|
-
beforeEach(() => {
|
|
491
|
-
summarizerNode = createRootSummarizerNodeWithGC(createChildLogger(), (() => undefined), 0, 0, undefined, undefined, getRootBaseGCDetails);
|
|
492
|
-
summarizerNode.startSummary(0, createChildLogger(), 0);
|
|
493
|
-
createSummarizerNodeFn = (summarizeInternal, getGCDataFn) => summarizerNode.createChild(summarizeInternal, dataStoreId, { type: CreateSummarizerNodeSource.FromSummary }, undefined, getGCDataFn);
|
|
494
|
-
});
|
|
495
|
-
it("can generate GC data without base GC details in initial summary", async () => {
|
|
496
|
-
dataStoreAttributes = {
|
|
497
|
-
pkg: "TestDataStore1",
|
|
498
|
-
summaryFormatVersion: undefined,
|
|
499
|
-
};
|
|
500
|
-
const buffer = stringToBuffer(JSON.stringify(dataStoreAttributes), "utf8");
|
|
501
|
-
const attachBlobs = new Map([
|
|
502
|
-
["fluidDataStoreAttributes", buffer],
|
|
503
|
-
]);
|
|
504
|
-
const snapshotTree = {
|
|
505
|
-
blobs: {
|
|
506
|
-
[dataStoreAttributesBlobName]: "fluidDataStoreAttributes",
|
|
507
|
-
},
|
|
508
|
-
trees: {},
|
|
509
|
-
};
|
|
510
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
511
|
-
id: dataStoreId,
|
|
512
|
-
snapshotTree,
|
|
513
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
514
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
515
|
-
scope,
|
|
516
|
-
createSummarizerNodeFn,
|
|
517
|
-
});
|
|
518
|
-
const gcData = await remoteDataStoreContext.getGCData();
|
|
519
|
-
assert.deepStrictEqual(gcData, emptyGCData, "GC data from getGCData should be empty.");
|
|
520
|
-
});
|
|
521
|
-
it("can generate GC data with GC details in initial summary", async () => {
|
|
522
|
-
dataStoreAttributes = {
|
|
523
|
-
pkg: "TestDataStore1",
|
|
524
|
-
summaryFormatVersion: undefined,
|
|
525
|
-
};
|
|
526
|
-
const attributesBuffer = stringToBuffer(JSON.stringify(dataStoreAttributes), "utf8");
|
|
527
|
-
const attachBlobs = new Map([
|
|
528
|
-
["fluidDataStoreAttributes", attributesBuffer],
|
|
529
|
-
]);
|
|
530
|
-
const snapshotTree = {
|
|
531
|
-
blobs: {
|
|
532
|
-
[dataStoreAttributesBlobName]: "fluidDataStoreAttributes",
|
|
533
|
-
},
|
|
534
|
-
trees: {},
|
|
535
|
-
};
|
|
536
|
-
// The base GC data of the data store.
|
|
537
|
-
const dataStoreGCData = {
|
|
538
|
-
gcNodes: {
|
|
539
|
-
"/": ["/dds1", "/dds2"],
|
|
540
|
-
"/dds1": ["/dds2", "/"],
|
|
541
|
-
},
|
|
542
|
-
};
|
|
543
|
-
// Set the root base GC details to include the child node's base GC data.
|
|
544
|
-
rootBaseGCDetails = {
|
|
545
|
-
usedRoutes: [],
|
|
546
|
-
gcData: buildRootGCData(dataStoreGCData, dataStoreId),
|
|
547
|
-
};
|
|
548
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
549
|
-
id: dataStoreId,
|
|
550
|
-
snapshotTree,
|
|
551
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
552
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
553
|
-
scope,
|
|
554
|
-
createSummarizerNodeFn,
|
|
555
|
-
});
|
|
556
|
-
const gcData = await remoteDataStoreContext.getGCData();
|
|
557
|
-
assert.deepStrictEqual(gcData, dataStoreGCData, "GC data from getGCData is incorrect.");
|
|
558
|
-
});
|
|
559
|
-
it("should not reuse summary data when used state changed since last summary", async () => {
|
|
560
|
-
dataStoreAttributes = {
|
|
561
|
-
pkg: "TestDataStore1",
|
|
562
|
-
summaryFormatVersion: undefined,
|
|
563
|
-
};
|
|
564
|
-
const attributesBuffer = stringToBuffer(JSON.stringify(dataStoreAttributes), "utf8");
|
|
565
|
-
const attachBlobs = new Map([
|
|
566
|
-
["fluidDataStoreAttributes", attributesBuffer],
|
|
567
|
-
]);
|
|
568
|
-
const snapshotTree = {
|
|
569
|
-
id: "dummy",
|
|
570
|
-
blobs: {
|
|
571
|
-
[dataStoreAttributesBlobName]: "fluidDataStoreAttributes",
|
|
572
|
-
},
|
|
573
|
-
trees: {},
|
|
574
|
-
};
|
|
575
|
-
// The base GC data of the data store.
|
|
576
|
-
const dataStoreGCData = {
|
|
577
|
-
gcNodes: {
|
|
578
|
-
"/": [],
|
|
579
|
-
},
|
|
580
|
-
};
|
|
581
|
-
// Set the root base GC details to include the child node's base GC data.
|
|
582
|
-
rootBaseGCDetails = {
|
|
583
|
-
usedRoutes: [`/${dataStoreId}`],
|
|
584
|
-
gcData: buildRootGCData(dataStoreGCData, dataStoreId),
|
|
585
|
-
};
|
|
586
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
587
|
-
id: dataStoreId,
|
|
588
|
-
snapshotTree,
|
|
589
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
590
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
591
|
-
scope,
|
|
592
|
-
createSummarizerNodeFn,
|
|
593
|
-
});
|
|
594
|
-
// Since GC is enabled, GC must run before summarize. Get the GC data and update used routes to
|
|
595
|
-
// emulate the GC process.
|
|
596
|
-
const gcData = await remoteDataStoreContext.getGCData();
|
|
597
|
-
assert.deepStrictEqual(gcData, dataStoreGCData, "GC data from getGCData should be empty.");
|
|
598
|
-
// Update used routes to the same as in initial GC details. This will ensure that the used state
|
|
599
|
-
// matches the initial used state.
|
|
600
|
-
remoteDataStoreContext.updateUsedRoutes([""]);
|
|
601
|
-
// The data in the store has not changed since last summary and the reference used routes (from initial
|
|
602
|
-
// used routes) and current used routes (default) are both empty. So, summarize should return a handle.
|
|
603
|
-
let summarizeResult = await remoteDataStoreContext.summarize(false /* fullTree */);
|
|
604
|
-
assert(summarizeResult.summary.type === SummaryType.Handle, "summarize should return a handle since nothing changed");
|
|
605
|
-
// Update the used routes of the data store to a different value than current.
|
|
606
|
-
remoteDataStoreContext.updateUsedRoutes([]);
|
|
607
|
-
// Since the used state has changed, it should generate a full summary tree.
|
|
608
|
-
summarizeResult = await remoteDataStoreContext.summarize(false /* fullTree */);
|
|
609
|
-
assert(summarizeResult.summary.type === SummaryType.Tree, "summarize should return a tree since used state changed");
|
|
610
|
-
});
|
|
611
|
-
function updateReferencedStateTest() {
|
|
612
|
-
const buffer = stringToBuffer(JSON.stringify(dataStoreAttributes), "utf8");
|
|
613
|
-
const attachBlobs = new Map([
|
|
614
|
-
["fluidDataStoreAttributes", buffer],
|
|
615
|
-
]);
|
|
616
|
-
const snapshotTree = {
|
|
617
|
-
id: "dummy",
|
|
618
|
-
blobs: { [".component"]: "fluidDataStoreAttributes" },
|
|
619
|
-
trees: {},
|
|
620
|
-
};
|
|
621
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
622
|
-
id: dataStoreId,
|
|
623
|
-
snapshotTree,
|
|
624
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
625
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
626
|
-
scope,
|
|
627
|
-
createSummarizerNodeFn,
|
|
628
|
-
});
|
|
629
|
-
// Get the summarizer node for this data store which tracks its referenced state.
|
|
630
|
-
const dataStoreSummarizerNode = summarizerNode.getChild(dataStoreId);
|
|
631
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), true, "Data store should be referenced by default");
|
|
632
|
-
// Update the used routes to not include route to the data store.
|
|
633
|
-
remoteDataStoreContext.updateUsedRoutes([]);
|
|
634
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), false, "Data store should now be unreferenced");
|
|
635
|
-
// Add the data store's route (empty string) to its used routes.
|
|
636
|
-
remoteDataStoreContext.updateUsedRoutes([""]);
|
|
637
|
-
assert.strictEqual(dataStoreSummarizerNode?.isReferenced(), true, "Data store should now be referenced");
|
|
638
|
-
}
|
|
639
|
-
it("can successfully update referenced state from format version 0", () => {
|
|
640
|
-
dataStoreAttributes = {
|
|
641
|
-
pkg: "TestDataStore1",
|
|
642
|
-
};
|
|
643
|
-
updateReferencedStateTest();
|
|
644
|
-
});
|
|
645
|
-
it("can successfully update referenced state from format version 1", () => {
|
|
646
|
-
dataStoreAttributes = {
|
|
647
|
-
pkg: '["TestDataStore1"]',
|
|
648
|
-
snapshotFormatVersion: "0.1",
|
|
649
|
-
};
|
|
650
|
-
updateReferencedStateTest();
|
|
651
|
-
});
|
|
652
|
-
it("can successfully update referenced state from format version 2", () => {
|
|
653
|
-
dataStoreAttributes = {
|
|
654
|
-
pkg: '["TestDataStore1"]',
|
|
655
|
-
summaryFormatVersion: 2,
|
|
656
|
-
};
|
|
657
|
-
updateReferencedStateTest();
|
|
658
|
-
});
|
|
659
|
-
it("can successfully tombstone a remote datastore", async () => {
|
|
660
|
-
dataStoreAttributes = {
|
|
661
|
-
pkg: JSON.stringify(["TestDataStore1"]),
|
|
662
|
-
isRootDataStore: false,
|
|
663
|
-
};
|
|
664
|
-
const buffer = stringToBuffer(JSON.stringify(dataStoreAttributes), "utf8");
|
|
665
|
-
const attachBlobs = new Map([
|
|
666
|
-
["fluidDataStoreAttributes", buffer],
|
|
667
|
-
]);
|
|
668
|
-
const snapshotTree = {
|
|
669
|
-
id: "dummy",
|
|
670
|
-
blobs: { [".component"]: "fluidDataStoreAttributes" },
|
|
671
|
-
trees: {},
|
|
672
|
-
};
|
|
673
|
-
remoteDataStoreContext = new RemoteFluidDataStoreContext({
|
|
674
|
-
id: dataStoreId,
|
|
675
|
-
snapshotTree,
|
|
676
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
677
|
-
storage: new StorageServiceWithAttachBlobs(storage, attachBlobs),
|
|
678
|
-
scope,
|
|
679
|
-
createSummarizerNodeFn,
|
|
680
|
-
});
|
|
681
|
-
remoteDataStoreContext.setTombstone(true);
|
|
682
|
-
assert(remoteDataStoreContext.tombstoned, `Local data store should be tombstoned!`);
|
|
683
|
-
remoteDataStoreContext.setTombstone(false);
|
|
684
|
-
assert(!remoteDataStoreContext.tombstoned, `Local data store should not be tombstoned!`);
|
|
685
|
-
});
|
|
686
|
-
});
|
|
687
|
-
});
|
|
688
|
-
describe("LocalDetachedFluidDataStoreContext", () => {
|
|
689
|
-
let localDataStoreContext;
|
|
690
|
-
let storage;
|
|
691
|
-
let scope;
|
|
692
|
-
let factory;
|
|
693
|
-
const makeLocallyVisibleFn = () => { };
|
|
694
|
-
const channelToDataStoreFn = (fluidDataStore) => channelToDataStore(fluidDataStore, "id", channelCollection, containerRuntime.logger);
|
|
695
|
-
let containerRuntime;
|
|
696
|
-
let channelCollection;
|
|
697
|
-
let provideDsRuntimeWithFailingEntrypoint = false;
|
|
698
|
-
beforeEach(async () => {
|
|
699
|
-
const summarizerNode = createRootSummarizerNodeWithGC(createChildLogger(), (() => undefined), 0, 0);
|
|
700
|
-
summarizerNode.startSummary(0, createChildLogger(), 0);
|
|
701
|
-
createSummarizerNodeFn = (summarizeInternal, getGCDataFn) => summarizerNode.createChild(summarizeInternal, dataStoreId, { type: CreateSummarizerNodeSource.Local }, undefined, getGCDataFn);
|
|
702
|
-
const failingEntryPoint = new FluidObjectHandle(new LazyPromise(async () => {
|
|
703
|
-
throw new Error("Simulating failure when initializing EntryPoint");
|
|
704
|
-
}), "", undefined);
|
|
705
|
-
factory = {
|
|
706
|
-
type: "store-type",
|
|
707
|
-
get IFluidDataStoreFactory() {
|
|
708
|
-
return factory;
|
|
709
|
-
},
|
|
710
|
-
instantiateDataStore: async (context, existing) => provideDsRuntimeWithFailingEntrypoint
|
|
711
|
-
? new MockFluidDataStoreRuntime({ entryPoint: failingEntryPoint })
|
|
712
|
-
: new MockFluidDataStoreRuntime(),
|
|
713
|
-
};
|
|
714
|
-
const registry = {
|
|
715
|
-
get IFluidDataStoreRegistry() {
|
|
716
|
-
return registry;
|
|
717
|
-
},
|
|
718
|
-
get: async (pkg) => (pkg === factory.type ? factory : undefined),
|
|
719
|
-
};
|
|
720
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
721
|
-
containerRuntime = {
|
|
722
|
-
IFluidDataStoreRegistry: registry,
|
|
723
|
-
on: (event, listener) => { },
|
|
724
|
-
logger: createChildLogger(),
|
|
725
|
-
clientDetails: {},
|
|
726
|
-
};
|
|
727
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
728
|
-
channelCollection = {
|
|
729
|
-
parentContext: containerRuntime,
|
|
730
|
-
};
|
|
731
|
-
});
|
|
732
|
-
describe("Initialization", () => {
|
|
733
|
-
it("rejects ids with forward slashes", async () => {
|
|
734
|
-
const invalidId = "beforeSlash/afterSlash";
|
|
735
|
-
const codeBlock = () => new LocalDetachedFluidDataStoreContext({
|
|
736
|
-
id: invalidId,
|
|
737
|
-
pkg: [factory.type],
|
|
738
|
-
parentContext: wrapContextForInnerChannel(invalidId, containerRuntime),
|
|
739
|
-
storage,
|
|
740
|
-
scope,
|
|
741
|
-
createSummarizerNodeFn,
|
|
742
|
-
makeLocallyVisibleFn,
|
|
743
|
-
snapshotTree: undefined,
|
|
744
|
-
isRootDataStore: true,
|
|
745
|
-
channelToDataStoreFn,
|
|
746
|
-
});
|
|
747
|
-
assert.throws(codeBlock, (e) => validateAssertionError(e, "Data store ID contains slash"));
|
|
748
|
-
});
|
|
749
|
-
describe("should error on attach if data store cannot be constructed/initialized", () => {
|
|
750
|
-
// Tests in this suite should be scenarios that lead to a data store which cannot be constructed for
|
|
751
|
-
// some reason.
|
|
752
|
-
it("because of package type for data store not present in registry", async () => {
|
|
753
|
-
let exceptionOccurred = false;
|
|
754
|
-
localDataStoreContext = new LocalDetachedFluidDataStoreContext({
|
|
755
|
-
id: dataStoreId,
|
|
756
|
-
pkg: ["some-datastore-type-not-present-in-registry"],
|
|
757
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
758
|
-
storage,
|
|
759
|
-
scope,
|
|
760
|
-
createSummarizerNodeFn,
|
|
761
|
-
makeLocallyVisibleFn,
|
|
762
|
-
snapshotTree: undefined,
|
|
763
|
-
isRootDataStore: false,
|
|
764
|
-
channelToDataStoreFn,
|
|
765
|
-
});
|
|
766
|
-
const dataStore = await factory.instantiateDataStore(localDataStoreContext, false);
|
|
767
|
-
await localDataStoreContext.attachRuntime(factory, dataStore).catch((error) => {
|
|
768
|
-
assert.strictEqual(error.message, "Registry does not contain entry for the package", "Unexpected exception thrown");
|
|
769
|
-
exceptionOccurred = true;
|
|
770
|
-
});
|
|
771
|
-
assert.strictEqual(exceptionOccurred, true, "attachRuntime() call did not fail as expected.");
|
|
772
|
-
assert.strictEqual(localDataStoreContext.attachState, AttachState.Detached);
|
|
773
|
-
});
|
|
774
|
-
it("because of entryPoint that fails to initialize", async () => {
|
|
775
|
-
let exceptionOccurred = false;
|
|
776
|
-
provideDsRuntimeWithFailingEntrypoint = true;
|
|
777
|
-
localDataStoreContext = new LocalDetachedFluidDataStoreContext({
|
|
778
|
-
id: dataStoreId,
|
|
779
|
-
pkg: [factory.type],
|
|
780
|
-
parentContext: wrapContextForInnerChannel(dataStoreId, containerRuntime),
|
|
781
|
-
storage,
|
|
782
|
-
scope,
|
|
783
|
-
createSummarizerNodeFn,
|
|
784
|
-
makeLocallyVisibleFn,
|
|
785
|
-
snapshotTree: undefined,
|
|
786
|
-
isRootDataStore: false,
|
|
787
|
-
channelToDataStoreFn,
|
|
788
|
-
});
|
|
789
|
-
const dataStore = await factory.instantiateDataStore(localDataStoreContext, false);
|
|
790
|
-
await localDataStoreContext.attachRuntime(factory, dataStore).catch((error) => {
|
|
791
|
-
assert.strictEqual(error.message, "Simulating failure when initializing EntryPoint", "Unexpected exception thrown");
|
|
792
|
-
exceptionOccurred = true;
|
|
793
|
-
});
|
|
794
|
-
assert.strictEqual(exceptionOccurred, true, "attachRuntime() call did not fail as expected.");
|
|
795
|
-
assert.strictEqual(localDataStoreContext.attachState, AttachState.Detached);
|
|
796
|
-
});
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
});
|
|
800
|
-
});
|
|
801
|
-
//# sourceMappingURL=dataStoreContext.spec.js.map
|