@fluidframework/container-runtime 2.1.0 → 2.1.1

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 (36) hide show
  1. package/container-runtime.test-files.tar +0 -0
  2. package/dist/containerRuntime.d.ts +1 -0
  3. package/dist/containerRuntime.d.ts.map +1 -1
  4. package/dist/containerRuntime.js +40 -34
  5. package/dist/containerRuntime.js.map +1 -1
  6. package/dist/opLifecycle/remoteMessageProcessor.d.ts +7 -7
  7. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  8. package/dist/opLifecycle/remoteMessageProcessor.js +7 -18
  9. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  10. package/dist/packageVersion.d.ts +1 -1
  11. package/dist/packageVersion.js +1 -1
  12. package/dist/packageVersion.js.map +1 -1
  13. package/dist/pendingStateManager.d.ts +2 -12
  14. package/dist/pendingStateManager.d.ts.map +1 -1
  15. package/dist/pendingStateManager.js +0 -12
  16. package/dist/pendingStateManager.js.map +1 -1
  17. package/lib/containerRuntime.d.ts +1 -0
  18. package/lib/containerRuntime.d.ts.map +1 -1
  19. package/lib/containerRuntime.js +40 -34
  20. package/lib/containerRuntime.js.map +1 -1
  21. package/lib/opLifecycle/remoteMessageProcessor.d.ts +7 -7
  22. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  23. package/lib/opLifecycle/remoteMessageProcessor.js +7 -18
  24. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  25. package/lib/packageVersion.d.ts +1 -1
  26. package/lib/packageVersion.js +1 -1
  27. package/lib/packageVersion.js.map +1 -1
  28. package/lib/pendingStateManager.d.ts +2 -12
  29. package/lib/pendingStateManager.d.ts.map +1 -1
  30. package/lib/pendingStateManager.js +0 -12
  31. package/lib/pendingStateManager.js.map +1 -1
  32. package/package.json +19 -32
  33. package/src/containerRuntime.ts +48 -39
  34. package/src/opLifecycle/remoteMessageProcessor.ts +9 -27
  35. package/src/packageVersion.ts +1 -1
  36. package/src/pendingStateManager.ts +2 -21
@@ -675,13 +675,14 @@ export class ContainerRuntime extends TypedEventEmitter {
675
675
  isAttached: () => this.attachState !== AttachState.Detached,
676
676
  }, pendingRuntimeState?.pending, this.logger);
677
677
  let outerDeltaManager;
678
- const useDeltaManagerOpsProxy = this.mc.config.getBoolean("Fluid.ContainerRuntime.DeltaManagerOpsProxy") !== false;
678
+ this.useDeltaManagerOpsProxy =
679
+ this.mc.config.getBoolean("Fluid.ContainerRuntime.DeltaManagerOpsProxy") === true;
679
680
  // The summarizerDeltaManager Proxy is used to lie to the summarizer to convince it is in the right state as a summarizer client.
680
681
  const summarizerDeltaManagerProxy = new DeltaManagerSummarizerProxy(this.innerDeltaManager);
681
682
  outerDeltaManager = summarizerDeltaManagerProxy;
682
683
  // The DeltaManagerPendingOpsProxy is used to control the minimum sequence number
683
684
  // It allows us to lie to the layers below so that they can maintain enough local state for rebasing ops.
