@fluidframework/container-runtime 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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 (264) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +9 -1
  4. package/api-report/container-runtime.api.md +124 -107
  5. package/dist/blobManager.d.ts +4 -4
  6. package/dist/blobManager.d.ts.map +1 -1
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/container-runtime-alpha.d.ts +1473 -0
  9. package/dist/container-runtime-beta.d.ts +300 -0
  10. package/dist/container-runtime-public.d.ts +300 -0
  11. package/dist/container-runtime-untrimmed.d.ts +1836 -0
  12. package/dist/containerRuntime.d.ts +30 -30
  13. package/dist/containerRuntime.d.ts.map +1 -1
  14. package/dist/containerRuntime.js +62 -40
  15. package/dist/containerRuntime.js.map +1 -1
  16. package/dist/dataStoreRegistry.d.ts +1 -1
  17. package/dist/dataStoreRegistry.js +1 -1
  18. package/dist/dataStoreRegistry.js.map +1 -1
  19. package/dist/dataStores.d.ts +10 -15
  20. package/dist/dataStores.d.ts.map +1 -1
  21. package/dist/dataStores.js +77 -40
  22. package/dist/dataStores.js.map +1 -1
  23. package/dist/gc/garbageCollection.d.ts +41 -13
  24. package/dist/gc/garbageCollection.d.ts.map +1 -1
  25. package/dist/gc/garbageCollection.js +215 -78
  26. package/dist/gc/garbageCollection.js.map +1 -1
  27. package/dist/gc/gcConfigs.d.ts.map +1 -1
  28. package/dist/gc/gcConfigs.js +34 -37
  29. package/dist/gc/gcConfigs.js.map +1 -1
  30. package/dist/gc/gcDefinitions.d.ts +121 -46
  31. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  32. package/dist/gc/gcDefinitions.js +26 -18
  33. package/dist/gc/gcDefinitions.js.map +1 -1
  34. package/dist/gc/gcHelpers.d.ts +18 -25
  35. package/dist/gc/gcHelpers.d.ts.map +1 -1
  36. package/dist/gc/gcHelpers.js +29 -45
  37. package/dist/gc/gcHelpers.js.map +1 -1
  38. package/dist/gc/gcTelemetry.d.ts +0 -5
  39. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  40. package/dist/gc/gcTelemetry.js +14 -42
  41. package/dist/gc/gcTelemetry.js.map +1 -1
  42. package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
  43. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  44. package/dist/gc/gcUnreferencedStateTracker.js +43 -19
  45. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  46. package/dist/gc/index.d.ts +1 -1
  47. package/dist/gc/index.d.ts.map +1 -1
  48. package/dist/gc/index.js +4 -5
  49. package/dist/gc/index.js.map +1 -1
  50. package/dist/index.d.ts +14 -2
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +16 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/messageTypes.d.ts +15 -7
  55. package/dist/messageTypes.d.ts.map +1 -1
  56. package/dist/messageTypes.js +6 -1
  57. package/dist/messageTypes.js.map +1 -1
  58. package/dist/opLifecycle/definitions.d.ts +1 -1
  59. package/dist/opLifecycle/definitions.js.map +1 -1
  60. package/dist/packageVersion.d.ts +1 -1
  61. package/dist/packageVersion.js +1 -1
  62. package/dist/packageVersion.js.map +1 -1
  63. package/dist/pendingStateManager.d.ts +1 -0
  64. package/dist/pendingStateManager.d.ts.map +1 -1
  65. package/dist/pendingStateManager.js +1 -0
  66. package/dist/pendingStateManager.js.map +1 -1
  67. package/dist/summary/orderedClientElection.d.ts +1 -1
  68. package/dist/summary/orderedClientElection.js.map +1 -1
  69. package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
  70. package/dist/summary/runWhileConnectedCoordinator.js +1 -1
  71. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  72. package/dist/summary/summarizer.d.ts +1 -1
  73. package/dist/summary/summarizer.js +1 -1
  74. package/dist/summary/summarizer.js.map +1 -1
  75. package/dist/summary/summarizerTypes.d.ts +30 -30
  76. package/dist/summary/summarizerTypes.js.map +1 -1
  77. package/dist/summary/summaryCollection.d.ts +10 -10
  78. package/dist/summary/summaryCollection.js +1 -1
  79. package/dist/summary/summaryCollection.js.map +1 -1
  80. package/dist/summary/summaryFormat.d.ts +3 -3
  81. package/dist/summary/summaryFormat.js.map +1 -1
  82. package/lib/blobManager.d.ts +4 -4
  83. package/lib/blobManager.d.ts.map +1 -1
  84. package/lib/blobManager.js.map +1 -1
  85. package/lib/container-runtime-alpha.d.ts +1473 -0
  86. package/lib/container-runtime-beta.d.ts +300 -0
  87. package/lib/container-runtime-public.d.ts +300 -0
  88. package/lib/container-runtime-untrimmed.d.ts +1836 -0
  89. package/lib/containerRuntime.d.ts +30 -30
  90. package/lib/containerRuntime.d.ts.map +1 -1
  91. package/lib/containerRuntime.js +64 -42
  92. package/lib/containerRuntime.js.map +1 -1
  93. package/lib/dataStoreRegistry.d.ts +1 -1
  94. package/lib/dataStoreRegistry.js +1 -1
  95. package/lib/dataStoreRegistry.js.map +1 -1
  96. package/lib/dataStores.d.ts +10 -15
  97. package/lib/dataStores.d.ts.map +1 -1
  98. package/lib/dataStores.js +80 -43
  99. package/lib/dataStores.js.map +1 -1
  100. package/lib/gc/garbageCollection.d.ts +41 -13
  101. package/lib/gc/garbageCollection.d.ts.map +1 -1
  102. package/lib/gc/garbageCollection.js +217 -80
  103. package/lib/gc/garbageCollection.js.map +1 -1
  104. package/lib/gc/gcConfigs.d.ts.map +1 -1
  105. package/lib/gc/gcConfigs.js +37 -40
  106. package/lib/gc/gcConfigs.js.map +1 -1
  107. package/lib/gc/gcDefinitions.d.ts +121 -46
  108. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  109. package/lib/gc/gcDefinitions.js +25 -17
  110. package/lib/gc/gcDefinitions.js.map +1 -1
  111. package/lib/gc/gcHelpers.d.ts +18 -25
  112. package/lib/gc/gcHelpers.d.ts.map +1 -1
  113. package/lib/gc/gcHelpers.js +27 -43
  114. package/lib/gc/gcHelpers.js.map +1 -1
  115. package/lib/gc/gcTelemetry.d.ts +0 -5
  116. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  117. package/lib/gc/gcTelemetry.js +15 -43
  118. package/lib/gc/gcTelemetry.js.map +1 -1
  119. package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
  120. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  121. package/lib/gc/gcUnreferencedStateTracker.js +43 -19
  122. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  123. package/lib/gc/index.d.ts +1 -1
  124. package/lib/gc/index.d.ts.map +1 -1
  125. package/lib/gc/index.js +1 -1
  126. package/lib/gc/index.js.map +1 -1
  127. package/lib/index.d.ts +14 -2
  128. package/lib/index.d.ts.map +1 -1
  129. package/lib/index.js +15 -1
  130. package/lib/index.js.map +1 -1
  131. package/lib/messageTypes.d.ts +15 -7
  132. package/lib/messageTypes.d.ts.map +1 -1
  133. package/lib/messageTypes.js +6 -1
  134. package/lib/messageTypes.js.map +1 -1
  135. package/lib/opLifecycle/definitions.d.ts +1 -1
  136. package/lib/opLifecycle/definitions.js.map +1 -1
  137. package/lib/packageVersion.d.ts +1 -1
  138. package/lib/packageVersion.js +1 -1
  139. package/lib/packageVersion.js.map +1 -1
  140. package/lib/pendingStateManager.d.ts +1 -0
  141. package/lib/pendingStateManager.d.ts.map +1 -1
  142. package/lib/pendingStateManager.js +1 -0
  143. package/lib/pendingStateManager.js.map +1 -1
  144. package/lib/summary/orderedClientElection.d.ts +1 -1
  145. package/lib/summary/orderedClientElection.js.map +1 -1
  146. package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
  147. package/lib/summary/runWhileConnectedCoordinator.js +1 -1
  148. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  149. package/lib/summary/summarizer.d.ts +1 -1
  150. package/lib/summary/summarizer.js +1 -1
  151. package/lib/summary/summarizer.js.map +1 -1
  152. package/lib/summary/summarizerTypes.d.ts +30 -30
  153. package/lib/summary/summarizerTypes.js.map +1 -1
  154. package/lib/summary/summaryCollection.d.ts +10 -10
  155. package/lib/summary/summaryCollection.js +1 -1
  156. package/lib/summary/summaryCollection.js.map +1 -1
  157. package/lib/summary/summaryFormat.d.ts +3 -3
  158. package/lib/summary/summaryFormat.js.map +1 -1
  159. package/package.json +42 -19
  160. package/src/blobManager.ts +5 -5
  161. package/src/containerRuntime.ts +86 -56
  162. package/src/dataStoreRegistry.ts +1 -1
  163. package/src/dataStores.ts +140 -69
  164. package/src/gc/garbageCollection.md +14 -15
  165. package/src/gc/garbageCollection.ts +256 -96
  166. package/src/gc/gcConfigs.ts +50 -52
  167. package/src/gc/gcDefinitions.ts +137 -52
  168. package/src/gc/gcHelpers.ts +31 -52
  169. package/src/gc/gcTelemetry.ts +16 -57
  170. package/src/gc/gcUnreferencedStateTracker.ts +61 -22
  171. package/src/gc/index.ts +6 -4
  172. package/src/index.ts +19 -1
  173. package/src/messageTypes.ts +19 -4
  174. package/src/opLifecycle/definitions.ts +1 -1
  175. package/src/packageVersion.ts +1 -1
  176. package/src/pendingStateManager.ts +1 -0
  177. package/src/summary/orderedClientElection.ts +1 -1
  178. package/src/summary/runWhileConnectedCoordinator.ts +2 -2
  179. package/src/summary/summarizer.ts +1 -1
  180. package/src/summary/summarizerTypes.ts +30 -30
  181. package/src/summary/summaryCollection.ts +10 -10
  182. package/src/summary/summaryFormat.ts +3 -3
  183. package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
  184. package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  185. package/dist/id-compressor/appendOnlySortedMap.js +0 -318
  186. package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
  187. package/dist/id-compressor/finalSpace.d.ts +0 -29
  188. package/dist/id-compressor/finalSpace.d.ts.map +0 -1
  189. package/dist/id-compressor/finalSpace.js +0 -62
  190. package/dist/id-compressor/finalSpace.js.map +0 -1
  191. package/dist/id-compressor/idCompressor.d.ts +0 -54
  192. package/dist/id-compressor/idCompressor.d.ts.map +0 -1
  193. package/dist/id-compressor/idCompressor.js +0 -495
  194. package/dist/id-compressor/idCompressor.js.map +0 -1
  195. package/dist/id-compressor/identifiers.d.ts +0 -32
  196. package/dist/id-compressor/identifiers.d.ts.map +0 -1
  197. package/dist/id-compressor/identifiers.js +0 -15
  198. package/dist/id-compressor/identifiers.js.map +0 -1
  199. package/dist/id-compressor/index.d.ts +0 -13
  200. package/dist/id-compressor/index.d.ts.map +0 -1
  201. package/dist/id-compressor/index.js +0 -32
  202. package/dist/id-compressor/index.js.map +0 -1
  203. package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
  204. package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
  205. package/dist/id-compressor/persistanceUtilities.js +0 -43
  206. package/dist/id-compressor/persistanceUtilities.js.map +0 -1
  207. package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  208. package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  209. package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
  210. package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  211. package/dist/id-compressor/sessions.d.ts +0 -115
  212. package/dist/id-compressor/sessions.d.ts.map +0 -1
  213. package/dist/id-compressor/sessions.js +0 -305
  214. package/dist/id-compressor/sessions.js.map +0 -1
  215. package/dist/id-compressor/utilities.d.ts +0 -52
  216. package/dist/id-compressor/utilities.d.ts.map +0 -1
  217. package/dist/id-compressor/utilities.js +0 -169
  218. package/dist/id-compressor/utilities.js.map +0 -1
  219. package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
  220. package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  221. package/lib/id-compressor/appendOnlySortedMap.js +0 -314
  222. package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
  223. package/lib/id-compressor/finalSpace.d.ts +0 -29
  224. package/lib/id-compressor/finalSpace.d.ts.map +0 -1
  225. package/lib/id-compressor/finalSpace.js +0 -58
  226. package/lib/id-compressor/finalSpace.js.map +0 -1
  227. package/lib/id-compressor/idCompressor.d.ts +0 -54
  228. package/lib/id-compressor/idCompressor.d.ts.map +0 -1
  229. package/lib/id-compressor/idCompressor.js +0 -491
  230. package/lib/id-compressor/idCompressor.js.map +0 -1
  231. package/lib/id-compressor/identifiers.d.ts +0 -32
  232. package/lib/id-compressor/identifiers.d.ts.map +0 -1
  233. package/lib/id-compressor/identifiers.js +0 -11
  234. package/lib/id-compressor/identifiers.js.map +0 -1
  235. package/lib/id-compressor/index.d.ts +0 -13
  236. package/lib/id-compressor/index.d.ts.map +0 -1
  237. package/lib/id-compressor/index.js +0 -13
  238. package/lib/id-compressor/index.js.map +0 -1
  239. package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
  240. package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
  241. package/lib/id-compressor/persistanceUtilities.js +0 -34
  242. package/lib/id-compressor/persistanceUtilities.js.map +0 -1
  243. package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  244. package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  245. package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
  246. package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  247. package/lib/id-compressor/sessions.d.ts +0 -115
  248. package/lib/id-compressor/sessions.d.ts.map +0 -1
  249. package/lib/id-compressor/sessions.js +0 -290
  250. package/lib/id-compressor/sessions.js.map +0 -1
  251. package/lib/id-compressor/utilities.d.ts +0 -52
  252. package/lib/id-compressor/utilities.d.ts.map +0 -1
  253. package/lib/id-compressor/utilities.js +0 -151
  254. package/lib/id-compressor/utilities.js.map +0 -1
  255. package/src/id-compressor/README.md +0 -3
  256. package/src/id-compressor/appendOnlySortedMap.ts +0 -366
  257. package/src/id-compressor/finalSpace.ts +0 -67
  258. package/src/id-compressor/idCompressor.ts +0 -630
  259. package/src/id-compressor/identifiers.ts +0 -42
  260. package/src/id-compressor/index.ts +0 -26
  261. package/src/id-compressor/persistanceUtilities.ts +0 -58
  262. package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
  263. package/src/id-compressor/sessions.ts +0 -405
  264. package/src/id-compressor/utilities.ts +0 -190
