@fluidframework/container-runtime 2.0.0-internal.7.1.1 → 2.0.0-internal.7.2.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 (169) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor.json +1 -13
  3. package/api-report/container-runtime.api.md +72 -9
  4. package/dist/blobManager.d.ts +3 -3
  5. package/dist/blobManager.d.ts.map +1 -1
  6. package/dist/blobManager.js +41 -49
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/containerRuntime.d.ts +65 -19
  9. package/dist/containerRuntime.d.ts.map +1 -1
  10. package/dist/containerRuntime.js +52 -29
  11. package/dist/containerRuntime.js.map +1 -1
  12. package/dist/dataStore.js +2 -2
  13. package/dist/dataStore.js.map +1 -1
  14. package/dist/dataStoreContext.d.ts +8 -2
  15. package/dist/dataStoreContext.d.ts.map +1 -1
  16. package/dist/dataStoreContext.js +14 -3
  17. package/dist/dataStoreContext.js.map +1 -1
  18. package/dist/dataStoreRegistry.d.ts +3 -0
  19. package/dist/dataStoreRegistry.d.ts.map +1 -1
  20. package/dist/dataStoreRegistry.js +3 -0
  21. package/dist/dataStoreRegistry.js.map +1 -1
  22. package/dist/deltaManagerProxyBase.d.ts +1 -1
  23. package/dist/deltaManagerProxyBase.d.ts.map +1 -1
  24. package/dist/deltaManagerProxyBase.js +2 -2
  25. package/dist/deltaManagerProxyBase.js.map +1 -1
  26. package/dist/gc/gcDefinitions.d.ts +26 -5
  27. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  28. package/dist/gc/gcDefinitions.js +4 -1
  29. package/dist/gc/gcDefinitions.js.map +1 -1
  30. package/dist/gc/gcSummaryDefinitions.d.ts +1 -1
  31. package/dist/gc/gcSummaryDefinitions.js.map +1 -1
  32. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  33. package/dist/gc/gcTelemetry.js +4 -4
  34. package/dist/gc/gcTelemetry.js.map +1 -1
  35. package/dist/id-compressor/utilities.d.ts +3 -0
  36. package/dist/id-compressor/utilities.d.ts.map +1 -1
  37. package/dist/id-compressor/utilities.js +3 -0
  38. package/dist/id-compressor/utilities.js.map +1 -1
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +3 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/messageTypes.d.ts +4 -1
  44. package/dist/messageTypes.d.ts.map +1 -1
  45. package/dist/messageTypes.js +3 -0
  46. package/dist/messageTypes.js.map +1 -1
  47. package/dist/opLifecycle/definitions.d.ts +3 -0
  48. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  49. package/dist/opLifecycle/definitions.js.map +1 -1
  50. package/dist/packageVersion.d.ts +1 -1
  51. package/dist/packageVersion.js +1 -1
  52. package/dist/packageVersion.js.map +1 -1
  53. package/dist/summary/orderedClientElection.d.ts +4 -1
  54. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  55. package/dist/summary/orderedClientElection.js.map +1 -1
  56. package/dist/summary/runWhileConnectedCoordinator.d.ts +5 -0
  57. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  58. package/dist/summary/runWhileConnectedCoordinator.js +1 -0
  59. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  60. package/dist/summary/summarizer.d.ts +1 -0
  61. package/dist/summary/summarizer.d.ts.map +1 -1
  62. package/dist/summary/summarizer.js +1 -0
  63. package/dist/summary/summarizer.js.map +1 -1
  64. package/dist/summary/summarizerTypes.d.ts +94 -10
  65. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  66. package/dist/summary/summarizerTypes.js.map +1 -1
  67. package/dist/summary/summaryCollection.d.ts +16 -0
  68. package/dist/summary/summaryCollection.d.ts.map +1 -1
  69. package/dist/summary/summaryCollection.js +1 -0
  70. package/dist/summary/summaryCollection.js.map +1 -1
  71. package/dist/summary/summaryFormat.d.ts +10 -1
  72. package/dist/summary/summaryFormat.d.ts.map +1 -1
  73. package/dist/summary/summaryFormat.js.map +1 -1
  74. package/lib/blobManager.d.ts +3 -3
  75. package/lib/blobManager.d.ts.map +1 -1
  76. package/lib/blobManager.js +42 -50
  77. package/lib/blobManager.js.map +1 -1
  78. package/lib/containerRuntime.d.ts +65 -19
  79. package/lib/containerRuntime.d.ts.map +1 -1
  80. package/lib/containerRuntime.js +52 -29
  81. package/lib/containerRuntime.js.map +1 -1
  82. package/lib/dataStore.js +2 -2
  83. package/lib/dataStore.js.map +1 -1
  84. package/lib/dataStoreContext.d.ts +8 -2
  85. package/lib/dataStoreContext.d.ts.map +1 -1
  86. package/lib/dataStoreContext.js +14 -3
  87. package/lib/dataStoreContext.js.map +1 -1
  88. package/lib/dataStoreRegistry.d.ts +3 -0
  89. package/lib/dataStoreRegistry.d.ts.map +1 -1
  90. package/lib/dataStoreRegistry.js +3 -0
  91. package/lib/dataStoreRegistry.js.map +1 -1
  92. package/lib/deltaManagerProxyBase.d.ts +1 -1
  93. package/lib/deltaManagerProxyBase.d.ts.map +1 -1
  94. package/lib/deltaManagerProxyBase.js +2 -2
  95. package/lib/deltaManagerProxyBase.js.map +1 -1
  96. package/lib/gc/gcDefinitions.d.ts +26 -5
  97. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  98. package/lib/gc/gcDefinitions.js +4 -1
  99. package/lib/gc/gcDefinitions.js.map +1 -1
  100. package/lib/gc/gcSummaryDefinitions.d.ts +1 -1
  101. package/lib/gc/gcSummaryDefinitions.js.map +1 -1
  102. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  103. package/lib/gc/gcTelemetry.js +4 -4
  104. package/lib/gc/gcTelemetry.js.map +1 -1
  105. package/lib/id-compressor/utilities.d.ts +3 -0
  106. package/lib/id-compressor/utilities.d.ts.map +1 -1
  107. package/lib/id-compressor/utilities.js +3 -0
  108. package/lib/id-compressor/utilities.js.map +1 -1
  109. package/lib/index.d.ts +3 -2
  110. package/lib/index.d.ts.map +1 -1
  111. package/lib/index.js +1 -0
  112. package/lib/index.js.map +1 -1
  113. package/lib/messageTypes.d.ts +4 -1
  114. package/lib/messageTypes.d.ts.map +1 -1
  115. package/lib/messageTypes.js +3 -0
  116. package/lib/messageTypes.js.map +1 -1
  117. package/lib/opLifecycle/definitions.d.ts +3 -0
  118. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  119. package/lib/opLifecycle/definitions.js.map +1 -1
  120. package/lib/packageVersion.d.ts +1 -1
  121. package/lib/packageVersion.js +1 -1
  122. package/lib/packageVersion.js.map +1 -1
  123. package/lib/summary/orderedClientElection.d.ts +4 -1
  124. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  125. package/lib/summary/orderedClientElection.js.map +1 -1
  126. package/lib/summary/runWhileConnectedCoordinator.d.ts +5 -0
  127. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  128. package/lib/summary/runWhileConnectedCoordinator.js +1 -0
  129. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  130. package/lib/summary/summarizer.d.ts +1 -0
  131. package/lib/summary/summarizer.d.ts.map +1 -1
  132. package/lib/summary/summarizer.js +1 -0
  133. package/lib/summary/summarizer.js.map +1 -1
  134. package/lib/summary/summarizerTypes.d.ts +94 -10
  135. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  136. package/lib/summary/summarizerTypes.js.map +1 -1
  137. package/lib/summary/summaryCollection.d.ts +16 -0
  138. package/lib/summary/summaryCollection.d.ts.map +1 -1
  139. package/lib/summary/summaryCollection.js +1 -0
  140. package/lib/summary/summaryCollection.js.map +1 -1
  141. package/lib/summary/summaryFormat.d.ts +10 -1
  142. package/lib/summary/summaryFormat.d.ts.map +1 -1
  143. package/lib/summary/summaryFormat.js.map +1 -1
  144. package/package.json +19 -20
  145. package/src/blobManager.ts +58 -59
  146. package/src/containerRuntime.ts +79 -39
  147. package/src/dataStore.ts +2 -2
  148. package/src/dataStoreContext.ts +14 -3
  149. package/src/dataStoreRegistry.ts +3 -0
  150. package/src/deltaManagerProxyBase.ts +2 -2
  151. package/src/gc/gcDefinitions.ts +27 -5
  152. package/src/gc/gcSummaryDefinitions.ts +1 -1
  153. package/src/gc/gcTelemetry.ts +5 -4
  154. package/src/id-compressor/utilities.ts +3 -0
  155. package/src/index.ts +13 -1
  156. package/src/messageTypes.ts +4 -1
  157. package/src/opLifecycle/definitions.ts +3 -0
  158. package/src/packageVersion.ts +1 -1
  159. package/src/summary/orderedClientElection.ts +4 -1
  160. package/src/summary/runWhileConnectedCoordinator.ts +5 -1
  161. package/src/summary/summarizer.ts +1 -0
  162. package/src/summary/summarizerTypes.ts +95 -11
  163. package/src/summary/summaryCollection.ts +18 -1
  164. package/src/summary/summaryFormat.ts +11 -1
  165. package/dist/container-runtime-alpha.d.ts +0 -1554
  166. package/dist/container-runtime-beta.d.ts +0 -1554
  167. package/dist/container-runtime-public.d.ts +0 -1554
  168. package/dist/container-runtime.d.ts +0 -1611
  169. package/src/gc/gcEarlyAdoption.md +0 -145
