@fluidframework/container-runtime 2.1.0-276326 → 2.1.0-276985

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 (107) hide show
  1. package/README.md +5 -5
  2. package/container-runtime.test-files.tar +0 -0
  3. package/dist/{blobManager.d.ts → blobManager/blobManager.d.ts} +9 -29
  4. package/dist/blobManager/blobManager.d.ts.map +1 -0
  5. package/dist/{blobManager.js → blobManager/blobManager.js} +23 -83
  6. package/dist/blobManager/blobManager.js.map +1 -0
  7. package/dist/blobManager/blobManagerSnapSum.d.ts +30 -0
  8. package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -0
  9. package/dist/blobManager/blobManagerSnapSum.js +82 -0
  10. package/dist/blobManager/blobManagerSnapSum.js.map +1 -0
  11. package/dist/blobManager/index.d.ts +7 -0
  12. package/dist/blobManager/index.d.ts.map +1 -0
  13. package/dist/blobManager/index.js +16 -0
  14. package/dist/blobManager/index.js.map +1 -0
  15. package/dist/containerRuntime.d.ts +1 -5
  16. package/dist/containerRuntime.d.ts.map +1 -1
  17. package/dist/containerRuntime.js +68 -75
  18. package/dist/containerRuntime.js.map +1 -1
  19. package/dist/dataStoreContext.d.ts +1 -0
  20. package/dist/dataStoreContext.d.ts.map +1 -1
  21. package/dist/dataStoreContext.js +7 -2
  22. package/dist/dataStoreContext.js.map +1 -1
  23. package/dist/gc/garbageCollection.js +2 -2
  24. package/dist/gc/garbageCollection.js.map +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/opLifecycle/remoteMessageProcessor.d.ts +17 -1
  29. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  30. package/dist/opLifecycle/remoteMessageProcessor.js +43 -5
  31. package/dist/opLifecycle/remoteMessageProcessor.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 +3 -1
  36. package/dist/pendingStateManager.d.ts.map +1 -1
  37. package/dist/pendingStateManager.js +16 -1
  38. package/dist/pendingStateManager.js.map +1 -1
  39. package/dist/summary/index.d.ts +1 -1
  40. package/dist/summary/index.d.ts.map +1 -1
  41. package/dist/summary/index.js +1 -2
  42. package/dist/summary/index.js.map +1 -1
  43. package/dist/summary/summaryFormat.d.ts +0 -1
  44. package/dist/summary/summaryFormat.d.ts.map +1 -1
  45. package/dist/summary/summaryFormat.js +3 -3
  46. package/dist/summary/summaryFormat.js.map +1 -1
  47. package/lib/{blobManager.d.ts → blobManager/blobManager.d.ts} +9 -29
  48. package/lib/blobManager/blobManager.d.ts.map +1 -0
  49. package/lib/{blobManager.js → blobManager/blobManager.js} +21 -83
  50. package/lib/blobManager/blobManager.js.map +1 -0
  51. package/lib/blobManager/blobManagerSnapSum.d.ts +30 -0
  52. package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -0
  53. package/lib/blobManager/blobManagerSnapSum.js +75 -0
  54. package/lib/blobManager/blobManagerSnapSum.js.map +1 -0
  55. package/lib/blobManager/index.d.ts +7 -0
  56. package/lib/blobManager/index.d.ts.map +1 -0
  57. package/lib/blobManager/index.js +7 -0
  58. package/lib/blobManager/index.js.map +1 -0
  59. package/lib/containerRuntime.d.ts +1 -5
  60. package/lib/containerRuntime.d.ts.map +1 -1
  61. package/lib/containerRuntime.js +17 -24
  62. package/lib/containerRuntime.js.map +1 -1
  63. package/lib/dataStoreContext.d.ts +1 -0
  64. package/lib/dataStoreContext.d.ts.map +1 -1
  65. package/lib/dataStoreContext.js +7 -2
  66. package/lib/dataStoreContext.js.map +1 -1
  67. package/lib/gc/garbageCollection.js +2 -2
  68. package/lib/gc/garbageCollection.js.map +1 -1
  69. package/lib/index.d.ts +1 -1
  70. package/lib/index.d.ts.map +1 -1
  71. package/lib/index.js.map +1 -1
  72. package/lib/opLifecycle/remoteMessageProcessor.d.ts +17 -1
  73. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  74. package/lib/opLifecycle/remoteMessageProcessor.js +41 -3
  75. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  76. package/lib/packageVersion.d.ts +1 -1
  77. package/lib/packageVersion.js +1 -1
  78. package/lib/packageVersion.js.map +1 -1
  79. package/lib/pendingStateManager.d.ts +3 -1
  80. package/lib/pendingStateManager.d.ts.map +1 -1
  81. package/lib/pendingStateManager.js +17 -2
  82. package/lib/pendingStateManager.js.map +1 -1
  83. package/lib/summary/index.d.ts +1 -1
  84. package/lib/summary/index.d.ts.map +1 -1
  85. package/lib/summary/index.js +1 -1
  86. package/lib/summary/index.js.map +1 -1
  87. package/lib/summary/summaryFormat.d.ts +0 -1
  88. package/lib/summary/summaryFormat.d.ts.map +1 -1
  89. package/lib/summary/summaryFormat.js +1 -1
  90. package/lib/summary/summaryFormat.js.map +1 -1
  91. package/package.json +21 -21
  92. package/src/{blobManager.ts → blobManager/blobManager.ts} +38 -123
  93. package/src/blobManager/blobManagerSnapSum.ts +133 -0
  94. package/src/blobManager/index.ts +19 -0
  95. package/src/containerRuntime.ts +34 -37
  96. package/src/dataStoreContext.ts +8 -2
  97. package/src/gc/garbageCollection.ts +2 -2
  98. package/src/index.ts +1 -1
  99. package/src/opLifecycle/remoteMessageProcessor.ts +63 -6
  100. package/src/packageVersion.ts +1 -1
  101. package/src/pendingStateManager.ts +18 -0
  102. package/src/summary/index.ts +0 -1
  103. package/src/summary/summaryFormat.ts +1 -1
  104. package/dist/blobManager.d.ts.map +0 -1
  105. package/dist/blobManager.js.map +0 -1
  106. package/lib/blobManager.d.ts.map +0 -1
  107. package/lib/blobManager.js.map +0 -1
