@fluidframework/container-runtime 2.0.0-internal.7.2.2 → 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 (302) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -2
  3. package/api-extractor-lint.json +13 -0
  4. package/api-extractor.json +9 -1
  5. package/api-report/container-runtime.api.md +124 -107
  6. package/dist/batchTracker.d.ts +1 -0
  7. package/dist/batchTracker.d.ts.map +1 -1
  8. package/dist/blobManager.d.ts +4 -4
  9. package/dist/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager.js.map +1 -1
  11. package/dist/connectionTelemetry.js +1 -1
  12. package/dist/connectionTelemetry.js.map +1 -1
  13. package/dist/container-runtime-alpha.d.ts +1473 -0
  14. package/dist/container-runtime-beta.d.ts +300 -0
  15. package/dist/container-runtime-public.d.ts +300 -0
  16. package/dist/container-runtime-untrimmed.d.ts +1836 -0
  17. package/dist/containerRuntime.d.ts +34 -40
  18. package/dist/containerRuntime.d.ts.map +1 -1
  19. package/dist/containerRuntime.js +79 -67
  20. package/dist/containerRuntime.js.map +1 -1
  21. package/dist/dataStoreRegistry.d.ts +1 -1
  22. package/dist/dataStoreRegistry.js +1 -1
  23. package/dist/dataStoreRegistry.js.map +1 -1
  24. package/dist/dataStores.d.ts +10 -15
  25. package/dist/dataStores.d.ts.map +1 -1
  26. package/dist/dataStores.js +77 -40
  27. package/dist/dataStores.js.map +1 -1
  28. package/dist/gc/garbageCollection.d.ts +41 -13
  29. package/dist/gc/garbageCollection.d.ts.map +1 -1
  30. package/dist/gc/garbageCollection.js +215 -78
  31. package/dist/gc/garbageCollection.js.map +1 -1
  32. package/dist/gc/gcConfigs.d.ts.map +1 -1
  33. package/dist/gc/gcConfigs.js +34 -37
  34. package/dist/gc/gcConfigs.js.map +1 -1
  35. package/dist/gc/gcDefinitions.d.ts +121 -46
  36. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  37. package/dist/gc/gcDefinitions.js +26 -18
  38. package/dist/gc/gcDefinitions.js.map +1 -1
  39. package/dist/gc/gcHelpers.d.ts +18 -25
  40. package/dist/gc/gcHelpers.d.ts.map +1 -1
  41. package/dist/gc/gcHelpers.js +29 -45
  42. package/dist/gc/gcHelpers.js.map +1 -1
  43. package/dist/gc/gcTelemetry.d.ts +0 -5
  44. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  45. package/dist/gc/gcTelemetry.js +14 -42
  46. package/dist/gc/gcTelemetry.js.map +1 -1
  47. package/dist/gc/gcUnreferencedStateTracker.d.ts +11 -5
  48. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  49. package/dist/gc/gcUnreferencedStateTracker.js +43 -19
  50. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  51. package/dist/gc/index.d.ts +1 -1
  52. package/dist/gc/index.d.ts.map +1 -1
  53. package/dist/gc/index.js +4 -5
  54. package/dist/gc/index.js.map +1 -1
  55. package/dist/index.d.ts +14 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +16 -5
  58. package/dist/index.js.map +1 -1
  59. package/dist/messageTypes.d.ts +16 -11
  60. package/dist/messageTypes.d.ts.map +1 -1
  61. package/dist/messageTypes.js +6 -1
  62. package/dist/messageTypes.js.map +1 -1
  63. package/dist/metadata.d.ts +6 -0
  64. package/dist/metadata.d.ts.map +1 -1
  65. package/dist/metadata.js.map +1 -1
  66. package/dist/opLifecycle/definitions.d.ts +1 -1
  67. package/dist/opLifecycle/definitions.js.map +1 -1
  68. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  69. package/dist/opLifecycle/opGroupingManager.js +10 -1
  70. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  71. package/dist/opLifecycle/outbox.d.ts +2 -0
  72. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  73. package/dist/opLifecycle/outbox.js +21 -0
  74. package/dist/opLifecycle/outbox.js.map +1 -1
  75. package/dist/packageVersion.d.ts +1 -1
  76. package/dist/packageVersion.js +1 -1
  77. package/dist/packageVersion.js.map +1 -1
  78. package/dist/pendingStateManager.d.ts +1 -1
  79. package/dist/pendingStateManager.d.ts.map +1 -1
  80. package/dist/pendingStateManager.js +2 -11
  81. package/dist/pendingStateManager.js.map +1 -1
  82. package/dist/scheduleManager.d.ts +1 -0
  83. package/dist/scheduleManager.d.ts.map +1 -1
  84. package/dist/summary/orderedClientElection.d.ts +1 -1
  85. package/dist/summary/orderedClientElection.js.map +1 -1
  86. package/dist/summary/runWhileConnectedCoordinator.d.ts +2 -2
  87. package/dist/summary/runWhileConnectedCoordinator.js +1 -1
  88. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  89. package/dist/summary/summarizer.d.ts +1 -1
  90. package/dist/summary/summarizer.js +1 -1
  91. package/dist/summary/summarizer.js.map +1 -1
  92. package/dist/summary/summarizerTypes.d.ts +30 -30
  93. package/dist/summary/summarizerTypes.js.map +1 -1
  94. package/dist/summary/summaryCollection.d.ts +10 -10
  95. package/dist/summary/summaryCollection.js +1 -1
  96. package/dist/summary/summaryCollection.js.map +1 -1
  97. package/dist/summary/summaryFormat.d.ts +3 -3
  98. package/dist/summary/summaryFormat.js.map +1 -1
  99. package/dist/tsdoc-metadata.json +1 -1
  100. package/lib/batchTracker.d.ts +1 -0
  101. package/lib/batchTracker.d.ts.map +1 -1
  102. package/lib/blobManager.d.ts +4 -4
  103. package/lib/blobManager.d.ts.map +1 -1
  104. package/lib/blobManager.js.map +1 -1
  105. package/lib/connectionTelemetry.js +1 -1
  106. package/lib/connectionTelemetry.js.map +1 -1
  107. package/lib/container-runtime-alpha.d.ts +1473 -0
  108. package/lib/container-runtime-beta.d.ts +300 -0
  109. package/lib/container-runtime-public.d.ts +300 -0
  110. package/lib/container-runtime-untrimmed.d.ts +1836 -0
  111. package/lib/containerRuntime.d.ts +34 -40
  112. package/lib/containerRuntime.d.ts.map +1 -1
  113. package/lib/containerRuntime.js +81 -69
  114. package/lib/containerRuntime.js.map +1 -1
  115. package/lib/dataStoreRegistry.d.ts +1 -1
  116. package/lib/dataStoreRegistry.js +1 -1
  117. package/lib/dataStoreRegistry.js.map +1 -1
  118. package/lib/dataStores.d.ts +10 -15
  119. package/lib/dataStores.d.ts.map +1 -1
  120. package/lib/dataStores.js +80 -43
  121. package/lib/dataStores.js.map +1 -1
  122. package/lib/gc/garbageCollection.d.ts +41 -13
  123. package/lib/gc/garbageCollection.d.ts.map +1 -1
  124. package/lib/gc/garbageCollection.js +217 -80
  125. package/lib/gc/garbageCollection.js.map +1 -1
  126. package/lib/gc/gcConfigs.d.ts.map +1 -1
  127. package/lib/gc/gcConfigs.js +37 -40
  128. package/lib/gc/gcConfigs.js.map +1 -1
  129. package/lib/gc/gcDefinitions.d.ts +121 -46
  130. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  131. package/lib/gc/gcDefinitions.js +25 -17
  132. package/lib/gc/gcDefinitions.js.map +1 -1
  133. package/lib/gc/gcHelpers.d.ts +18 -25
  134. package/lib/gc/gcHelpers.d.ts.map +1 -1
  135. package/lib/gc/gcHelpers.js +27 -43
  136. package/lib/gc/gcHelpers.js.map +1 -1
  137. package/lib/gc/gcTelemetry.d.ts +0 -5
  138. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  139. package/lib/gc/gcTelemetry.js +15 -43
  140. package/lib/gc/gcTelemetry.js.map +1 -1
  141. package/lib/gc/gcUnreferencedStateTracker.d.ts +11 -5
  142. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  143. package/lib/gc/gcUnreferencedStateTracker.js +43 -19
  144. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  145. package/lib/gc/index.d.ts +1 -1
  146. package/lib/gc/index.d.ts.map +1 -1
  147. package/lib/gc/index.js +1 -1
  148. package/lib/gc/index.js.map +1 -1
  149. package/lib/index.d.ts +14 -2
  150. package/lib/index.d.ts.map +1 -1
  151. package/lib/index.js +15 -1
  152. package/lib/index.js.map +1 -1
  153. package/lib/messageTypes.d.ts +16 -11
  154. package/lib/messageTypes.d.ts.map +1 -1
  155. package/lib/messageTypes.js +6 -1
  156. package/lib/messageTypes.js.map +1 -1
  157. package/lib/metadata.d.ts +6 -0
  158. package/lib/metadata.d.ts.map +1 -1
  159. package/lib/metadata.js.map +1 -1
  160. package/lib/opLifecycle/definitions.d.ts +1 -1
  161. package/lib/opLifecycle/definitions.js.map +1 -1
  162. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  163. package/lib/opLifecycle/opGroupingManager.js +10 -1
  164. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  165. package/lib/opLifecycle/outbox.d.ts +2 -0
  166. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  167. package/lib/opLifecycle/outbox.js +21 -0
  168. package/lib/opLifecycle/outbox.js.map +1 -1
  169. package/lib/packageVersion.d.ts +1 -1
  170. package/lib/packageVersion.js +1 -1
  171. package/lib/packageVersion.js.map +1 -1
  172. package/lib/pendingStateManager.d.ts +1 -1
  173. package/lib/pendingStateManager.d.ts.map +1 -1
  174. package/lib/pendingStateManager.js +2 -11
  175. package/lib/pendingStateManager.js.map +1 -1
  176. package/lib/scheduleManager.d.ts +1 -0
  177. package/lib/scheduleManager.d.ts.map +1 -1
  178. package/lib/summary/orderedClientElection.d.ts +1 -1
  179. package/lib/summary/orderedClientElection.js.map +1 -1
  180. package/lib/summary/runWhileConnectedCoordinator.d.ts +2 -2
  181. package/lib/summary/runWhileConnectedCoordinator.js +1 -1
  182. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  183. package/lib/summary/summarizer.d.ts +1 -1
  184. package/lib/summary/summarizer.js +1 -1
  185. package/lib/summary/summarizer.js.map +1 -1
  186. package/lib/summary/summarizerTypes.d.ts +30 -30
  187. package/lib/summary/summarizerTypes.js.map +1 -1
  188. package/lib/summary/summaryCollection.d.ts +10 -10
  189. package/lib/summary/summaryCollection.js +1 -1
  190. package/lib/summary/summaryCollection.js.map +1 -1
  191. package/lib/summary/summaryFormat.d.ts +3 -3
  192. package/lib/summary/summaryFormat.js.map +1 -1
  193. package/package.json +56 -29
  194. package/src/blobManager.ts +5 -5
  195. package/src/connectionTelemetry.ts +1 -1
  196. package/src/containerRuntime.ts +113 -90
  197. package/src/dataStoreRegistry.ts +1 -1
  198. package/src/dataStores.ts +140 -69
  199. package/src/gc/garbageCollection.md +14 -15
  200. package/src/gc/garbageCollection.ts +256 -96
  201. package/src/gc/gcConfigs.ts +50 -52
  202. package/src/gc/gcDefinitions.ts +137 -52
  203. package/src/gc/gcHelpers.ts +31 -52
  204. package/src/gc/gcTelemetry.ts +16 -57
  205. package/src/gc/gcUnreferencedStateTracker.ts +61 -22
  206. package/src/gc/index.ts +6 -4
  207. package/src/index.ts +19 -1
  208. package/src/messageTypes.ts +21 -11
  209. package/src/metadata.ts +7 -0
  210. package/src/opLifecycle/definitions.ts +1 -1
  211. package/src/opLifecycle/opGroupingManager.ts +10 -1
  212. package/src/opLifecycle/outbox.ts +34 -0
  213. package/src/packageVersion.ts +1 -1
  214. package/src/pendingStateManager.ts +3 -13
  215. package/src/summary/orderedClientElection.ts +1 -1
  216. package/src/summary/runWhileConnectedCoordinator.ts +2 -2
  217. package/src/summary/summarizer.ts +1 -1
  218. package/src/summary/summarizerTypes.ts +30 -30
  219. package/src/summary/summaryCollection.ts +10 -10
  220. package/src/summary/summaryFormat.ts +3 -3
  221. package/dist/id-compressor/appendOnlySortedMap.d.ts +0 -124
  222. package/dist/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  223. package/dist/id-compressor/appendOnlySortedMap.js +0 -318
  224. package/dist/id-compressor/appendOnlySortedMap.js.map +0 -1
  225. package/dist/id-compressor/finalSpace.d.ts +0 -29
  226. package/dist/id-compressor/finalSpace.d.ts.map +0 -1
  227. package/dist/id-compressor/finalSpace.js +0 -62
  228. package/dist/id-compressor/finalSpace.js.map +0 -1
  229. package/dist/id-compressor/idCompressor.d.ts +0 -54
  230. package/dist/id-compressor/idCompressor.d.ts.map +0 -1
  231. package/dist/id-compressor/idCompressor.js +0 -495
  232. package/dist/id-compressor/idCompressor.js.map +0 -1
  233. package/dist/id-compressor/identifiers.d.ts +0 -32
  234. package/dist/id-compressor/identifiers.d.ts.map +0 -1
  235. package/dist/id-compressor/identifiers.js +0 -15
  236. package/dist/id-compressor/identifiers.js.map +0 -1
  237. package/dist/id-compressor/index.d.ts +0 -13
  238. package/dist/id-compressor/index.d.ts.map +0 -1
  239. package/dist/id-compressor/index.js +0 -32
  240. package/dist/id-compressor/index.js.map +0 -1
  241. package/dist/id-compressor/persistanceUtilities.d.ts +0 -22
  242. package/dist/id-compressor/persistanceUtilities.d.ts.map +0 -1
  243. package/dist/id-compressor/persistanceUtilities.js +0 -43
  244. package/dist/id-compressor/persistanceUtilities.js.map +0 -1
  245. package/dist/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  246. package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  247. package/dist/id-compressor/sessionSpaceNormalizer.js +0 -80
  248. package/dist/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  249. package/dist/id-compressor/sessions.d.ts +0 -115
  250. package/dist/id-compressor/sessions.d.ts.map +0 -1
  251. package/dist/id-compressor/sessions.js +0 -305
  252. package/dist/id-compressor/sessions.js.map +0 -1
  253. package/dist/id-compressor/utilities.d.ts +0 -52
  254. package/dist/id-compressor/utilities.d.ts.map +0 -1
  255. package/dist/id-compressor/utilities.js +0 -169
  256. package/dist/id-compressor/utilities.js.map +0 -1
  257. package/lib/id-compressor/appendOnlySortedMap.d.ts +0 -124
  258. package/lib/id-compressor/appendOnlySortedMap.d.ts.map +0 -1
  259. package/lib/id-compressor/appendOnlySortedMap.js +0 -314
  260. package/lib/id-compressor/appendOnlySortedMap.js.map +0 -1
  261. package/lib/id-compressor/finalSpace.d.ts +0 -29
  262. package/lib/id-compressor/finalSpace.d.ts.map +0 -1
  263. package/lib/id-compressor/finalSpace.js +0 -58
  264. package/lib/id-compressor/finalSpace.js.map +0 -1
  265. package/lib/id-compressor/idCompressor.d.ts +0 -54
  266. package/lib/id-compressor/idCompressor.d.ts.map +0 -1
  267. package/lib/id-compressor/idCompressor.js +0 -491
  268. package/lib/id-compressor/idCompressor.js.map +0 -1
  269. package/lib/id-compressor/identifiers.d.ts +0 -32
  270. package/lib/id-compressor/identifiers.d.ts.map +0 -1
  271. package/lib/id-compressor/identifiers.js +0 -11
  272. package/lib/id-compressor/identifiers.js.map +0 -1
  273. package/lib/id-compressor/index.d.ts +0 -13
  274. package/lib/id-compressor/index.d.ts.map +0 -1
  275. package/lib/id-compressor/index.js +0 -13
  276. package/lib/id-compressor/index.js.map +0 -1
  277. package/lib/id-compressor/persistanceUtilities.d.ts +0 -22
  278. package/lib/id-compressor/persistanceUtilities.d.ts.map +0 -1
  279. package/lib/id-compressor/persistanceUtilities.js +0 -34
  280. package/lib/id-compressor/persistanceUtilities.js.map +0 -1
  281. package/lib/id-compressor/sessionSpaceNormalizer.d.ts +0 -46
  282. package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +0 -1
  283. package/lib/id-compressor/sessionSpaceNormalizer.js +0 -76
  284. package/lib/id-compressor/sessionSpaceNormalizer.js.map +0 -1
  285. package/lib/id-compressor/sessions.d.ts +0 -115
  286. package/lib/id-compressor/sessions.d.ts.map +0 -1
  287. package/lib/id-compressor/sessions.js +0 -290
  288. package/lib/id-compressor/sessions.js.map +0 -1
  289. package/lib/id-compressor/utilities.d.ts +0 -52
  290. package/lib/id-compressor/utilities.d.ts.map +0 -1
  291. package/lib/id-compressor/utilities.js +0 -151
  292. package/lib/id-compressor/utilities.js.map +0 -1
  293. package/src/id-compressor/README.md +0 -3
  294. package/src/id-compressor/appendOnlySortedMap.ts +0 -366
  295. package/src/id-compressor/finalSpace.ts +0 -67
  296. package/src/id-compressor/idCompressor.ts +0 -630
  297. package/src/id-compressor/identifiers.ts +0 -42
  298. package/src/id-compressor/index.ts +0 -26
  299. package/src/id-compressor/persistanceUtilities.ts +0 -58
  300. package/src/id-compressor/sessionSpaceNormalizer.ts +0 -83
  301. package/src/id-compressor/sessions.ts +0 -405
  302. 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
