@fluidframework/container-runtime 2.0.0-internal.3.0.0 → 2.0.0-internal.3.1.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/.eslintrc.js +19 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -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 +9 -2
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +80 -33
- 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 +10 -0
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +140 -72
- 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 +18 -1
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +66 -15
- 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 +26 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +103 -18
- 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 +34 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +188 -93
- package/dist/garbageCollection.js.map +1 -1
- package/dist/garbageCollectionConstants.d.ts +3 -0
- package/dist/garbageCollectionConstants.d.ts.map +1 -1
- package/dist/garbageCollectionConstants.js +6 -1
- package/dist/garbageCollectionConstants.js.map +1 -1
- package/dist/garbageCollectionHelpers.d.ts +26 -0
- package/dist/garbageCollectionHelpers.d.ts.map +1 -0
- package/dist/garbageCollectionHelpers.js +45 -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 +14 -10
- package/dist/gcSweepReadyUsageDetection.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +5 -5
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +19 -12
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/definitions.d.ts.map +1 -1
- package/dist/opLifecycle/definitions.js.map +1 -1
- package/dist/opLifecycle/index.d.ts.map +1 -1
- package/dist/opLifecycle/index.js.map +1 -1
- package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opCompressor.js.map +1 -1
- package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/dist/opLifecycle/opDecompressor.js +5 -2
- package/dist/opLifecycle/opDecompressor.js.map +1 -1
- package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
- package/dist/opLifecycle/opSplitter.js +4 -1
- package/dist/opLifecycle/opSplitter.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +19 -17
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
- 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 +7 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +7 -4
- 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 -21
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts.map +1 -1
- package/dist/scheduleManager.js +3 -2
- package/dist/scheduleManager.js.map +1 -1
- package/dist/serializedSnapshotStorage.d.ts +2 -2
- package/dist/serializedSnapshotStorage.d.ts.map +1 -1
- package/dist/serializedSnapshotStorage.js +5 -3
- package/dist/serializedSnapshotStorage.js.map +1 -1
- package/dist/summarizer.d.ts +2 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +37 -17
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerClientElection.d.ts.map +1 -1
- 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 +21 -21
- 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 +22 -0
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js +18 -10
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +34 -15
- 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.map +1 -1
- package/lib/batchTracker.js +2 -1
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +9 -2
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +82 -35
- 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 +10 -0
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +146 -78
- 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 +18 -1
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +68 -17
- 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 +26 -1
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +109 -24
- 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 +34 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +190 -95
- package/lib/garbageCollection.js.map +1 -1
- package/lib/garbageCollectionConstants.d.ts +3 -0
- package/lib/garbageCollectionConstants.d.ts.map +1 -1
- package/lib/garbageCollectionConstants.js +5 -0
- package/lib/garbageCollectionConstants.js.map +1 -1
- package/lib/garbageCollectionHelpers.d.ts +26 -0
- package/lib/garbageCollectionHelpers.d.ts.map +1 -0
- package/lib/garbageCollectionHelpers.js +40 -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 +14 -10
- package/lib/gcSweepReadyUsageDetection.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +5 -5
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +19 -12
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/definitions.d.ts.map +1 -1
- package/lib/opLifecycle/definitions.js.map +1 -1
- package/lib/opLifecycle/index.d.ts.map +1 -1
- package/lib/opLifecycle/index.js.map +1 -1
- package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opCompressor.js.map +1 -1
- package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
- package/lib/opLifecycle/opDecompressor.js +5 -2
- package/lib/opLifecycle/opDecompressor.js.map +1 -1
- package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
- package/lib/opLifecycle/opSplitter.js +5 -2
- package/lib/opLifecycle/opSplitter.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +19 -17
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
- package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
- 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 +7 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +7 -4
- 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 -22
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts.map +1 -1
- package/lib/scheduleManager.js +3 -2
- package/lib/scheduleManager.js.map +1 -1
- package/lib/serializedSnapshotStorage.d.ts +2 -2
- package/lib/serializedSnapshotStorage.d.ts.map +1 -1
- package/lib/serializedSnapshotStorage.js +5 -3
- package/lib/serializedSnapshotStorage.js.map +1 -1
- package/lib/summarizer.d.ts +2 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +37 -17
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerClientElection.d.ts.map +1 -1
- 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 +21 -21
- 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 +22 -0
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js +20 -12
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +34 -15
- 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 +121 -149
- package/prettier.config.cjs +1 -1
- package/src/batchTracker.ts +54 -49
- package/src/blobManager.ts +793 -672
- package/src/connectionTelemetry.ts +280 -249
- package/src/containerHandleContext.ts +27 -29
- package/src/containerRuntime.ts +3168 -2940
- package/src/dataStore.ts +172 -159
- package/src/dataStoreContext.ts +1098 -996
- package/src/dataStoreContexts.ts +178 -161
- package/src/dataStoreRegistry.ts +25 -20
- package/src/dataStores.ts +884 -728
- package/src/deltaScheduler.ts +158 -150
- package/src/garbageCollection.ts +1883 -1692
- package/src/garbageCollectionConstants.ts +6 -0
- package/src/garbageCollectionHelpers.ts +61 -0
- package/src/gcSweepReadyUsageDetection.ts +89 -83
- package/src/index.ts +67 -66
- package/src/opLifecycle/README.md +152 -0
- package/src/opLifecycle/batchManager.ts +145 -141
- package/src/opLifecycle/definitions.ts +29 -29
- package/src/opLifecycle/index.ts +5 -5
- package/src/opLifecycle/opCompressor.ts +54 -53
- package/src/opLifecycle/opDecompressor.ts +100 -81
- package/src/opLifecycle/opSplitter.ts +214 -188
- package/src/opLifecycle/outbox.ts +204 -194
- package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
- package/src/opProperties.ts +11 -9
- package/src/orderedClientElection.ts +489 -457
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +384 -338
- package/src/runWhileConnectedCoordinator.ts +78 -71
- package/src/runningSummarizer.ts +619 -581
- package/src/scheduleManager.ts +299 -269
- package/src/serializedSnapshotStorage.ts +126 -112
- package/src/summarizer.ts +417 -381
- package/src/summarizerClientElection.ts +107 -100
- package/src/summarizerHandle.ts +11 -9
- package/src/summarizerHeuristics.ts +183 -186
- package/src/summarizerTypes.ts +344 -330
- package/src/summaryCollection.ts +378 -349
- package/src/summaryFormat.ts +170 -126
- package/src/summaryGenerator.ts +465 -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/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/dist/garbageCollectionTombstoneUtils.js +0 -23
- package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
- package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
- package/lib/garbageCollectionTombstoneUtils.js +0 -19
- package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
- package/src/garbageCollectionTombstoneUtils.ts +0 -28
|
@@ -7,9 +7,7 @@ import { IDisposable } from "@fluidframework/common-definitions";
|
|
|
7
7
|
import { assert, Lazy } from "@fluidframework/common-utils";
|
|
8
8
|
import { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
9
9
|
import { DataProcessingError } from "@fluidframework/container-utils";
|
|
10
|
-
import {
|
|
11
|
-
ISequencedDocumentMessage,
|
|
12
|
-
} from "@fluidframework/protocol-definitions";
|
|
10
|
+
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
13
11
|
import Deque from "double-ended-queue";
|
|
14
12
|
import { ContainerMessageType } from "./containerRuntime";
|
|
15
13
|
import { pkgVersion } from "./packageVersion";
|
|
@@ -17,15 +15,16 @@ import { pkgVersion } from "./packageVersion";
|
|
|
17
15
|
/**
|
|
18
16
|
* This represents a message that has been submitted and is added to the pending queue when `submit` is called on the
|
|
19
17
|
* ContainerRuntime. This message has either not been ack'd by the server or has not been submitted to the server yet.
|
|
18
|
+
* @deprecated - This interface will no longer be exported in a future version
|
|
20
19
|
*/
|
|
21
20
|
export interface IPendingMessage {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
type: "message";
|
|
22
|
+
messageType: ContainerMessageType;
|
|
23
|
+
clientSequenceNumber: number;
|
|
24
|
+
referenceSequenceNumber: number;
|
|
25
|
+
content: any;
|
|
26
|
+
localOpMetadata: unknown;
|
|
27
|
+
opMetadata: Record<string, unknown> | undefined;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -34,33 +33,40 @@ export interface IPendingMessage {
|
|
|
34
33
|
* @deprecated Use batch metadata on IPendingMessage instead. To be removed in 2.0.0-internal.4.0.0 (AB#2496)
|
|
35
34
|
*/
|
|
36
35
|
export interface IPendingFlush {
|
|
37
|
-
|
|
36
|
+
type: "flush";
|
|
38
37
|
}
|
|
39
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated - This interface will no longer be exported in a future version
|
|
41
|
+
*/
|
|
40
42
|
export type IPendingState = IPendingMessage | IPendingFlush;
|
|
41
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated - This interface will no longer be exported in a future version
|
|
46
|
+
*/
|
|
42
47
|
export interface IPendingLocalState {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
/**
|
|
49
|
+
* list of pending states, including ops and batch information
|
|
50
|
+
*/
|
|
51
|
+
pendingStates: IPendingState[];
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
export interface IRuntimeStateHandler {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
connected(): boolean;
|
|
56
|
+
clientId(): string | undefined;
|
|
57
|
+
close(error?: ICriticalContainerError): void;
|
|
58
|
+
applyStashedOp: (
|
|
59
|
+
type: ContainerMessageType,
|
|
60
|
+
content: ISequencedDocumentMessage,
|
|
61
|
+
) => Promise<unknown>;
|
|
62
|
+
reSubmit(
|
|
63
|
+
type: ContainerMessageType,
|
|
64
|
+
content: any,
|
|
65
|
+
localOpMetadata: unknown,
|
|
66
|
+
opMetadata: Record<string, unknown> | undefined,
|
|
67
|
+
): void;
|
|
68
|
+
rollback(type: ContainerMessageType, content: any, localOpMetadata: unknown): void;
|
|
69
|
+
orderSequentially(callback: () => void): void;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
/**
|
|
@@ -73,313 +79,353 @@ export interface IRuntimeStateHandler {
|
|
|
73
79
|
* It verifies that all the ops are acked, are received in the right order and batch information is correct.
|
|
74
80
|
*/
|
|
75
81
|
export class PendingStateManager implements IDisposable {
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
82
|
+
private readonly pendingMessages = new Deque<IPendingMessage>();
|
|
83
|
+
private readonly initialMessages = new Deque<IPendingMessage>();
|
|
84
|
+
private readonly disposeOnce = new Lazy<void>(() => {
|
|
85
|
+
this.initialMessages.clear();
|
|
86
|
+
this.pendingMessages.clear();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
public get pendingMessagesCount(): number {
|
|
90
|
+
return this.pendingMessages.length;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Indicates whether we are processing a batch.
|
|
94
|
+
private isProcessingBatch: boolean = false;
|
|
95
|
+
|
|
96
|
+
// This stores the first message in the batch that we are processing. This is used to verify that we get
|
|
97
|
+
// the correct batch metadata.
|
|
98
|
+
private pendingBatchBeginMessage: ISequencedDocumentMessage | undefined;
|
|
99
|
+
|
|
100
|
+
private clientId: string | undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Called to check if there are any pending messages in the pending message queue.
|
|
104
|
+
* @returns A boolean indicating whether there are messages or not.
|
|
105
|
+
*/
|
|
106
|
+
public hasPendingMessages(): boolean {
|
|
107
|
+
return !this.pendingMessages.isEmpty() || !this.initialMessages.isEmpty();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public getLocalState(): IPendingLocalState | undefined {
|
|
111
|
+
assert(
|
|
112
|
+
this.initialMessages.isEmpty(),
|
|
113
|
+
0x2e9 /* "Must call getLocalState() after applying initial states" */,
|
|
114
|
+
);
|
|
115
|
+
if (!this.pendingMessages.isEmpty()) {
|
|
116
|
+
return {
|
|
117
|
+
pendingStates: this.pendingMessages.toArray().reduce((arr, message) => {
|
|
118
|
+
// delete localOpMetadata since it may not be serializable
|
|
119
|
+
// and will be regenerated by applyStashedOp()
|
|
120
|
+
arr.push({ ...message, localOpMetadata: undefined });
|
|
121
|
+
|
|
122
|
+
// TODO: Remove in 2.0.0-internal.4.0.0 (AB#2496)
|
|
123
|
+
if (message.opMetadata?.batch === false) {
|
|
124
|
+
arr.push({ type: "flush" });
|
|
125
|
+
}
|
|
126
|
+
return arr;
|
|
127
|
+
}, new Array<IPendingState>()),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
constructor(
|
|
133
|
+
private readonly stateHandler: IRuntimeStateHandler,
|
|
134
|
+
initialLocalState: IPendingLocalState | undefined,
|
|
135
|
+
) {
|
|
136
|
+
/**
|
|
137
|
+
* Convert old local state format to the new format
|
|
138
|
+
* The old format contained "flush" messages as the indicator of batch ends
|
|
139
|
+
* The new format instead uses batch metadata on the last message to indicate batch ends
|
|
140
|
+
* ! TODO: Remove this conversion in "2.0.0-internal.4.0.0" as rollback from future version will be new format
|
|
141
|
+
* AB#2496 tracks removal
|
|
142
|
+
*/
|
|
143
|
+
if (initialLocalState?.pendingStates) {
|
|
144
|
+
const pendingStates = initialLocalState?.pendingStates;
|
|
145
|
+
let currentlyBatching = false;
|
|
146
|
+
for (let i = 0; i < pendingStates.length; i++) {
|
|
147
|
+
const initialState = pendingStates[i];
|
|
148
|
+
|
|
149
|
+
// Skip over "flush" messages
|
|
150
|
+
if (initialState.type === "message") {
|
|
151
|
+
if (initialState.opMetadata?.batch) {
|
|
152
|
+
currentlyBatching = true;
|
|
153
|
+
} else if (initialState.opMetadata?.batch === false) {
|
|
154
|
+
currentlyBatching = false;
|
|
155
|
+
} else if (
|
|
156
|
+
// End of batch if we are currently batching and this is last message or next message is flush
|
|
157
|
+
currentlyBatching &&
|
|
158
|
+
(i === pendingStates.length - 1 || pendingStates[i + 1].type === "flush")
|
|
159
|
+
) {
|
|
160
|
+
currentlyBatching = false;
|
|
161
|
+
initialState.opMetadata = { ...initialState.opMetadata, batch: false };
|
|
162
|
+
}
|
|
163
|
+
this.initialMessages.push(initialState);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
public get disposed() {
|
|
170
|
+
return this.disposeOnce.evaluated;
|
|
171
|
+
}
|
|
172
|
+
public readonly dispose = () => this.disposeOnce.value;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Called when a message is submitted locally. Adds the message and the associated details to the pending state
|
|
176
|
+
* queue.
|
|
177
|
+
* @param type - The container message type.
|
|
178
|
+
* @param clientSequenceNumber - The clientSequenceNumber associated with the message.
|
|
179
|
+
* @param content - The message content.
|
|
180
|
+
* @param localOpMetadata - The local metadata associated with the message.
|
|
181
|
+
*/
|
|
182
|
+
public onSubmitMessage(
|
|
183
|
+
type: ContainerMessageType,
|
|
184
|
+
clientSequenceNumber: number,
|
|
185
|
+
referenceSequenceNumber: number,
|
|
186
|
+
content: any,
|
|
187
|
+
localOpMetadata: unknown,
|
|
188
|
+
opMetadata: Record<string, unknown> | undefined,
|
|
189
|
+
) {
|
|
190
|
+
const pendingMessage: IPendingMessage = {
|
|
191
|
+
type: "message",
|
|
192
|
+
messageType: type,
|
|
193
|
+
clientSequenceNumber,
|
|
194
|
+
referenceSequenceNumber,
|
|
195
|
+
content,
|
|
196
|
+
localOpMetadata,
|
|
197
|
+
opMetadata,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
this.pendingMessages.push(pendingMessage);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Applies stashed ops at their reference sequence number so they are ready to be ACKed or resubmitted
|
|
205
|
+
* @param seqNum - Sequence number at which to apply ops. Will apply all ops if seqNum is undefined.
|
|
206
|
+
*/
|
|
207
|
+
public async applyStashedOpsAt(seqNum?: number) {
|
|
208
|
+
// apply stashed ops at sequence number
|
|
209
|
+
while (!this.initialMessages.isEmpty()) {
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
211
|
+
const nextMessage = this.initialMessages.peekFront()!;
|
|
212
|
+
if (seqNum !== undefined) {
|
|
213
|
+
if (nextMessage.referenceSequenceNumber > seqNum) {
|
|
214
|
+
break; // nothing left to do at this sequence number
|
|
215
|
+
}
|
|
216
|
+
if (nextMessage.referenceSequenceNumber < seqNum) {
|
|
217
|
+
throw new Error("loaded from snapshot too recent to apply stashed ops");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// applyStashedOp will cause the DDS to behave as if it has sent the op but not actually send it
|
|
222
|
+
const localOpMetadata = await this.stateHandler.applyStashedOp(
|
|
223
|
+
nextMessage.messageType,
|
|
224
|
+
nextMessage.content,
|
|
225
|
+
);
|
|
226
|
+
nextMessage.localOpMetadata = localOpMetadata;
|
|
227
|
+
|
|
228
|
+
// then we push onto pendingMessages which will cause PendingStateManager to resubmit when we connect
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
230
|
+
this.pendingMessages.push(this.initialMessages.shift()!);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Processes a local message once its ack'd by the server. It verifies that there was no data corruption and that
|
|
236
|
+
* the batch information was preserved for batch messages.
|
|
237
|
+
* @param message - The message that got ack'd and needs to be processed.
|
|
238
|
+
*/
|
|
239
|
+
public processPendingLocalMessage(message: ISequencedDocumentMessage): unknown {
|
|
240
|
+
// Pre-processing part - This may be the start of a batch.
|
|
241
|
+
this.maybeProcessBatchBegin(message);
|
|
242
|
+
|
|
243
|
+
// Get the next message from the pending queue. Verify a message exists.
|
|
244
|
+
const pendingMessage = this.pendingMessages.peekFront();
|
|
245
|
+
assert(
|
|
246
|
+
pendingMessage !== undefined,
|
|
247
|
+
0x169 /* "No pending message found for this remote message" */,
|
|
248
|
+
);
|
|
249
|
+
this.pendingMessages.shift();
|
|
250
|
+
|
|
251
|
+
// Processing part - Verify that there has been no data corruption.
|
|
252
|
+
// The clientSequenceNumber of the incoming message must match that of the pending message.
|
|
253
|
+
if (pendingMessage.clientSequenceNumber !== message.clientSequenceNumber) {
|
|
254
|
+
// Close the container because this could indicate data corruption.
|
|
255
|
+
const error = DataProcessingError.create(
|
|
256
|
+
"pending local message clientSequenceNumber mismatch",
|
|
257
|
+
"unexpectedAckReceived",
|
|
258
|
+
message,
|
|
259
|
+
{ expectedClientSequenceNumber: pendingMessage.clientSequenceNumber },
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
this.stateHandler.close(error);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Post-processing part - If we are processing a batch then this could be the last message in the batch.
|
|
267
|
+
this.maybeProcessBatchEnd(message);
|
|
268
|
+
|
|
269
|
+
return pendingMessage.localOpMetadata;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* This message could be the first message in batch. If so, set batch state marking the beginning of a batch.
|
|
274
|
+
* @param message - The message that is being processed.
|
|
275
|
+
*/
|
|
276
|
+
private maybeProcessBatchBegin(message: ISequencedDocumentMessage) {
|
|
277
|
+
// This message is the first in a batch if the "batch" property on the metadata is set to true
|
|
278
|
+
if (message.metadata?.batch) {
|
|
279
|
+
// We should not already be processing a batch and there should be no pending batch begin message.
|
|
280
|
+
assert(
|
|
281
|
+
!this.isProcessingBatch && this.pendingBatchBeginMessage === undefined,
|
|
282
|
+
0x16b /* "The pending batch state indicates we are already processing a batch" */,
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
// Set the pending batch state indicating we have started processing a batch.
|
|
286
|
+
this.pendingBatchBeginMessage = message;
|
|
287
|
+
this.isProcessingBatch = true;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* This message could be the last message in batch. If so, clear batch state since the batch is complete.
|
|
293
|
+
* @param message - The message that is being processed.
|
|
294
|
+
*/
|
|
295
|
+
private maybeProcessBatchEnd(message: ISequencedDocumentMessage) {
|
|
296
|
+
if (!this.isProcessingBatch) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// There should be a pending batch begin message.
|
|
301
|
+
assert(
|
|
302
|
+
this.pendingBatchBeginMessage !== undefined,
|
|
303
|
+
0x16d /* "There is no pending batch begin message" */,
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
const batchEndMetadata = message.metadata?.batch;
|
|
307
|
+
if (this.pendingMessages.isEmpty() || batchEndMetadata === false) {
|
|
308
|
+
// Get the batch begin metadata from the first message in the batch.
|
|
309
|
+
const batchBeginMetadata = this.pendingBatchBeginMessage.metadata?.batch;
|
|
310
|
+
|
|
311
|
+
// There could be just a single message in the batch. If so, it should not have any batch metadata. If there
|
|
312
|
+
// are multiple messages in the batch, verify that we got the correct batch begin and end metadata.
|
|
313
|
+
if (this.pendingBatchBeginMessage === message) {
|
|
314
|
+
assert(
|
|
315
|
+
batchBeginMetadata === undefined,
|
|
316
|
+
0x16e /* "Batch with single message should not have batch metadata" */,
|
|
317
|
+
);
|
|
318
|
+
} else {
|
|
319
|
+
if (batchBeginMetadata !== true || batchEndMetadata !== false) {
|
|
320
|
+
this.stateHandler.close(
|
|
321
|
+
DataProcessingError.create(
|
|
322
|
+
"Pending batch inconsistency", // Formerly known as asserts 0x16f and 0x170
|
|
323
|
+
"processPendingLocalMessage",
|
|
324
|
+
message,
|
|
325
|
+
{
|
|
326
|
+
runtimeVersion: pkgVersion,
|
|
327
|
+
batchClientId: this.pendingBatchBeginMessage.clientId,
|
|
328
|
+
clientId: this.stateHandler.clientId(),
|
|
329
|
+
hasBatchStart: batchBeginMetadata === true,
|
|
330
|
+
hasBatchEnd: batchEndMetadata === false,
|
|
331
|
+
messageType: message.type,
|
|
332
|
+
batchStartSequenceNumber:
|
|
333
|
+
this.pendingBatchBeginMessage.clientSequenceNumber,
|
|
334
|
+
pendingMessagesCount: this.pendingMessagesCount,
|
|
335
|
+
},
|
|
336
|
+
),
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Clear the pending batch state now that we have processed the entire batch.
|
|
342
|
+
this.pendingBatchBeginMessage = undefined;
|
|
343
|
+
this.isProcessingBatch = false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Called when the Container's connection state changes. If the Container gets connected, it replays all the pending
|
|
349
|
+
* states in its queue. This includes triggering resubmission of unacked ops.
|
|
350
|
+
*/
|
|
351
|
+
public replayPendingStates() {
|
|
352
|
+
assert(
|
|
353
|
+
this.stateHandler.connected(),
|
|
354
|
+
0x172 /* "The connection state is not consistent with the runtime" */,
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
// This assert suggests we are about to send same ops twice, which will result in data loss.
|
|
358
|
+
assert(
|
|
359
|
+
this.clientId !== this.stateHandler.clientId(),
|
|
360
|
+
0x173 /* "replayPendingStates called twice for same clientId!" */,
|
|
361
|
+
);
|
|
362
|
+
this.clientId = this.stateHandler.clientId();
|
|
363
|
+
|
|
364
|
+
assert(
|
|
365
|
+
this.initialMessages.isEmpty(),
|
|
366
|
+
0x174 /* "initial states should be empty before replaying pending" */,
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
let pendingMessagesCount = this.pendingMessages.length;
|
|
370
|
+
if (pendingMessagesCount === 0) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Process exactly `pendingMessagesCount` items in the queue as it represents the number of messages that were
|
|
375
|
+
// pending when we connected. This is important because the `reSubmitFn` might add more items in the queue
|
|
376
|
+
// which must not be replayed.
|
|
377
|
+
while (pendingMessagesCount > 0) {
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
379
|
+
let pendingMessage = this.pendingMessages.shift()!;
|
|
380
|
+
pendingMessagesCount--;
|
|
381
|
+
assert(
|
|
382
|
+
pendingMessage.opMetadata?.batch !== false,
|
|
383
|
+
0x41b /* We cannot process batches in chunks */,
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* We want to ensure grouped messages get processed in a batch.
|
|
388
|
+
* Note: It is not possible for the PendingStateManager to receive a partially acked batch. It will
|
|
389
|
+
* either receive the whole batch ack or nothing at all.
|
|
390
|
+
*/
|
|
391
|
+
if (pendingMessage.opMetadata?.batch) {
|
|
392
|
+
assert(
|
|
393
|
+
pendingMessagesCount > 0,
|
|
394
|
+
0x554 /* Last pending message cannot be a batch begin */,
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
this.stateHandler.orderSequentially(() => {
|
|
398
|
+
while (pendingMessagesCount >= 0) {
|
|
399
|
+
// check is >= because batch end may be last pending message
|
|
400
|
+
this.stateHandler.reSubmit(
|
|
401
|
+
pendingMessage.messageType,
|
|
402
|
+
pendingMessage.content,
|
|
403
|
+
pendingMessage.localOpMetadata,
|
|
404
|
+
pendingMessage.opMetadata,
|
|
405
|
+
);
|
|
406
|
+
|
|
407
|
+
if (pendingMessage.opMetadata?.batch === false) {
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
assert(pendingMessagesCount > 0, 0x555 /* No batch end found */);
|
|
411
|
+
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
413
|
+
pendingMessage = this.pendingMessages.shift()!;
|
|
414
|
+
pendingMessagesCount--;
|
|
415
|
+
assert(
|
|
416
|
+
pendingMessage.opMetadata?.batch !== true,
|
|
417
|
+
0x556 /* Batch start needs a corresponding batch end */,
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
} else {
|
|
422
|
+
this.stateHandler.reSubmit(
|
|
423
|
+
pendingMessage.messageType,
|
|
424
|
+
pendingMessage.content,
|
|
425
|
+
pendingMessage.localOpMetadata,
|
|
426
|
+
pendingMessage.opMetadata,
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
385
431
|
}
|