@@ -16,7 +16,7 @@ import { DataCorruptionError, DataProcessingError, GenericError, LoggingError, P
16
16
  TaggedLoggerAdapter, UsageError, createChildLogger, createChildMonitoringContext, createSampledLogger, loggerToMonitoringContext, raiseConnectedEvent, wrapError, tagCodeArtifacts, } from "@fluidframework/telemetry-utils/internal";
17
17
  import { v4 as uuid } from "uuid";
18
18
  import { BindBatchTracker } from "./batchTracker.js";
19
- import { BlobManager } from "./blobManager.js";
19
+ import { BlobManager, blobManagerBasePath, blobsTreeName, isBlobPath, loadBlobManagerLoadInfo, } from "./blobManager/index.js";
20
20
  import { ChannelCollection, getSummaryForDatastores, wrapContext, } from "./channelCollection.js";
21
21
  import { ReportOpPerfTelemetry } from "./connectionTelemetry.js";
22
22
  import { ContainerFluidHandleContext } from "./containerHandleContext.js";
@@ -29,7 +29,7 @@ import { OpCompressor, OpDecompressor, OpGroupingManager, OpSplitter, Outbox, Re
29
29
  import { pkgVersion } from "./packageVersion.js";
30
30
  import { PendingStateManager, } from "./pendingStateManager.js";
31
31
  import { ScheduleManager } from "./scheduleManager.js";
32
- import { DocumentsSchemaController, OrderedClientCollection, OrderedClientElection, RetriableSummaryError, RunWhileConnectedCoordinator, Summarizer, SummarizerClientElection, SummaryCollection, SummaryManager, aliasBlobName, blobsTreeName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, rootHasIsolatedChannels, summarizerClientType, wrapSummaryInChannelsTree, } from "./summary/index.js";
32
+ import { DocumentsSchemaController, OrderedClientCollection, OrderedClientElection, RetriableSummaryError, RunWhileConnectedCoordinator, Summarizer, SummarizerClientElection, SummaryCollection, SummaryManager, aliasBlobName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, rootHasIsolatedChannels, summarizerClientType, wrapSummaryInChannelsTree, } from "./summary/index.js";
33
33
  import { Throttler, formExponentialFn } from "./throttler.js";
34
34
  /**
35
35
  * Utility to implement compat behaviors given an unknown message type
@@ -277,12 +277,7 @@ export class ContainerRuntime extends TypedEventEmitter {
277
277
  tryFetchBlob(idCompressorBlobName),
278
278
  ]);
279
279
  // read snapshot blobs needed for BlobManager to load
280
- const blobManagerSnapshot = await BlobManager.load(context.baseSnapshot?.trees[blobsTreeName], async (id) => {
281
- // IContainerContext storage api return type still has undefined in 0.39 package version.
282
- // So once we release 0.40 container-defn package we can remove this check.
283
- assert(context.storage !== undefined, 0x256 /* "storage undefined in attached container" */);
284
- return readAndParse(context.storage, id);
285
- });
280
+ const blobManagerSnapshot = await loadBlobManagerLoadInfo(context);
286
281
  const messageAtLastSummary = lastMessageFromMetadata(metadata);
287
282
  // Verify summary runtime sequence number matches protocol sequence number.
288
283
  const runtimeSequenceNumber = messageAtLastSummary?.sequenceNumber;