- IdCreationRangeWithStashedState,
95
- } from "@fluidframework/runtime-definitions";
97
+ SerializedIdCompressorWithOngoingSession,
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,
@@ -185,16 +188,16 @@ import {
185
188
  getLongStack,
186
189
  } from "./opLifecycle";
187
190
  import { DeltaManagerSummarizerProxy } from "./deltaManagerSummarizerProxy";
188
- import { IBatchMetadata } from "./metadata";
191
+ import { IBatchMetadata, IIdAllocationMetadata } from "./metadata";
189
192
  import {
190
193
  ContainerMessageType,
191
194
  type InboundSequencedContainerRuntimeMessage,
192
195
  type InboundSequencedContainerRuntimeMessageOrSystemMessage,
193
196
  type ContainerRuntimeIdAllocationMessage,
194
- type LocalContainerRuntimeIdAllocationMessage,
195
197
  type LocalContainerRuntimeMessage,
196
198
  type OutboundContainerRuntimeMessage,
197
199
  type UnknownContainerRuntimeMessage,
200
+ ContainerRuntimeGCMessage,
198
201
  } from "./messageTypes";
199
202
 
200
203
  /**
@@ -213,17 +216,8 @@ function compatBehaviorAllowsMessageType(
213
216
  return compatBehavior === "Ignore";
214
217
  }
215
218
 
216
- function prepareLocalContainerRuntimeIdAllocationMessageForTransit(
217
- message: LocalContainerRuntimeIdAllocationMessage | ContainerRuntimeIdAllocationMessage,
218
- ): asserts message is ContainerRuntimeIdAllocationMessage {
219
- // Remove the stashedState from the op if it's a stashed op
220
- if ("stashedState" in message.contents) {
221
- delete message.contents.stashedState;
222
- }
223
- }
224
-
225
219
  /**
226
- * @public
220
+ * @alpha
227
221
  */