@@ -44,6 +44,9 @@ function prepareLocalContainerRuntimeIdAllocationMessageForTransit(message) {
44
44
  delete message.contents.stashedState;
45
45
  }
46
46
  }
47
+ /**
48
+ * @public
49
+ */
47
50
  export const DefaultSummaryConfiguration = {
48
51
  state: "enabled",
49
52
  minIdleTime: 0,
@@ -60,6 +63,7 @@ export const DefaultSummaryConfiguration = {
60
63
  };
61
64
  /**
62
65
  * Accepted header keys for requests coming to the runtime.
66
+ * @public
63
67
  */
64
68
  export var RuntimeHeaders;
65
69
  (function (RuntimeHeaders) {
@@ -68,13 +72,24 @@ export var RuntimeHeaders;
68
72
  /** True if the request is coming from an IFluidHandle. */
69
73
  RuntimeHeaders["viaHandle"] = "viaHandle";
70
74
  })(RuntimeHeaders || (RuntimeHeaders = {}));
71
- /** True if a tombstoned object should be returned without erroring */
75
+ /** True if a tombstoned object should be returned without erroring
76
+ * @public
77
+ */
72
78
  export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
73
- /** [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring */
79
+ /**
80
+ * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
81
+ * @public
82
+ */
74
83
  export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
75
- /** Tombstone error responses will have this header set to true */
84
+ /**
85
+ * Tombstone error responses will have this header set to true
86
+ * @public
87
+ */
76
88
  export const TombstoneResponseHeaderKey = "isTombstoned";
77
- /** Inactive error responses will have this header set to true */
89
+ /**
90
+ * Inactive error responses will have this header set to true
91
+ * @public
92
+ */
78
93
  export const InactiveResponseHeaderKey = "isInactive";
79
94
  /** Default values for Runtime Headers */
80
95
  export const defaultRuntimeHeaderData = {
@@ -85,6 +100,7 @@ export const defaultRuntimeHeaderData = {
85
100
  };
86
101
  /**
87
102
  * Available compression algorithms for op compression.
103
+ * @public
88
104
  */
89
105
  export var CompressionAlgorithms;
90
106
  (function (CompressionAlgorithms) {
@@ -114,7 +130,8 @@ export const defaultPendingOpsRetryDelayMs = 1000;
114
130
  */
115
131
  const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
116
132
  /**
117
- * @deprecated - use ContainerRuntimeMessageType instead
133
+ * @deprecated use ContainerRuntimeMessageType instead
134
+ * @public
118
135
  */
119
136
  export var RuntimeMessage;
120
137
  (function (RuntimeMessage) {
@@ -127,7 +144,8 @@ export var RuntimeMessage;
127
144
  RuntimeMessage["Operation"] = "op";
128
145
  })(RuntimeMessage || (RuntimeMessage = {}));
129
146
  /**
130
- * @deprecated - please use version in driver-utils
147
+ * @deprecated please use version in driver-utils
148
+ * @public
131
149
  */
132
150
  export function isRuntimeMessage(message) {
133
151
  return Object.values(RuntimeMessage).includes(message.type);
@@ -136,6 +154,7 @@ export function isRuntimeMessage(message) {
136
154
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
137
155
  * special-case for document dirty state. Ultimately we should have no special-cases from the
138
156
  * ContainerRuntime's perspective.
157
+ * @public
139
158
  */
140
159
  export const agentSchedulerId = "_scheduler";
141
160
  // safely check navigator and get the hardware spec value
@@ -203,6 +222,7 @@ async function createSummarizer(loader, url) {
203
222
  }
204
223
  /**
205
224
  * This function is not supported publicly and exists for e2e testing
225
+ * @internal
206
226
  */
207
227
  export async function TEST_requestSummarizer(loader, url) {
208
228
  return createSummarizer(loader, url);
@@ -210,16 +230,17 @@ export async function TEST_requestSummarizer(loader, url) {
210
230
  /**
211
231
  * Represents the runtime of the container. Contains helper functions/state of the container.
212
232
  * It will define the store level mappings.
233
+ * @public
213
234
  */
214
235
  export class ContainerRuntime extends TypedEventEmitter {
215
236
  /**
216
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
237
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
217
238
  */
218
239
  get IFluidRouter() {
219
240
  return this;
220
241
  }
221
242
  /**
222
- * @deprecated - use loadRuntime instead.
243
+ * @deprecated use loadRuntime instead.
223
244
  * Load the stores from a snapshot and returns the runtime.
224
245
  * @param context - Context of the container.
225
246
  * @param registryEntries - Mapping to the stores.
@@ -809,7 +830,7 @@ export class ContainerRuntime extends TypedEventEmitter {
809
830
  /**
810
831
  * Notifies this object about the request made to the container.
811
832
  * @param request - Request made to the handler.
812
- * @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
833
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
813
834
  */
814
835
  async request(request) {
815
836
  try {
@@ -1334,7 +1355,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1334
1355
  * Returns the runtime of the data store.
1335
1356
  * @param id - Id supplied during creating the data store.
1336
1357
  * @param wait - True if you want to wait for it.
1337
- * @deprecated - Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
1358
+ * @deprecated Use getAliasedDataStoreEntryPoint instead to get an aliased data store's entry point.
1338
1359
  */
1339
1360
  // eslint-disable-next-line import/no-deprecated
1340
1361
  async getRootDataStore(id, wait = true) {
@@ -1503,15 +1524,22 @@ export class ContainerRuntime extends TypedEventEmitter {
1503
1524
  * Submits the signal to be sent to other clients.
1504
1525
  * @param type - Type of the signal.
1505
1526
  * @param content - Content of the signal.
1527
+ * @param targetClientId - When specified, the signal is only sent to the provided client id.
1506
1528
  */
1507
- submitSignal(type, content) {
1529
+ submitSignal(type, content, targetClientId) {
1508
1530
  this.verifyNotClosed();
1509
1531
  const envelope = this.createNewSignalEnvelope(undefined /* address */, type, content);
1510
- return this.submitSignalFn(envelope);
1532
+ return this.submitSignalFn(envelope, targetClientId);
1511
1533
  }
1512
- submitDataStoreSignal(address, type, content) {
1534
+ /**
1535
+ * Submits the signal to be sent to other clients.
1536
+ * @param type - Type of the signal.
1537
+ * @param content - Content of the signal.
1538
+ * @param targetClientId - When specified, the signal is only sent to the provided client id.
1539
+ */
1540
+ submitDataStoreSignal(address, type, content, targetClientId) {
1513
1541
  const envelope = this.createNewSignalEnvelope(address, type, content);
1514
- return this.submitSignalFn(envelope);
1542
+ return this.submitSignalFn(envelope, targetClientId);
1515
1543
  }
1516
1544
  setAttachState(attachState) {
1517
1545
  if (attachState === AttachState.Attaching) {
@@ -1634,7 +1662,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1634
1662
  this.dataStores.updateUnusedRoutes(dataStoreRoutes);
1635
1663
  }
1636
1664
  /**
1637
- * @deprecated - Replaced by deleteSweepReadyNodes.
1665
+ * @deprecated Replaced by deleteSweepReadyNodes.
1638
1666
  */
1639
1667
  deleteUnusedNodes(unusedRoutes) {
1640
1668
  throw new Error("deleteUnusedRoutes should not be called");
@@ -2370,11 +2398,11 @@ export class ContainerRuntime extends TypedEventEmitter {
2370
2398
  * and then close as the current main client is likely to be re-elected as the parent summarizer again.
2371
2399
  */
2372
2400
  if (!result.isSummaryTracked && result.isSummaryNewer) {
2373
- const fetchResult = await this.fetchSnapshotFromStorage(summaryLogger, {
2401
+ const fetchResult = await this.fetchLatestSnapshotFromStorage(summaryLogger, {
2374
2402
  eventName: "RefreshLatestSummaryAckFetch",
2375
2403
  ackHandle,
2376
2404
  targetSequenceNumber: summaryRefSeq,
2377
- }, readAndParseBlob, null);
2405
+ }, readAndParseBlob);
2378
2406
  /**
2379
2407
  * If the fetched snapshot is older than the one for which the ack was received, close the container.
2380
2408
  * This should never happen because an ack should be sent after the latest summary is updated in the server.
@@ -2410,9 +2438,9 @@ export class ContainerRuntime extends TypedEventEmitter {
2410
2438
  const readAndParseBlob = async (id) => readAndParse(this.storage, id);
2411
2439
  // This is a performance optimization as the same parent is likely to be elected again, and would use its
2412
2440
  // cache to fetch the snapshot instead of the network.
2413
- await this.fetchSnapshotFromStorage(summaryLogger, {
2441
+ await this.fetchLatestSnapshotFromStorage(summaryLogger, {
2414
2442
  eventName: "RefreshLatestSummaryFromServerFetch",
2415
- }, readAndParseBlob, null);
2443
+ }, readAndParseBlob);
2416
2444
  await this.closeStaleSummarizer("RefreshLatestSummaryFromServerFetch");
2417
2445
  return {
2418
2446
  stage: "base",
@@ -2422,27 +2450,21 @@ export class ContainerRuntime extends TypedEventEmitter {
2422
2450
  };
2423
2451
  }
2424
2452
  async closeStaleSummarizer(codePath) {
2425
- this.mc.logger.sendTelemetryEvent({
2426
- eventName: "ClosingSummarizerOnSummaryStale",
2427
- codePath,
2428
- message: "Stopping fetch from storage",
2429
- closeSummarizerDelayMs: this.closeSummarizerDelayMs,
2430
- }, new GenericError("Restarting summarizer instead of refreshing"));
2431
2453
  // Delay before restarting summarizer to prevent the summarizer from restarting too frequently.
2432
2454
  await delay(this.closeSummarizerDelayMs);
2433
2455
  this._summarizer?.stop("latestSummaryStateStale");
2434
2456
  this.disposeFn();
2435
2457
  }
2436
2458
  /**
2437
- * Downloads snapshot from storage with the given versionId or latest if versionId is null.
2459
+ * Downloads the latest snapshot from storage.
2438
2460
  * By default, it also closes the container after downloading the snapshot. However, this may be
2439
2461
  * overridden via options.
2440
2462
  */
2441
- async fetchSnapshotFromStorage(logger, event, readAndParseBlob, versionId) {
2463
+ async fetchLatestSnapshotFromStorage(logger, event, readAndParseBlob) {
2442
2464
  return PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
2443
2465
  const stats = {};
2444
2466
  const trace = Trace.start();
2445
- const versions = await this.storage.getVersions(versionId, 1, "prefetchLatestSummaryBeforeClose", versionId === null ? FetchSource.noCache : undefined);
2467
+ const versions = await this.storage.getVersions(null, 1, "prefetchLatestSummaryBeforeClose", FetchSource.noCache);
2446
2468
  assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */);
2447
2469
  stats.getVersionDuration = trace.trace().duration;
2448
2470
  const maybeSnapshot = await this.storage.getSnapshotTree(versions[0]);
@@ -2467,6 +2489,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2467
2489
  }, async (event) => {
2468
2490
  this.verifyNotClosed();
2469
2491
  const waitBlobsToAttach = props?.notifyImminentClosure;
2492
+ const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
2470
2493
  if (this._orderSequentiallyCalls !== 0) {
2471
2494
  throw new UsageError("can't get state during orderSequentially");
2472
2495
  }
@@ -2475,7 +2498,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2475
2498
  // to close current batch.
2476
2499
  this.flush();
2477
2500
  const pendingAttachmentBlobs = waitBlobsToAttach
2478
- ? await this.blobManager.attachAndGetPendingBlobs()
2501
+ ? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
2479
2502
  : undefined;
2480
2503
  const pending = this.pendingStateManager.getLocalState();
2481
2504
  if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {