@fluidframework/container-runtime 2.41.0-338401 → 2.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/container-runtime.test-files.tar +0 -0
- package/dist/containerRuntime.d.ts +35 -17
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +174 -127
- package/dist/containerRuntime.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +4 -0
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +7 -0
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +1 -0
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +6 -1
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +4 -0
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +16 -0
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runCounter.d.ts.map +1 -1
- package/dist/runCounter.js +1 -1
- package/dist/runCounter.js.map +1 -1
- package/lib/containerRuntime.d.ts +35 -17
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +174 -128
- package/lib/containerRuntime.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +4 -0
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +7 -0
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +1 -0
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +6 -1
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +4 -0
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +16 -0
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runCounter.d.ts.map +1 -1
- package/lib/runCounter.js +1 -1
- package/lib/runCounter.js.map +1 -1
- package/package.json +18 -18
- package/src/containerRuntime.ts +263 -152
- package/src/opLifecycle/batchManager.ts +8 -0
- package/src/opLifecycle/outbox.ts +8 -1
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +17 -0
- package/src/runCounter.ts +4 -1
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "@fluidframework/telemetry-utils/internal";
|
|
12
12
|
|
|
13
13
|
import { ICompressionRuntimeOptions } from "../compressionDefinitions.js";
|
|
14
|
+
import { isContainerMessageDirtyable } from "../containerRuntime.js";
|
|
14
15
|
import { asBatchMetadata, type IBatchMetadata } from "../metadata.js";
|
|
15
16
|
import type { IPendingMessage } from "../pendingStateManager.js";
|
|
16
17
|
|
|
@@ -168,6 +169,13 @@ export class BatchManager {
|
|
|
168
169
|
},
|
|
169
170
|
};
|
|
170
171
|
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Does this batch current contain user changes ("dirtyable" ops)?
|
|
175
|
+
*/
|
|
176
|
+
public containsUserChanges(): boolean {
|
|
177
|
+
return this.pendingBatch.some((message) => isContainerMessageDirtyable(message.runtimeOp));
|
|
178
|
+
}
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
const addBatchMetadata = (batch: LocalBatch, batchId?: BatchId): LocalBatch => {
|
|
@@ -236,6 +236,13 @@ export class Outbox {
|
|
|
236
236
|
return this.messageCount === 0;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
public containsUserChanges(): boolean {
|
|
240
|
+
return (
|
|
241
|
+
this.mainBatch.containsUserChanges() || this.blobAttachBatch.containsUserChanges()
|
|
242
|
+
// ID Allocation ops are not user changes
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
239
246
|
/**
|
|
240
247
|
* Detect whether batching has been interrupted by an incoming message being processed. In this case,
|
|
241
248
|
* we will flush the accumulated messages to account for that (if allowed) and create a new batch with the new
|
|
@@ -440,7 +447,7 @@ export class Outbox {
|
|
|
440
447
|
const staged = rawBatch.staged === true;
|
|
441
448
|
assert(
|
|
442
449
|
resubmitInfo === undefined || resubmitInfo.staged === staged,
|
|
443
|
-
|
|
450
|
+
0xba3 /* Mismatch in staged state tracking */,
|
|
444
451
|
);
|
|
445
452
|
|
|
446
453
|
const groupingEnabled =
|
package/src/packageVersion.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import Deque from "double-ended-queue";
|
|
16
16
|
import { v4 as uuid } from "uuid";
|
|
17
17
|
|
|
18
|
+
import { isContainerMessageDirtyable } from "./containerRuntime.js";
|
|
18
19
|
import {
|
|
19
20
|
type InboundContainerRuntimeMessage,
|
|
20
21
|
type InboundSequencedContainerRuntimeMessage,
|
|
@@ -282,6 +283,22 @@ export class PendingStateManager implements IDisposable {
|
|
|
282
283
|
return this.pendingMessages.length + this.initialMessages.length;
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Checks the pending messages to see if any of them represent user changes (aka "dirtyable" messages)
|
|
288
|
+
*/
|
|
289
|
+
public hasPendingUserChanges(): boolean {
|
|
290
|
+
for (let i = 0; i < this.pendingMessages.length; i++) {
|
|
291
|
+
const element = this.pendingMessages.get(i);
|
|
292
|
+
// Missing runtimeOp implies not dirtyable: This only happens for empty batches
|
|
293
|
+
if (element?.runtimeOp !== undefined && isContainerMessageDirtyable(element.runtimeOp)) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Consider any initial messages to be user changes
|
|
298
|
+
// (it's an approximation since we would have to parse them to know for sure)
|
|
299
|
+
return this.initialMessages.length > 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
285
302
|
/**
|
|
286
303
|
* The minimumPendingMessageSequenceNumber is the minimum of the first pending message and the first initial message.
|
|
287
304
|
*
|
package/src/runCounter.ts
CHANGED
|
@@ -45,7 +45,10 @@ export class BatchRunCounter extends RunCounter {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
public run<T>(act: () => T, resubmitInfo?: BatchResubmitInfo): T {
|
|
48
|
-
assert(
|
|
48
|
+
assert(
|
|
49
|
+
this.#resubmitInfo === undefined,
|
|
50
|
+
0xba2 /* Reentrancy not allowed in BatchRunCounter */,
|
|
51
|
+
);
|
|
49
52
|
this.#resubmitInfo = resubmitInfo;
|
|
50
53
|
try {
|
|
51
54
|
return super.run(act);
|