@fluidframework/container-runtime 2.0.0-internal.6.1.1 → 2.0.0-internal.6.3.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 +39 -0
- package/README.md +4 -3
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +5 -4
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +4 -21
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +119 -185
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +13 -12
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +99 -16
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +380 -242
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +4 -5
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +2 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +40 -41
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts +1 -2
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -8
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.js +2 -2
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +23 -25
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaManagerProxyBase.d.ts +1 -1
- package/dist/deltaManagerProxyBase.js +2 -2
- package/dist/deltaManagerProxyBase.js.map +1 -1
- package/dist/deltaScheduler.js +6 -6
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/error.d.ts +14 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +21 -0
- package/dist/error.js.map +1 -0
- package/dist/gc/garbageCollection.d.ts +4 -6
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +26 -25
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +5 -3
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +4 -2
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.js +7 -7
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts +4 -7
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +15 -52
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +2 -0
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/gcUnreferencedStateTracker.js +4 -4
- 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 +1 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js +26 -68
- package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/dist/id-compressor/finalSpace.d.ts +29 -0
- package/dist/id-compressor/finalSpace.d.ts.map +1 -0
- package/dist/id-compressor/finalSpace.js +62 -0
- package/dist/id-compressor/finalSpace.js.map +1 -0
- package/dist/id-compressor/idCompressor.d.ts +25 -250
- package/dist/id-compressor/idCompressor.d.ts.map +1 -1
- package/dist/id-compressor/idCompressor.js +387 -1150
- package/dist/id-compressor/idCompressor.js.map +1 -1
- package/dist/id-compressor/identifiers.d.ts +32 -0
- package/dist/id-compressor/identifiers.d.ts.map +1 -0
- package/dist/id-compressor/identifiers.js +15 -0
- package/dist/id-compressor/identifiers.js.map +1 -0
- package/dist/id-compressor/index.d.ts +5 -6
- package/dist/id-compressor/index.d.ts.map +1 -1
- package/dist/id-compressor/index.js +20 -26
- package/dist/id-compressor/index.js.map +1 -1
- package/dist/id-compressor/persistanceUtilities.d.ts +22 -0
- package/dist/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/dist/id-compressor/persistanceUtilities.js +43 -0
- package/dist/id-compressor/persistanceUtilities.js.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js +80 -0
- package/dist/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/dist/id-compressor/sessions.d.ts +115 -0
- package/dist/id-compressor/sessions.d.ts.map +1 -0
- package/dist/id-compressor/sessions.js +305 -0
- package/dist/id-compressor/sessions.js.map +1 -0
- package/dist/id-compressor/utilities.d.ts +49 -0
- package/dist/id-compressor/utilities.d.ts.map +1 -0
- package/dist/id-compressor/utilities.js +166 -0
- package/dist/id-compressor/utilities.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.js +5 -5
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +11 -10
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opGroupingManager.js +3 -3
- package/dist/opLifecycle/opGroupingManager.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +14 -15
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +1 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +16 -17
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js +11 -5
- 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 +12 -5
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +36 -23
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +23 -23
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +3 -3
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +2 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +2 -3
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +8 -8
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +3 -3
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +27 -4
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +246 -74
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +6 -5
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +73 -69
- 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 +2 -2
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.js +2 -2
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerNode/index.d.ts +1 -1
- package/dist/summary/summarizerNode/index.d.ts.map +1 -1
- package/dist/summary/summarizerNode/index.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts +5 -14
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +32 -109
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +6 -30
- package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +0 -11
- package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js +5 -88
- package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +38 -25
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +2 -3
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +9 -8
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.js +2 -2
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +10 -4
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +52 -48
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryManager.d.ts +7 -6
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +30 -22
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +3 -2
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +4 -21
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +91 -157
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +2 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +99 -16
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +332 -192
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +2 -3
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +2 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +3 -4
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts +1 -2
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +1 -2
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.js +1 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +2 -4
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaManagerProxyBase.d.ts +1 -1
- package/lib/deltaManagerProxyBase.js +1 -1
- package/lib/deltaManagerProxyBase.js.map +1 -1
- package/lib/deltaScheduler.js +1 -1
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/error.d.ts +14 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +17 -0
- package/lib/error.js.map +1 -0
- package/lib/gc/garbageCollection.d.ts +4 -6
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +26 -25
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +3 -1
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +4 -2
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.js +1 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts +4 -7
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +16 -53
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +2 -0
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/gcUnreferencedStateTracker.js +1 -1
- 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/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js +25 -66
- package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
- package/lib/id-compressor/finalSpace.d.ts +29 -0
- package/lib/id-compressor/finalSpace.d.ts.map +1 -0
- package/lib/id-compressor/finalSpace.js +58 -0
- package/lib/id-compressor/finalSpace.js.map +1 -0
- package/lib/id-compressor/idCompressor.d.ts +25 -250
- package/lib/id-compressor/idCompressor.d.ts.map +1 -1
- package/lib/id-compressor/idCompressor.js +382 -1139
- package/lib/id-compressor/idCompressor.js.map +1 -1
- package/lib/id-compressor/identifiers.d.ts +32 -0
- package/lib/id-compressor/identifiers.d.ts.map +1 -0
- package/lib/id-compressor/identifiers.js +11 -0
- package/lib/id-compressor/identifiers.js.map +1 -0
- package/lib/id-compressor/index.d.ts +5 -6
- package/lib/id-compressor/index.d.ts.map +1 -1
- package/lib/id-compressor/index.js +5 -6
- package/lib/id-compressor/index.js.map +1 -1
- package/lib/id-compressor/persistanceUtilities.d.ts +22 -0
- package/lib/id-compressor/persistanceUtilities.d.ts.map +1 -0
- package/lib/id-compressor/persistanceUtilities.js +34 -0
- package/lib/id-compressor/persistanceUtilities.js.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
- package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js +76 -0
- package/lib/id-compressor/sessionSpaceNormalizer.js.map +1 -0
- package/lib/id-compressor/sessions.d.ts +115 -0
- package/lib/id-compressor/sessions.d.ts.map +1 -0
- package/lib/id-compressor/sessions.js +290 -0
- package/lib/id-compressor/sessions.js.map +1 -0
- package/lib/id-compressor/utilities.d.ts +49 -0
- package/lib/id-compressor/utilities.d.ts.map +1 -0
- package/lib/id-compressor/utilities.js +148 -0
- package/lib/id-compressor/utilities.js.map +1 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.js +3 -3
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +2 -1
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opGroupingManager.js +1 -1
- package/lib/opLifecycle/opGroupingManager.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +2 -3
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +1 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +7 -8
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js +12 -6
- 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 +12 -5
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +21 -8
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -3
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/index.d.ts +3 -3
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -1
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +2 -3
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +3 -3
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +27 -4
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +240 -68
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +6 -5
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +69 -65
- 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 +1 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.js +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerNode/index.d.ts +1 -1
- package/lib/summary/summarizerNode/index.d.ts.map +1 -1
- package/lib/summary/summarizerNode/index.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts +5 -14
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +16 -93
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +6 -30
- package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +0 -11
- package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -86
- package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +38 -25
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +2 -3
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +2 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.js +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +10 -4
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +46 -42
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryManager.d.ts +7 -6
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +26 -18
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +30 -29
- package/src/batchTracker.ts +3 -2
- package/src/blobManager.ts +105 -185
- package/src/connectionTelemetry.ts +2 -1
- package/src/containerRuntime.ts +481 -267
- package/src/dataStore.ts +2 -3
- package/src/dataStoreContext.ts +5 -8
- package/src/dataStoreContexts.ts +2 -4
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +4 -7
- package/src/deltaManagerProxyBase.ts +1 -1
- package/src/deltaScheduler.ts +1 -1
- package/src/error.ts +18 -0
- package/src/gc/garbageCollection.ts +39 -41
- package/src/gc/gcConfigs.ts +4 -2
- package/src/gc/gcDefinitions.ts +4 -6
- package/src/gc/gcHelpers.ts +1 -1
- package/src/gc/gcSummaryStateTracker.ts +19 -65
- package/src/gc/gcTelemetry.ts +2 -0
- package/src/gc/gcUnreferencedStateTracker.ts +1 -1
- package/src/gc/index.ts +0 -1
- package/src/id-compressor/appendOnlySortedMap.ts +26 -87
- package/src/id-compressor/finalSpace.ts +67 -0
- package/src/id-compressor/idCompressor.ts +456 -1681
- package/src/id-compressor/identifiers.ts +42 -0
- package/src/id-compressor/index.ts +11 -20
- package/src/id-compressor/persistanceUtilities.ts +58 -0
- package/src/id-compressor/sessionSpaceNormalizer.ts +83 -0
- package/src/id-compressor/sessions.ts +405 -0
- package/src/id-compressor/utilities.ts +187 -0
- package/src/index.ts +7 -1
- package/src/opLifecycle/opCompressor.ts +3 -3
- package/src/opLifecycle/opDecompressor.ts +2 -1
- package/src/opLifecycle/opGroupingManager.ts +1 -1
- package/src/opLifecycle/opSplitter.ts +4 -4
- package/src/opLifecycle/outbox.ts +14 -11
- package/src/opLifecycle/remoteMessageProcessor.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +50 -29
- package/src/scheduleManager.ts +6 -4
- package/src/summary/index.ts +4 -3
- package/src/summary/orderedClientElection.ts +8 -5
- package/src/summary/runWhileConnectedCoordinator.ts +1 -1
- package/src/summary/runningSummarizer.ts +273 -97
- package/src/summary/summarizer.ts +23 -12
- package/src/summary/summarizerClientElection.ts +2 -2
- package/src/summary/summarizerHeuristics.ts +1 -1
- package/src/summary/summarizerNode/index.ts +1 -2
- package/src/summary/summarizerNode/summarizerNode.ts +23 -145
- package/src/summary/summarizerNode/summarizerNodeUtils.ts +7 -38
- package/src/summary/summarizerNode/summarizerNodeWithGc.ts +3 -123
- package/src/summary/summarizerTypes.ts +40 -25
- package/src/summary/summaryCollection.ts +3 -3
- package/src/summary/summaryFormat.ts +1 -1
- package/src/summary/summaryGenerator.ts +52 -55
- package/src/summary/summaryManager.ts +36 -13
- package/dist/id-compressor/idRange.d.ts +0 -11
- package/dist/id-compressor/idRange.d.ts.map +0 -1
- package/dist/id-compressor/idRange.js +0 -29
- package/dist/id-compressor/idRange.js.map +0 -1
- package/dist/id-compressor/numericUuid.d.ts +0 -59
- package/dist/id-compressor/numericUuid.d.ts.map +0 -1
- package/dist/id-compressor/numericUuid.js +0 -325
- package/dist/id-compressor/numericUuid.js.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/dist/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/dist/id-compressor/sessionIdNormalizer.js +0 -483
- package/dist/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/dist/id-compressor/utils.d.ts +0 -57
- package/dist/id-compressor/utils.d.ts.map +0 -1
- package/dist/id-compressor/utils.js +0 -90
- package/dist/id-compressor/utils.js.map +0 -1
- package/dist/id-compressor/uuidUtilities.d.ts +0 -28
- package/dist/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/dist/id-compressor/uuidUtilities.js +0 -104
- package/dist/id-compressor/uuidUtilities.js.map +0 -1
- package/lib/id-compressor/idRange.d.ts +0 -11
- package/lib/id-compressor/idRange.d.ts.map +0 -1
- package/lib/id-compressor/idRange.js +0 -25
- package/lib/id-compressor/idRange.js.map +0 -1
- package/lib/id-compressor/numericUuid.d.ts +0 -59
- package/lib/id-compressor/numericUuid.d.ts.map +0 -1
- package/lib/id-compressor/numericUuid.js +0 -315
- package/lib/id-compressor/numericUuid.js.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.d.ts +0 -138
- package/lib/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
- package/lib/id-compressor/sessionIdNormalizer.js +0 -479
- package/lib/id-compressor/sessionIdNormalizer.js.map +0 -1
- package/lib/id-compressor/utils.d.ts +0 -57
- package/lib/id-compressor/utils.d.ts.map +0 -1
- package/lib/id-compressor/utils.js +0 -79
- package/lib/id-compressor/utils.js.map +0 -1
- package/lib/id-compressor/uuidUtilities.d.ts +0 -28
- package/lib/id-compressor/uuidUtilities.d.ts.map +0 -1
- package/lib/id-compressor/uuidUtilities.js +0 -96
- package/lib/id-compressor/uuidUtilities.js.map +0 -1
- package/src/id-compressor/idRange.ts +0 -35
- package/src/id-compressor/numericUuid.ts +0 -383
- package/src/id-compressor/sessionIdNormalizer.ts +0 -609
- package/src/id-compressor/utils.ts +0 -114
- package/src/id-compressor/uuidUtilities.ts +0 -120
|
@@ -1,609 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
7
|
-
|
|
8
|
-
import { assert } from "@fluidframework/common-utils";
|
|
9
|
-
import {
|
|
10
|
-
FinalCompressedId,
|
|
11
|
-
LocalCompressedId,
|
|
12
|
-
SessionSpaceCompressedId,
|
|
13
|
-
SerializedSessionIdNormalizer,
|
|
14
|
-
} from "@fluidframework/runtime-definitions";
|
|
15
|
-
import { compareFiniteNumbers, compareFiniteNumbersReversed, fail, Mutable } from "./utils";
|
|
16
|
-
import { AppendOnlyDoublySortedMap } from "./appendOnlySortedMap";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Maps IDs created by a session between their local and final forms (i.e. normalization). These IDs are in a contiguous range.
|
|
20
|
-
* The local and final forms of IDs made by a session can be thought of as two equal-length sparse arrays, aligned such
|
|
21
|
-
* that normalizeLocalToFinal(locals[i]) === finals[i] and vice versa.
|
|
22
|
-
* Below is an example to illustrate how various mappings can arise:
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
* +- Creation Index
|
|
26
|
-
* / +- Locals
|
|
27
|
-
* / / +- Finals
|
|
28
|
-
* / / /
|
|
29
|
-
* ---+-----+----
|
|
30
|
-
* 0 | -1 | 0 -|___ Two IDs are allocated as locals since no cluster exists. A new cluster is created when acked.
|
|
31
|
-
* 1 | -2 | 1 -|
|
|
32
|
-
* 2 | | 2 -|
|
|
33
|
-
* 3 | | 3 --|-- Three more IDs are allocated as finals eagerly since a cluster exists with available capacity.
|
|
34
|
-
* 4 | | 4 -|
|
|
35
|
-
* 5 | -6 | 10 ----- One ID is allocated as a local (it overflows the existing cluster) and a new cluster is created after ack.
|
|
36
|
-
* 6 | | 11 ----- One ID is allocated as a final eagerly into the existing cluster.
|
|
37
|
-
* 7 | -8 | 12 ----- A local ID with an override is allocated. The override forces it to be a local ID.
|
|
38
|
-
* 8 | | 13
|
|
39
|
-
* 9 | | 14
|
|
40
|
-
* 10 | -11 | ----- A local ID is allocated. It has no corresponding final ID since it has not been acked.
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* Note that in this example, some IDs (those at indices 2, 3, 4, 6, 8, and 9) have no local form. The ID at index 10 has no final form.
|
|
44
|
-
* These kinds of "gaps" occur due to the timing of allocation calls on the client and how they relate to finalization/cluster creation,
|
|
45
|
-
* which depends on receiving an ack/sequence number from the server. Given this context, "session space" can be thought of as:
|
|
46
|
-
*
|
|
47
|
-
* ```
|
|
48
|
-
* for each index in the range of IDs created by a session:
|
|
49
|
-
* the local form if it exists, otherwise the final form
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* This class is designed to efficiently build and query these mappings by leveraging the facts that much of the range (in both local and
|
|
53
|
-
* final space) is uninterrupted by "gaps" and can be compactly represented by a (first, last) pair and is easily binary searched for
|
|
54
|
-
* normalization between local and final space.
|
|
55
|
-
*/
|
|
56
|
-
export class SessionIdNormalizer<TRangeObject> {
|
|
57
|
-
private nextLocalId: LocalCompressedId = -1 as LocalCompressedId;
|
|
58
|
-
private readonly idRanges: AppendOnlyDoublySortedMap<
|
|
59
|
-
LocalCompressedId,
|
|
60
|
-
[lastLocal: LocalCompressedId, finalRanges: FinalRanges<TRangeObject> | undefined],
|
|
61
|
-
FinalCompressedId
|
|
62
|
-
> = new AppendOnlyDoublySortedMap(
|
|
63
|
-
compareFiniteNumbersReversed,
|
|
64
|
-
([_, finalRanges]) => {
|
|
65
|
-
if (finalRanges !== undefined) {
|
|
66
|
-
const first = getFirstRange(finalRanges);
|
|
67
|
-
return extractFirstFinalFromRange(first);
|
|
68
|
-
}
|
|
69
|
-
return Number.POSITIVE_INFINITY as FinalCompressedId;
|
|
70
|
-
},
|
|
71
|
-
compareFiniteNumbers,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
public constructor(private readonly expensiveAsserts = false) {}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Converts the final ID to its session-space representation.
|
|
78
|
-
* This will be the corresponding local if a local form exists, and `finalId` otherwise.
|
|
79
|
-
*/
|
|
80
|
-
public getSessionSpaceId(finalId: FinalCompressedId): SessionSpaceCompressedId | undefined {
|
|
81
|
-
const localRange = this.idRanges.getPairOrNextLowerByValue(finalId);
|
|
82
|
-
if (localRange !== undefined) {
|
|
83
|
-
const [firstLocal, [lastLocal, finalRanges]] = localRange;
|
|
84
|
-
const finalRange = getPairOrNextLowerByValue(firstLocal, finalRanges, finalId);
|
|
85
|
-
if (finalRange !== undefined) {
|
|
86
|
-
const [alignedLocal, [firstFinal, lastFinal]] = finalRange;
|
|
87
|
-
if (finalId <= lastFinal) {
|
|
88
|
-
const localRangeDelta = alignedLocal - lastLocal;
|
|
89
|
-
const finalDelta = finalId - firstFinal;
|
|
90
|
-
if (finalDelta <= localRangeDelta) {
|
|
91
|
-
return (alignedLocal - finalDelta) as LocalCompressedId;
|
|
92
|
-
}
|
|
93
|
-
// `finalId` was an eagerly generated final ID
|
|
94
|
-
return finalId as SessionSpaceCompressedId;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Converts the local ID to its corresponding final ID, if one exists.
|
|
103
|
-
*/
|
|
104
|
-
public getFinalId(localId: LocalCompressedId): [FinalCompressedId, TRangeObject] | undefined {
|
|
105
|
-
const localRange =
|
|
106
|
-
this.idRanges.getPairOrNextLower(localId) ??
|
|
107
|
-
fail("Local ID was never recorded with this normalizer.");
|
|
108
|
-
const [firstLocal, [lastLocal, finalRanges]] = localRange;
|
|
109
|
-
if (localId < lastLocal) {
|
|
110
|
-
fail("Local ID was never recorded with this normalizer.");
|
|
111
|
-
}
|
|
112
|
-
const finalRange = getPairOrNextLower(firstLocal, finalRanges, localId);
|
|
113
|
-
if (finalRange !== undefined) {
|
|
114
|
-
const [alignedLocal, [firstFinal, lastFinal, rangeObject]] = finalRange;
|
|
115
|
-
const rangeDelta = lastFinal - firstFinal;
|
|
116
|
-
const localDelta = alignedLocal - localId;
|
|
117
|
-
if (localDelta <= rangeDelta) {
|
|
118
|
-
// Local is within a range segment that has a corresponding final
|
|
119
|
-
return [(firstFinal + localDelta) as FinalCompressedId, rangeObject];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Returns the index of the local ID corresponding to the supplied final ID in the total range of IDs created by the session,
|
|
127
|
-
* if the ID was created by the session for this `SessionIdNormalizer`.
|
|
128
|
-
*/
|
|
129
|
-
public getCreationIndex(finalId: FinalCompressedId): number | undefined {
|
|
130
|
-
const localRange = this.idRanges.getPairOrNextLowerByValue(finalId);
|
|
131
|
-
if (localRange !== undefined) {
|
|
132
|
-
const [firstLocal, [_, finalRanges]] = localRange;
|
|
133
|
-
const finalRange = getPairOrNextLowerByValue(firstLocal, finalRanges, finalId);
|
|
134
|
-
if (finalRange !== undefined) {
|
|
135
|
-
const [alignedLocal, [firstFinal, lastFinal]] = finalRange;
|
|
136
|
-
if (finalId <= lastFinal) {
|
|
137
|
-
const finalDelta = finalId - firstFinal;
|
|
138
|
-
return -alignedLocal - 1 + finalDelta;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return undefined;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Returns the session-space ID at the supplied creation index, if one exists.
|
|
147
|
-
*/
|
|
148
|
-
public getIdByCreationIndex(index: number): SessionSpaceCompressedId | undefined {
|
|
149
|
-
const localByIndex = -(index + 1) as LocalCompressedId;
|
|
150
|
-
const localRange = this.idRanges.getPairOrNextLower(localByIndex);
|
|
151
|
-
if (localRange === undefined) {
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
const [firstLocal, [lastLocal, finalRanges]] = localRange;
|
|
155
|
-
if (localByIndex >= lastLocal) {
|
|
156
|
-
return localByIndex;
|
|
157
|
-
}
|
|
158
|
-
const finalRange =
|
|
159
|
-
getPairOrNextLower(firstLocal, finalRanges, localByIndex) ??
|
|
160
|
-
fail("Final ranges not aligned with owning local range.");
|
|
161
|
-
|
|
162
|
-
const [alignedLocal, [firstFinal, lastFinal]] = finalRange;
|
|
163
|
-
const localDelta = alignedLocal - localByIndex;
|
|
164
|
-
const finalId = firstFinal + localDelta;
|
|
165
|
-
if (finalId <= lastFinal) {
|
|
166
|
-
// `finalId` was an eagerly generated final ID
|
|
167
|
-
return finalId as SessionSpaceCompressedId;
|
|
168
|
-
}
|
|
169
|
-
return undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private static makeFinalRangesMap<TRangeObject>(): FinalRangesMap<TRangeObject> {
|
|
173
|
-
return new AppendOnlyDoublySortedMap(
|
|
174
|
-
compareFiniteNumbersReversed,
|
|
175
|
-
extractFirstFinalFromRange,
|
|
176
|
-
compareFiniteNumbers,
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Returns the last final ID known to this normalizer.
|
|
182
|
-
*/
|
|
183
|
-
public getLastFinalId(): FinalCompressedId | undefined {
|
|
184
|
-
const lastIndex = this.idRanges.size - 1;
|
|
185
|
-
const secondToLast = Math.max(0, lastIndex - 1);
|
|
186
|
-
for (let i = lastIndex; i >= secondToLast; i--) {
|
|
187
|
-
const localRange = this.idRanges.getAtIndex(i);
|
|
188
|
-
if (localRange !== undefined) {
|
|
189
|
-
const finalRanges = localRange[1][1];
|
|
190
|
-
if (finalRanges !== undefined) {
|
|
191
|
-
return getLastRange(finalRanges)[1];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return undefined;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Registers and returns the next ID in local space with this normalizer. An example:
|
|
200
|
-
*
|
|
201
|
-
* Locals: [-1, -2, X, X]
|
|
202
|
-
* Finals: [ 0, 1, 2, 3]
|
|
203
|
-
* In this scenario, a call to this method would generate and return -5.
|
|
204
|
-
*/
|
|
205
|
-
public addLocalId(): LocalCompressedId {
|
|
206
|
-
const localId = this.nextLocalId-- as LocalCompressedId;
|
|
207
|
-
const lastLocalRange = this.idRanges.last();
|
|
208
|
-
if (lastLocalRange !== undefined) {
|
|
209
|
-
const lastLocal = lastLocalRange[1][0];
|
|
210
|
-
if (localId === lastLocal - 1) {
|
|
211
|
-
// New local simply expands the last local range tracked
|
|
212
|
-
lastLocalRange[1][0] = localId;
|
|
213
|
-
return localId;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (this.expensiveAsserts) {
|
|
218
|
-
if (lastLocalRange === undefined) {
|
|
219
|
-
assert(localId === -1, 0x49e /* Local ID space must start at -1. */);
|
|
220
|
-
} else {
|
|
221
|
-
const [firstLocal, [_, finalRanges]] = lastLocalRange;
|
|
222
|
-
let finalDelta = 0;
|
|
223
|
-
for (const [__, [firstFinal, lastFinal]] of entries(firstLocal, finalRanges)) {
|
|
224
|
-
finalDelta += lastFinal - firstFinal + 1;
|
|
225
|
-
}
|
|
226
|
-
assert(
|
|
227
|
-
localId === firstLocal - finalDelta,
|
|
228
|
-
0x49f /* Local ID space must be contiguous. */,
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this.idRanges.append(localId, [localId, undefined]);
|
|
234
|
-
return localId;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Registers one or more final IDs with this normalizer.
|
|
239
|
-
* If there are any local IDs at the tip of session-space that do not have a corresponding final, they will be registered (aligned)
|
|
240
|
-
* starting with the first of those. Otherwise, will be registered as the next ID in session space in creation order.
|
|
241
|
-
*
|
|
242
|
-
* An example:
|
|
243
|
-
* Locals: [-1, -2, X, -4]
|
|
244
|
-
* Finals: [ 0, 1, 2, X]
|
|
245
|
-
* Calling `addFinalIds` with first === last === 5 results in the following:
|
|
246
|
-
* Locals: [-1, -2, X, -4]
|
|
247
|
-
* Finals: [ 0, 1, 2, 5]
|
|
248
|
-
* Subsequently calling `addFinalIds` with first === last === 6 results in the following:
|
|
249
|
-
* Locals: [-1, -2, X, -4, X]
|
|
250
|
-
* Finals: [ 0, 1, 2, 5, 6]
|
|
251
|
-
*
|
|
252
|
-
* Non-contiguous final IDs (i.e. the first final after a "gap" in final space) must always correspond to a local ID. For example,
|
|
253
|
-
* in the final call to `addFinalIds` above would fail if first === last === 9, because the resulting state would have a
|
|
254
|
-
* non-contiguous final ID without a local form:
|
|
255
|
-
* Locals: [-1, -2, X, -4, X]
|
|
256
|
-
* Finals: [ 0, 1, 2, 5, 9]
|
|
257
|
-
*
|
|
258
|
-
* ^final ID 9 is not contiguous and does not have a corresponding local ID
|
|
259
|
-
*/
|
|
260
|
-
public addFinalIds(
|
|
261
|
-
firstFinal: FinalCompressedId,
|
|
262
|
-
lastFinal: FinalCompressedId,
|
|
263
|
-
rangeObject: TRangeObject,
|
|
264
|
-
): void {
|
|
265
|
-
assert(lastFinal >= firstFinal, 0x5ae /* Malformed normalization range. */);
|
|
266
|
-
const [firstLocal, finalRangesObj] =
|
|
267
|
-
this.idRanges.last() ?? fail("Final IDs must be added to an existing local range.");
|
|
268
|
-
const [lastLocal, finalRanges] = finalRangesObj;
|
|
269
|
-
let nextLocal: LocalCompressedId;
|
|
270
|
-
if (finalRanges === undefined) {
|
|
271
|
-
finalRangesObj[1] = [firstFinal, lastFinal, rangeObject];
|
|
272
|
-
nextLocal = Math.min(
|
|
273
|
-
this.nextLocalId,
|
|
274
|
-
firstLocal - (lastFinal - firstFinal) - 1,
|
|
275
|
-
) as LocalCompressedId;
|
|
276
|
-
} else {
|
|
277
|
-
const [firstAlignedLocal, lastAlignedLocal, lastAlignedFinal, lastFinalRange] =
|
|
278
|
-
this.getAlignmentOfLastRange(firstLocal, finalRanges);
|
|
279
|
-
nextLocal = Math.min(
|
|
280
|
-
this.nextLocalId,
|
|
281
|
-
lastAlignedLocal - (lastFinal - firstFinal) - 2,
|
|
282
|
-
) as LocalCompressedId;
|
|
283
|
-
if (firstFinal === lastAlignedFinal + 1) {
|
|
284
|
-
lastFinalRange[1] = lastFinal;
|
|
285
|
-
} else {
|
|
286
|
-
const alignedLocal = (lastAlignedLocal - 1) as LocalCompressedId;
|
|
287
|
-
let rangeMap: FinalRangesMap<TRangeObject>;
|
|
288
|
-
if (isSingleRange(finalRanges)) {
|
|
289
|
-
// Convert the single range to a range collection
|
|
290
|
-
rangeMap = SessionIdNormalizer.makeFinalRangesMap();
|
|
291
|
-
rangeMap.append(firstAlignedLocal, lastFinalRange);
|
|
292
|
-
finalRangesObj[1] = rangeMap;
|
|
293
|
-
} else {
|
|
294
|
-
rangeMap = finalRanges;
|
|
295
|
-
}
|
|
296
|
-
rangeMap.append(alignedLocal, [firstFinal, lastFinal, rangeObject]);
|
|
297
|
-
assert(
|
|
298
|
-
alignedLocal >= lastLocal,
|
|
299
|
-
0x4a0 /* Gaps in final space must align to a local. */,
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
if (this.expensiveAsserts) {
|
|
303
|
-
this.idRanges.assertValid();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
this.nextLocalId = nextLocal;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Alerts the normalizer to the existence of a block of final IDs that are *allocated* (but may not be entirely used).
|
|
312
|
-
*
|
|
313
|
-
* The normalizer may have unaligned (unfinalized) local IDs; any such outstanding locals will be eagerly aligned with
|
|
314
|
-
* as many finals from the registered block as possible.
|
|
315
|
-
*
|
|
316
|
-
* It is important to register blocks via this method as soon as they are created for future eager final generations to be utilized, as such
|
|
317
|
-
* generation is dependant on the normalizer being up-to-date with which local IDs have been aligned with finals. If, for instance,
|
|
318
|
-
* a block of finals is not immediately registered with the normalizer and there are outstanding locals that would have aligned with them,
|
|
319
|
-
* those locals will not be finalized until their creation range is finalized, which could be later if the block was created by an earlier
|
|
320
|
-
* creation range's finalization but is large enough to span them both. In this scenario, no eager finals can be generated until the second
|
|
321
|
-
* creation range is finalized.
|
|
322
|
-
*
|
|
323
|
-
* A usage example:
|
|
324
|
-
* Locals: [-1, -2, X, -4, -5, -6]
|
|
325
|
-
* Finals: [ 0, 1, 2, X, X, X]
|
|
326
|
-
* Calling `registerFinalIdBlock` with firstFinalInBlock === 5 and count === 10 results in the following:
|
|
327
|
-
* Locals: [-1, -2, X, -4, -5, -6]
|
|
328
|
-
* Finals: [ 0, 1, 2, 5, 6, 7]
|
|
329
|
-
* Instead calling `registerFinalIdBlock` with firstFinalInBlock === 5 and count === 2 results in the following:
|
|
330
|
-
* Locals: [-1, -2, X, -4, -5, -6]
|
|
331
|
-
* Finals: [ 0, 1, 2, 5, 6, X]
|
|
332
|
-
*
|
|
333
|
-
*/
|
|
334
|
-
public registerFinalIdBlock(
|
|
335
|
-
firstFinalInBlock: FinalCompressedId,
|
|
336
|
-
count: number,
|
|
337
|
-
rangeObject: TRangeObject,
|
|
338
|
-
): void {
|
|
339
|
-
assert(count >= 1, 0x5af /* Malformed normalization block. */);
|
|
340
|
-
const [firstLocal, [lastLocal, finalRanges]] =
|
|
341
|
-
this.idRanges.last() ??
|
|
342
|
-
fail("Final ID block should not be registered before any locals.");
|
|
343
|
-
let unalignedLocalCount: number;
|
|
344
|
-
if (finalRanges === undefined) {
|
|
345
|
-
unalignedLocalCount = firstLocal - lastLocal + 1;
|
|
346
|
-
} else {
|
|
347
|
-
const [_, lastAlignedLocal] = this.getAlignmentOfLastRange(firstLocal, finalRanges);
|
|
348
|
-
unalignedLocalCount = lastAlignedLocal - lastLocal;
|
|
349
|
-
}
|
|
350
|
-
assert(
|
|
351
|
-
unalignedLocalCount > 0,
|
|
352
|
-
0x51b /* Final ID block should not be registered without an existing local range. */,
|
|
353
|
-
);
|
|
354
|
-
const lastFinal = (firstFinalInBlock +
|
|
355
|
-
Math.min(unalignedLocalCount, count) -
|
|
356
|
-
1) as FinalCompressedId;
|
|
357
|
-
this.addFinalIds(firstFinalInBlock, lastFinal, rangeObject);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
private getAlignmentOfLastRange(
|
|
361
|
-
firstLocal: LocalCompressedId,
|
|
362
|
-
finalRanges: FinalRanges<TRangeObject>,
|
|
363
|
-
): [
|
|
364
|
-
firstAlignedLocal: LocalCompressedId,
|
|
365
|
-
lastAlignedLocal: LocalCompressedId,
|
|
366
|
-
lastAlignedFinal: FinalCompressedId,
|
|
367
|
-
lastFinalRange: FinalRange<TRangeObject>,
|
|
368
|
-
] {
|
|
369
|
-
const isSingle = isSingleRange(finalRanges);
|
|
370
|
-
let lastFinalRange: FinalRange<TRangeObject>;
|
|
371
|
-
let firstAlignedLocal: LocalCompressedId;
|
|
372
|
-
if (isSingle) {
|
|
373
|
-
firstAlignedLocal = firstLocal;
|
|
374
|
-
lastFinalRange = finalRanges;
|
|
375
|
-
} else {
|
|
376
|
-
[firstAlignedLocal, lastFinalRange] =
|
|
377
|
-
finalRanges.last() ?? fail("Map should be non-empty.");
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
const [firstAlignedFinal, lastAlignedFinal] = lastFinalRange;
|
|
381
|
-
const lastAlignedLocal = firstAlignedLocal - (lastAlignedFinal - firstAlignedFinal);
|
|
382
|
-
return [
|
|
383
|
-
firstAlignedLocal,
|
|
384
|
-
lastAlignedLocal as LocalCompressedId,
|
|
385
|
-
lastAlignedFinal,
|
|
386
|
-
lastFinalRange,
|
|
387
|
-
];
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Returns an enumerable of all session-space IDs known to this normalizer, in creation order.
|
|
392
|
-
*/
|
|
393
|
-
public *[Symbol.iterator](): IterableIterator<SessionSpaceCompressedId> {
|
|
394
|
-
for (const [firstLocal, [lastLocal, finalRanges]] of this.idRanges.entries()) {
|
|
395
|
-
for (let i = firstLocal; i >= lastLocal; i--) {
|
|
396
|
-
yield i;
|
|
397
|
-
}
|
|
398
|
-
if (finalRanges !== undefined) {
|
|
399
|
-
// Safe to get only the last final range, as all others must have corresponding locals (see `addFinalIds` docs)
|
|
400
|
-
let lastFinalRange: FinalRange<TRangeObject>;
|
|
401
|
-
let alignedLocal: LocalCompressedId;
|
|
402
|
-
if (isSingleRange(finalRanges)) {
|
|
403
|
-
alignedLocal = firstLocal;
|
|
404
|
-
lastFinalRange = finalRanges;
|
|
405
|
-
} else {
|
|
406
|
-
[alignedLocal, lastFinalRange] =
|
|
407
|
-
finalRanges.last() ?? fail("Map should be non-empty.");
|
|
408
|
-
}
|
|
409
|
-
const [firstFinal, lastFinal] = lastFinalRange;
|
|
410
|
-
const localRangeDelta = alignedLocal - lastLocal;
|
|
411
|
-
for (let i = firstFinal + localRangeDelta + 1; i <= lastFinal; i++) {
|
|
412
|
-
yield i as SessionSpaceCompressedId;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
public serialize(): SerializedSessionIdNormalizer {
|
|
419
|
-
const serialized: Mutable<SerializedSessionIdNormalizer> = {
|
|
420
|
-
localRanges: [],
|
|
421
|
-
nextLocalId: this.nextLocalId,
|
|
422
|
-
};
|
|
423
|
-
const localRanges = serialized.localRanges as Mutable<typeof serialized.localRanges>;
|
|
424
|
-
for (const [firstLocal, finalRanges] of this.idRanges.entries()) {
|
|
425
|
-
const [lastLocal, finalRangesTable] = finalRanges;
|
|
426
|
-
if (finalRangesTable !== undefined) {
|
|
427
|
-
const serializedFinalRanges: [
|
|
428
|
-
LocalCompressedId,
|
|
429
|
-
FinalCompressedId,
|
|
430
|
-
FinalCompressedId,
|
|
431
|
-
][] = [];
|
|
432
|
-
for (const [alignedLocal, [firstFinal, lastFinal]] of entries(
|
|
433
|
-
firstLocal,
|
|
434
|
-
finalRangesTable,
|
|
435
|
-
)) {
|
|
436
|
-
serializedFinalRanges.push([alignedLocal, firstFinal, lastFinal]);
|
|
437
|
-
}
|
|
438
|
-
localRanges.push([firstLocal, lastLocal, serializedFinalRanges]);
|
|
439
|
-
} else {
|
|
440
|
-
localRanges.push([firstLocal, lastLocal]);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
return serialized;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
public static deserialize<TRangeObject>(
|
|
447
|
-
serialized: SerializedSessionIdNormalizer,
|
|
448
|
-
getRangeObject: (finalId: FinalCompressedId) => TRangeObject,
|
|
449
|
-
): SessionIdNormalizer<TRangeObject> {
|
|
450
|
-
const normalizer = new SessionIdNormalizer<TRangeObject>();
|
|
451
|
-
const { idRanges } = normalizer;
|
|
452
|
-
for (const [firstLocal, lastLocal, serializedFinalRanges] of serialized.localRanges) {
|
|
453
|
-
let finalRanges: FinalRanges<TRangeObject> | undefined;
|
|
454
|
-
if (serializedFinalRanges !== undefined) {
|
|
455
|
-
assert(
|
|
456
|
-
serializedFinalRanges.length !== 0,
|
|
457
|
-
0x4a1 /* Empty range should not be reified. */,
|
|
458
|
-
);
|
|
459
|
-
if (serializedFinalRanges.length === 1) {
|
|
460
|
-
const [_, firstFinal, lastFinal] = serializedFinalRanges[0];
|
|
461
|
-
finalRanges = [firstFinal, lastFinal, getRangeObject(firstFinal)];
|
|
462
|
-
} else {
|
|
463
|
-
finalRanges = SessionIdNormalizer.makeFinalRangesMap<TRangeObject>();
|
|
464
|
-
for (const [alignedLocal, firstFinal, lastFinal] of serializedFinalRanges) {
|
|
465
|
-
finalRanges.append(alignedLocal, [
|
|
466
|
-
firstFinal,
|
|
467
|
-
lastFinal,
|
|
468
|
-
getRangeObject(firstFinal),
|
|
469
|
-
]);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
idRanges.append(firstLocal, [lastLocal, finalRanges]);
|
|
474
|
-
}
|
|
475
|
-
normalizer.nextLocalId = serialized.nextLocalId;
|
|
476
|
-
return normalizer;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
public equals(
|
|
480
|
-
other: SessionIdNormalizer<TRangeObject>,
|
|
481
|
-
compareRangeObjects: (a: TRangeObject, b: TRangeObject) => boolean = (a, b) => a === b,
|
|
482
|
-
): boolean {
|
|
483
|
-
return (
|
|
484
|
-
this.nextLocalId === other.nextLocalId &&
|
|
485
|
-
this.idRanges.equals(other.idRanges, (localRangeA, localRangeB) => {
|
|
486
|
-
const [lastLocalA, finalRangesA] = localRangeA;
|
|
487
|
-
const [lastLocalB, finalRangesB] = localRangeB;
|
|
488
|
-
if (finalRangesA === undefined || finalRangesB === undefined) {
|
|
489
|
-
return finalRangesA === finalRangesB;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
const rangeEquals = (
|
|
493
|
-
finalRangeA: FinalRange<TRangeObject>,
|
|
494
|
-
finalRangeB: FinalRange<TRangeObject>,
|
|
495
|
-
) => {
|
|
496
|
-
const [firstFinalA, lastFinalA, rangeObjectA] = finalRangeA;
|
|
497
|
-
const [firstFinalB, lastFinalB, rangeObjectB] = finalRangeB;
|
|
498
|
-
return (
|
|
499
|
-
firstFinalA === firstFinalB &&
|
|
500
|
-
lastFinalA === lastFinalB &&
|
|
501
|
-
compareRangeObjects(rangeObjectA, rangeObjectB)
|
|
502
|
-
);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
if (isSingleRange(finalRangesA) || isSingleRange(finalRangesB)) {
|
|
506
|
-
if (!isSingleRange(finalRangesA) || !isSingleRange(finalRangesB)) {
|
|
507
|
-
return false;
|
|
508
|
-
}
|
|
509
|
-
return rangeEquals(finalRangesA, finalRangesB);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return lastLocalA === lastLocalB && finalRangesA.equals(finalRangesB, rangeEquals);
|
|
513
|
-
})
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
type FinalRange<TRangeObject> = [
|
|
519
|
-
firstFinal: FinalCompressedId,
|
|
520
|
-
lastFinal: FinalCompressedId,
|
|
521
|
-
rangeObject: TRangeObject,
|
|
522
|
-
];
|
|
523
|
-
|
|
524
|
-
type FinalRangesMap<TRangeObject> = AppendOnlyDoublySortedMap<
|
|
525
|
-
LocalCompressedId,
|
|
526
|
-
FinalRange<TRangeObject>,
|
|
527
|
-
FinalCompressedId
|
|
528
|
-
>;
|
|
529
|
-
|
|
530
|
-
type FinalRanges<TRangeObject> = FinalRange<TRangeObject> | FinalRangesMap<TRangeObject>;
|
|
531
|
-
|
|
532
|
-
function isSingleRange<TRangeObject>(
|
|
533
|
-
ranges: FinalRanges<TRangeObject>,
|
|
534
|
-
): ranges is FinalRange<TRangeObject> {
|
|
535
|
-
return Array.isArray(ranges);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function getLastRange<TRangeObject>(
|
|
539
|
-
finalRanges: FinalRanges<TRangeObject>,
|
|
540
|
-
): FinalRange<TRangeObject> {
|
|
541
|
-
if (isSingleRange(finalRanges)) {
|
|
542
|
-
return finalRanges;
|
|
543
|
-
}
|
|
544
|
-
return (finalRanges.last() ?? fail("Map must be non-empty"))[1];
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function getFirstRange<TRangeObject>(
|
|
548
|
-
finalRanges: FinalRanges<TRangeObject>,
|
|
549
|
-
): FinalRange<TRangeObject> {
|
|
550
|
-
if (isSingleRange(finalRanges)) {
|
|
551
|
-
return finalRanges;
|
|
552
|
-
}
|
|
553
|
-
return (finalRanges.first() ?? fail("Map must be non-empty"))[1];
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function extractFirstFinalFromRange<TRangeObject>(
|
|
557
|
-
finalRange: FinalRange<TRangeObject>,
|
|
558
|
-
): FinalCompressedId {
|
|
559
|
-
return finalRange[0];
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
function getPairOrNextLowerByValue<TRangeObject>(
|
|
563
|
-
firstLocal: LocalCompressedId,
|
|
564
|
-
finalRanges: FinalRanges<TRangeObject> | undefined,
|
|
565
|
-
finalId: FinalCompressedId,
|
|
566
|
-
): readonly [LocalCompressedId, FinalRange<TRangeObject>] | undefined {
|
|
567
|
-
if (finalRanges === undefined) {
|
|
568
|
-
return undefined;
|
|
569
|
-
}
|
|
570
|
-
if (isSingleRange(finalRanges)) {
|
|
571
|
-
if (finalId < finalRanges[0]) {
|
|
572
|
-
return undefined;
|
|
573
|
-
}
|
|
574
|
-
return [firstLocal, finalRanges];
|
|
575
|
-
}
|
|
576
|
-
return finalRanges.getPairOrNextLowerByValue(finalId);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function getPairOrNextLower<TRangeObject>(
|
|
580
|
-
firstLocal: LocalCompressedId,
|
|
581
|
-
finalRanges: FinalRanges<TRangeObject> | undefined,
|
|
582
|
-
localId: LocalCompressedId,
|
|
583
|
-
): readonly [LocalCompressedId, FinalRange<TRangeObject>] | undefined {
|
|
584
|
-
if (finalRanges === undefined) {
|
|
585
|
-
return undefined;
|
|
586
|
-
}
|
|
587
|
-
if (isSingleRange(finalRanges)) {
|
|
588
|
-
if (localId > firstLocal) {
|
|
589
|
-
return undefined;
|
|
590
|
-
}
|
|
591
|
-
return [firstLocal, finalRanges];
|
|
592
|
-
}
|
|
593
|
-
return finalRanges.getPairOrNextLower(localId);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
function* entries<TRangeObject>(
|
|
597
|
-
firstLocal: LocalCompressedId,
|
|
598
|
-
finalRanges: FinalRanges<TRangeObject> | undefined,
|
|
599
|
-
): IterableIterator<readonly [LocalCompressedId, FinalRange<TRangeObject>]> {
|
|
600
|
-
if (finalRanges !== undefined) {
|
|
601
|
-
if (isSingleRange(finalRanges)) {
|
|
602
|
-
yield [firstLocal, finalRanges];
|
|
603
|
-
} else {
|
|
604
|
-
for (const range of finalRanges.entries()) {
|
|
605
|
-
yield range;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|