@fluidframework/container-runtime 2.0.0-dev.1.4.5.105745 → 2.0.0-dev.2.2.0.111723
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 +1 -1
- package/dist/batchManager.d.ts +11 -6
- package/dist/batchManager.d.ts.map +1 -1
- package/dist/batchManager.js +23 -13
- package/dist/batchManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +74 -20
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +190 -137
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +6 -0
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +14 -21
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +71 -57
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStoreContexts.js +1 -1
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/dataStores.d.ts +11 -10
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +50 -20
- package/dist/dataStores.js.map +1 -1
- package/dist/garbageCollection.d.ts +36 -19
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +207 -121
- package/dist/garbageCollection.js.map +1 -1
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/dist/gcSweepReadyUsageDetection.js +3 -12
- package/dist/gcSweepReadyUsageDetection.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/opCompressor.d.ts +18 -0
- package/dist/opCompressor.d.ts.map +1 -0
- package/dist/opCompressor.js +50 -0
- package/dist/opCompressor.js.map +1 -0
- package/dist/opDecompressor.d.ts +20 -0
- package/dist/opDecompressor.d.ts.map +1 -0
- package/dist/opDecompressor.js +72 -0
- package/dist/opDecompressor.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +6 -26
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +42 -62
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runningSummarizer.d.ts +3 -2
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +10 -3
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.js.map +1 -1
- package/dist/summarizer.js +7 -2
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.js +1 -1
- package/dist/summarizerClientElection.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +0 -3
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +19 -2
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryFormat.d.ts +4 -2
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +3 -2
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +10 -6
- package/dist/summaryManager.js.map +1 -1
- package/garbageCollection.md +27 -22
- package/lib/batchManager.d.ts +11 -6
- package/lib/batchManager.d.ts.map +1 -1
- package/lib/batchManager.js +23 -13
- package/lib/batchManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +74 -20
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +189 -136
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +6 -0
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +14 -21
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +75 -61
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStoreContexts.js +1 -1
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/dataStores.d.ts +11 -10
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +53 -23
- package/lib/dataStores.js.map +1 -1
- package/lib/garbageCollection.d.ts +36 -19
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +208 -122
- package/lib/garbageCollection.js.map +1 -1
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
- package/lib/gcSweepReadyUsageDetection.js +3 -12
- package/lib/gcSweepReadyUsageDetection.js.map +1 -1
- package/lib/index.d.ts +4 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -1
- package/lib/opCompressor.d.ts +18 -0
- package/lib/opCompressor.d.ts.map +1 -0
- package/lib/opCompressor.js +46 -0
- package/lib/opCompressor.js.map +1 -0
- package/lib/opDecompressor.d.ts +20 -0
- package/lib/opDecompressor.d.ts.map +1 -0
- package/lib/opDecompressor.js +68 -0
- package/lib/opDecompressor.js.map +1 -0
- 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 +6 -26
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +42 -62
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runningSummarizer.d.ts +3 -2
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +10 -3
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.js.map +1 -1
- package/lib/summarizer.js +7 -2
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.js +1 -1
- package/lib/summarizerClientElection.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +0 -3
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +19 -2
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryFormat.d.ts +4 -2
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +3 -2
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +10 -6
- package/lib/summaryManager.js.map +1 -1
- package/package.json +37 -63
- package/prettier.config.cjs +8 -0
- package/src/batchManager.ts +32 -15
- package/src/containerRuntime.ts +260 -156
- package/src/dataStore.ts +13 -1
- package/src/dataStoreContext.ts +100 -76
- package/src/dataStoreContexts.ts +1 -1
- package/src/dataStores.ts +61 -23
- package/src/garbageCollection.ts +257 -126
- package/src/gcSweepReadyUsageDetection.ts +2 -10
- package/src/index.ts +4 -4
- package/src/opCompressor.ts +59 -0
- package/src/opDecompressor.ts +82 -0
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +57 -96
- package/src/runningSummarizer.ts +11 -3
- package/src/scheduleManager.ts +1 -0
- package/src/summarizer.ts +6 -6
- package/src/summarizerClientElection.ts +1 -1
- package/src/summarizerHeuristics.ts +0 -3
- package/src/summarizerTypes.ts +20 -7
- package/src/summaryFormat.ts +4 -2
- package/src/summaryGenerator.ts +3 -2
- package/src/summaryManager.ts +18 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-runtime",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.2.2.0.111723",
|
|
4
4
|
"description": "Fluid container runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -28,17 +28,19 @@
|
|
|
28
28
|
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
29
|
"eslint": "eslint --format stylish src",
|
|
30
30
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
+
"format": "npm run prettier:fix",
|
|
31
32
|
"lint": "npm run eslint",
|
|
32
33
|
"lint:fix": "npm run eslint:fix",
|
|
34
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
35
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
33
36
|
"test": "npm run test:mocha",
|
|
34
37
|
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
38
|
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
36
39
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
40
|
"tsc": "tsc",
|
|
38
41
|
"tsc:watch": "tsc --watch",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"typetests:gen": "fluid-type-validator -g -d ."
|
|
42
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
43
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
42
44
|
},
|
|
43
45
|
"nyc": {
|
|
44
46
|
"all": true,
|
|
@@ -63,29 +65,31 @@
|
|
|
63
65
|
"dependencies": {
|
|
64
66
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
65
67
|
"@fluidframework/common-utils": "^1.0.0",
|
|
66
|
-
"@fluidframework/container-definitions": "2.0.0-dev.
|
|
67
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-dev.
|
|
68
|
-
"@fluidframework/container-utils": "2.0.0-dev.
|
|
69
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.
|
|
70
|
-
"@fluidframework/datastore": "2.0.0-dev.
|
|
71
|
-
"@fluidframework/driver-definitions": "2.0.0-dev.
|
|
72
|
-
"@fluidframework/driver-utils": "2.0.0-dev.
|
|
73
|
-
"@fluidframework/garbage-collector": "2.0.0-dev.
|
|
74
|
-
"@fluidframework/protocol-base": "^0.
|
|
75
|
-
"@fluidframework/protocol-definitions": "^1.
|
|
76
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev.
|
|
77
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.
|
|
78
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.
|
|
68
|
+
"@fluidframework/container-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
69
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
70
|
+
"@fluidframework/container-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
71
|
+
"@fluidframework/core-interfaces": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
72
|
+
"@fluidframework/datastore": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
73
|
+
"@fluidframework/driver-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
74
|
+
"@fluidframework/driver-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
75
|
+
"@fluidframework/garbage-collector": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
76
|
+
"@fluidframework/protocol-base": "^0.1038.2000",
|
|
77
|
+
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
78
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
79
|
+
"@fluidframework/runtime-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
80
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
79
81
|
"double-ended-queue": "^2.1.0-0",
|
|
82
|
+
"lz4js": "^0.2.0",
|
|
80
83
|
"uuid": "^8.3.1"
|
|
81
84
|
},
|
|
82
85
|
"devDependencies": {
|
|
83
|
-
"@
|
|
84
|
-
"@fluidframework/build-
|
|
85
|
-
"@fluidframework/
|
|
86
|
-
"@fluidframework/
|
|
87
|
-
"@fluidframework/
|
|
88
|
-
"@fluidframework/test-
|
|
86
|
+
"@fluid-tools/build-cli": "^0.6.0-109663",
|
|
87
|
+
"@fluidframework/build-common": "^1.1.0",
|
|
88
|
+
"@fluidframework/build-tools": "^0.6.0-109663",
|
|
89
|
+
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.2.1.0",
|
|
90
|
+
"@fluidframework/eslint-config-fluid": "^1.2.0",
|
|
91
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
92
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-dev.2.2.0.111723 <2.0.0-dev.3.0.0",
|
|
89
93
|
"@microsoft/api-extractor": "^7.22.2",
|
|
90
94
|
"@rushstack/eslint-config": "^2.5.1",
|
|
91
95
|
"@types/double-ended-queue": "^2.1.0",
|
|
@@ -101,54 +105,24 @@
|
|
|
101
105
|
"nyc": "^15.0.0",
|
|
102
106
|
"rimraf": "^2.6.2",
|
|
103
107
|
"sinon": "^7.4.2",
|
|
104
|
-
"typescript": "~4.5.5"
|
|
105
|
-
"typescript-formatter": "7.1.0"
|
|
108
|
+
"typescript": "~4.5.5"
|
|
106
109
|
},
|
|
107
110
|
"typeValidation": {
|
|
108
|
-
"version": "2.0.0",
|
|
111
|
+
"version": "2.0.0-internal.2.2.0",
|
|
112
|
+
"baselineRange": ">=2.0.0-internal.2.1.0 <2.0.0-internal.2.2.0",
|
|
113
|
+
"baselineVersion": "2.0.0-internal.2.1.0",
|
|
109
114
|
"broken": {
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
},
|
|
114
|
-
"TypeAliasDeclaration_ISummaryConfiguration": {
|
|
115
|
-
"forwardCompat": false,
|
|
116
|
-
"backCompat": false
|
|
117
|
-
},
|
|
118
|
-
"InterfaceDeclaration_ISummaryConfigurationHeuristics": {
|
|
119
|
-
"forwardCompat": false,
|
|
120
|
-
"backCompat": false
|
|
121
|
-
},
|
|
122
|
-
"InterfaceDeclaration_IGeneratedSummaryStats": {
|
|
123
|
-
"backCompat": false
|
|
124
|
-
},
|
|
125
|
-
"InterfaceDeclaration_IGenerateSummaryTreeResult": {
|
|
126
|
-
"backCompat": false
|
|
127
|
-
},
|
|
128
|
-
"InterfaceDeclaration_ISubmitSummaryOpResult": {
|
|
129
|
-
"backCompat": false
|
|
130
|
-
},
|
|
131
|
-
"InterfaceDeclaration_IUploadSummaryResult": {
|
|
132
|
-
"backCompat": false
|
|
115
|
+
"InterfaceDeclaration_ICompressionRuntimeOptions": {
|
|
116
|
+
"backCompat": false,
|
|
117
|
+
"forwardCompat": false
|
|
133
118
|
},
|
|
134
|
-
"
|
|
135
|
-
"backCompat": false
|
|
119
|
+
"InterfaceDeclaration_IContainerRuntimeOptions": {
|
|
120
|
+
"backCompat": false,
|
|
121
|
+
"forwardCompat": false
|
|
136
122
|
},
|
|
137
123
|
"ClassDeclaration_ContainerRuntime": {
|
|
138
|
-
"backCompat": false
|
|
139
|
-
},
|
|
140
|
-
"InterfaceDeclaration_IConnectableRuntime": {
|
|
141
|
-
"backCompat": false
|
|
142
|
-
},
|
|
143
|
-
"InterfaceDeclaration_ISummarizerRuntime": {
|
|
144
|
-
"backCompat": false
|
|
145
|
-
},
|
|
146
|
-
"RemovedInterfaceDeclaration_IPendingRuntimeState": {
|
|
147
124
|
"forwardCompat": false,
|
|
148
125
|
"backCompat": false
|
|
149
|
-
},
|
|
150
|
-
"ClassDeclaration_ScheduleManager": {
|
|
151
|
-
"forwardCompat": false
|
|
152
126
|
}
|
|
153
127
|
}
|
|
154
128
|
}
|
package/src/batchManager.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
7
|
import { IBatchMessage } from "@fluidframework/container-definitions";
|
|
7
|
-
import { ContainerRuntimeMessage } from "./containerRuntime";
|
|
8
|
+
import { ContainerRuntimeMessage, ICompressionRuntimeOptions } from "./containerRuntime";
|
|
9
|
+
import { OpCompressor } from "./opCompressor";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Message type used by BatchManager
|
|
@@ -15,27 +17,28 @@ export type BatchMessage = IBatchMessage & {
|
|
|
15
17
|
referenceSequenceNumber: number;
|
|
16
18
|
};
|
|
17
19
|
|
|
20
|
+
export interface IBatchManagerOptions {
|
|
21
|
+
readonly hardLimit: number;
|
|
22
|
+
readonly softLimit?: number;
|
|
23
|
+
readonly compressionOptions?: ICompressionRuntimeOptions;
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
/**
|
|
19
27
|
* Helper class that manages partial batch & rollback.
|
|
20
28
|
*/
|
|
21
29
|
export class BatchManager {
|
|
30
|
+
private readonly opCompressor: OpCompressor;
|
|
22
31
|
private pendingBatch: BatchMessage [] = [];
|
|
23
32
|
private batchContentSize = 0;
|
|
24
33
|
|
|
25
|
-
// The actual limit is 1Mb (socket.io and Kafka limits)
|
|
26
|
-
// We can't estimate it fully, as we
|
|
27
|
-
// - do not know what properties relay service will add
|
|
28
|
-
// - we do not stringify final op, thus we do not know how much escaping will be added.
|
|
29
|
-
private static readonly hardLimit = 950 * 1024;
|
|
30
|
-
|
|
31
34
|
public get length() { return this.pendingBatch.length; }
|
|
32
|
-
public get limit() { return BatchManager.hardLimit; }
|
|
33
|
-
public static get limit() { return BatchManager.hardLimit; }
|
|
34
35
|
|
|
35
|
-
constructor(public readonly
|
|
36
|
+
constructor(public readonly logger: ITelemetryLogger, public readonly options: IBatchManagerOptions) {
|
|
37
|
+
this.opCompressor = new OpCompressor(logger);
|
|
38
|
+
}
|
|
36
39
|
|
|
37
40
|
public push(message: BatchMessage): boolean {
|
|
38
|
-
const contentSize = this.batchContentSize + message.contents
|
|
41
|
+
const contentSize = this.batchContentSize + (message.contents?.length ?? 0);
|
|
39
42
|
const opCount = this.pendingBatch.length;
|
|
40
43
|
|
|
41
44
|
// Attempt to estimate batch size, aka socket message size.
|
|
@@ -48,11 +51,17 @@ export class BatchManager {
|
|
|
48
51
|
// If we were provided soft limit, check for exceeding it.
|
|
49
52
|
// But only if we have any ops, as the intention here is to flush existing ops (on exceeding this limit)
|
|
50
53
|
// and start over. That's not an option if we have no ops.
|
|
51
|
-
|
|
54
|
+
// If compression is enabled, the soft and hard limit are ignored and the message will be pushed anyways.
|
|
55
|
+
// Cases where the message is still too large will be handled by the maxConsecutiveReconnects path.
|
|
56
|
+
if (this.options.softLimit !== undefined
|
|
57
|
+
&& this.length > 0
|
|
58
|
+
&& socketMessageSize >= this.options.softLimit
|
|
59
|
+
&& Infinity === (this.options.compressionOptions?.minimumBatchSizeInBytes ?? Infinity)) {
|
|
52
60
|
return false;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
if (socketMessageSize >= this.
|
|
63
|
+
if (socketMessageSize >= this.options.hardLimit
|
|
64
|
+
&& Infinity === (this.options.compressionOptions?.minimumBatchSizeInBytes ?? Infinity)) {
|
|
56
65
|
return false;
|
|
57
66
|
}
|
|
58
67
|
|
|
@@ -65,22 +74,30 @@ export class BatchManager {
|
|
|
65
74
|
|
|
66
75
|
public popBatch() {
|
|
67
76
|
const batch = this.pendingBatch;
|
|
77
|
+
const size = this.batchContentSize;
|
|
68
78
|
this.pendingBatch = [];
|
|
69
79
|
this.batchContentSize = 0;
|
|
80
|
+
|
|
81
|
+
if (batch.length > 0
|
|
82
|
+
&& this.options.compressionOptions !== undefined
|
|
83
|
+
&& this.options.compressionOptions.minimumBatchSizeInBytes < size) {
|
|
84
|
+
return this.opCompressor.compressBatch(batch, size);
|
|
85
|
+
}
|
|
86
|
+
|
|
70
87
|
return batch;
|
|
71
88
|
}
|
|
72
89
|
|
|
73
90
|
/**
|
|
74
91
|
* Capture the pending state at this point
|
|
75
92
|
*/
|
|
76
|
-
|
|
93
|
+
public checkpoint() {
|
|
77
94
|
const startPoint = this.pendingBatch.length;
|
|
78
95
|
return {
|
|
79
96
|
rollback: (process: (message: BatchMessage) => void) => {
|
|
80
97
|
for (let i = this.pendingBatch.length; i > startPoint;) {
|
|
81
98
|
i--;
|
|
82
99
|
const message = this.pendingBatch[i];
|
|
83
|
-
this.batchContentSize -= message.contents
|
|
100
|
+
this.batchContentSize -= message.contents?.length ?? 0;
|
|
84
101
|
process(message);
|
|
85
102
|
}
|
|
86
103
|
|