@fluidframework/container-runtime 2.0.0-internal.6.1.1 → 2.0.0-internal.6.2.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 +35 -0
- package/README.md +4 -3
- package/dist/batchTracker.d.ts +1 -1
- package/dist/batchTracker.js +1 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +4 -20
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +47 -125
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +82 -14
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +236 -138
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +1 -2
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +4 -5
- 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.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 +4 -5
- package/dist/dataStores.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 +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +23 -5
- 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 +2 -0
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.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/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/dist/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/dist/id-compressor/appendOnlySortedMap.js +25 -67
- 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 +385 -1149
- 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.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js +1 -2
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +2 -3
- 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 +10 -11
- 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 +24 -10
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +4 -5
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summary/index.d.ts +2 -2
- 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 +1 -2
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js +2 -3
- package/dist/summary/orderedClientElection.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 +237 -66
- 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 +70 -67
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.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 +1 -2
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts +9 -3
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +42 -38
- 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 +22 -15
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/batchTracker.d.ts +1 -1
- package/lib/batchTracker.js +1 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +4 -20
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +46 -124
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +82 -14
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +223 -123
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +1 -2
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +1 -2
- 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.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 +1 -2
- package/lib/dataStores.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 +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +22 -4
- 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 +2 -0
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.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/id-compressor/appendOnlySortedMap.d.ts +8 -30
- package/lib/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
- package/lib/id-compressor/appendOnlySortedMap.js +24 -65
- 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 +381 -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.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js +1 -2
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +1 -2
- 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 +6 -7
- 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 -7
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +1 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summary/index.d.ts +2 -2
- 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 +1 -2
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js +1 -2
- package/lib/summary/orderedClientElection.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 +237 -66
- 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 +68 -65
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.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 +1 -2
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts +9 -3
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +43 -39
- 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 +23 -16
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +27 -24
- package/src/batchTracker.ts +1 -1
- package/src/blobManager.ts +57 -146
- package/src/containerRuntime.ts +331 -158
- package/src/dataStore.ts +1 -2
- package/src/dataStoreContext.ts +3 -6
- package/src/dataStoreContexts.ts +1 -2
- package/src/dataStoreRegistry.ts +1 -1
- package/src/dataStores.ts +3 -5
- package/src/error.ts +18 -0
- package/src/gc/garbageCollection.ts +38 -5
- package/src/gc/gcConfigs.ts +4 -2
- package/src/gc/gcDefinitions.ts +2 -0
- package/src/gc/gcTelemetry.ts +2 -0
- package/src/id-compressor/appendOnlySortedMap.ts +25 -86
- package/src/id-compressor/finalSpace.ts +67 -0
- package/src/id-compressor/idCompressor.ts +455 -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 +1 -2
- package/src/opLifecycle/opSplitter.ts +4 -4
- package/src/opLifecycle/outbox.ts +13 -10
- package/src/opLifecycle/remoteMessageProcessor.ts +19 -6
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +49 -27
- package/src/scheduleManager.ts +5 -4
- package/src/summary/index.ts +3 -1
- package/src/summary/orderedClientElection.ts +6 -4
- package/src/summary/runningSummarizer.ts +276 -95
- package/src/summary/summarizer.ts +22 -12
- package/src/summary/summarizerClientElection.ts +1 -1
- package/src/summary/summarizerTypes.ts +40 -25
- package/src/summary/summaryCollection.ts +1 -2
- package/src/summary/summaryGenerator.ts +49 -52
- package/src/summary/summaryManager.ts +33 -11
- 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
package/src/blobManager.ts
CHANGED
|
@@ -30,8 +30,9 @@ import {
|
|
|
30
30
|
} from "@fluidframework/container-runtime-definitions";
|
|
31
31
|
import { AttachState, ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
32
32
|
import {
|
|
33
|
-
LoggingError,
|
|
34
33
|
createChildMonitoringContext,
|
|
34
|
+
GenericError,
|
|
35
|
+
LoggingError,
|
|
35
36
|
MonitoringContext,
|
|
36
37
|
PerformanceEvent,
|
|
37
38
|
} from "@fluidframework/telemetry-utils";
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
ISummaryTreeWithStats,
|
|
41
42
|
ITelemetryContext,
|
|
42
43
|
} from "@fluidframework/runtime-definitions";
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
import { ContainerRuntime, TombstoneResponseHeaderKey } from "./containerRuntime";
|
|
45
46
|
import { sendGCUnexpectedUsageEvent, sweepAttachmentBlobsKey, throwOnTombstoneLoadKey } from "./gc";
|
|
46
47
|
import { Throttler, formExponentialFn, IThrottler } from "./throttler";
|
|
@@ -122,20 +123,12 @@ export type IBlobManagerRuntime = Pick<
|
|
|
122
123
|
Pick<ContainerRuntime, "gcTombstoneEnforcementAllowed"> &
|
|
123
124
|
TypedEventEmitter<IContainerRuntimeEvents>;
|
|
124
125
|
|
|
125
|
-
// Note that while offline we "submit" an op before uploading the blob, but we always
|
|
126
|
-
// expect blobs to be uploaded before we actually see the op round-trip
|
|
127
|
-
export enum PendingBlobStatus {
|
|
128
|
-
OnlinePendingUpload,
|
|
129
|
-
OnlinePendingOp,
|
|
130
|
-
OfflinePendingUpload,
|
|
131
|
-
OfflinePendingOp,
|
|
132
|
-
}
|
|
133
|
-
|
|
134
126
|
type ICreateBlobResponseWithTTL = ICreateBlobResponse & Partial<Record<"minTTLInSeconds", number>>;
|
|
135
127
|
|
|
136
128
|
interface PendingBlob {
|
|
137
129
|
blob: ArrayBufferLike;
|
|
138
|
-
|
|
130
|
+
uploading?: boolean;
|
|
131
|
+
opsent?: boolean;
|
|
139
132
|
storageId?: string;
|
|
140
133
|
handleP: Deferred<BlobHandle>;
|
|
141
134
|
uploadP?: Promise<ICreateBlobResponse | void>;
|
|
@@ -144,7 +137,6 @@ interface PendingBlob {
|
|
|
144
137
|
attached?: boolean;
|
|
145
138
|
acked?: boolean;
|
|
146
139
|
abortSignal?: AbortSignal;
|
|
147
|
-
opsent?: boolean;
|
|
148
140
|
}
|
|
149
141
|
|
|
150
142
|
export interface IPendingBlobs {
|
|
@@ -177,9 +169,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
177
169
|
private readonly redirectTable: Map<string, string | undefined>;
|
|
178
170
|
|
|
179
171
|
/**
|
|
180
|
-
* Blobs which
|
|
181
|
-
* Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so
|
|
182
|
-
* we must save it. This is true for both the online and offline flow.
|
|
172
|
+
* Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.
|
|
183
173
|
*/
|
|
184
174
|
private readonly pendingBlobs: Map<string, PendingBlob> = new Map();
|
|
185
175
|
|
|
@@ -245,8 +235,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
245
235
|
this.runtime.gcTombstoneEnforcementAllowed &&
|
|
246
236
|
this.runtime.clientDetails.type !== summarizerClientType;
|
|
247
237
|
|
|
248
|
-
this.runtime.on("disconnected", () => this.onDisconnected());
|
|
249
|
-
|
|
250
238
|
this.redirectTable = this.load(snapshot);
|
|
251
239
|
|
|
252
240
|
// Begin uploading stashed blobs from previous container instance
|
|
@@ -261,7 +249,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
261
249
|
if (entry.minTTLInSeconds - timeLapseSinceLocalUpload > entry.minTTLInSeconds / 2) {
|
|
262
250
|
this.pendingBlobs.set(localId, {
|
|
263
251
|
blob,
|
|
264
|
-
|
|
252
|
+
uploading: false,
|
|
253
|
+
opsent: true,
|
|
265
254
|
handleP: new Deferred(),
|
|
266
255
|
storageId,
|
|
267
256
|
uploadP: undefined,
|
|
@@ -275,11 +264,12 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
275
264
|
}
|
|
276
265
|
this.pendingBlobs.set(localId, {
|
|
277
266
|
blob,
|
|
278
|
-
|
|
267
|
+
uploading: true,
|
|
279
268
|
handleP: new Deferred(),
|
|
280
269
|
uploadP: this.uploadBlob(localId, blob),
|
|
281
270
|
attached,
|
|
282
271
|
acked,
|
|
272
|
+
opsent: true,
|
|
283
273
|
});
|
|
284
274
|
});
|
|
285
275
|
|
|
@@ -289,13 +279,11 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
289
279
|
pendingEntry !== undefined,
|
|
290
280
|
0x725 /* Must have pending blob entry for upcoming op */,
|
|
291
281
|
);
|
|
292
|
-
pendingEntry.opsent = true;
|
|
293
282
|
if (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {
|
|
294
283
|
const secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;
|
|
295
284
|
const expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;
|
|
296
285
|
this.mc.logger.sendTelemetryEvent({
|
|
297
286
|
eventName: "sendBlobAttach",
|
|
298
|
-
entryStatus: pendingEntry.status,
|
|
299
287
|
secondsSinceUpload,
|
|
300
288
|
minTTLInSeconds: pendingEntry.minTTLInSeconds,
|
|
301
289
|
expired,
|
|
@@ -309,27 +297,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
309
297
|
{
|
|
310
298
|
localId,
|
|
311
299
|
blobId,
|
|
312
|
-
entryStatus: pendingEntry.status,
|
|
313
300
|
secondsSinceUpload,
|
|
314
301
|
},
|
|
315
302
|
),
|
|
316
303
|
);
|
|
317
304
|
}
|
|
318
305
|
}
|
|
306
|
+
pendingEntry.opsent = true;
|
|
319
307
|
return sendBlobAttachOp(localId, blobId);
|
|
320
308
|
};
|
|
321
309
|
}
|
|
322
310
|
|
|
323
|
-
private get pendingOfflineUploads() {
|
|
324
|
-
return Array.from(this.pendingBlobs.values()).filter(
|
|
325
|
-
(e) => e.status === PendingBlobStatus.OfflinePendingUpload,
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
public get hasPendingOfflineUploads(): boolean {
|
|
330
|
-
return this.pendingOfflineUploads.length > 0;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
311
|
public get allBlobsAttached(): boolean {
|
|
334
312
|
for (const [, entry] of this.pendingBlobs) {
|
|
335
313
|
if (entry.attached === false) {
|
|
@@ -349,20 +327,21 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
349
327
|
private createAbortError(pending?: PendingBlob) {
|
|
350
328
|
return new LoggingError("uploadBlob aborted", {
|
|
351
329
|
acked: pending?.acked,
|
|
352
|
-
status: pending?.status,
|
|
353
330
|
uploadTime: pending?.uploadTime,
|
|
354
331
|
});
|
|
355
332
|
}
|
|
356
333
|
/**
|
|
357
334
|
* Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
|
|
358
335
|
*/
|
|
359
|
-
public async
|
|
336
|
+
public async processStashedChanges() {
|
|
360
337
|
this.retryThrottler.cancel();
|
|
361
|
-
const pendingUploads = this.
|
|
338
|
+
const pendingUploads = Array.from(this.pendingBlobs.values())
|
|
339
|
+
.filter((e) => e.uploading === true)
|
|
340
|
+
.map(async (e) => e.uploadP);
|
|
362
341
|
await PerformanceEvent.timedExecAsync(
|
|
363
342
|
this.mc.logger,
|
|
364
343
|
{
|
|
365
|
-
eventName: "
|
|
344
|
+
eventName: "BlobUploadProcessStashedChanges",
|
|
366
345
|
count: pendingUploads.length,
|
|
367
346
|
},
|
|
368
347
|
async () => Promise.all(pendingUploads),
|
|
@@ -370,30 +349,12 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
370
349
|
);
|
|
371
350
|
}
|
|
372
351
|
|
|
373
|
-
|
|
374
|
-
* Transition online blobs waiting for BlobAttach op round-trip since we will not see the op until we are connected
|
|
375
|
-
* again
|
|
376
|
-
*/
|
|
377
|
-
private onDisconnected() {
|
|
378
|
-
for (const [localId, entry] of this.pendingBlobs) {
|
|
379
|
-
if (entry.status === PendingBlobStatus.OnlinePendingOp) {
|
|
380
|
-
// This will submit another BlobAttach op for this blob. This is necessary because the one we sent
|
|
381
|
-
// already didn't have the local ID.
|
|
382
|
-
this.transitionToOffline(localId);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
private async shutdownPendingBlobs(): Promise<void> {
|
|
352
|
+
private async stashPendingBlobs(): Promise<void> {
|
|
388
353
|
for (const [localId, entry] of this.pendingBlobs) {
|
|
389
|
-
if (entry.
|
|
354
|
+
if (!entry.opsent) {
|
|
390
355
|
this.sendBlobAttachOp(localId, entry.storageId);
|
|
391
|
-
entry.status = PendingBlobStatus.OfflinePendingUpload;
|
|
392
|
-
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
393
|
-
} else if (entry.status === PendingBlobStatus.OnlinePendingOp) {
|
|
394
|
-
entry.status = PendingBlobStatus.OfflinePendingOp;
|
|
395
|
-
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
396
356
|
}
|
|
357
|
+
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
397
358
|
}
|
|
398
359
|
return new Promise<void>((resolve) => {
|
|
399
360
|
if (this.allBlobsAttached) {
|
|
@@ -521,7 +482,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
521
482
|
const localId = uuid();
|
|
522
483
|
const pendingEntry: PendingBlob = {
|
|
523
484
|
blob,
|
|
524
|
-
|
|
485
|
+
uploading: true,
|
|
525
486
|
handleP: new Deferred(),
|
|
526
487
|
uploadP: this.uploadBlob(localId, blob),
|
|
527
488
|
attached: false,
|
|
@@ -589,50 +550,37 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
589
550
|
return;
|
|
590
551
|
}
|
|
591
552
|
assert(
|
|
592
|
-
entry.
|
|
593
|
-
entry.status === PendingBlobStatus.OfflinePendingUpload,
|
|
553
|
+
entry.uploading === true,
|
|
594
554
|
0x386 /* Must have pending blob entry for uploaded blob */,
|
|
595
555
|
);
|
|
596
556
|
entry.storageId = response.id;
|
|
597
557
|
entry.uploadTime = Date.now();
|
|
598
558
|
entry.minTTLInSeconds = response.minTTLInSeconds;
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
} else {
|
|
615
|
-
// If there is already an op for this storage ID, append the local ID to the list. Once any op for
|
|
616
|
-
// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
|
|
617
|
-
// blob alive in storage.
|
|
618
|
-
this.opsInFlight.set(
|
|
619
|
-
response.id,
|
|
620
|
-
(this.opsInFlight.get(response.id) ?? []).concat(localId),
|
|
621
|
-
);
|
|
622
|
-
entry.status = PendingBlobStatus.OnlinePendingOp;
|
|
623
|
-
}
|
|
624
|
-
} else if (entry.status === PendingBlobStatus.OfflinePendingUpload) {
|
|
625
|
-
// We already submitted a BlobAttach op for this blob when it was transitioned to offline flow
|
|
626
|
-
entry.status = PendingBlobStatus.OfflinePendingOp;
|
|
627
|
-
}
|
|
559
|
+
// Send a blob attach op. This serves two purposes:
|
|
560
|
+
// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op
|
|
561
|
+
// until its storage ID is added to the next summary.
|
|
562
|
+
// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the
|
|
563
|
+
// blob from the server via the storage ID.
|
|
564
|
+
if (!entry.opsent) {
|
|
565
|
+
this.sendBlobAttachOp(localId, response.id);
|
|
566
|
+
}
|
|
567
|
+
if (this.storageIds.has(response.id)) {
|
|
568
|
+
// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
|
|
569
|
+
// an existing blob, we don't have to wait for the op to be ack'd since this step has already
|
|
570
|
+
// happened before and so, the server won't delete it.
|
|
571
|
+
this.setRedirection(localId, response.id);
|
|
572
|
+
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
573
|
+
this.deletePendingBlobMaybe(localId);
|
|
628
574
|
} else {
|
|
629
|
-
//
|
|
630
|
-
this
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
575
|
+
// If there is already an op for this storage ID, append the local ID to the list. Once any op for
|
|
576
|
+
// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
|
|
577
|
+
// blob alive in storage.
|
|
578
|
+
this.opsInFlight.set(
|
|
579
|
+
response.id,
|
|
580
|
+
(this.opsInFlight.get(response.id) ?? []).concat(localId),
|
|
581
|
+
);
|
|
635
582
|
}
|
|
583
|
+
|
|
636
584
|
return response;
|
|
637
585
|
}
|
|
638
586
|
|
|
@@ -644,9 +592,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
644
592
|
return;
|
|
645
593
|
}
|
|
646
594
|
if (!this.runtime.connected) {
|
|
647
|
-
if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
|
|
648
|
-
this.transitionToOffline(localId);
|
|
649
|
-
}
|
|
650
595
|
// we are probably not connected to storage but start another upload request in case we are
|
|
651
596
|
entry.uploadP = this.retryThrottler
|
|
652
597
|
.getDelay()
|
|
@@ -658,39 +603,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
658
603
|
}
|
|
659
604
|
}
|
|
660
605
|
|
|
661
|
-
private transitionToOffline(localId: string) {
|
|
662
|
-
assert(
|
|
663
|
-
!this.runtime.connected,
|
|
664
|
-
0x388 /* Must only transition to offline flow while runtime is disconnected */,
|
|
665
|
-
);
|
|
666
|
-
const entry = this.pendingBlobs.get(localId);
|
|
667
|
-
assert(!!entry, 0x389 /* No pending blob entry */);
|
|
668
|
-
assert(
|
|
669
|
-
[PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(
|
|
670
|
-
entry.status,
|
|
671
|
-
),
|
|
672
|
-
0x38a /* Blob must be in online flow to transition to offline flow */,
|
|
673
|
-
);
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* If we haven't already submitted a BlobAttach op for this entry, send it before returning the blob handle.
|
|
677
|
-
* This will make sure that the BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise,
|
|
678
|
-
* an invalid handle could be added to the document.
|
|
679
|
-
* storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()
|
|
680
|
-
* is called on reconnection.
|
|
681
|
-
*/
|
|
682
|
-
if (entry.status !== PendingBlobStatus.OnlinePendingOp) {
|
|
683
|
-
this.sendBlobAttachOp(localId, entry.storageId);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
entry.status =
|
|
687
|
-
entry.status === PendingBlobStatus.OnlinePendingUpload
|
|
688
|
-
? PendingBlobStatus.OfflinePendingUpload
|
|
689
|
-
: PendingBlobStatus.OfflinePendingOp;
|
|
690
|
-
|
|
691
|
-
entry.handleP.resolve(this.getBlobHandle(localId));
|
|
692
|
-
}
|
|
693
|
-
|
|
694
606
|
/**
|
|
695
607
|
* Resubmit a BlobAttach op. Used to add storage IDs to ops that were
|
|
696
608
|
* submitted to runtime while disconnected.
|
|
@@ -705,8 +617,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
705
617
|
if (!blobId) {
|
|
706
618
|
// We submitted this op while offline. The blob should have been uploaded by now.
|
|
707
619
|
assert(
|
|
708
|
-
pendingEntry?.
|
|
709
|
-
!!pendingEntry?.storageId,
|
|
620
|
+
pendingEntry?.opsent === true && !!pendingEntry?.storageId,
|
|
710
621
|
0x38d /* blob must be uploaded before resubmitting BlobAttach op */,
|
|
711
622
|
);
|
|
712
623
|
return this.sendBlobAttachOp(localId, pendingEntry?.storageId);
|
|
@@ -750,22 +661,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
750
661
|
entry !== undefined,
|
|
751
662
|
0x38f /* local online BlobAttach op with no pending blob entry */,
|
|
752
663
|
);
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
entry.acked = true;
|
|
758
|
-
entry.handleP.resolve(this.getBlobHandle(pendingLocalId));
|
|
759
|
-
this.deletePendingBlobMaybe(pendingLocalId);
|
|
760
|
-
}
|
|
664
|
+
this.setRedirection(pendingLocalId, blobId);
|
|
665
|
+
entry.acked = true;
|
|
666
|
+
entry.handleP.resolve(this.getBlobHandle(pendingLocalId));
|
|
667
|
+
this.deletePendingBlobMaybe(pendingLocalId);
|
|
761
668
|
});
|
|
762
669
|
this.opsInFlight.delete(blobId);
|
|
763
670
|
}
|
|
764
|
-
// offline flow does not resolve the handle (since it was already resolved)
|
|
765
|
-
// but we still need to delete the entry in case is acked and attached.
|
|
766
671
|
const localEntry = this.pendingBlobs.get(localId);
|
|
767
672
|
if (localEntry) {
|
|
768
673
|
localEntry.acked = true;
|
|
674
|
+
localEntry.handleP.resolve(this.getBlobHandle(localId));
|
|
769
675
|
this.deletePendingBlobMaybe(localId);
|
|
770
676
|
}
|
|
771
677
|
}
|
|
@@ -1037,10 +943,15 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
1037
943
|
}
|
|
1038
944
|
}
|
|
1039
945
|
|
|
1040
|
-
public async getPendingBlobs(waitBlobsToAttach?: boolean): Promise<IPendingBlobs> {
|
|
946
|
+
public async getPendingBlobs(waitBlobsToAttach?: boolean): Promise<IPendingBlobs | undefined> {
|
|
1041
947
|
if (waitBlobsToAttach) {
|
|
1042
|
-
await this.
|
|
948
|
+
await this.stashPendingBlobs();
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (this.pendingBlobs.size === 0) {
|
|
952
|
+
return;
|
|
1043
953
|
}
|
|
954
|
+
|
|
1044
955
|
const blobs = {};
|
|
1045
956
|
for (const [key, entry] of this.pendingBlobs) {
|
|
1046
957
|
blobs[key] = {
|