@fluidframework/container-runtime 2.43.0-343119 → 2.50.0-345060

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 (94) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/container-runtime.test-files.tar +0 -0
  3. package/dist/channelCollection.d.ts +1 -1
  4. package/dist/channelCollection.d.ts.map +1 -1
  5. package/dist/channelCollection.js +3 -1
  6. package/dist/channelCollection.js.map +1 -1
  7. package/dist/containerRuntime.d.ts +1 -1
  8. package/dist/containerRuntime.d.ts.map +1 -1
  9. package/dist/containerRuntime.js +18 -17
  10. package/dist/containerRuntime.js.map +1 -1
  11. package/dist/dataStoreContext.d.ts +0 -2
  12. package/dist/dataStoreContext.d.ts.map +1 -1
  13. package/dist/dataStoreContext.js.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +7 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/opLifecycle/batchManager.d.ts +1 -0
  19. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  20. package/dist/opLifecycle/batchManager.js +3 -2
  21. package/dist/opLifecycle/batchManager.js.map +1 -1
  22. package/dist/opLifecycle/index.d.ts +1 -1
  23. package/dist/opLifecycle/index.d.ts.map +1 -1
  24. package/dist/opLifecycle/index.js +2 -1
  25. package/dist/opLifecycle/index.js.map +1 -1
  26. package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
  27. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  28. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  29. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  30. package/dist/opLifecycle/outbox.js +2 -5
  31. package/dist/opLifecycle/outbox.js.map +1 -1
  32. package/dist/packageVersion.d.ts +1 -1
  33. package/dist/packageVersion.js +1 -1
  34. package/dist/packageVersion.js.map +1 -1
  35. package/dist/pendingStateManager.d.ts +7 -6
  36. package/dist/pendingStateManager.d.ts.map +1 -1
  37. package/dist/pendingStateManager.js +20 -15
  38. package/dist/pendingStateManager.js.map +1 -1
  39. package/dist/runtimeLayerCompatState.d.ts +3 -3
  40. package/dist/runtimeLayerCompatState.d.ts.map +1 -1
  41. package/dist/runtimeLayerCompatState.js +10 -10
  42. package/dist/runtimeLayerCompatState.js.map +1 -1
  43. package/lib/channelCollection.d.ts +1 -1
  44. package/lib/channelCollection.d.ts.map +1 -1
  45. package/lib/channelCollection.js +3 -1
  46. package/lib/channelCollection.js.map +1 -1
  47. package/lib/containerRuntime.d.ts +1 -1
  48. package/lib/containerRuntime.d.ts.map +1 -1
  49. package/lib/containerRuntime.js +18 -17
  50. package/lib/containerRuntime.js.map +1 -1
  51. package/lib/dataStoreContext.d.ts +0 -2
  52. package/lib/dataStoreContext.d.ts.map +1 -1
  53. package/lib/dataStoreContext.js.map +1 -1
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/index.js +1 -0
  57. package/lib/index.js.map +1 -1
  58. package/lib/opLifecycle/batchManager.d.ts +1 -0
  59. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  60. package/lib/opLifecycle/batchManager.js +1 -1
  61. package/lib/opLifecycle/batchManager.js.map +1 -1
  62. package/lib/opLifecycle/index.d.ts +1 -1
  63. package/lib/opLifecycle/index.d.ts.map +1 -1
  64. package/lib/opLifecycle/index.js +1 -1
  65. package/lib/opLifecycle/index.js.map +1 -1
  66. package/lib/opLifecycle/opGroupingManager.d.ts +1 -1
  67. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  68. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  69. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  70. package/lib/opLifecycle/outbox.js +2 -5
  71. package/lib/opLifecycle/outbox.js.map +1 -1
  72. package/lib/packageVersion.d.ts +1 -1
  73. package/lib/packageVersion.js +1 -1
  74. package/lib/packageVersion.js.map +1 -1
  75. package/lib/pendingStateManager.d.ts +7 -6
  76. package/lib/pendingStateManager.d.ts.map +1 -1
  77. package/lib/pendingStateManager.js +20 -15
  78. package/lib/pendingStateManager.js.map +1 -1
  79. package/lib/runtimeLayerCompatState.d.ts +3 -3
  80. package/lib/runtimeLayerCompatState.d.ts.map +1 -1
  81. package/lib/runtimeLayerCompatState.js +9 -9
  82. package/lib/runtimeLayerCompatState.js.map +1 -1
  83. package/package.json +20 -20
  84. package/src/channelCollection.ts +3 -1
  85. package/src/containerRuntime.ts +24 -28
  86. package/src/dataStoreContext.ts +0 -2
  87. package/src/index.ts +7 -0
  88. package/src/opLifecycle/batchManager.ts +1 -1
  89. package/src/opLifecycle/index.ts +1 -0
  90. package/src/opLifecycle/opGroupingManager.ts +1 -1
  91. package/src/opLifecycle/outbox.ts +2 -5
  92. package/src/packageVersion.ts +1 -1
  93. package/src/pendingStateManager.ts +30 -22
  94. package/src/runtimeLayerCompatState.ts +10 -10
@@ -448,11 +448,11 @@ export class ContainerRuntime extends TypedEventEmitter {
448
448
  runtime.setConnectionStateCore(true, runtime.delayConnectClientId);
449
449
  }
450
450
  }, (error) => runtime.closeFn(error));
