@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.
Files changed (55) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/container-runtime.test-files.tar +0 -0
  3. package/dist/containerRuntime.d.ts +35 -17
  4. package/dist/containerRuntime.d.ts.map +1 -1
  5. package/dist/containerRuntime.js +174 -127
  6. package/dist/containerRuntime.js.map +1 -1
  7. package/dist/opLifecycle/batchManager.d.ts +4 -0
  8. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  9. package/dist/opLifecycle/batchManager.js +7 -0
  10. package/dist/opLifecycle/batchManager.js.map +1 -1
  11. package/dist/opLifecycle/outbox.d.ts +1 -0
  12. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  13. package/dist/opLifecycle/outbox.js +6 -1
  14. package/dist/opLifecycle/outbox.js.map +1 -1
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.d.ts.map +1 -1
  17. package/dist/packageVersion.js +1 -1
  18. package/dist/packageVersion.js.map +1 -1
  19. package/dist/pendingStateManager.d.ts +4 -0
  20. package/dist/pendingStateManager.d.ts.map +1 -1
  21. package/dist/pendingStateManager.js +16 -0
  22. package/dist/pendingStateManager.js.map +1 -1
  23. package/dist/runCounter.d.ts.map +1 -1
  24. package/dist/runCounter.js +1 -1
  25. package/dist/runCounter.js.map +1 -1
  26. package/lib/containerRuntime.d.ts +35 -17
  27. package/lib/containerRuntime.d.ts.map +1 -1
  28. package/lib/containerRuntime.js +174 -128
  29. package/lib/containerRuntime.js.map +1 -1
  30. package/lib/opLifecycle/batchManager.d.ts +4 -0
  31. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  32. package/lib/opLifecycle/batchManager.js +7 -0
  33. package/lib/opLifecycle/batchManager.js.map +1 -1
  34. package/lib/opLifecycle/outbox.d.ts +1 -0
  35. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  36. package/lib/opLifecycle/outbox.js +6 -1
  37. package/lib/opLifecycle/outbox.js.map +1 -1
  38. package/lib/packageVersion.d.ts +1 -1
  39. package/lib/packageVersion.d.ts.map +1 -1
  40. package/lib/packageVersion.js +1 -1
  41. package/lib/packageVersion.js.map +1 -1
  42. package/lib/pendingStateManager.d.ts +4 -0
  43. package/lib/pendingStateManager.d.ts.map +1 -1
  44. package/lib/pendingStateManager.js +16 -0
  45. package/lib/pendingStateManager.js.map +1 -1
  46. package/lib/runCounter.d.ts.map +1 -1
  47. package/lib/runCounter.js +1 -1
  48. package/lib/runCounter.js.map +1 -1
  49. package/package.json +18 -18
  50. package/src/containerRuntime.ts +263 -152
  51. package/src/opLifecycle/batchManager.ts +8 -0
  52. package/src/opLifecycle/outbox.ts +8 -1
  53. package/src/packageVersion.ts +1 -1
  54. package/src/pendingStateManager.ts +17 -0
  55. 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
- "Mismatch in staged state tracking",
450
+ 0xba3 /* Mismatch in staged state tracking */,
444
451
  );
445
452
 
446
453
  const groupingEnabled =
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.41.0-338401";
9
+ export const pkgVersion = "2.41.0";
@@ -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(this.#resubmitInfo === undefined, "Reentrancy not allowed in BatchRunCounter");
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);