@fluidframework/container-runtime 2.0.0-dev.2.2.0.111723 → 2.0.0-dev.3.1.0.125672
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +21 -10
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -1
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +62 -28
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +256 -102
- package/dist/blobManager.js.map +1 -1
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js +11 -9
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerHandleContext.d.ts.map +1 -1
- package/dist/containerHandleContext.js +3 -1
- package/dist/containerHandleContext.js.map +1 -1
- package/dist/containerRuntime.d.ts +110 -78
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +336 -331
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +11 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +2 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +40 -23
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -3
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStoreRegistry.d.ts.map +1 -1
- package/dist/dataStoreRegistry.js +3 -1
- package/dist/dataStoreRegistry.js.map +1 -1
- package/dist/dataStores.d.ts +12 -9
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +69 -46
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +8 -3
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +57 -42
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +371 -239
- package/dist/garbageCollection.js.map +1 -1
- package/dist/garbageCollectionConstants.d.ts +23 -0
- package/dist/garbageCollectionConstants.d.ts.map +1 -0
- package/dist/garbageCollectionConstants.js +36 -0
- package/dist/garbageCollectionConstants.js.map +1 -0
- package/dist/garbageCollectionHelpers.d.ts +15 -0
- package/dist/garbageCollectionHelpers.d.ts.map +1 -0
- package/dist/garbageCollectionHelpers.js +27 -0
- package/dist/garbageCollectionHelpers.js.map +1 -0
- package/dist/gcSweepReadyUsageDetection.d.ts +5 -5
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/dist/gcSweepReadyUsageDetection.js +15 -11
- package/dist/gcSweepReadyUsageDetection.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +42 -0
- package/dist/opLifecycle/batchManager.d.ts.map +1 -0
- package/dist/opLifecycle/batchManager.js +124 -0
- package/dist/opLifecycle/batchManager.js.map +1 -0
- package/dist/opLifecycle/definitions.d.ts +64 -0
- package/dist/opLifecycle/definitions.d.ts.map +1 -0
- package/dist/opLifecycle/definitions.js +7 -0
- package/dist/opLifecycle/definitions.js.map +1 -0
- package/dist/opLifecycle/index.d.ts +12 -0
- package/dist/opLifecycle/index.d.ts.map +1 -0
- package/dist/opLifecycle/index.js +22 -0
- package/dist/opLifecycle/index.js.map +1 -0
- package/dist/{opCompressor.d.ts → opLifecycle/opCompressor.d.ts} +3 -3
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
- package/dist/opLifecycle/opCompressor.js +67 -0
- package/dist/opLifecycle/opCompressor.js.map +1 -0
- package/dist/{opDecompressor.d.ts → opLifecycle/opDecompressor.d.ts} +2 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
- package/dist/{opDecompressor.js → opLifecycle/opDecompressor.js} +37 -21
- package/dist/opLifecycle/opDecompressor.js.map +1 -0
- package/dist/opLifecycle/opSplitter.d.ts +49 -0
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
- package/dist/opLifecycle/opSplitter.js +173 -0
- package/dist/opLifecycle/opSplitter.js.map +1 -0
- package/dist/opLifecycle/outbox.d.ts +52 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -0
- package/dist/opLifecycle/outbox.js +164 -0
- package/dist/opLifecycle/outbox.js.map +1 -0
- package/dist/opLifecycle/remoteMessageProcessor.d.ts +26 -0
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
- package/dist/opLifecycle/remoteMessageProcessor.js +96 -0
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -0
- package/dist/opProperties.d.ts.map +1 -1
- package/dist/opProperties.js +1 -3
- package/dist/opProperties.js.map +1 -1
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +10 -4
- package/dist/orderedClientElection.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 +4 -13
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +134 -161
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +34 -22
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts +0 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +11 -21
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +3 -1
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summarizer.d.ts +2 -3
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +39 -18
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.d.ts +1 -2
- package/dist/summarizerClientElection.d.ts.map +1 -1
- package/dist/summarizerClientElection.js +3 -30
- package/dist/summarizerClientElection.js.map +1 -1
- package/dist/summarizerHandle.d.ts.map +1 -1
- package/dist/summarizerHandle.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +6 -9
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +22 -25
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +18 -8
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +18 -11
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +32 -14
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +21 -9
- package/dist/summaryManager.js.map +1 -1
- package/dist/throttler.d.ts +2 -2
- package/dist/throttler.d.ts.map +1 -1
- package/dist/throttler.js +4 -4
- package/dist/throttler.js.map +1 -1
- package/garbageCollection.md +15 -2
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +62 -28
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +259 -105
- package/lib/blobManager.js.map +1 -1
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js +11 -9
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerHandleContext.d.ts.map +1 -1
- package/lib/containerHandleContext.js +3 -1
- package/lib/containerHandleContext.js.map +1 -1
- package/lib/containerRuntime.d.ts +110 -78
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +340 -334
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +11 -9
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +2 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +41 -24
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -3
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStoreRegistry.d.ts.map +1 -1
- package/lib/dataStoreRegistry.js +3 -1
- package/lib/dataStoreRegistry.js.map +1 -1
- package/lib/dataStores.d.ts +12 -9
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +75 -52
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +9 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +57 -42
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +364 -232
- package/lib/garbageCollection.js.map +1 -1
- package/lib/garbageCollectionConstants.d.ts +23 -0
- package/lib/garbageCollectionConstants.d.ts.map +1 -0
- package/lib/garbageCollectionConstants.js +33 -0
- package/lib/garbageCollectionConstants.js.map +1 -0
- package/lib/garbageCollectionHelpers.d.ts +15 -0
- package/lib/garbageCollectionHelpers.d.ts.map +1 -0
- package/lib/garbageCollectionHelpers.js +23 -0
- package/lib/garbageCollectionHelpers.js.map +1 -0
- package/lib/gcSweepReadyUsageDetection.d.ts +5 -5
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/lib/gcSweepReadyUsageDetection.js +15 -11
- package/lib/gcSweepReadyUsageDetection.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +42 -0
- package/lib/opLifecycle/batchManager.d.ts.map +1 -0
- package/lib/opLifecycle/batchManager.js +120 -0
- package/lib/opLifecycle/batchManager.js.map +1 -0
- package/lib/opLifecycle/definitions.d.ts +64 -0
- package/lib/opLifecycle/definitions.d.ts.map +1 -0
- package/lib/opLifecycle/definitions.js +6 -0
- package/lib/opLifecycle/definitions.js.map +1 -0
- package/lib/opLifecycle/index.d.ts +12 -0
- package/lib/opLifecycle/index.d.ts.map +1 -0
- package/lib/opLifecycle/index.js +11 -0
- package/lib/opLifecycle/index.js.map +1 -0
- package/lib/{opCompressor.d.ts → opLifecycle/opCompressor.d.ts} +3 -3
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
- package/lib/opLifecycle/opCompressor.js +63 -0
- package/lib/opLifecycle/opCompressor.js.map +1 -0
- package/lib/{opDecompressor.d.ts → opLifecycle/opDecompressor.d.ts} +2 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
- package/lib/{opDecompressor.js → opLifecycle/opDecompressor.js} +37 -21
- package/lib/opLifecycle/opDecompressor.js.map +1 -0
- package/lib/opLifecycle/opSplitter.d.ts +49 -0
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
- package/lib/opLifecycle/opSplitter.js +168 -0
- package/lib/opLifecycle/opSplitter.js.map +1 -0
- package/lib/opLifecycle/outbox.d.ts +52 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -0
- package/lib/opLifecycle/outbox.js +160 -0
- package/lib/opLifecycle/outbox.js.map +1 -0
- package/lib/opLifecycle/remoteMessageProcessor.d.ts +26 -0
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
- package/lib/opLifecycle/remoteMessageProcessor.js +91 -0
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
- package/lib/opProperties.d.ts.map +1 -1
- package/lib/opProperties.js +1 -3
- package/lib/opProperties.js.map +1 -1
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +10 -4
- package/lib/orderedClientElection.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 +4 -13
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +134 -161
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +35 -23
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts +0 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +11 -21
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +3 -1
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summarizer.d.ts +2 -3
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +39 -18
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.d.ts +1 -2
- package/lib/summarizerClientElection.d.ts.map +1 -1
- package/lib/summarizerClientElection.js +3 -30
- package/lib/summarizerClientElection.js.map +1 -1
- package/lib/summarizerHandle.d.ts.map +1 -1
- package/lib/summarizerHandle.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +6 -9
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +22 -25
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +18 -8
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +20 -13
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +32 -14
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +21 -9
- package/lib/summaryManager.js.map +1 -1
- package/lib/throttler.d.ts +2 -2
- package/lib/throttler.d.ts.map +1 -1
- package/lib/throttler.js +4 -4
- package/lib/throttler.js.map +1 -1
- package/package.json +28 -38
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +55 -50
- package/src/blobManager.ts +802 -541
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3125 -2982
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1049 -992
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +785 -711
- package/src/deltaScheduler.ts +158 -150
- package/src/garbageCollection.ts +1797 -1558
- package/src/garbageCollectionConstants.ts +38 -0
- package/src/garbageCollectionHelpers.ts +37 -0
- package/src/gcSweepReadyUsageDetection.ts +90 -84
- package/src/index.ts +68 -69
- package/src/opLifecycle/batchManager.ts +167 -0
- package/src/opLifecycle/definitions.ts +70 -0
- package/src/opLifecycle/index.ts +18 -0
- package/src/opLifecycle/opCompressor.ts +82 -0
- package/src/opLifecycle/opDecompressor.ts +124 -0
- package/src/opLifecycle/opSplitter.ts +238 -0
- package/src/opLifecycle/outbox.ts +228 -0
- package/src/opLifecycle/remoteMessageProcessor.ts +106 -0
- package/src/opProperties.ts +11 -9
- package/src/orderedClientElection.ts +489 -457
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +379 -381
- package/src/runWhileConnectedCoordinator.ts +78 -71
- package/src/runningSummarizer.ts +619 -582
- package/src/scheduleManager.ts +299 -280
- package/src/serializedSnapshotStorage.ts +116 -111
- package/src/summarizer.ts +417 -381
- package/src/summarizerClientElection.ts +107 -129
- package/src/summarizerHandle.ts +11 -9
- package/src/summarizerHeuristics.ts +183 -186
- package/src/summarizerTypes.ts +344 -333
- package/src/summaryCollection.ts +378 -349
- package/src/summaryFormat.ts +146 -127
- package/src/summaryGenerator.ts +464 -406
- package/src/summaryManager.ts +377 -348
- package/src/throttler.ts +131 -122
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
- package/dist/batchManager.d.ts +0 -42
- package/dist/batchManager.d.ts.map +0 -1
- package/dist/batchManager.js +0 -83
- package/dist/batchManager.js.map +0 -1
- package/dist/opCompressor.d.ts.map +0 -1
- package/dist/opCompressor.js +0 -50
- package/dist/opCompressor.js.map +0 -1
- package/dist/opDecompressor.d.ts.map +0 -1
- package/dist/opDecompressor.js.map +0 -1
- package/lib/batchManager.d.ts +0 -42
- package/lib/batchManager.d.ts.map +0 -1
- package/lib/batchManager.js +0 -79
- package/lib/batchManager.js.map +0 -1
- package/lib/opCompressor.d.ts.map +0 -1
- package/lib/opCompressor.js +0 -46
- package/lib/opCompressor.js.map +0 -1
- package/lib/opDecompressor.d.ts.map +0 -1
- package/lib/opDecompressor.js.map +0 -1
- package/src/batchManager.ts +0 -108
- package/src/opCompressor.ts +0 -59
- package/src/opDecompressor.ts +0 -82
package/src/throttler.ts
CHANGED
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export interface IThrottler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Computes what the throttle delay should be, and records an attempt
|
|
9
|
+
* which will be used for calculating future attempt delays.
|
|
10
|
+
*/
|
|
11
|
+
getDelay(): number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Number of attempts that occurred within the sliding window as of
|
|
15
|
+
* the most recent delay computation.
|
|
16
|
+
*/
|
|
17
|
+
readonly numAttempts: number;
|
|
18
|
+
|
|
19
|
+
/** Width of sliding delay window in milliseconds. */
|
|
20
|
+
readonly delayWindowMs: number;
|
|
21
|
+
/** Maximum delay allowed in milliseconds. */
|
|
22
|
+
readonly maxDelayMs: number;
|
|
23
|
+
/**
|
|
24
|
+
* Delay function used to calculate what the delay should be.
|
|
25
|
+
* The input is the number of attempts that occurred within the sliding window.
|
|
26
|
+
* The result is the calculated delay in milliseconds.
|
|
27
|
+
*/
|
|
28
|
+
readonly delayFn: (numAttempts: number) => number;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -33,74 +33,74 @@ export interface IThrottler {
|
|
|
33
33
|
* Delay is based on previous attempts within specified time window, subtracting delay time.
|
|
34
34
|
*/
|
|
35
35
|
export class Throttler implements IThrottler {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
36
|
+
private startTimes: number[] = [];
|
|
37
|
+
|
|
38
|
+
public get numAttempts() {
|
|
39
|
+
return this.startTimes.length;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gets all attempt start times after compensating for the delay times
|
|
44
|
+
* by adding the delay times to the actual times.
|
|
45
|
+
*/
|
|
46
|
+
public getAttempts(): readonly number[] {
|
|
47
|
+
return [...this.startTimes];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Latest attempt time after compensating for the delay time itself
|
|
52
|
+
* by adding the delay time to the actual time.
|
|
53
|
+
*/
|
|
54
|
+
public get latestAttemptTime() {
|
|
55
|
+
return this.startTimes.length > 0 ? this.startTimes[this.startTimes.length - 1] : undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
constructor(
|
|
59
|
+
/** Width of sliding delay window in milliseconds. */
|
|
60
|
+
public readonly delayWindowMs: number,
|
|
61
|
+
/** Maximum delay allowed in milliseconds. */
|
|
62
|
+
public readonly maxDelayMs: number,
|
|
63
|
+
/**
|
|
64
|
+
* Delay function used to calculate what the delay should be.
|
|
65
|
+
* The input is the number of attempts that occurred within the sliding window.
|
|
66
|
+
* The result is the calculated delay in milliseconds.
|
|
67
|
+
*/
|
|
68
|
+
public readonly delayFn: (numAttempts: number) => number,
|
|
69
|
+
) {}
|
|
70
|
+
|
|
71
|
+
public getDelay() {
|
|
72
|
+
const now = Date.now();
|
|
73
|
+
|
|
74
|
+
const latestAttemptTime = this.latestAttemptTime;
|
|
75
|
+
if (latestAttemptTime !== undefined) {
|
|
76
|
+
// If getDelay was called sooner than the most recent delay,
|
|
77
|
+
// subtract the remaining time, since we previously added it.
|
|
78
|
+
const earlyMs = latestAttemptTime - now;
|
|
79
|
+
if (earlyMs > 0) {
|
|
80
|
+
this.startTimes = this.startTimes.map((t) => t - earlyMs);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Remove all attempts that have already fallen out of the window.
|
|
85
|
+
this.startTimes = this.startTimes.filter((t) => now - t < this.delayWindowMs);
|
|
86
|
+
|
|
87
|
+
// Compute delay, but do not exceed the specified max delay.
|
|
88
|
+
const delayMs = Math.min(this.delayFn(this.startTimes.length), this.maxDelayMs);
|
|
89
|
+
|
|
90
|
+
// Record this attempt start time.
|
|
91
|
+
this.startTimes.push(now);
|
|
92
|
+
|
|
93
|
+
// Account for the delay time, by effectively removing it from the delay window.
|
|
94
|
+
this.startTimes = this.startTimes.map((t) => t + delayMs);
|
|
95
|
+
|
|
96
|
+
if (delayMs === this.maxDelayMs) {
|
|
97
|
+
// We hit max delay, so adding more won't affect anything.
|
|
98
|
+
// Shift off oldest time to stop this array from growing forever.
|
|
99
|
+
this.startTimes.shift();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return delayMs;
|
|
103
|
+
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
@@ -114,28 +114,37 @@ export class Throttler implements IThrottler {
|
|
|
114
114
|
* Use initialDelay to decide what should happen when numAttempts is 0,
|
|
115
115
|
* leave it undefined to not special case.
|
|
116
116
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
export const formExponentialFn =
|
|
118
|
+
({
|
|
119
|
+
multiplier = 2,
|
|
120
|
+
coefficient = 1,
|
|
121
|
+
offset = 0,
|
|
122
|
+
initialDelay = undefined as number | undefined,
|
|
123
|
+
} = {}): IThrottler["delayFn"] =>
|
|
124
|
+
(numAttempts) =>
|
|
125
|
+
Math.max(
|
|
126
|
+
0,
|
|
127
|
+
numAttempts <= 0 && initialDelay !== undefined
|
|
128
|
+
? initialDelay
|
|
129
|
+
: coefficient * Math.pow(multiplier, numAttempts) + offset,
|
|
130
|
+
);
|
|
126
131
|
|
|
127
132
|
/** f(n) = C x (B^(n+A)) + F = (C x B^A) x B^n + F */
|
|
128
|
-
export const formExponentialFnWithAttemptOffset = (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
export const formExponentialFnWithAttemptOffset = (
|
|
134
|
+
attemptOffset: number,
|
|
135
|
+
{
|
|
136
|
+
multiplier = 2,
|
|
137
|
+
coefficient = 1,
|
|
138
|
+
offset = 0,
|
|
139
|
+
initialDelay = undefined as number | undefined,
|
|
140
|
+
} = {},
|
|
141
|
+
) =>
|
|
142
|
+
formExponentialFn({
|
|
143
|
+
multiplier,
|
|
144
|
+
coefficient: coefficient * Math.pow(multiplier, attemptOffset),
|
|
145
|
+
offset,
|
|
146
|
+
initialDelay,
|
|
147
|
+
});
|
|
139
148
|
|
|
140
149
|
/**
|
|
141
150
|
* Helper function to generate simple linear throttle functions.
|
|
@@ -144,17 +153,17 @@ export const formExponentialFnWithAttemptOffset = (attemptOffset: number, {
|
|
|
144
153
|
* If not provided, coefficient will default to 1, and offset to 0, yielding:
|
|
145
154
|
* 0 ms, 1 ms, 2 ms, 3 ms, ..., n ms delays; a linear back-off.
|
|
146
155
|
*/
|
|
147
|
-
export const formLinearFn =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
coefficient * numAttempts + offset);
|
|
156
|
+
export const formLinearFn =
|
|
157
|
+
({ coefficient = 1, offset = 0 } = {}): IThrottler["delayFn"] =>
|
|
158
|
+
(numAttempts) =>
|
|
159
|
+
Math.max(0, coefficient * numAttempts + offset);
|
|
152
160
|
|
|
153
161
|
/** f(n) = C x (n+A) + F = C x n + (C x A + F) */
|
|
154
|
-
export const formLinearFnWithAttemptOffset = (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
export const formLinearFnWithAttemptOffset = (
|
|
163
|
+
attemptOffset: number,
|
|
164
|
+
{ coefficient = 1, offset = 0 } = {},
|
|
165
|
+
) =>
|
|
166
|
+
formLinearFn({
|
|
167
|
+
coefficient,
|
|
168
|
+
offset: coefficient * attemptOffset + offset,
|
|
169
|
+
});
|
package/tsconfig.esnext.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./lib",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
},
|
|
7
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"exclude": [
|
|
12
|
-
"src/test/**/*"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
2
|
+
"extends": "@fluidframework/build-common/ts-common-config.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
},
|
|
8
|
+
"include": ["src/**/*"],
|
|
9
|
+
"exclude": ["src/test/**/*"],
|
|
10
|
+
}
|
package/dist/batchManager.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
|
-
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
|
-
import { ContainerRuntimeMessage, ICompressionRuntimeOptions } from "./containerRuntime";
|
|
8
|
-
/**
|
|
9
|
-
* Message type used by BatchManager
|
|
10
|
-
*/
|
|
11
|
-
export declare type BatchMessage = IBatchMessage & {
|
|
12
|
-
localOpMetadata: unknown;
|
|
13
|
-
deserializedContent: ContainerRuntimeMessage;
|
|
14
|
-
referenceSequenceNumber: number;
|
|
15
|
-
};
|
|
16
|
-
export interface IBatchManagerOptions {
|
|
17
|
-
readonly hardLimit: number;
|
|
18
|
-
readonly softLimit?: number;
|
|
19
|
-
readonly compressionOptions?: ICompressionRuntimeOptions;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Helper class that manages partial batch & rollback.
|
|
23
|
-
*/
|
|
24
|
-
export declare class BatchManager {
|
|
25
|
-
readonly logger: ITelemetryLogger;
|
|
26
|
-
readonly options: IBatchManagerOptions;
|
|
27
|
-
private readonly opCompressor;
|
|
28
|
-
private pendingBatch;
|
|
29
|
-
private batchContentSize;
|
|
30
|
-
get length(): number;
|
|
31
|
-
constructor(logger: ITelemetryLogger, options: IBatchManagerOptions);
|
|
32
|
-
push(message: BatchMessage): boolean;
|
|
33
|
-
get empty(): boolean;
|
|
34
|
-
popBatch(): BatchMessage[];
|
|
35
|
-
/**
|
|
36
|
-
* Capture the pending state at this point
|
|
37
|
-
*/
|
|
38
|
-
checkpoint(): {
|
|
39
|
-
rollback: (process: (message: BatchMessage) => void) => void;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=batchManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchManager.d.ts","sourceRoot":"","sources":["../src/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGzF;;GAEG;AACH,oBAAY,YAAY,GAAG,aAAa,GAAG;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,uBAAuB,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CAC5D;AAED;;GAEG;AACH,qBAAa,YAAY;aAOO,MAAM,EAAE,gBAAgB;aAAkB,OAAO,EAAE,oBAAoB;IANnG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAAK;IAE7B,IAAW,MAAM,WAAuC;gBAE5B,MAAM,EAAE,gBAAgB,EAAkB,OAAO,EAAE,oBAAoB;IAI5F,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IAiC3C,IAAW,KAAK,YAA6C;IAEtD,QAAQ;IAef;;OAEG;IACI,UAAU;sCAGqB,YAAY,KAAK,IAAI;;CAY9D"}
|
package/dist/batchManager.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.BatchManager = void 0;
|
|
8
|
-
const opCompressor_1 = require("./opCompressor");
|
|
9
|
-
/**
|
|
10
|
-
* Helper class that manages partial batch & rollback.
|
|
11
|
-
*/
|
|
12
|
-
class BatchManager {
|
|
13
|
-
constructor(logger, options) {
|
|
14
|
-
this.logger = logger;
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.pendingBatch = [];
|
|
17
|
-
this.batchContentSize = 0;
|
|
18
|
-
this.opCompressor = new opCompressor_1.OpCompressor(logger);
|
|
19
|
-
}
|
|
20
|
-
get length() { return this.pendingBatch.length; }
|
|
21
|
-
push(message) {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f;
|
|
23
|
-
const contentSize = this.batchContentSize + ((_b = (_a = message.contents) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
|
|
24
|
-
const opCount = this.pendingBatch.length;
|
|
25
|
-
// Attempt to estimate batch size, aka socket message size.
|
|
26
|
-
// Each op has pretty large envelope, estimating to be 200 bytes.
|
|
27
|
-
// Also content will be strigified, and that adds a lot of overhead due to a lot of escape characters.
|
|
28
|
-
// Not taking it into account, as compression work should help there - compressed payload will be
|
|
29
|
-
// initially stored as base64, and that requires only 2 extra escape characters.
|
|
30
|
-
const socketMessageSize = contentSize + 200 * opCount;
|
|
31
|
-
// If we were provided soft limit, check for exceeding it.
|
|
32
|
-
// But only if we have any ops, as the intention here is to flush existing ops (on exceeding this limit)
|
|
33
|
-
// and start over. That's not an option if we have no ops.
|
|
34
|
-
// If compression is enabled, the soft and hard limit are ignored and the message will be pushed anyways.
|
|
35
|
-
// Cases where the message is still too large will be handled by the maxConsecutiveReconnects path.
|
|
36
|
-
if (this.options.softLimit !== undefined
|
|
37
|
-
&& this.length > 0
|
|
38
|
-
&& socketMessageSize >= this.options.softLimit
|
|
39
|
-
&& Infinity === ((_d = (_c = this.options.compressionOptions) === null || _c === void 0 ? void 0 : _c.minimumBatchSizeInBytes) !== null && _d !== void 0 ? _d : Infinity)) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if (socketMessageSize >= this.options.hardLimit
|
|
43
|
-
&& Infinity === ((_f = (_e = this.options.compressionOptions) === null || _e === void 0 ? void 0 : _e.minimumBatchSizeInBytes) !== null && _f !== void 0 ? _f : Infinity)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
this.batchContentSize = contentSize;
|
|
47
|
-
this.pendingBatch.push(message);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
get empty() { return this.pendingBatch.length === 0; }
|
|
51
|
-
popBatch() {
|
|
52
|
-
const batch = this.pendingBatch;
|
|
53
|
-
const size = this.batchContentSize;
|
|
54
|
-
this.pendingBatch = [];
|
|
55
|
-
this.batchContentSize = 0;
|
|
56
|
-
if (batch.length > 0
|
|
57
|
-
&& this.options.compressionOptions !== undefined
|
|
58
|
-
&& this.options.compressionOptions.minimumBatchSizeInBytes < size) {
|
|
59
|
-
return this.opCompressor.compressBatch(batch, size);
|
|
60
|
-
}
|
|
61
|
-
return batch;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Capture the pending state at this point
|
|
65
|
-
*/
|
|
66
|
-
checkpoint() {
|
|
67
|
-
const startPoint = this.pendingBatch.length;
|
|
68
|
-
return {
|
|
69
|
-
rollback: (process) => {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
for (let i = this.pendingBatch.length; i > startPoint;) {
|
|
72
|
-
i--;
|
|
73
|
-
const message = this.pendingBatch[i];
|
|
74
|
-
this.batchContentSize -= (_b = (_a = message.contents) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
75
|
-
process(message);
|
|
76
|
-
}
|
|
77
|
-
this.pendingBatch.length = startPoint;
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.BatchManager = BatchManager;
|
|
83
|
-
//# sourceMappingURL=batchManager.js.map
|
package/dist/batchManager.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchManager.js","sourceRoot":"","sources":["../src/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AAO,CAAC,OAAO,CAAC,CAAC;iBACpB;gBAED,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC;YAC1C,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA/ED,oCA+EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IBatchMessage } from \"@fluidframework/container-definitions\";\nimport { ContainerRuntimeMessage, ICompressionRuntimeOptions } from \"./containerRuntime\";\nimport { OpCompressor } from \"./opCompressor\";\n\n/**\n * Message type used by BatchManager\n */\nexport type BatchMessage = IBatchMessage & {\n localOpMetadata: unknown;\n deserializedContent: ContainerRuntimeMessage;\n referenceSequenceNumber: number;\n};\n\nexport interface IBatchManagerOptions {\n readonly hardLimit: number;\n readonly softLimit?: number;\n readonly compressionOptions?: ICompressionRuntimeOptions;\n}\n\n/**\n * Helper class that manages partial batch & rollback.\n */\nexport class BatchManager {\n private readonly opCompressor: OpCompressor;\n private pendingBatch: BatchMessage [] = [];\n private batchContentSize = 0;\n\n public get length() { return this.pendingBatch.length; }\n\n constructor(public readonly logger: ITelemetryLogger, public readonly options: IBatchManagerOptions) {\n this.opCompressor = new OpCompressor(logger);\n }\n\n public push(message: BatchMessage): boolean {\n const contentSize = this.batchContentSize + (message.contents?.length ?? 0);\n const opCount = this.pendingBatch.length;\n\n // Attempt to estimate batch size, aka socket message size.\n // Each op has pretty large envelope, estimating to be 200 bytes.\n // Also content will be strigified, and that adds a lot of overhead due to a lot of escape characters.\n // Not taking it into account, as compression work should help there - compressed payload will be\n // initially stored as base64, and that requires only 2 extra escape characters.\n const socketMessageSize = contentSize + 200 * opCount;\n\n // If we were provided soft limit, check for exceeding it.\n // But only if we have any ops, as the intention here is to flush existing ops (on exceeding this limit)\n // and start over. That's not an option if we have no ops.\n // If compression is enabled, the soft and hard limit are ignored and the message will be pushed anyways.\n // Cases where the message is still too large will be handled by the maxConsecutiveReconnects path.\n if (this.options.softLimit !== undefined\n && this.length > 0\n && socketMessageSize >= this.options.softLimit\n && Infinity === (this.options.compressionOptions?.minimumBatchSizeInBytes ?? Infinity)) {\n return false;\n }\n\n if (socketMessageSize >= this.options.hardLimit\n && Infinity === (this.options.compressionOptions?.minimumBatchSizeInBytes ?? Infinity)) {\n return false;\n }\n\n this.batchContentSize = contentSize;\n this.pendingBatch.push(message);\n return true;\n }\n\n public get empty() { return this.pendingBatch.length === 0; }\n\n public popBatch() {\n const batch = this.pendingBatch;\n const size = this.batchContentSize;\n this.pendingBatch = [];\n this.batchContentSize = 0;\n\n if (batch.length > 0\n && this.options.compressionOptions !== undefined\n && this.options.compressionOptions.minimumBatchSizeInBytes < size) {\n return this.opCompressor.compressBatch(batch, size);\n }\n\n return batch;\n }\n\n /**\n * Capture the pending state at this point\n */\n public checkpoint() {\n const startPoint = this.pendingBatch.length;\n return {\n rollback: (process: (message: BatchMessage) => void) => {\n for (let i = this.pendingBatch.length; i > startPoint;) {\n i--;\n const message = this.pendingBatch[i];\n this.batchContentSize -= message.contents?.length ?? 0;\n process(message);\n }\n\n this.pendingBatch.length = startPoint;\n },\n };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opCompressor.d.ts","sourceRoot":"","sources":["../src/opCompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;GAIG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,oBAAoB,CAAK;gBAErB,MAAM,EAAE,gBAAgB;IAI7B,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,YAAY,EAAE;CAiCtF"}
|
package/dist/opCompressor.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.OpCompressor = void 0;
|
|
8
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
-
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
|
-
const lz4js_1 = require("lz4js");
|
|
11
|
-
const containerRuntime_1 = require("./containerRuntime");
|
|
12
|
-
/**
|
|
13
|
-
* Compresses batches of ops. It generates a single compressed op that contains
|
|
14
|
-
* the contents of each op in the batch. It then submits empty ops for each original
|
|
15
|
-
* op to reserve sequence numbers.
|
|
16
|
-
*/
|
|
17
|
-
class OpCompressor {
|
|
18
|
-
constructor(logger) {
|
|
19
|
-
this.compressedBatchCount = 0;
|
|
20
|
-
this.logger = telemetry_utils_1.ChildLogger.create(logger, "OpCompressor");
|
|
21
|
-
}
|
|
22
|
-
compressBatch(batch, originalLength) {
|
|
23
|
-
const batchToSend = [];
|
|
24
|
-
this.compressedBatchCount++;
|
|
25
|
-
const batchedContents = [];
|
|
26
|
-
for (const message of batch) {
|
|
27
|
-
batchedContents.push(message.deserializedContent);
|
|
28
|
-
}
|
|
29
|
-
const compressionStart = Date.now();
|
|
30
|
-
const contentsAsBuffer = new TextEncoder().encode(JSON.stringify(batchedContents));
|
|
31
|
-
const compressedContents = (0, lz4js_1.compress)(contentsAsBuffer);
|
|
32
|
-
const compressedContent = common_utils_1.IsoBuffer.from(compressedContents).toString("base64");
|
|
33
|
-
const duration = Date.now() - compressionStart;
|
|
34
|
-
if (originalLength > 200000 || this.compressedBatchCount % 100) {
|
|
35
|
-
this.logger.sendPerformanceEvent({
|
|
36
|
-
eventName: "CompressedBatch",
|
|
37
|
-
duration,
|
|
38
|
-
sizeBeforeCompression: originalLength,
|
|
39
|
-
sizeAfterCompression: compressedContent.length,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
batchToSend.push(Object.assign(Object.assign({}, batch[0]), { contents: JSON.stringify({ packedContents: compressedContent }), metadata: Object.assign(Object.assign({}, batch[0].metadata), { compressed: true }), compression: containerRuntime_1.CompressionAlgorithms.lz4 }));
|
|
43
|
-
for (const message of batch.slice(1)) {
|
|
44
|
-
batchToSend.push(Object.assign(Object.assign({}, message), { contents: undefined }));
|
|
45
|
-
}
|
|
46
|
-
return batchToSend;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.OpCompressor = OpCompressor;
|
|
50
|
-
//# sourceMappingURL=opCompressor.js.map
|
package/dist/opCompressor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opCompressor.js","sourceRoot":"","sources":["../src/opCompressor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAyD;AACzD,qEAA8D;AAC9D,iCAAiC;AAEjC,yDAAoF;AAEpF;;;;GAIG;AACH,MAAa,YAAY;IAIrB,YAAY,MAAwB;QAF5B,yBAAoB,GAAG,CAAC,CAAC;QAG7B,IAAI,CAAC,MAAM,GAAG,6BAAW,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7D,CAAC;IAEM,aAAa,CAAC,KAAqB,EAAE,cAAsB;QAC9D,MAAM,WAAW,GAAmB,EAAE,CAAC;QACvC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,MAAM,eAAe,GAA8B,EAAE,CAAC;QACtD,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE;YACzB,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;SACrD;QAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACpC,MAAM,gBAAgB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;QACnF,MAAM,kBAAkB,GAAG,IAAA,gBAAQ,EAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,iBAAiB,GAAG,wBAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAChF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,gBAAgB,CAAC;QAE/C,IAAI,cAAc,GAAG,MAAM,IAAI,IAAI,CAAC,oBAAoB,GAAG,GAAG,EAAE;YAC5D,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAC7B,SAAS,EAAE,iBAAiB;gBAC5B,QAAQ;gBACR,qBAAqB,EAAE,cAAc;gBACrC,oBAAoB,EAAE,iBAAiB,CAAC,MAAM;aACjD,CAAC,CAAC;SACN;QAED,WAAW,CAAC,IAAI,iCAAM,KAAK,CAAC,CAAC,CAAC,KAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,EAC5E,QAAQ,kCAAO,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAE,UAAU,EAAE,IAAI,KAClD,WAAW,EAAE,wCAAqB,CAAC,GAAG,IAAG,CAAC;QAE7D,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YAClC,WAAW,CAAC,IAAI,iCAAM,OAAO,KAAE,QAAQ,EAAE,SAAS,IAAG,CAAC;SACzD;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AAzCD,oCAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IsoBuffer } from \"@fluidframework/common-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { compress } from \"lz4js\";\nimport { BatchMessage } from \"./batchManager\";\nimport { CompressionAlgorithms, ContainerRuntimeMessage } from \"./containerRuntime\";\n\n/**\n * Compresses batches of ops. It generates a single compressed op that contains\n * the contents of each op in the batch. It then submits empty ops for each original\n * op to reserve sequence numbers.\n */\nexport class OpCompressor {\n private readonly logger;\n private compressedBatchCount = 0;\n\n constructor(logger: ITelemetryLogger) {\n this.logger = ChildLogger.create(logger, \"OpCompressor\");\n }\n\n public compressBatch(batch: BatchMessage[], originalLength: number): BatchMessage[] {\n const batchToSend: BatchMessage[] = [];\n this.compressedBatchCount++;\n const batchedContents: ContainerRuntimeMessage[] = [];\n for (const message of batch) {\n batchedContents.push(message.deserializedContent);\n }\n\n const compressionStart = Date.now();\n const contentsAsBuffer = new TextEncoder().encode(JSON.stringify(batchedContents));\n const compressedContents = compress(contentsAsBuffer);\n const compressedContent = IsoBuffer.from(compressedContents).toString(\"base64\");\n const duration = Date.now() - compressionStart;\n\n if (originalLength > 200000 || this.compressedBatchCount % 100) {\n this.logger.sendPerformanceEvent({\n eventName: \"CompressedBatch\",\n duration,\n sizeBeforeCompression: originalLength,\n sizeAfterCompression: compressedContent.length,\n });\n }\n\n batchToSend.push({ ...batch[0], contents: JSON.stringify({ packedContents: compressedContent }),\n metadata: { ...batch[0].metadata, compressed: true },\n compression: CompressionAlgorithms.lz4 });\n\n for (const message of batch.slice(1)) {\n batchToSend.push({ ...message, contents: undefined });\n }\n\n return batchToSend;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opDecompressor.d.ts","sourceRoot":"","sources":["../src/opDecompressor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAIjF;;;;;;;GAOG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,cAAc,CAAK;IAEpB,cAAc,CAAC,OAAO,EAAE,yBA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M,UAAU,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAErC,uCAAY,OAAO,KAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,IAAG;SAC7C;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA/DD,wCA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { decompress } from \"lz4js\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { assert, IsoBuffer, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport { CompressionAlgorithms } from \".\";\n\n/**\n * State machine that \"unrolls\" contents of compressed batches of ops after decompressing them.\n * This class relies on some implicit contracts defined below:\n * 1. A compressed batch will have its first message with batch metadata set to true and compressed set to true\n * 2. Messages in the middle of a compressed batch will have neither batch metadata nor the compression property set\n * 3. The final message of a batch will have batch metadata set to false\n * 4. An individually compressed op will have undefined batch metadata and compression set to true\n */\nexport class OpDecompressor {\n private activeBatch = false;\n private rootMessageContents: any | undefined;\n private processedCount = 0;\n\n public processMessage(message: ISequencedDocumentMessage): ISequencedDocumentMessage {\n // We're checking for compression = true or top level compression property so\n // that we can enable compression without waiting on all ordering services\n // to pick up protocol change. Eventually only the top level property should\n // be used.\n if (message.metadata?.batch === true\n && (message.metadata?.compressed || message.compression !== undefined)) {\n // Beginning of a compressed batch\n assert(this.activeBatch === false, \"shouldn't have multiple active batches\");\n if (message.compression) {\n // lz4 is the only supported compression algorithm for now\n assert(message.compression === CompressionAlgorithms.lz4,\n \"lz4 is currently the only supported compression algorithm\");\n }\n\n this.activeBatch = true;\n\n const contents = IsoBuffer.from(message.contents.packedContents, \"base64\");\n const decompressedMessage = decompress(contents);\n const intoString = Uint8ArrayToString(decompressedMessage);\n const asObj = JSON.parse(intoString);\n this.rootMessageContents = asObj;\n\n return { ...message, contents: this.rootMessageContents[this.processedCount++] };\n }\n\n if (this.rootMessageContents !== undefined && message.metadata?.batch === undefined && this.activeBatch) {\n // Continuation of compressed batch\n return { ...message, contents: this.rootMessageContents[this.processedCount++] };\n }\n\n if (this.rootMessageContents !== undefined && message.metadata?.batch === false) {\n // End of compressed batch\n const returnMessage = { ...message,\n contents: this.rootMessageContents[this.processedCount++] };\n\n this.activeBatch = false;\n this.rootMessageContents = undefined;\n this.processedCount = 0;\n\n return returnMessage;\n }\n\n if (message.metadata?.batch === undefined &&\n (message.metadata?.compressed || message.compression === CompressionAlgorithms.lz4)) {\n // Single compressed message\n assert(this.activeBatch === false, \"shouldn't receive compressed message in middle of a batch\");\n\n const contents = IsoBuffer.from(message.contents.packedContents, \"base64\");\n const decompressedMessage = decompress(contents);\n const intoString = new TextDecoder().decode(decompressedMessage);\n const asObj = JSON.parse(intoString);\n\n return { ...message, contents: asObj[0] };\n }\n\n return message;\n }\n}\n"]}
|
package/lib/batchManager.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
|
-
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
|
-
import { ContainerRuntimeMessage, ICompressionRuntimeOptions } from "./containerRuntime";
|
|
8
|
-
/**
|
|
9
|
-
* Message type used by BatchManager
|
|
10
|
-
*/
|
|
11
|
-
export declare type BatchMessage = IBatchMessage & {
|
|
12
|
-
localOpMetadata: unknown;
|
|
13
|
-
deserializedContent: ContainerRuntimeMessage;
|
|
14
|
-
referenceSequenceNumber: number;
|
|
15
|
-
};
|
|
16
|
-
export interface IBatchManagerOptions {
|
|
17
|
-
readonly hardLimit: number;
|
|
18
|
-
readonly softLimit?: number;
|
|
19
|
-
readonly compressionOptions?: ICompressionRuntimeOptions;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Helper class that manages partial batch & rollback.
|
|
23
|
-
*/
|
|
24
|
-
export declare class BatchManager {
|
|
25
|
-
readonly logger: ITelemetryLogger;
|
|
26
|
-
readonly options: IBatchManagerOptions;
|
|
27
|
-
private readonly opCompressor;
|
|
28
|
-
private pendingBatch;
|
|
29
|
-
private batchContentSize;
|
|
30
|
-
get length(): number;
|
|
31
|
-
constructor(logger: ITelemetryLogger, options: IBatchManagerOptions);
|
|
32
|
-
push(message: BatchMessage): boolean;
|
|
33
|
-
get empty(): boolean;
|
|
34
|
-
popBatch(): BatchMessage[];
|
|
35
|
-
/**
|
|
36
|
-
* Capture the pending state at this point
|
|
37
|
-
*/
|
|
38
|
-
checkpoint(): {
|
|
39
|
-
rollback: (process: (message: BatchMessage) => void) => void;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=batchManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batchManager.d.ts","sourceRoot":"","sources":["../src/batchManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGzF;;GAEG;AACH,oBAAY,YAAY,GAAG,aAAa,GAAG;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,uBAAuB,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CAC5D;AAED;;GAEG;AACH,qBAAa,YAAY;aAOO,MAAM,EAAE,gBAAgB;aAAkB,OAAO,EAAE,oBAAoB;IANnG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAAK;IAE7B,IAAW,MAAM,WAAuC;gBAE5B,MAAM,EAAE,gBAAgB,EAAkB,OAAO,EAAE,oBAAoB;IAI5F,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IAiC3C,IAAW,KAAK,YAA6C;IAEtD,QAAQ;IAef;;OAEG;IACI,UAAU;sCAGqB,YAAY,KAAK,IAAI;;CAY9D"}
|