451
+ // Initialize the base state of the runtime before it's returned.
452
+ await runtime.initializeBaseState(context.loader);
451
453
  // Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,
452
454
  // or zero. This must be done before Container replays saved ops.
453
455
  await runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);
454
- // Initialize the base state of the runtime before it's returned.
455
- await runtime.initializeBaseState(context.loader);
456
456
  return runtime;
457
457
  }
458
458
  get clientId() {
@@ -621,15 +621,15 @@ export class ContainerRuntime extends TypedEventEmitter {
621
621
  // eslint-disable-next-line import/no-deprecated
622
622
  this.enterStagingMode = () => {
623
623
  if (this.stageControls !== undefined) {
624
- throw new UsageError("already in staging mode");
624
+ throw new UsageError("Already in staging mode");
625
625
  }
626
626
  if (this.attachState === AttachState.Detached) {
627
- throw new UsageError("cannot enter staging mode while detached");
627
+ throw new UsageError("Cannot enter staging mode while Detached");
628
628
  }
629
629
  // Make sure Outbox is empty before entering staging mode,
630
630
  // since we mark whole batches as "staged" or not to indicate whether to submit them.
631
631
  this.flush();
632
- const exitStagingMode = (discardOrCommit) => () => {
632
+ const exitStagingMode = (discardOrCommit) => {
633
633
  try {
634
634
  // Final flush of any last staged changes
635
635
  // NOTE: We can't use this.flush() here, because orderSequentially uses StagingMode and in the rollback case we'll hit assert 0x24c
@@ -649,22 +649,23 @@ export class ContainerRuntime extends TypedEventEmitter {
649
649
  };
650
650
  // eslint-disable-next-line import/no-deprecated
651
651
  const stageControls = {
652
- discardChanges: exitStagingMode(() => {
652
+ discardChanges: () => exitStagingMode(() => {
653
653
  // Pop all staged batches from the PSM and roll them back in LIFO order
654
654
  this.pendingStateManager.popStagedBatches(({ runtimeOp, localOpMetadata }) => {
655
- assert(runtimeOp !== undefined, 0xb82 /* Staged batches expected to have runtimeOp defined */);
656
- this.rollbackStagedChanges(runtimeOp, localOpMetadata);
655
+ this.rollbackStagedChange(runtimeOp, localOpMetadata);
657
656
  });
658
657
  this.updateDocumentDirtyState();
659
658
  }),
660
- commitChanges: (optionsParam) => {
661
- const options = { ...defaultStagingCommitOptions, ...optionsParam };
662
- return exitStagingMode(() => {
659
+ commitChanges: (options) => {
660
+ const { squash } = { ...defaultStagingCommitOptions, ...options };
661
+ exitStagingMode(() => {
662
+ // Replay all staged batches in typical FIFO order.
663
+ // We'll be out of staging mode so they'll be sent to the service finally.
663
664
  this.pendingStateManager.replayPendingStates({
664
- onlyStagedBatches: true,
665
- squash: options.squash ?? false,
665
+ committingStagedBatches: true,
666
+ squash,
666
667
  });
667
- })();
668
+ });
668
669
  },
669
670
  };
670
671
  this.stageControls = stageControls;
@@ -1109,7 +1110,6 @@ export class ContainerRuntime extends TypedEventEmitter {
1109
1110
  * Initializes the state from the base snapshot this container runtime loaded from.
1110
1111
  */
1111
1112
  async initializeBaseState(loader) {
1112
- await this.initializeSummarizer(loader);
1113
1113
  if (this.sessionSchema.idCompressorMode === "on" ||
1114
1114
  (this.sessionSchema.idCompressorMode === "delayed" && this.connected)) {
1115
1115
  PerformanceEvent.timedExec(this.mc.logger, { eventName: "CreateIdCompressorOnBoot" }, (event) => {
@@ -1123,6 +1123,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1123
1123
  // This is called from loadRuntime(), long before we process any ops, so there should be no ops accumulated yet.
1124
1124
  assert(this.pendingIdCompressorOps.length === 0, 0x8ec /* no pending ops */);
1125
1125
  }
1126
+ await this.initializeSummarizer(loader);
1126
1127
  await this.garbageCollector.initializeBaseState();
1127
1128
  }
1128
1129
  async initializeSummarizer(loader) {
@@ -2076,7 +2077,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2076
2077
  try {
2077
2078
  checkpoint.rollback((message) =>
2078
2079
  // These changes are staged since we entered staging mode above
2079
- this.rollbackStagedChanges(message.runtimeOp, message.localOpMetadata));
2080
+ this.rollbackStagedChange(message.runtimeOp, message.localOpMetadata));
2080
2081
  this.updateDocumentDirtyState();
2081
2082
  stageControls?.discardChanges();
2082
2083
  stageControls = undefined;
@@ -3055,7 +3056,7 @@ export class ContainerRuntime extends TypedEventEmitter {
3055
3056
  /**
3056
3057
  * Rollback the given op which was only staged but not yet submitted.
3057
3058
  */
3058
- rollbackStagedChanges({ type, contents }, localOpMetadata) {
3059
+ rollbackStagedChange({ type, contents }, localOpMetadata) {
3059
3060
  assert(canStageMessageOfType(type), 0xbbc /* Unexpected message type to be rolled back */);
3060
3061
  switch (type) {
3061
3062
  case ContainerMessageType.FluidDataStoreOp: {