684
- if (useDeltaManagerOpsProxy) {
685
+ if (this.useDeltaManagerOpsProxy) {
685
686
  const pendingOpsDeltaManagerProxy = new DeltaManagerPendingOpsProxy(summarizerDeltaManagerProxy, this.pendingStateManager);
686
687
  outerDeltaManager = pendingOpsDeltaManagerProxy;
687
688
  }
@@ -1478,36 +1479,33 @@ export class ContainerRuntime extends TypedEventEmitter {
1478
1479
  const messageCopy = { ...messageArg };
1479
1480
  // We expect runtime messages to have JSON contents - deserialize it in place.
1480
1481
  ensureContentsDeserialized(messageCopy, modernRuntimeMessage, logLegacyCase);
1481
- if (modernRuntimeMessage) {
1482
- const processResult = this.remoteMessageProcessor.process(messageCopy, logLegacyCase);
1483
- if (processResult === undefined) {
1484
- // This means the incoming message is an incomplete part of a message or batch
1485
- // and we need to process more messages before the rest of the system can understand it.
1486
- return;
1487
- }
1488
- const batchStartCsn = processResult.batchStartCsn;
1489
- const batch = processResult.messages;
1490
- const messages = local
1491
- ? this.pendingStateManager.processPendingLocalBatch(batch, batchStartCsn)
1492
- : batch.map((message) => ({ message, localOpMetadata: undefined }));
1493
- messages.forEach(({ message, localOpMetadata }) => {
1494
- const msg = {
1495
- message,
1482
+ const processResult = this.remoteMessageProcessor.process(messageCopy);
1483
+ if (processResult === undefined) {
1484
+ // This means the incoming message is an incomplete part of a message or batch
1485
+ // and we need to process more messages before the rest of the system can understand it.
1486
+ return;
1487
+ }
1488
+ for (const message of processResult.messages) {
1489
+ const msg = modernRuntimeMessage
1490
+ ? {
1491
+ // Cast it since we expect it to be this based on modernRuntimeMessage computation above.
1492
+ // There is nothing really ensuring that anytime original message.type is Operation that
1493
+ // the result messages will be so. In the end modern bool being true only directs to
1494
+ // throw error if ultimately unrecognized without compat details saying otherwise.
1495
+ message: message,
1496
1496
  local,
1497
1497
  modernRuntimeMessage,
1498
- savedOp,
1499
- localOpMetadata,
1500
- };
1501
- this.ensureNoDataModelChanges(() => this.processCore(msg));
1502
- });
1503
- }
1504
- else {
1505
- const msg = {
1506
- message: messageCopy,
1507
- local,
1508
- modernRuntimeMessage,
1509
- savedOp,
1510
- };
1498
+ batchStartCsn: processResult.batchStartCsn,
1499
+ }
1500
+ : // Unrecognized message will be ignored.
1501
+ {
1502
+ message,
1503
+ local,
1504
+ modernRuntimeMessage,
1505
+ batchStartCsn: processResult.batchStartCsn,
1506
+ };
1507
+ msg.savedOp = savedOp;
1508
+ // ensure that we observe any re-entrancy, and if needed, rebase ops
1511
1509
  this.ensureNoDataModelChanges(() => this.processCore(msg));
1512
1510
  }
1513
1511
  }
@@ -1515,11 +1513,12 @@ export class ContainerRuntime extends TypedEventEmitter {
1515
1513
  * Direct the message to the correct subsystem for processing, and implement other side effects
1516
1514
  */
1517
1515
  processCore(messageWithContext) {
1518
- const { message, local, localOpMetadata } = messageWithContext;
1516
+ const { message, local } = messageWithContext;
1519
1517
  // Intercept to reduce minimum sequence number to the delta manager's minimum sequence number.
1520
1518
  // Sequence numbers are not guaranteed to follow any sort of order. Re-entrancy is one of those situations
1521
- if (this.deltaManager.minimumSequenceNumber <
1522
- messageWithContext.message.minimumSequenceNumber) {
1519
+ if (this.useDeltaManagerOpsProxy &&
1520
+ this.deltaManager.minimumSequenceNumber <
1521
+ messageWithContext.message.minimumSequenceNumber) {
1523
1522
  messageWithContext.message.minimumSequenceNumber =
1524
1523
  this.deltaManager.minimumSequenceNumber;
1525
1524
  }
@@ -1529,8 +1528,15 @@ export class ContainerRuntime extends TypedEventEmitter {
1529
1528
  this.scheduleManager.beforeOpProcessing(message);
1530
1529
  this._processedClientSequenceNumber = message.clientSequenceNumber;
1531
1530
  try {
1532
- // RemoteMessageProcessor would have already reconstituted Chunked Ops into the original op type
1531
+ // See commit that added this assert for more details.
1532
+ // These calls should be made for all but chunked ops:
1533
+ // 1) this.pendingStateManager.processPendingLocalMessage() below
1534
+ // 2) this.resetReconnectCount() below
1533
1535
  assert(message.type !== ContainerMessageType.ChunkedOp, 0x93b /* we should never get here with chunked ops */);
1536
+ let localOpMetadata;
1537
+ if (local && messageWithContext.modernRuntimeMessage) {
1538
+ localOpMetadata = this.pendingStateManager.processPendingLocalMessage(messageWithContext.message, messageWithContext.batchStartCsn);
1539
+ }
1534
1540
  // If there are no more pending messages after processing a local message,
1535
1541
  // the document is no longer dirty.
1536
1542
  if (!this.hasPendingMessages()) {