@@ -1162,7 +1157,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1162
1157
  // eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures
1163
1158
  return this.resolveHandle(requestParser.createSubRequest(1));
1164
1159
  }
1165
- if (id === BlobManager.basePath && requestParser.isLeaf(2)) {
1160
+ if (id === blobManagerBasePath && requestParser.isLeaf(2)) {
1166
1161
  const blob = await this.blobManager.getBlob(requestParser.pathParts[1]);
1167
1162
  return blob
1168
1163
  ? {
@@ -1476,7 +1471,13 @@ export class ContainerRuntime extends TypedEventEmitter {
1476
1471
  // but will not modify the contents object (likely it will replace it on the message).
1477
1472
  const messageCopy = { ...messageArg };
1478
1473
  const savedOp = messageCopy.metadata?.savedOp;
1479
- for (const message of this.remoteMessageProcessor.process(messageCopy)) {
1474
+ const processResult = this.remoteMessageProcessor.process(messageCopy);
1475
+ if (processResult === undefined) {
1476
+ // This means the incoming message is an incomplete part of a message or batch
1477
+ // and we need to process more messages before the rest of the system can understand it.
1478
+ return;
1479
+ }
1480
+ for (const message of processResult.messages) {
1480
1481
  const msg = modernRuntimeMessage
1481
1482
  ? {
1482
1483
  // Cast it since we expect it to be this based on modernRuntimeMessage computation above.
@@ -1486,12 +1487,14 @@ export class ContainerRuntime extends TypedEventEmitter {
1486
1487
  message: message,
1487
1488
  local,
1488
1489
  modernRuntimeMessage,
1490
+ batchStartCsn: processResult.batchStartCsn,
1489
1491
  }
1490
1492
  : // Unrecognized message will be ignored.
1491
1493
  {
1492
1494
  message,
1493
1495
  local,
1494
1496
  modernRuntimeMessage,
1497
+ batchStartCsn: processResult.batchStartCsn,
1495
1498
  };
1496
1499
  msg.savedOp = savedOp;
1497
1500
  // ensure that we observe any re-entrancy, and if needed, rebase ops
@@ -1523,7 +1526,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1523
1526
  assert(message.type !== ContainerMessageType.ChunkedOp, 0x93b /* we should never get here with chunked ops */);
1524
1527
  let localOpMetadata;
1525
1528
  if (local && messageWithContext.modernRuntimeMessage) {
1526
- localOpMetadata = this.pendingStateManager.processPendingLocalMessage(messageWithContext.message);
1529
+ localOpMetadata = this.pendingStateManager.processPendingLocalMessage(messageWithContext.message, messageWithContext.batchStartCsn);
1527
1530
  }
1528
1531
  // If there are no more pending messages after processing a local message,
1529
1532
  // the document is no longer dirty.
@@ -2007,7 +2010,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2007
2010
  * blob manager.
2008
2011
  */
2009
2012
  getNodeType(nodePath) {
2010
- if (this.isBlobPath(nodePath)) {
2013
+ if (isBlobPath(nodePath)) {
2011
2014
  return GCNodeType.Blob;
2012
2015
  }
2013
2016
  return this.channelCollection.getGCNodeType(nodePath) ?? GCNodeType.Other;
@@ -2024,7 +2027,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2024
2027
  }
2025
2028
  switch (this.getNodeType(nodePath)) {
2026
2029
  case GCNodeType.Blob:
2027
- return [BlobManager.basePath];
2030
+ return [blobManagerBasePath];
2028
2031
  case GCNodeType.DataStore:
2029
2032
  case GCNodeType.SubDataStore:
2030
2033
  return this.channelCollection.getDataStorePackagePath(nodePath);
@@ -2032,16 +2035,6 @@ export class ContainerRuntime extends TypedEventEmitter {
2032
2035
  assert(false, 0x2de /* "Package path requested for unsupported node type." */);
2033
2036
  }
2034
2037
  }
2035
- /**
2036
- * Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
2037
- */
2038
- isBlobPath(path) {
2039
- const pathParts = path.split("/");
2040
- if (pathParts.length < 2 || pathParts[1] !== BlobManager.basePath) {
2041
- return false;
2042
- }
2043
- return true;
2044
- }
2045
2038
  /**
2046
2039
  * From a given list of routes, separate and return routes that belong to blob manager and data stores.
2047
2040
  * @param routes - A list of routes that can belong to data stores or blob manager.
@@ -2052,7 +2045,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2052
2045
  const blobManagerRoutes = [];
2053
2046
  const dataStoreRoutes = [];
2054
2047
  for (const route of routes) {
2055
- if (this.isBlobPath(route)) {
2048
+ if (isBlobPath(route)) {
2056
2049
  blobManagerRoutes.push(route);
2057
2050
  }
2058
2051
  else {