@@ -47,6 +47,7 @@ import {
47
47
  wrapError,
48
48
  ITelemetryLoggerExt,
49
49
  UsageError,
50
+ LoggingError,
50
51
  } from "@fluidframework/telemetry-utils";
51
52
  import {
52
53
  DriverHeader,
@@ -87,12 +88,14 @@ import {
87
88
  channelsTreeName,
88
89
  IDataStore,
89
90
  ITelemetryContext,
91
+ } from "@fluidframework/runtime-definitions";
92
+ import type {
90
93
  SerializedIdCompressorWithNoSession,
91
94
  IIdCompressor,
92
95
  IIdCompressorCore,
93
96
  IdCreationRange,
94
97
  SerializedIdCompressorWithOngoingSession,
95
- } from "@fluidframework/runtime-definitions";
98
+ } from "@fluidframework/id-compressor";
96
99
  import {
97
100
  addBlobToSummary,
98
101
  addSummarizeResultToSummary,
@@ -163,7 +166,7 @@ import { formExponentialFn, Throttler } from "./throttler";
163
166
  import {
164
167
  GarbageCollector,
165
168
  GCNodeType,
166
- gcTombstoneGenerationOptionName,
169
+ gcGenerationOptionName,
167
170
  IGarbageCollector,
168
171
  IGCRuntimeOptions,
169
172
  IGCStats,
@@ -194,6 +197,7 @@ import {
194
197
  type LocalContainerRuntimeMessage,
195
198
  type OutboundContainerRuntimeMessage,
196
199
  type UnknownContainerRuntimeMessage,
200
+ ContainerRuntimeGCMessage,
197
201
  } from "./messageTypes";
198
202
 
199
203
  /**
@@ -213,7 +217,7 @@ function compatBehaviorAllowsMessageType(
213
217
  }
214
218
 
215
219
  /**
216
- * @public
220
+ * @alpha
217
221
  */
218
222
  export interface ISummaryBaseConfiguration {
219
223
  /**
@@ -235,7 +239,7 @@ export interface ISummaryBaseConfiguration {
235
239
  }
236
240
 
237
241
  /**
238
- * @public
242
+ * @alpha
239
243
  */
240
244
  export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {
241
245
  state: "enabled";
@@ -298,21 +302,21 @@ export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfigurati
298
302
  }
299
303
 
300
304
  /**
301
- * @public
305
+ * @alpha
302
306
  */
303
307
  export interface ISummaryConfigurationDisableSummarizer {
304
308
  state: "disabled";
305
309
  }
306
310
 
307
311
  /**
308
- * @public
312
+ * @alpha
309
313
  */
310
314
  export interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConfiguration {
311
315
  state: "disableHeuristics";
312
316
  }
313
317
 
314
318
  /**
315
- * @public
319
+ * @alpha
316
320
  */
317
321
  export type ISummaryConfiguration =
318
322
  | ISummaryConfigurationDisableSummarizer
@@ -320,7 +324,7 @@ export type ISummaryConfiguration =
320
324
  | ISummaryConfigurationHeuristics;
321
325
 
322
326
  /**
323
- * @public
327
+ * @internal
324
328
  */
325
329
  export const DefaultSummaryConfiguration: ISummaryConfiguration = {
326
330
  state: "enabled",
@@ -349,7 +353,7 @@ export const DefaultSummaryConfiguration: ISummaryConfiguration = {
349
353
  };
350
354
 
351
355
  /**
352
- * @public
356
+ * @alpha
353
357
  */
354
358
  export interface ISummaryRuntimeOptions {
355
359
  /** Override summary configurations set by the server. */
@@ -366,7 +370,7 @@ export interface ISummaryRuntimeOptions {
366
370
 
367
371
  /**
368
372
  * Options for op compression.
369
- * @public
373
+ * @alpha
370
374
  */
371
375
  export interface ICompressionRuntimeOptions {
372
376
  /**
@@ -384,7 +388,7 @@ export interface ICompressionRuntimeOptions {
384
388
 
385
389
  /**
386
390
  * Options for container runtime.
387
- * @public
391
+ * @alpha
388
392
  */
389
393
  export interface IContainerRuntimeOptions {
390
394
  readonly summaryOptions?: ISummaryRuntimeOptions;
@@ -466,7 +470,7 @@ export interface IContainerRuntimeOptions {
466
470
 
467
471
  /**
468
472
  * Accepted header keys for requests coming to the runtime.
469
- * @public
473
+ * @internal
470
474
  */
471
475
  export enum RuntimeHeaders {
472
476
  /** True to wait for a data store to be created and loaded before returning it. */
@@ -476,23 +480,23 @@ export enum RuntimeHeaders {
476
480
  }
477
481
 
478
482
  /** True if a tombstoned object should be returned without erroring
479
- * @public
483
+ * @internal
480
484
  */
481
485
  export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
482
486
  /**
483
487
  * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
484
- * @public
488
+ * @internal
485
489
  */
486
490
  export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
487
491
 
488
492
  /**
489
493
  * Tombstone error responses will have this header set to true
490
- * @public
494
+ * @internal
491
495
  */
492
496
  export const TombstoneResponseHeaderKey = "isTombstoned";
493
497
  /**
494
498
  * Inactive error responses will have this header set to true
495
- * @public
499
+ * @internal
496
500
  */
497
501
  export const InactiveResponseHeaderKey = "isInactive";
498
502
 
@@ -516,7 +520,7 @@ export const defaultRuntimeHeaderData: Required<RuntimeHeaderData> = {
516
520
 
517
521
  /**
518
522
  * Available compression algorithms for op compression.
519
- * @public
523
+ * @alpha
520
524
  */
521
525
  export enum CompressionAlgorithms {
522
526
  lz4 = "lz4",
@@ -585,7 +589,7 @@ const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
585
589
 
586
590
  /**
587
591
  * @deprecated use ContainerRuntimeMessageType instead
588
- * @public
592
+ * @internal
589
593
  */
590
594
  export enum RuntimeMessage {
591
595
  FluidDataStoreOp = "component",
@@ -599,7 +603,7 @@ export enum RuntimeMessage {
599
603
 
600
604
  /**
601
605
  * @deprecated please use version in driver-utils
602
- * @public
606
+ * @internal
603
607
  */
604
608
  export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean {
605
609
  return (Object.values(RuntimeMessage) as string[]).includes(message.type);
@@ -609,7 +613,7 @@ export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean {
609
613
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
610
614
  * special-case for document dirty state. Ultimately we should have no special-cases from the
611
615
  * ContainerRuntime's perspective.
612
- * @public
616
+ * @internal
613
617
  */
614
618
  export const agentSchedulerId = "_scheduler";
615
619
 
@@ -718,7 +722,7 @@ export async function TEST_requestSummarizer(loader: ILoader, url: string): Prom
718
722
  /**
719
723
  * Represents the runtime of the container. Contains helper functions/state of the container.
720
724
  * It will define the store level mappings.
721
- * @public
725
+ * @alpha
722
726
  */
723
727
  export class ContainerRuntime
724
728
  extends TypedEventEmitter<IContainerRuntimeEvents & ISummarizerEvents>
@@ -909,16 +913,18 @@ export class ContainerRuntime
909
913
  metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
910
914
  let idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
911
915
  if (idCompressorEnabled) {
912
- const { IdCompressor, createSessionId } = await import("./id-compressor");
916
+ const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import(
917
+ "@fluidframework/id-compressor"
918
+ );
913
919
 
914
920
  const pendingLocalState = context.pendingLocalState as IPendingRuntimeState;
915
921
 
916
922
  if (pendingLocalState?.pendingIdCompressorState !== undefined) {
917
- idCompressor = IdCompressor.deserialize(pendingLocalState.pendingIdCompressorState);
923
+ idCompressor = deserializeIdCompressor(pendingLocalState.pendingIdCompressorState);
918
924
  } else if (serializedIdCompressor !== undefined) {
919
- idCompressor = IdCompressor.deserialize(serializedIdCompressor, createSessionId());
925
+ idCompressor = deserializeIdCompressor(serializedIdCompressor, createSessionId());
920
926
  } else {
921
- idCompressor = IdCompressor.create(logger);
927
+ idCompressor = createIdCompressor(logger);
922
928
  }
923
929
  }
924
930
 
@@ -963,6 +969,7 @@ export class ContainerRuntime
963
969
  }
964
970
 
965
971
  public readonly options: ILoaderOptions;
972
+ private imminentClosure: boolean = false;
966
973
 
967
974
  private readonly _getClientId: () => string | undefined;
968
975
  public get clientId(): string | undefined {
@@ -1214,9 +1221,7 @@ export class ContainerRuntime
1214
1221
  */
1215
1222
  private readonly loadedFromVersionId: string | undefined;
1216
1223
 
1217
- /**
1218
- * @internal
1219
- */
1224
+ /***/
1220
1225
  protected constructor(
1221
1226
  context: IContainerContext,
1222
1227
  private readonly registry: IFluidDataStoreRegistry,
@@ -1342,8 +1347,7 @@ export class ContainerRuntime
1342
1347
  eventName: "GCFeatureMatrix",
1343
1348
  metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
1344
1349
  inputs: JSON.stringify({
1345
- gcOptions_gcTombstoneGeneration:
1346
- this.runtimeOptions.gcOptions[gcTombstoneGenerationOptionName],
1350
+ gcOptions_gcGeneration: this.runtimeOptions.gcOptions[gcGenerationOptionName],
1347
1351
  }),
1348
1352
  });
1349
1353
 
@@ -1448,6 +1452,7 @@ export class ContainerRuntime
1448
1452
  // GC runs in summarizer client and needs access to the real (non-proxy) active information. The proxy
1449
1453
  // delta manager would always return false for summarizer client.
1450
1454
  activeConnection: () => this.innerDeltaManager.active,
1455
+ submitMessage: (message: ContainerRuntimeGCMessage) => this.submit(message),
1451
1456
  });
1452
1457
 
1453
1458
  const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
@@ -2083,6 +2088,9 @@ export class ContainerRuntime
2083
2088
  throw new Error("chunkedOp not expected here");
2084
2089
  case ContainerMessageType.Rejoin:
2085
2090
  throw new Error("rejoin not expected here");
2091
+ case ContainerMessageType.GC:
2092
+ // GC op is only sent in summarizer which should never have stashed ops.
2093
+ throw new LoggingError("GC op not expected to be stashed in summarizer");
2086
2094
  default: {
2087
2095
  // This should be extremely rare for stashed ops.
2088
2096
  // It would require a newer runtime stashing ops and then an older one applying them,
@@ -2336,6 +2344,9 @@ export class ContainerRuntime
2336
2344
  this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
2337
2345
  }
2338
2346
  break;
2347
+ case ContainerMessageType.GC:
2348
+ this.garbageCollector.processMessage(messageWithContext.message, local);
2349
+ break;
2339
2350
  case ContainerMessageType.ChunkedOp:
2340
2351
  case ContainerMessageType.Rejoin:
2341
2352
  break;
@@ -2582,7 +2593,6 @@ export class ContainerRuntime
2582
2593
 
2583
2594
  /**
2584
2595
  * @deprecated 0.16 Issue #1537, #3631
2585
- * @internal
2586
2596
  */
2587
2597
  public async _createDataStoreWithProps(
2588
2598
  pkg: string | string[],
@@ -2603,7 +2613,9 @@ export class ContainerRuntime
2603
2613
  private canSendOps() {
2604
2614
  // Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because
2605
2615
  // container runtime's ability to send ops depend on the actual readonly state of the delta manager.
2606
- return this.connected && !this.innerDeltaManager.readOnlyInfo.readonly;
2616
+ return (
2617
+ this.connected && !this.innerDeltaManager.readOnlyInfo.readonly && !this.imminentClosure
2618
+ );
2607
2619
  }
2608
2620
 
2609
2621
  /**
@@ -2632,18 +2644,28 @@ export class ContainerRuntime
2632
2644
  }
2633
2645
 
2634
2646
  private isContainerMessageDirtyable({ type, contents }: OutboundContainerRuntimeMessage) {
2635
- // For legacy purposes, exclude the old built-in AgentScheduler from dirty consideration as a special-case.
2636
- // Ultimately we should have no special-cases from the ContainerRuntime's perspective.
2637
- if (type === ContainerMessageType.Attach) {
2638
- const attachMessage = contents as InboundAttachMessage;
2639
- if (attachMessage.id === agentSchedulerId) {
2640
- return false;
2647
+ // Certain container runtime messages should not mark the container dirty such as the old built-in
2648
+ // AgentScheduler and Garbage collector messages.
2649
+ switch (type) {
2650
+ case ContainerMessageType.Attach: {
2651
+ const attachMessage = contents as InboundAttachMessage;
2652
+ if (attachMessage.id === agentSchedulerId) {
2653
+ return false;
2654
+ }
2655
+ break;
2641
2656
  }
2642
- } else if (type === ContainerMessageType.FluidDataStoreOp) {
2643
- const envelope = contents;
2644
- if (envelope.address === agentSchedulerId) {
2657
+ case ContainerMessageType.FluidDataStoreOp: {
2658
+ const envelope = contents;
2659
+ if (envelope.address === agentSchedulerId) {
2660
+ return false;
2661
+ }
2662
+ break;
2663
+ }
2664
+ case ContainerMessageType.GC: {
2645
2665
  return false;
2646
2666
  }
2667
+ default:
2668
+ break;
2647
2669
  }
2648
2670
  return true;
2649
2671
  }
@@ -2874,7 +2896,7 @@ export class ContainerRuntime
2874
2896
  * @param usedRoutes - The routes that are used in all nodes in this Container.
2875
2897
  * @see IGarbageCollectionRuntime.updateUsedRoutes
2876
2898
  */
2877
- public updateUsedRoutes(usedRoutes: string[]) {
2899
+ public updateUsedRoutes(usedRoutes: readonly string[]) {
2878
2900
  // Update our summarizer node's used routes. Updating used routes in summarizer node before
2879
2901
  // summarizing is required and asserted by the the summarizer node. We are the root and are
2880
2902
  // always referenced, so the used routes is only self-route (empty string).
@@ -2888,7 +2910,7 @@ export class ContainerRuntime
2888
2910
  * This is called to update objects whose routes are unused.
2889
2911
  * @param unusedRoutes - Data store and attachment blob routes that are unused in this Container.
2890
2912
  */
2891
- public updateUnusedRoutes(unusedRoutes: string[]) {
2913
+ public updateUnusedRoutes(unusedRoutes: readonly string[]) {
2892
2914
  const { blobManagerRoutes, dataStoreRoutes } =
2893
2915
  this.getDataStoreAndBlobManagerRoutes(unusedRoutes);
2894
2916
  this.blobManager.updateUnusedRoutes(blobManagerRoutes);
@@ -2898,7 +2920,7 @@ export class ContainerRuntime
2898
2920
  /**
2899
2921
  * @deprecated Replaced by deleteSweepReadyNodes.
2900
2922
  */
2901
- public deleteUnusedNodes(unusedRoutes: string[]): string[] {
2923
+ public deleteUnusedNodes(unusedRoutes: readonly string[]): string[] {
2902
2924
  throw new Error("deleteUnusedRoutes should not be called");
2903
2925
  }
2904
2926
 
@@ -2907,7 +2929,7 @@ export class ContainerRuntime
2907
2929
  * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.
2908
2930
  * @returns The routes of nodes that were deleted.
2909
2931
  */
2910
- public deleteSweepReadyNodes(sweepReadyRoutes: string[]): string[] {
2932
+ public deleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[] {
2911
2933
  const { dataStoreRoutes, blobManagerRoutes } =
2912
2934
  this.getDataStoreAndBlobManagerRoutes(sweepReadyRoutes);
2913
2935
 
@@ -2919,7 +2941,7 @@ export class ContainerRuntime
2919
2941
  * This is called to update objects that are tombstones.
2920
2942
  * @param tombstonedRoutes - Data store and attachment blob routes that are tombstones in this Container.
2921
2943
  */
2922
- public updateTombstonedRoutes(tombstonedRoutes: string[]) {
2944
+ public updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {
2923
2945
  const { blobManagerRoutes, dataStoreRoutes } =
2924
2946
  this.getDataStoreAndBlobManagerRoutes(tombstonedRoutes);
2925
2947
  this.blobManager.updateTombstonedRoutes(blobManagerRoutes);
@@ -2979,7 +3001,7 @@ export class ContainerRuntime
2979
3001
  * @returns Two route lists - One that contains routes for blob manager and another one that contains routes
2980
3002
  * for data stores.
2981
3003
  */
2982
- private getDataStoreAndBlobManagerRoutes(routes: string[]) {
3004
+ private getDataStoreAndBlobManagerRoutes(routes: readonly string[]) {
2983
3005
  const blobManagerRoutes: string[] = [];
2984
3006
  const dataStoreRoutes: string[] = [];
2985
3007
  for (const route of routes) {
@@ -3056,10 +3078,10 @@ export class ContainerRuntime
3056
3078
  );
3057
3079
  }
3058
3080
 
3059
- // If there are pending (unacked ops), the summary will not be eventual consistent and it may even be
3060
- // incorrect. So, wait for the container to be saved with a timeout. If the container is not saved
3061
- // within the timeout, check if it should be failed or can continue.
3062
- if (this.validateSummaryBeforeUpload && this.hasPendingMessages()) {
3081
+ // If the container is dirty, i.e., there are pending unacked ops, the summary will not be eventual consistent
3082
+ // and it may even be incorrect. So, wait for the container to be saved with a timeout. If the container is not
3083
+ // saved within the timeout, check if it should be failed or can continue.
3084
+ if (this.validateSummaryBeforeUpload && this.isDirty) {
3063
3085
  const countBefore = this.pendingMessagesCount;
3064
3086
  // The timeout for waiting for pending ops can be overridden via configurations.
3065
3087
  const pendingOpsTimeout =
@@ -3081,7 +3103,7 @@ export class ContainerRuntime
3081
3103
  // happens, whether we attempted to wait for these ops to be acked and what was the result.
3082
3104
  summaryNumberLogger.sendTelemetryEvent({
3083
3105
  eventName: "PendingOpsWhileSummarizing",
3084
- saved: this.hasPendingMessages() ? false : true,
3106
+ saved: !this.isDirty,
3085
3107
  timeout: pendingOpsTimeout,
3086
3108
  countBefore,
3087
3109
  countAfter: this.pendingMessagesCount,
@@ -3360,7 +3382,7 @@ export class ContainerRuntime
3360
3382
  }
3361
3383
 
3362
3384
  /**
3363
- * This helper is called during summarization. If there are pending ops, it will return a failed summarize result
3385
+ * This helper is called during summarization. If the container is dirty, it will return a failed summarize result
3364
3386
  * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.
3365
3387
  * @param logger - The logger to be used for sending telemetry.
3366
3388
  * @param referenceSequenceNumber - The reference sequence number of the summary attempt.
@@ -3376,7 +3398,7 @@ export class ContainerRuntime
3376
3398
  finalAttempt: boolean,
3377
3399
  beforeSummaryGeneration: boolean,
3378
3400
  ): Promise<IBaseSummarizeResult | undefined> {
3379
- if (!this.hasPendingMessages()) {
3401
+ if (!this.isDirty) {
3380
3402
  return;
3381
3403
  }
3382
3404
 
@@ -3724,6 +3746,7 @@ export class ContainerRuntime
3724
3746
  /**
3725
3747
  * Finds the right store and asks it to resubmit the message. This typically happens when we
3726
3748
  * reconnect and there are pending messages.
3749
+ * ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)
3727
3750
  * @param message - The original LocalContainerRuntimeMessage.
3728
3751
  * @param localOpMetadata - The local metadata associated with the original message.
3729
3752
  */
@@ -3752,6 +3775,9 @@ export class ContainerRuntime
3752
3775
  case ContainerMessageType.Rejoin:
3753
3776
  this.submit(message);
3754
3777
  break;
3778
+ case ContainerMessageType.GC:
3779
+ // GC op is only sent in summarizer which should never reconnect.
3780
+ throw new LoggingError("GC op not expected to be resubmitted in summarizer");
3755
3781
  default: {
3756
3782
  // This case should be very rare - it would imply an op was stashed from a
3757
3783
  // future version of runtime code and now is being applied on an older version
@@ -3963,7 +3989,11 @@ export class ContainerRuntime
3963
3989
  },
3964
3990
  async (event) => {
3965
3991
  this.verifyNotClosed();
3966
- const waitBlobsToAttach = props?.notifyImminentClosure;
3992
+ // in case imminentClosure is set to true by future code, we don't
3993
+ // try to change its value
3994
+ if (!this.imminentClosure) {
3995
+ this.imminentClosure = props?.notifyImminentClosure ?? this.imminentClosure;
3996
+ }
3967
3997
  const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
3968
3998
  if (this._orderSequentiallyCalls !== 0) {
3969
3999
  throw new UsageError("can't get state during orderSequentially");
@@ -3972,7 +4002,7 @@ export class ContainerRuntime
3972
4002
  // getPendingLocalState() is only exposed through Container.closeAndGetPendingLocalState(), so it's safe
3973
4003
  // to close current batch.
3974
4004
  this.flush();
3975
- const pendingAttachmentBlobs = waitBlobsToAttach
4005
+ const pendingAttachmentBlobs = this.imminentClosure
3976
4006
  ? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
3977
4007
  : undefined;
3978
4008
  const pending = this.pendingStateManager.getLocalState();
@@ -10,7 +10,7 @@ import {
10
10
  } from "@fluidframework/runtime-definitions";
11
11
 
12
12
  /**
13
- * @public
13
+ * @internal
14
14
  */
15
15
  export class FluidDataStoreRegistry implements IFluidDataStoreRegistry {
16
16
  private readonly map: Map<