@fluidframework/container-runtime 2.1.0-276985 → 2.1.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 (199) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +71 -18
  3. package/api-extractor/api-extractor.current.json +5 -0
  4. package/api-extractor/api-extractor.legacy.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/container-runtime.legacy.public.api.md +9 -0
  7. package/container-runtime.test-files.tar +0 -0
  8. package/dist/blobManager/blobManager.d.ts +10 -0
  9. package/dist/blobManager/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager/blobManager.js +19 -0
  11. package/dist/blobManager/blobManager.js.map +1 -1
  12. package/dist/channelCollection.d.ts +1 -1
  13. package/dist/channelCollection.d.ts.map +1 -1
  14. package/dist/channelCollection.js +40 -8
  15. package/dist/channelCollection.js.map +1 -1
  16. package/dist/containerRuntime.d.ts +14 -5
  17. package/dist/containerRuntime.d.ts.map +1 -1
  18. package/dist/containerRuntime.js +151 -99
  19. package/dist/containerRuntime.js.map +1 -1
  20. package/dist/dataStoreContext.d.ts +4 -0
  21. package/dist/dataStoreContext.d.ts.map +1 -1
  22. package/dist/dataStoreContext.js +9 -3
  23. package/dist/dataStoreContext.js.map +1 -1
  24. package/dist/gc/garbageCollection.d.ts +1 -1
  25. package/dist/gc/garbageCollection.d.ts.map +1 -1
  26. package/dist/gc/garbageCollection.js +14 -8
  27. package/dist/gc/garbageCollection.js.map +1 -1
  28. package/dist/gc/gcDefinitions.d.ts +4 -2
  29. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  30. package/dist/gc/gcDefinitions.js.map +1 -1
  31. package/dist/gc/gcHelpers.d.ts.map +1 -1
  32. package/dist/gc/gcHelpers.js +12 -0
  33. package/dist/gc/gcHelpers.js.map +1 -1
  34. package/dist/gc/gcTelemetry.d.ts +3 -2
  35. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  36. package/dist/gc/gcTelemetry.js +6 -6
  37. package/dist/gc/gcTelemetry.js.map +1 -1
  38. package/dist/legacy.d.ts +1 -1
  39. package/dist/metadata.d.ts +7 -1
  40. package/dist/metadata.d.ts.map +1 -1
  41. package/dist/metadata.js +6 -0
  42. package/dist/metadata.js.map +1 -1
  43. package/dist/opLifecycle/batchManager.d.ts +8 -1
  44. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  45. package/dist/opLifecycle/batchManager.js +37 -16
  46. package/dist/opLifecycle/batchManager.js.map +1 -1
  47. package/dist/opLifecycle/definitions.d.ts +1 -1
  48. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  49. package/dist/opLifecycle/definitions.js.map +1 -1
  50. package/dist/opLifecycle/index.d.ts +2 -2
  51. package/dist/opLifecycle/index.d.ts.map +1 -1
  52. package/dist/opLifecycle/index.js +3 -1
  53. package/dist/opLifecycle/index.js.map +1 -1
  54. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  55. package/dist/opLifecycle/opCompressor.js +12 -8
  56. package/dist/opLifecycle/opCompressor.js.map +1 -1
  57. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  58. package/dist/opLifecycle/opGroupingManager.js +14 -11
  59. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  60. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  61. package/dist/opLifecycle/opSplitter.js +11 -6
  62. package/dist/opLifecycle/opSplitter.js.map +1 -1
  63. package/dist/opLifecycle/outbox.d.ts +22 -6
  64. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  65. package/dist/opLifecycle/outbox.js +43 -21
  66. package/dist/opLifecycle/outbox.js.map +1 -1
  67. package/dist/opLifecycle/remoteMessageProcessor.d.ts +10 -8
  68. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  69. package/dist/opLifecycle/remoteMessageProcessor.js +39 -15
  70. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  71. package/dist/packageVersion.d.ts +1 -1
  72. package/dist/packageVersion.d.ts.map +1 -1
  73. package/dist/packageVersion.js +1 -1
  74. package/dist/packageVersion.js.map +1 -1
  75. package/dist/pendingStateManager.d.ts +37 -13
  76. package/dist/pendingStateManager.d.ts.map +1 -1
  77. package/dist/pendingStateManager.js +95 -45
  78. package/dist/pendingStateManager.js.map +1 -1
  79. package/dist/public.d.ts +1 -1
  80. package/dist/scheduleManager.js +4 -0
  81. package/dist/scheduleManager.js.map +1 -1
  82. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  83. package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  84. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  85. package/dist/summary/summaryFormat.d.ts.map +1 -1
  86. package/dist/summary/summaryFormat.js +4 -1
  87. package/dist/summary/summaryFormat.js.map +1 -1
  88. package/internal.d.ts +1 -1
  89. package/legacy.d.ts +1 -1
  90. package/lib/blobManager/blobManager.d.ts +10 -0
  91. package/lib/blobManager/blobManager.d.ts.map +1 -1
  92. package/lib/blobManager/blobManager.js +19 -0
  93. package/lib/blobManager/blobManager.js.map +1 -1
  94. package/lib/channelCollection.d.ts +1 -1
  95. package/lib/channelCollection.d.ts.map +1 -1
  96. package/lib/channelCollection.js +40 -8
  97. package/lib/channelCollection.js.map +1 -1
  98. package/lib/containerRuntime.d.ts +14 -5
  99. package/lib/containerRuntime.d.ts.map +1 -1
  100. package/lib/containerRuntime.js +152 -100
  101. package/lib/containerRuntime.js.map +1 -1
  102. package/lib/dataStoreContext.d.ts +4 -0
  103. package/lib/dataStoreContext.d.ts.map +1 -1
  104. package/lib/dataStoreContext.js +10 -4
  105. package/lib/dataStoreContext.js.map +1 -1
  106. package/lib/gc/garbageCollection.d.ts +1 -1
  107. package/lib/gc/garbageCollection.d.ts.map +1 -1
  108. package/lib/gc/garbageCollection.js +14 -8
  109. package/lib/gc/garbageCollection.js.map +1 -1
  110. package/lib/gc/gcDefinitions.d.ts +4 -2
  111. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  112. package/lib/gc/gcDefinitions.js.map +1 -1
  113. package/lib/gc/gcHelpers.d.ts.map +1 -1
  114. package/lib/gc/gcHelpers.js +12 -0
  115. package/lib/gc/gcHelpers.js.map +1 -1
  116. package/lib/gc/gcTelemetry.d.ts +3 -2
  117. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  118. package/lib/gc/gcTelemetry.js +6 -6
  119. package/lib/gc/gcTelemetry.js.map +1 -1
  120. package/lib/legacy.d.ts +1 -1
  121. package/lib/metadata.d.ts +7 -1
  122. package/lib/metadata.d.ts.map +1 -1
  123. package/lib/metadata.js +4 -1
  124. package/lib/metadata.js.map +1 -1
  125. package/lib/opLifecycle/batchManager.d.ts +8 -1
  126. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  127. package/lib/opLifecycle/batchManager.js +35 -15
  128. package/lib/opLifecycle/batchManager.js.map +1 -1
  129. package/lib/opLifecycle/definitions.d.ts +1 -1
  130. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  131. package/lib/opLifecycle/definitions.js.map +1 -1
  132. package/lib/opLifecycle/index.d.ts +2 -2
  133. package/lib/opLifecycle/index.d.ts.map +1 -1
  134. package/lib/opLifecycle/index.js +2 -2
  135. package/lib/opLifecycle/index.js.map +1 -1
  136. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  137. package/lib/opLifecycle/opCompressor.js +12 -8
  138. package/lib/opLifecycle/opCompressor.js.map +1 -1
  139. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  140. package/lib/opLifecycle/opGroupingManager.js +14 -11
  141. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  142. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  143. package/lib/opLifecycle/opSplitter.js +11 -6
  144. package/lib/opLifecycle/opSplitter.js.map +1 -1
  145. package/lib/opLifecycle/outbox.d.ts +22 -6
  146. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  147. package/lib/opLifecycle/outbox.js +44 -22
  148. package/lib/opLifecycle/outbox.js.map +1 -1
  149. package/lib/opLifecycle/remoteMessageProcessor.d.ts +10 -8
  150. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  151. package/lib/opLifecycle/remoteMessageProcessor.js +37 -14
  152. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  153. package/lib/packageVersion.d.ts +1 -1
  154. package/lib/packageVersion.d.ts.map +1 -1
  155. package/lib/packageVersion.js +1 -1
  156. package/lib/packageVersion.js.map +1 -1
  157. package/lib/pendingStateManager.d.ts +37 -13
  158. package/lib/pendingStateManager.d.ts.map +1 -1
  159. package/lib/pendingStateManager.js +95 -45
  160. package/lib/pendingStateManager.js.map +1 -1
  161. package/lib/public.d.ts +1 -1
  162. package/lib/scheduleManager.js +4 -0
  163. package/lib/scheduleManager.js.map +1 -1
  164. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  165. package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  166. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  167. package/lib/summary/summaryFormat.d.ts.map +1 -1
  168. package/lib/summary/summaryFormat.js +4 -1
  169. package/lib/summary/summaryFormat.js.map +1 -1
  170. package/package.json +46 -31
  171. package/src/blobManager/blobManager.ts +19 -0
  172. package/src/channelCollection.ts +48 -11
  173. package/src/containerRuntime.ts +203 -133
  174. package/src/dataStoreContext.ts +22 -4
  175. package/src/gc/garbageCollection.ts +15 -10
  176. package/src/gc/gcDefinitions.ts +7 -2
  177. package/src/gc/gcHelpers.ts +18 -6
  178. package/src/gc/gcTelemetry.ts +20 -8
  179. package/src/metadata.ts +11 -1
  180. package/src/opLifecycle/README.md +0 -8
  181. package/src/opLifecycle/batchManager.ts +49 -16
  182. package/src/opLifecycle/definitions.ts +1 -1
  183. package/src/opLifecycle/index.ts +13 -2
  184. package/src/opLifecycle/opCompressor.ts +12 -8
  185. package/src/opLifecycle/opGroupingManager.ts +14 -11
  186. package/src/opLifecycle/opSplitter.ts +10 -6
  187. package/src/opLifecycle/outbox.ts +64 -26
  188. package/src/opLifecycle/remoteMessageProcessor.ts +56 -17
  189. package/src/packageVersion.ts +1 -1
  190. package/src/pendingStateManager.ts +173 -74
  191. package/src/scheduleManager.ts +6 -2
  192. package/src/summary/README.md +81 -0
  193. package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -1
  194. package/src/summary/summaryFormat.ts +3 -1
  195. package/src/summary/summaryFormats.md +69 -8
  196. package/tsconfig.json +0 -1
  197. package/src/summary/images/appTree.png +0 -0
  198. package/src/summary/images/protocolAndAppTree.png +0 -0
  199. package/src/summary/images/summaryTree.png +0 -0
@@ -69,6 +69,7 @@ import {
69
69
  createChildMonitoringContext,
70
70
  extractSafePropertiesFromMessage,
71
71
  tagCodeArtifacts,
72
+ type ITelemetryPropertiesExt,
72
73
  } from "@fluidframework/telemetry-utils/internal";
73
74
  import { v4 as uuid } from "uuid";
74
75
 
@@ -562,7 +563,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
562
563
  return {
563
564
  id: localContext.id,
564
565
  snapshot,
565
- type: getLocalDataStoreType(localContext),
566
+ // TODO why are we non null asserting here?
567
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
568
+ type: getLocalDataStoreType(localContext)!,
566
569
  } satisfies IAttachMessage;
567
570
  }
568
571
 
@@ -805,6 +808,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
805
808
  makeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),
806
809
  snapshotTree,
807
810
  });
811
+ // add to the list of bound or remoted, as this context must be bound
812
+ // to had an attach message sent, and is the non-detached case is remoted.
813
+ this.contexts.addBoundOrRemoted(dataStoreContext);
808
814
 
809
815
  // realize the local context, as local contexts shouldn't be delay
810
816
  // loaded, as this client is playing the role of creating client,
@@ -812,9 +818,6 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
812
818
  const channel = await dataStoreContext.realize();
813
819
  await channel.entryPoint.get();
814
820
 
815
- // add to the list of bound or remoted, as this context must be bound
816
- // to had an attach message sent, and is the non-detached case is remoted.
817
- this.contexts.addBoundOrRemoted(dataStoreContext);
818
821
  if (this.parentContext.attachState !== AttachState.Detached) {
819
822
  // if the client is not detached put in the pending attach list
820
823
  // so that on ack of the stashed op, the context is found.
@@ -1113,7 +1116,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1113
1116
  0x166 /* "BaseSnapshot should be there as detached container loaded from snapshot" */,
1114
1117
  );
1115
1118
  dataStoreSummary = convertSnapshotTreeToSummaryTree(
1116
- getSnapshotTree(this.baseSnapshot).trees[contextId],
1119
+ // TODO why are we non null asserting here?
1120
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1121
+ getSnapshotTree(this.baseSnapshot).trees[contextId]!,
1117
1122
  );
1118
1123
  }
1119
1124
  builder.addWithStats(contextId, dataStoreSummary);
@@ -1182,6 +1187,7 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1182
1187
  */
1183
1188
  private async visitContextsDuringSummary(
1184
1189
  visitor: (contextId: string, context: FluidDataStoreContext) => Promise<void>,
1190
+ telemetryProps: ITelemetryPropertiesExt,
1185
1191
  ): Promise<void> {
1186
1192
  for (const [contextId, context] of this.contexts) {
1187
1193
  // Summarizer client and hence GC works only with clients with no local changes. A data store in
@@ -1197,7 +1203,23 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1197
1203
  }
1198
1204
 
1199
1205
  if (context.attachState === AttachState.Attached) {
1206
+ // If summary / getGCData results in this data store's realization, let GC know so that it can log in
1207
+ // case the data store is not referenced. This will help identifying scenarios that we see today where
1208
+ // unreferenced data stores are being loaded.
1209
+ const contextLoadedBefore = context.isLoaded;
1210
+ const trailingOpCount = context.pendingCount;
1211
+
1200
1212
  await visitor(contextId, context);
1213
+
1214
+ if (!contextLoadedBefore && context.isLoaded) {
1215
+ this.gcNodeUpdated({
1216
+ node: { type: "DataStore", path: `/${context.id}` },
1217
+ reason: "Realized",
1218
+ packagePath: context.packagePath,
1219
+ timestampMs: undefined, // This will be added by the parent context if needed.
1220
+ additionalProps: { trailingOpCount, ...telemetryProps },
1221
+ });
1222
+ }
1201
1223
  }
1202
1224
  }
1203
1225
  }
@@ -1213,6 +1235,7 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1213
1235
  const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);
1214
1236
  summaryBuilder.addWithStats(contextId, contextSummary);
1215
1237
  },
1238
+ { fullTree, realizedDuring: "summarize" },
1216
1239
  );
1217
1240
  return summaryBuilder.getSummaryTree();
1218
1241
  }
@@ -1239,6 +1262,7 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1239
1262
  // This also gradually builds the id of each node to be a path from the root.
1240
1263
  builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);
1241
1264
  },
1265
+ { fullGC, realizedDuring: "getGCData" },
1242
1266
  );
1243
1267
 
1244
1268
  // Get the outbound routes and add a GC node for this channel.
@@ -1276,9 +1300,12 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1276
1300
  this.mc.logger.sendTelemetryEvent({
1277
1301
  eventName: "GC_DeletingLoadedDataStore",
1278
1302
  ...tagCodeArtifacts({
1279
- id: dataStoreId,
1303
+ id: `/${dataStoreId}`, // Make the id consistent with GC node path format by prefixing a slash.
1280
1304
  pkg: dataStoreContext.packagePath.join("/"),
1281
1305
  }),
1306
+ details: {
1307
+ aliased: this.aliasedDataStores.has(dataStoreId),
1308
+ },
1282
1309
  });
1283
1310
  }
1284
1311
 
@@ -1300,7 +1327,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1300
1327
  ): readonly string[] {
1301
1328
  for (const route of sweepReadyDataStoreRoutes) {
1302
1329
  const pathParts = route.split("/");
1303
- const dataStoreId = pathParts[1];
1330
+ // TODO why are we non null asserting here?
1331
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1332
+ const dataStoreId = pathParts[1]!;
1304
1333
 
1305
1334
  // Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
1306
1335
  // need to delete the data store.
@@ -1345,7 +1374,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1345
1374
  if (pathParts.length > 2) {
1346
1375
  continue;
1347
1376
  }
1348
- const dataStoreId = pathParts[1];
1377
+ // TODO why are we non null asserting here?
1378
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1379
+ const dataStoreId = pathParts[1]!;
1349
1380
  assert(this.contexts.has(dataStoreId), 0x510 /* No data store with specified id */);
1350
1381
  tombstonedDataStoresSet.add(dataStoreId);
1351
1382
  }
@@ -1380,7 +1411,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1380
1411
  ): Promise<readonly string[] | undefined> {
1381
1412
  // If the node belongs to a data store, return its package path. For DDSes, we return the package path of the
1382
1413
  // data store that contains it.
1383
- const context = this.contexts.get(nodePath.split("/")[1]);
1414
+ // TODO why are we non null asserting here?
1415
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1416
+ const context = this.contexts.get(nodePath.split("/")[1]!);
1384
1417
  return (await context?.getInitialSnapshotDetails())?.pkg;
1385
1418
  }
1386
1419
 
@@ -1390,7 +1423,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1390
1423
  */
1391
1424
  public getGCNodeType(nodePath: string): GCNodeType | undefined {
1392
1425
  const pathParts = nodePath.split("/");
1393
- if (!this.contexts.has(pathParts[1])) {
1426
+ // TODO why are we non null asserting here?
1427
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1428
+ if (!this.contexts.has(pathParts[1]!)) {
1394
1429
  return undefined;
1395
1430
  }
1396
1431
 
@@ -1408,7 +1443,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
1408
1443
 
1409
1444
  public async request(request: IRequest): Promise<IResponse> {
1410
1445
  const requestParser = RequestParser.create(request);
1411
- const id = requestParser.pathParts[0];
1446
+ // TODO why are we non null asserting here?
1447
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1448
+ const id = requestParser.pathParts[0]!;
1412
1449
 
1413
1450
  // Differentiate between requesting the dataStore directly, or one of its children
1414
1451
  const requestForChild = !requestParser.isLeaf(1);