228
222
  export interface ISummaryBaseConfiguration {
229
223
  /**
@@ -245,7 +239,7 @@ export interface ISummaryBaseConfiguration {
245
239
  }
246
240
 
247
241
  /**
248
- * @public
242
+ * @alpha
249
243
  */
250
244
  export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {
251
245
  state: "enabled";
@@ -308,21 +302,21 @@ export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfigurati
308
302
  }
309
303
 
310
304
  /**
311
- * @public
305
+ * @alpha
312
306
  */
313
307
  export interface ISummaryConfigurationDisableSummarizer {
314
308
  state: "disabled";
315
309
  }
316
310
 
317
311
  /**
318
- * @public
312
+ * @alpha
319
313
  */
320
314
  export interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConfiguration {
321
315
  state: "disableHeuristics";
322
316
  }
323
317
 
324
318
  /**
325
- * @public
319
+ * @alpha
326
320
  */
327
321
  export type ISummaryConfiguration =
328
322
  | ISummaryConfigurationDisableSummarizer
@@ -330,7 +324,7 @@ export type ISummaryConfiguration =
330
324
  | ISummaryConfigurationHeuristics;
331
325
 
332
326
  /**
333
- * @public
327
+ * @internal
334
328
  */
335
329
  export const DefaultSummaryConfiguration: ISummaryConfiguration = {
336
330
  state: "enabled",
@@ -359,7 +353,7 @@ export const DefaultSummaryConfiguration: ISummaryConfiguration = {
359
353
  };
360
354
 
361
355
  /**
362
- * @public
356
+ * @alpha
363
357
  */
364
358
  export interface ISummaryRuntimeOptions {
365
359
  /** Override summary configurations set by the server. */
@@ -376,7 +370,7 @@ export interface ISummaryRuntimeOptions {
376
370
 
377
371
  /**
378
372
  * Options for op compression.
379
- * @public
373
+ * @alpha
380
374
  */
381
375
  export interface ICompressionRuntimeOptions {
382
376
  /**
@@ -394,7 +388,7 @@ export interface ICompressionRuntimeOptions {
394
388
 
395
389
  /**
396
390
  * Options for container runtime.
397
- * @public
391
+ * @alpha
398
392
  */
399
393
  export interface IContainerRuntimeOptions {
400
394
  readonly summaryOptions?: ISummaryRuntimeOptions;
@@ -476,7 +470,7 @@ export interface IContainerRuntimeOptions {
476
470
 
477
471
  /**
478
472
  * Accepted header keys for requests coming to the runtime.
479
- * @public
473
+ * @internal
480
474
  */
481
475
  export enum RuntimeHeaders {
482
476
  /** True to wait for a data store to be created and loaded before returning it. */
@@ -486,23 +480,23 @@ export enum RuntimeHeaders {
486
480
  }
487
481
 
488
482
  /** True if a tombstoned object should be returned without erroring
489
- * @public
483
+ * @internal
490
484
  */
491
485
  export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
492
486
  /**
493
487
  * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
494
- * @public
488
+ * @internal
495
489
  */
496
490
  export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
497
491
 
498
492
  /**
499
493
  * Tombstone error responses will have this header set to true
500
- * @public
494
+ * @internal
501
495
  */
502
496
  export const TombstoneResponseHeaderKey = "isTombstoned";
503
497
  /**
504
498
  * Inactive error responses will have this header set to true
505
- * @public
499
+ * @internal
506
500
  */
507
501
  export const InactiveResponseHeaderKey = "isInactive";
508
502
 
@@ -526,7 +520,7 @@ export const defaultRuntimeHeaderData: Required<RuntimeHeaderData> = {
526
520
 
527
521
  /**
528
522
  * Available compression algorithms for op compression.
529
- * @public
523
+ * @alpha
530
524
  */
531
525
  export enum CompressionAlgorithms {
532
526
  lz4 = "lz4",
@@ -557,6 +551,10 @@ export interface IPendingRuntimeState {
557
551
  * Pending blobs from BlobManager
558
552
  */
559
553
  pendingAttachmentBlobs?: IPendingBlobs;
554
+ /**
555
+ * Pending idCompressor state
556
+ */
557
+ pendingIdCompressorState?: SerializedIdCompressorWithOngoingSession;
560
558
  }
561
559
 
562
560
  const maxConsecutiveReconnectsKey = "Fluid.ContainerRuntime.MaxConsecutiveReconnects";
@@ -591,7 +589,7 @@ const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
591
589
 
592
590
  /**
593
591
  * @deprecated use ContainerRuntimeMessageType instead
594
- * @public
592
+ * @internal
595
593
  */
596
594
  export enum RuntimeMessage {
597
595
  FluidDataStoreOp = "component",
@@ -605,7 +603,7 @@ export enum RuntimeMessage {
605
603
 
606
604
  /**
607
605
  * @deprecated please use version in driver-utils
608
- * @public
606
+ * @internal
609
607
  */
610
608
  export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean {
611
609
  return (Object.values(RuntimeMessage) as string[]).includes(message.type);
@@ -615,7 +613,7 @@ export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean {
615
613
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
616
614
  * special-case for document dirty state. Ultimately we should have no special-cases from the
617
615
  * ContainerRuntime's perspective.
618
- * @public
616
+ * @internal
619
617
  */
620
618
  export const agentSchedulerId = "_scheduler";
621
619
 
@@ -724,7 +722,7 @@ export async function TEST_requestSummarizer(loader: ILoader, url: string): Prom
724
722
  /**
725
723
  * Represents the runtime of the container. Contains helper functions/state of the container.
726
724
  * It will define the store level mappings.
727
- * @public
725
+ * @alpha
728
726
  */
729
727
  export class ContainerRuntime
730
728
  extends TypedEventEmitter<IContainerRuntimeEvents & ISummarizerEvents>
@@ -915,11 +913,19 @@ export class ContainerRuntime
915
913
  metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
916
914
  let idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
917
915
  if (idCompressorEnabled) {
918
- const { IdCompressor, createSessionId } = await import("./id-compressor");
919
- idCompressor =
920
- serializedIdCompressor !== undefined
921
- ? IdCompressor.deserialize(serializedIdCompressor, createSessionId())
922
- : IdCompressor.create(logger);
916
+ const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import(
917
+ "@fluidframework/id-compressor"
918
+ );
919
+
920
+ const pendingLocalState = context.pendingLocalState as IPendingRuntimeState;
921
+
922
+ if (pendingLocalState?.pendingIdCompressorState !== undefined) {
923
+ idCompressor = deserializeIdCompressor(pendingLocalState.pendingIdCompressorState);
924
+ } else if (serializedIdCompressor !== undefined) {
925
+ idCompressor = deserializeIdCompressor(serializedIdCompressor, createSessionId());
926
+ } else {
927
+ idCompressor = createIdCompressor(logger);
928
+ }
923
929
  }
924
930
 
925
931
  const runtime = new containerRuntimeCtor(
@@ -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;
@@ -2050,20 +2055,6 @@ export class ContainerRuntime
2050
2055
  this.updateDocumentDirtyState(newState);
2051
2056
  }
2052
2057
 
2053
- /**
2054
- * Updates the runtime's IdCompressor with the stashed state present in the given op. This is a bit of a
2055
- * hack and is unnecessarily expensive. As it stands, every locally stashed op (all ops that get stored in
2056
- * the PendingStateManager) will store their serialized representation locally until ack'd. Upon receiving
2057
- * this stashed state, the IdCompressor blindly deserializes to the stashed state and assumes the session.
2058
- * Technically only the last stashed state is needed to do this correctly, but we would have to write some
2059
- * more hacky code to modify the batch before it gets sent out.
2060
- * @param content - An IdAllocationOp with "stashedState", which is a representation of un-ack'd local state.
2061
- */
2062
- private async applyStashedIdAllocationOp(op: IdCreationRangeWithStashedState) {
2063
- const { IdCompressor } = await import("./id-compressor");
2064
- this.idCompressor = IdCompressor.deserialize(op.stashedState);
2065
- }
2066
-
2067
2058
  /**
2068
2059
  * Parse an op's type and actual content from given serialized content
2069
2060
  * ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
@@ -2089,7 +2080,7 @@ export class ContainerRuntime
2089
2080
  this.idCompressor !== undefined,
2090
2081
  0x67b /* IdCompressor should be defined if enabled */,
2091
2082
  );
2092
- return this.applyStashedIdAllocationOp(opContents.contents);
2083
+ return;
2093
2084
  case ContainerMessageType.Alias:
2094
2085
  case ContainerMessageType.BlobAttach:
2095
2086
  return;
@@ -2097,6 +2088,9 @@ export class ContainerRuntime
2097
2088
  throw new Error("chunkedOp not expected here");
2098
2089
  case ContainerMessageType.Rejoin:
2099
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");
2100
2094
  default: {
2101
2095
  // This should be extremely rare for stashed ops.
2102
2096
  // It would require a newer runtime stashing ops and then an older one applying them,
@@ -2341,7 +2335,17 @@ export class ContainerRuntime
2341
2335
  this.idCompressor !== undefined,
2342
2336
  0x67c /* IdCompressor should be defined if enabled */,
2343
2337
  );
2344
- this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
2338
+
2339
+ // Don't re-finalize the range if we're processing a "savedOp" in
2340
+ // stashed ops flow. The compressor is stashed with these ops already processed.
2341
+ if (
2342
+ (messageWithContext.message.metadata as IIdAllocationMetadata)?.savedOp !== true
2343
+ ) {
2344
+ this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
2345
+ }
2346
+ break;
2347
+ case ContainerMessageType.GC:
2348
+ this.garbageCollector.processMessage(messageWithContext.message, local);
2345
2349
  break;
2346
2350
  case ContainerMessageType.ChunkedOp:
2347
2351
  case ContainerMessageType.Rejoin:
@@ -2589,7 +2593,6 @@ export class ContainerRuntime
2589
2593
 
2590
2594
  /**
2591
2595
  * @deprecated 0.16 Issue #1537, #3631
2592
- * @internal
2593
2596
  */
2594
2597
  public async _createDataStoreWithProps(
2595
2598
  pkg: string | string[],
@@ -2610,7 +2613,9 @@ export class ContainerRuntime
2610
2613
  private canSendOps() {
2611
2614
  // Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because
2612
2615
  // container runtime's ability to send ops depend on the actual readonly state of the delta manager.
2613
- return this.connected && !this.innerDeltaManager.readOnlyInfo.readonly;
2616
+ return (
2617
+ this.connected && !this.innerDeltaManager.readOnlyInfo.readonly && !this.imminentClosure
2618
+ );
2614
2619
  }
2615
2620
 
2616
2621
  /**
@@ -2639,18 +2644,28 @@ export class ContainerRuntime
2639
2644
  }
2640
2645
 
2641
2646
  private isContainerMessageDirtyable({ type, contents }: OutboundContainerRuntimeMessage) {
2642
- // For legacy purposes, exclude the old built-in AgentScheduler from dirty consideration as a special-case.
2643
- // Ultimately we should have no special-cases from the ContainerRuntime's perspective.
2644
- if (type === ContainerMessageType.Attach) {
2645
- const attachMessage = contents as InboundAttachMessage;
2646
- if (attachMessage.id === agentSchedulerId) {
2647
- 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;
2656
+ }
2657
+ case ContainerMessageType.FluidDataStoreOp: {
2658
+ const envelope = contents;
2659
+ if (envelope.address === agentSchedulerId) {
2660
+ return false;
2661
+ }
2662
+ break;
2648
2663
  }
2649
- } else if (type === ContainerMessageType.FluidDataStoreOp) {
2650
- const envelope = contents;
2651
- if (envelope.address === agentSchedulerId) {
2664
+ case ContainerMessageType.GC: {
2652
2665
  return false;
2653
2666
  }
2667
+ default:
2668
+ break;
2654
2669
  }
2655
2670
  return true;
2656
2671
  }
@@ -2881,7 +2896,7 @@ export class ContainerRuntime
2881
2896
  * @param usedRoutes - The routes that are used in all nodes in this Container.
2882
2897
  * @see IGarbageCollectionRuntime.updateUsedRoutes
2883
2898
  */
2884
- public updateUsedRoutes(usedRoutes: string[]) {
2899
+ public updateUsedRoutes(usedRoutes: readonly string[]) {
2885
2900
  // Update our summarizer node's used routes. Updating used routes in summarizer node before
2886
2901
  // summarizing is required and asserted by the the summarizer node. We are the root and are
2887
2902
  // always referenced, so the used routes is only self-route (empty string).
@@ -2895,7 +2910,7 @@ export class ContainerRuntime
2895
2910
  * This is called to update objects whose routes are unused.
2896
2911
  * @param unusedRoutes - Data store and attachment blob routes that are unused in this Container.
2897
2912
  */
2898
- public updateUnusedRoutes(unusedRoutes: string[]) {
2913
+ public updateUnusedRoutes(unusedRoutes: readonly string[]) {
2899
2914
  const { blobManagerRoutes, dataStoreRoutes } =
2900
2915
  this.getDataStoreAndBlobManagerRoutes(unusedRoutes);
2901
2916
  this.blobManager.updateUnusedRoutes(blobManagerRoutes);
@@ -2905,7 +2920,7 @@ export class ContainerRuntime
2905
2920
  /**
2906
2921
  * @deprecated Replaced by deleteSweepReadyNodes.
2907
2922
  */
2908
- public deleteUnusedNodes(unusedRoutes: string[]): string[] {
2923
+ public deleteUnusedNodes(unusedRoutes: readonly string[]): string[] {
2909
2924
  throw new Error("deleteUnusedRoutes should not be called");
2910
2925
  }
2911
2926
 
@@ -2914,7 +2929,7 @@ export class ContainerRuntime
2914
2929
  * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.
2915
2930
  * @returns The routes of nodes that were deleted.
2916
2931
  */
2917
- public deleteSweepReadyNodes(sweepReadyRoutes: string[]): string[] {
2932
+ public deleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[] {
2918
2933
  const { dataStoreRoutes, blobManagerRoutes } =
2919
2934
  this.getDataStoreAndBlobManagerRoutes(sweepReadyRoutes);
2920
2935
 
@@ -2926,7 +2941,7 @@ export class ContainerRuntime
2926
2941
  * This is called to update objects that are tombstones.
2927
2942
  * @param tombstonedRoutes - Data store and attachment blob routes that are tombstones in this Container.
2928
2943
  */
2929
- public updateTombstonedRoutes(tombstonedRoutes: string[]) {
2944
+ public updateTombstonedRoutes(tombstonedRoutes: readonly string[]) {
2930
2945
  const { blobManagerRoutes, dataStoreRoutes } =
2931
2946
  this.getDataStoreAndBlobManagerRoutes(tombstonedRoutes);
2932
2947
  this.blobManager.updateTombstonedRoutes(blobManagerRoutes);
@@ -2986,7 +3001,7 @@ export class ContainerRuntime
2986
3001
  * @returns Two route lists - One that contains routes for blob manager and another one that contains routes
2987
3002
  * for data stores.
2988
3003
  */
2989
- private getDataStoreAndBlobManagerRoutes(routes: string[]) {
3004
+ private getDataStoreAndBlobManagerRoutes(routes: readonly string[]) {
2990
3005
  const blobManagerRoutes: string[] = [];
2991
3006
  const dataStoreRoutes: string[] = [];
2992
3007
  for (const route of routes) {
@@ -3063,10 +3078,10 @@ export class ContainerRuntime
3063
3078
  );
3064
3079
  }
3065
3080
 
3066
- // If there are pending (unacked ops), the summary will not be eventual consistent and it may even be
3067
- // incorrect. So, wait for the container to be saved with a timeout. If the container is not saved
3068
- // within the timeout, check if it should be failed or can continue.
3069
- 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) {
3070
3085
  const countBefore = this.pendingMessagesCount;
3071
3086
  // The timeout for waiting for pending ops can be overridden via configurations.
3072
3087
  const pendingOpsTimeout =
@@ -3088,7 +3103,7 @@ export class ContainerRuntime
3088
3103
  // happens, whether we attempted to wait for these ops to be acked and what was the result.
3089
3104
  summaryNumberLogger.sendTelemetryEvent({
3090
3105
  eventName: "PendingOpsWhileSummarizing",
3091
- saved: this.hasPendingMessages() ? false : true,
3106
+ saved: !this.isDirty,
3092
3107
  timeout: pendingOpsTimeout,
3093
3108
  countBefore,
3094
3109
  countAfter: this.pendingMessagesCount,
@@ -3367,7 +3382,7 @@ export class ContainerRuntime
3367
3382
  }
3368
3383
 
3369
3384
  /**
3370
- * 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
3371
3386
  * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.
3372
3387
  * @param logger - The logger to be used for sending telemetry.
3373
3388
  * @param referenceSequenceNumber - The reference sequence number of the summary attempt.
@@ -3383,7 +3398,7 @@ export class ContainerRuntime
3383
3398
  finalAttempt: boolean,
3384
3399
  beforeSummaryGeneration: boolean,
3385
3400
  ): Promise<IBaseSummarizeResult | undefined> {
3386
- if (!this.hasPendingMessages()) {
3401
+ if (!this.isDirty) {
3387
3402
  return;
3388
3403
  }
3389
3404
 
@@ -3516,13 +3531,13 @@ export class ContainerRuntime
3516
3531
  contents: JSON.stringify(idAllocationMessage),
3517
3532
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
3518
3533
  metadata: undefined,
3519
- localOpMetadata: this.idCompressor?.serialize(true),
3534
+ localOpMetadata: undefined,
3520
3535
  type: ContainerMessageType.IdAllocation,
3521
3536
  };
3522
3537
  }
3523
3538
 
3524
3539
  if (idAllocationBatchMessage !== undefined) {
3525
- this.outbox.submit(idAllocationBatchMessage);
3540
+ this.outbox.submitIdAllocation(idAllocationBatchMessage);
3526
3541
  }
3527
3542
  }
3528
3543
  }
@@ -3731,6 +3746,7 @@ export class ContainerRuntime
3731
3746
  /**
3732
3747
  * Finds the right store and asks it to resubmit the message. This typically happens when we
3733
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)
3734
3750
  * @param message - The original LocalContainerRuntimeMessage.
3735
3751
  * @param localOpMetadata - The local metadata associated with the original message.
3736
3752
  */
@@ -3747,10 +3763,7 @@ export class ContainerRuntime
3747
3763
  break;
3748
3764
  case ContainerMessageType.Attach:
3749
3765
  case ContainerMessageType.Alias:
3750
- this.submit(message, localOpMetadata);
3751
- break;
3752
3766
  case ContainerMessageType.IdAllocation: {
3753
- prepareLocalContainerRuntimeIdAllocationMessageForTransit(message);
3754
3767
  this.submit(message, localOpMetadata);
3755
3768
  break;
3756
3769
  }
@@ -3762,6 +3775,9 @@ export class ContainerRuntime
3762
3775
  case ContainerMessageType.Rejoin:
3763
3776
  this.submit(message);
3764
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");
3765
3781
  default: {
3766
3782
  // This case should be very rare - it would imply an op was stashed from a
3767
3783
  // future version of runtime code and now is being applied on an older version
@@ -3973,7 +3989,11 @@ export class ContainerRuntime
3973
3989
  },
3974
3990
  async (event) => {
3975
3991
  this.verifyNotClosed();
3976
- 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
+ }
3977
3997
  const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
3978
3998
  if (this._orderSequentiallyCalls !== 0) {
3979
3999
  throw new UsageError("can't get state during orderSequentially");
@@ -3982,7 +4002,7 @@ export class ContainerRuntime
3982
4002
  // getPendingLocalState() is only exposed through Container.closeAndGetPendingLocalState(), so it's safe
3983
4003
  // to close current batch.
3984
4004
  this.flush();
3985
- const pendingAttachmentBlobs = waitBlobsToAttach
4005
+ const pendingAttachmentBlobs = this.imminentClosure
3986
4006
  ? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
3987
4007
  : undefined;
3988
4008
  const pending = this.pendingStateManager.getLocalState();
@@ -3990,9 +4010,12 @@ export class ContainerRuntime
3990
4010
  return; // no pending state to save
3991
4011
  }
3992
4012
 
4013
+ const pendingIdCompressorState = this.idCompressor?.serialize(true);
4014
+
3993
4015
  const pendingState: IPendingRuntimeState = {
3994
4016
  pending,
3995
4017
  pendingAttachmentBlobs,
4018
+ pendingIdCompressorState,
3996
4019
  };
3997
4020
  event.end({
3998
4021
  attachmentBlobsSize: Object.keys(pendingAttachmentBlobs ?? {}).length,
@@ -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<