@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
@@ -3,7 +3,7 @@ import { assert, delay, LazyPromise } from "@fluidframework/core-utils";
3
3
  import { Trace, TypedEventEmitter } from "@fluid-internal/client-utils";
4
4
  import { createChildLogger, createChildMonitoringContext, DataCorruptionError, DataProcessingError, GenericError, raiseConnectedEvent, PerformanceEvent,
5
5
  // eslint-disable-next-line import/no-deprecated
6
- TaggedLoggerAdapter, wrapError, UsageError, } from "@fluidframework/telemetry-utils";
6
+ TaggedLoggerAdapter, wrapError, UsageError, LoggingError, } from "@fluidframework/telemetry-utils";
7
7
  import { DriverHeader, FetchSource, } from "@fluidframework/driver-definitions";
8
8
  import { readAndParse } from "@fluidframework/driver-utils";
9
9
  import { MessageType, SummaryType, } from "@fluidframework/protocol-definitions";
@@ -19,7 +19,7 @@ import { BlobManager } from "./blobManager";
19
19
  import { DataStores, getSummaryForDatastores } from "./dataStores";
20
20
  import { aliasBlobName, blobsTreeName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, Summarizer, SummaryManager, wrapSummaryInChannelsTree, SummaryCollection, OrderedClientCollection, OrderedClientElection, SummarizerClientElection, summarizerClientType, RunWhileConnectedCoordinator, RetriableSummaryError, } from "./summary";
21
21
  import { formExponentialFn, Throttler } from "./throttler";
22
- import { GarbageCollector, GCNodeType, gcTombstoneGenerationOptionName, trimLeadingAndTrailingSlashes, } from "./gc";
22
+ import { GarbageCollector, GCNodeType, gcGenerationOptionName, trimLeadingAndTrailingSlashes, } from "./gc";
23
23
  import { channelToDataStore, isDataStoreAliasMessage } from "./dataStore";
24
24
  import { BindBatchTracker } from "./batchTracker";
25
25
  import { ScheduleManager } from "./scheduleManager";
@@ -38,14 +38,8 @@ function compatBehaviorAllowsMessageType(_unknownContainerRuntimeMessageType, co
38
38
  // undefined defaults to same behavior as "FailToProcess"
39
39
  return compatBehavior === "Ignore";
40
40
  }
41
- function prepareLocalContainerRuntimeIdAllocationMessageForTransit(message) {
42
- // Remove the stashedState from the op if it's a stashed op
43
- if ("stashedState" in message.contents) {
44
- delete message.contents.stashedState;
45
- }
46
- }
47
41
  /**
48
- * @public
42
+ * @internal
49
43
  */
50
44
  export const DefaultSummaryConfiguration = {
51
45
  state: "enabled",
@@ -63,7 +57,7 @@ export const DefaultSummaryConfiguration = {
63
57
  };
64
58
  /**
65
59
  * Accepted header keys for requests coming to the runtime.
66
- * @public
60
+ * @internal
67
61
  */
68
62
  export var RuntimeHeaders;
69
63
  (function (RuntimeHeaders) {
@@ -73,22 +67,22 @@ export var RuntimeHeaders;
73
67
  RuntimeHeaders["viaHandle"] = "viaHandle";
74
68
  })(RuntimeHeaders || (RuntimeHeaders = {}));
75
69
  /** True if a tombstoned object should be returned without erroring
76
- * @public
70
+ * @internal
77
71
  */
78
72
  export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
79
73
  /**
80
74
  * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
81
- * @public
75
+ * @internal
82
76
  */
83
77
  export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
84
78
  /**
85
79
  * Tombstone error responses will have this header set to true
86
- * @public
80
+ * @internal
87
81
  */
88
82
  export const TombstoneResponseHeaderKey = "isTombstoned";
89
83
  /**
90
84
  * Inactive error responses will have this header set to true
91
- * @public
85
+ * @internal
92
86
  */
93
87
  export const InactiveResponseHeaderKey = "isInactive";
94
88
  /** Default values for Runtime Headers */
@@ -100,7 +94,7 @@ export const defaultRuntimeHeaderData = {
100
94
  };
101
95
  /**
102
96
  * Available compression algorithms for op compression.
103
- * @public
97
+ * @alpha
104
98
  */
105
99
  export var CompressionAlgorithms;
106
100
  (function (CompressionAlgorithms) {
@@ -131,7 +125,7 @@ export const defaultPendingOpsRetryDelayMs = 1000;
131
125
  const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
132
126
  /**
133
127
  * @deprecated use ContainerRuntimeMessageType instead
134
- * @public
128
+ * @internal
135
129
  */
136
130
  export var RuntimeMessage;
137
131
  (function (RuntimeMessage) {
@@ -145,7 +139,7 @@ export var RuntimeMessage;
145
139
  })(RuntimeMessage || (RuntimeMessage = {}));
146
140
  /**
147
141
  * @deprecated please use version in driver-utils
148
- * @public
142
+ * @internal
149
143
  */
150
144
  export function isRuntimeMessage(message) {
151
145
  return Object.values(RuntimeMessage).includes(message.type);
@@ -154,7 +148,7 @@ export function isRuntimeMessage(message) {
154
148
  * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
155
149
  * special-case for document dirty state. Ultimately we should have no special-cases from the
156
150
  * ContainerRuntime's perspective.
157
- * @public
151
+ * @internal
158
152
  */
159
153
  export const agentSchedulerId = "_scheduler";
160
154
  // safely check navigator and get the hardware spec value
@@ -230,7 +224,7 @@ export async function TEST_requestSummarizer(loader, url) {
230
224
  /**
231
225
  * Represents the runtime of the container. Contains helper functions/state of the container.
232
226
  * It will define the store level mappings.
233
- * @public
227
+ * @alpha
234
228
  */
235
229
  export class ContainerRuntime extends TypedEventEmitter {
236
230
  /**
@@ -347,11 +341,17 @@ export class ContainerRuntime extends TypedEventEmitter {
347
341
  const idCompressorEnabled = metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
348
342
  let idCompressor;
349
343
  if (idCompressorEnabled) {
350
- const { IdCompressor, createSessionId } = await import("./id-compressor");
351
- idCompressor =
352
- serializedIdCompressor !== undefined
353
- ? IdCompressor.deserialize(serializedIdCompressor, createSessionId())
354
- : IdCompressor.create(logger);
344
+ const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import("@fluidframework/id-compressor");
345
+ const pendingLocalState = context.pendingLocalState;
346
+ if (pendingLocalState?.pendingIdCompressorState !== undefined) {
347
+ idCompressor = deserializeIdCompressor(pendingLocalState.pendingIdCompressorState);
348
+ }
349
+ else if (serializedIdCompressor !== undefined) {
350
+ idCompressor = deserializeIdCompressor(serializedIdCompressor, createSessionId());
351
+ }
352
+ else {
353
+ idCompressor = createIdCompressor(logger);
354
+ }
355
355
  }
356
356
  const runtime = new containerRuntimeCtor(context, registry, metadata, electedSummarizerData, chunks ?? [], aliases ?? [], {
357
357
  summaryOptions,
@@ -453,9 +453,7 @@ export class ContainerRuntime extends TypedEventEmitter {
453
453
  get gcThrowOnTombstoneUsage() {
454
454
  return this.garbageCollector.throwOnTombstoneUsage;
455
455
  }
456
- /**
457
- * @internal
458
- */
456
+ /***/
459
457
  constructor(context, registry, metadata, electedSummarizerData, chunks, dataStoreAliasMap, runtimeOptions, containerScope, logger, existing, blobManagerSnapshot, _storage, idCompressor, provideEntryPoint, requestHandler, summaryConfiguration = {
460
458
  // the defaults
461
459
  ...DefaultSummaryConfiguration,
@@ -470,6 +468,7 @@ export class ContainerRuntime extends TypedEventEmitter {
470
468
  this._storage = _storage;
471
469
  this.requestHandler = requestHandler;
472
470
  this.summaryConfiguration = summaryConfiguration;
471
+ this.imminentClosure = false;
473
472
  this.defaultMaxConsecutiveReconnects = 7;
474
473
  this._orderSequentiallyCalls = 0;
475
474
  this.flushTaskExists = false;
@@ -561,7 +560,7 @@ export class ContainerRuntime extends TypedEventEmitter {
561
560
  eventName: "GCFeatureMatrix",
562
561
  metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
563
562
  inputs: JSON.stringify({
564
- gcOptions_gcTombstoneGeneration: this.runtimeOptions.gcOptions[gcTombstoneGenerationOptionName],
563
+ gcOptions_gcGeneration: this.runtimeOptions.gcOptions[gcGenerationOptionName],
565
564
  }),
566
565
  });
567
566
  this.telemetryDocumentId = metadata?.telemetryDocumentId ?? uuid();
@@ -627,6 +626,7 @@ export class ContainerRuntime extends TypedEventEmitter {
627
626
  // GC runs in summarizer client and needs access to the real (non-proxy) active information. The proxy
628
627
  // delta manager would always return false for summarizer client.
629
628
  activeConnection: () => this.innerDeltaManager.active,
629
+ submitMessage: (message) => this.submit(message),
630
630
  });
631
631
  const loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;
632
632
  this.summarizerNode = createRootSummarizerNodeWithGC(createChildLogger({ logger: this.logger, namespace: "SummarizerNode" }),
@@ -1050,19 +1050,6 @@ export class ContainerRuntime extends TypedEventEmitter {
1050
1050
  // Officially transition from the old state to the new state.
1051
1051
  this.updateDocumentDirtyState(newState);
1052
1052
  }
1053
- /**
1054
- * Updates the runtime's IdCompressor with the stashed state present in the given op. This is a bit of a
1055
- * hack and is unnecessarily expensive. As it stands, every locally stashed op (all ops that get stored in
1056
- * the PendingStateManager) will store their serialized representation locally until ack'd. Upon receiving
1057
- * this stashed state, the IdCompressor blindly deserializes to the stashed state and assumes the session.
1058
- * Technically only the last stashed state is needed to do this correctly, but we would have to write some
1059
- * more hacky code to modify the batch before it gets sent out.
1060
- * @param content - An IdAllocationOp with "stashedState", which is a representation of un-ack'd local state.
1061
- */
1062
- async applyStashedIdAllocationOp(op) {
1063
- const { IdCompressor } = await import("./id-compressor");
1064
- this.idCompressor = IdCompressor.deserialize(op.stashedState);
1065
- }
1066
1053
  /**
1067
1054
  * Parse an op's type and actual content from given serialized content
1068
1055
  * ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
@@ -1084,7 +1071,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1084
1071
  return this.dataStores.applyStashedAttachOp(opContents.contents);
1085
1072
  case ContainerMessageType.IdAllocation:
1086
1073
  assert(this.idCompressor !== undefined, 0x67b /* IdCompressor should be defined if enabled */);
1087
- return this.applyStashedIdAllocationOp(opContents.contents);
1074
+ return;
1088
1075
  case ContainerMessageType.Alias:
1089
1076
  case ContainerMessageType.BlobAttach:
1090
1077
  return;
@@ -1092,6 +1079,9 @@ export class ContainerRuntime extends TypedEventEmitter {
1092
1079
  throw new Error("chunkedOp not expected here");
1093
1080
  case ContainerMessageType.Rejoin:
1094
1081
  throw new Error("rejoin not expected here");
1082
+ case ContainerMessageType.GC:
1083
+ // GC op is only sent in summarizer which should never have stashed ops.
1084
+ throw new LoggingError("GC op not expected to be stashed in summarizer");
1095
1085
  default: {
1096
1086
  // This should be extremely rare for stashed ops.
1097
1087
  // It would require a newer runtime stashing ops and then an older one applying them,
@@ -1270,7 +1260,14 @@ export class ContainerRuntime extends TypedEventEmitter {
1270
1260
  break;
1271
1261
  case ContainerMessageType.IdAllocation:
1272
1262
  assert(this.idCompressor !== undefined, 0x67c /* IdCompressor should be defined if enabled */);
1273
- this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
1263
+ // Don't re-finalize the range if we're processing a "savedOp" in
1264
+ // stashed ops flow. The compressor is stashed with these ops already processed.
1265
+ if (messageWithContext.message.metadata?.savedOp !== true) {
1266
+ this.idCompressor.finalizeCreationRange(messageWithContext.message.contents);
1267
+ }
1268
+ break;
1269
+ case ContainerMessageType.GC:
1270
+ this.garbageCollector.processMessage(messageWithContext.message, local);
1274
1271
  break;
1275
1272
  case ContainerMessageType.ChunkedOp:
1276
1273
  case ContainerMessageType.Rejoin:
@@ -1461,7 +1458,6 @@ export class ContainerRuntime extends TypedEventEmitter {
1461
1458
  }
1462
1459
  /**
1463
1460
  * @deprecated 0.16 Issue #1537, #3631
1464
- * @internal
1465
1461
  */
1466
1462
  async _createDataStoreWithProps(pkg, props, id = uuid()) {
1467
1463
  return channelToDataStore(await this.dataStores
@@ -1471,7 +1467,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1471
1467
  canSendOps() {
1472
1468
  // Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because
1473
1469
  // container runtime's ability to send ops depend on the actual readonly state of the delta manager.
1474
- return this.connected && !this.innerDeltaManager.readOnlyInfo.readonly;
1470
+ return (this.connected && !this.innerDeltaManager.readOnlyInfo.readonly && !this.imminentClosure);
1475
1471
  }
1476
1472
  /**
1477
1473
  * Are we in the middle of batching ops together?
@@ -1493,19 +1489,28 @@ export class ContainerRuntime extends TypedEventEmitter {
1493
1489
  return this.dirtyContainer;
1494
1490
  }
1495
1491
  isContainerMessageDirtyable({ type, contents }) {
1496
- // For legacy purposes, exclude the old built-in AgentScheduler from dirty consideration as a special-case.
1497
- // Ultimately we should have no special-cases from the ContainerRuntime's perspective.
1498
- if (type === ContainerMessageType.Attach) {
1499
- const attachMessage = contents;
1500
- if (attachMessage.id === agentSchedulerId) {
1501
- return false;
1492
+ // Certain container runtime messages should not mark the container dirty such as the old built-in
1493
+ // AgentScheduler and Garbage collector messages.
1494
+ switch (type) {
1495
+ case ContainerMessageType.Attach: {
1496
+ const attachMessage = contents;
1497
+ if (attachMessage.id === agentSchedulerId) {
1498
+ return false;
1499
+ }
1500
+ break;
1502
1501
  }
1503
- }
1504
- else if (type === ContainerMessageType.FluidDataStoreOp) {
1505
- const envelope = contents;
1506
- if (envelope.address === agentSchedulerId) {
1502
+ case ContainerMessageType.FluidDataStoreOp: {
1503
+ const envelope = contents;
1504
+ if (envelope.address === agentSchedulerId) {
1505
+ return false;
1506
+ }
1507
+ break;
1508
+ }
1509
+ case ContainerMessageType.GC: {
1507
1510
  return false;
1508
1511
  }
1512
+ default:
1513
+ break;
1509
1514
  }
1510
1515
  return true;
1511
1516
  }
@@ -1796,10 +1801,10 @@ export class ContainerRuntime extends TypedEventEmitter {
1796
1801
  properties: { all: { safeSummary: true } },
1797
1802
  }));
1798
1803
  }
1799
- // If there are pending (unacked ops), the summary will not be eventual consistent and it may even be
1800
- // incorrect. So, wait for the container to be saved with a timeout. If the container is not saved
1801
- // within the timeout, check if it should be failed or can continue.
1802
- if (this.validateSummaryBeforeUpload && this.hasPendingMessages()) {
1804
+ // If the container is dirty, i.e., there are pending unacked ops, the summary will not be eventual consistent
1805
+ // and it may even be incorrect. So, wait for the container to be saved with a timeout. If the container is not
1806
+ // saved within the timeout, check if it should be failed or can continue.
1807
+ if (this.validateSummaryBeforeUpload && this.isDirty) {
1803
1808
  const countBefore = this.pendingMessagesCount;
1804
1809
  // The timeout for waiting for pending ops can be overridden via configurations.
1805
1810
  const pendingOpsTimeout = this.mc.config.getNumber("Fluid.Summarizer.waitForPendingOpsTimeoutMs") ??
@@ -1819,7 +1824,7 @@ export class ContainerRuntime extends TypedEventEmitter {
1819
1824
  // happens, whether we attempted to wait for these ops to be acked and what was the result.
1820
1825
  summaryNumberLogger.sendTelemetryEvent({
1821
1826
  eventName: "PendingOpsWhileSummarizing",
1822
- saved: this.hasPendingMessages() ? false : true,
1827
+ saved: !this.isDirty,
1823
1828
  timeout: pendingOpsTimeout,
1824
1829
  countBefore,
1825
1830
  countAfter: this.pendingMessagesCount,
@@ -2044,7 +2049,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2044
2049
  }
2045
2050
  }
2046
2051
  /**
2047
- * This helper is called during summarization. If there are pending ops, it will return a failed summarize result
2052
+ * This helper is called during summarization. If the container is dirty, it will return a failed summarize result
2048
2053
  * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.
2049
2054
  * @param logger - The logger to be used for sending telemetry.
2050
2055
  * @param referenceSequenceNumber - The reference sequence number of the summary attempt.
@@ -2054,7 +2059,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2054
2059
  * @returns failed summarize result (IBaseSummarizeResult) if summary should be failed, undefined otherwise.
2055
2060
  */
2056
2061
  async shouldFailSummaryOnPendingOps(logger, referenceSequenceNumber, minimumSequenceNumber, finalAttempt, beforeSummaryGeneration) {
2057
- if (!this.hasPendingMessages()) {
2062
+ if (!this.isDirty) {
2058
2063
  return;
2059
2064
  }
2060
2065
  // If "SkipFailingIncorrectSummary" option is true, don't fail the summary in the last attempt.
@@ -2146,12 +2151,12 @@ export class ContainerRuntime extends TypedEventEmitter {
2146
2151
  contents: JSON.stringify(idAllocationMessage),
2147
2152
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
2148
2153
  metadata: undefined,
2149
- localOpMetadata: this.idCompressor?.serialize(true),
2154
+ localOpMetadata: undefined,
2150
2155
  type: ContainerMessageType.IdAllocation,
2151
2156
  };
2152
2157
  }
2153
2158
  if (idAllocationBatchMessage !== undefined) {
2154
- this.outbox.submit(idAllocationBatchMessage);
2159
+ this.outbox.submitIdAllocation(idAllocationBatchMessage);
2155
2160
  }
2156
2161
  }
2157
2162
  }
@@ -2324,6 +2329,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2324
2329
  /**
2325
2330
  * Finds the right store and asks it to resubmit the message. This typically happens when we
2326
2331
  * reconnect and there are pending messages.
2332
+ * ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)
2327
2333
  * @param message - The original LocalContainerRuntimeMessage.
2328
2334
  * @param localOpMetadata - The local metadata associated with the original message.
2329
2335
  */
@@ -2336,10 +2342,7 @@ export class ContainerRuntime extends TypedEventEmitter {
2336
2342
  break;
2337
2343
  case ContainerMessageType.Attach:
2338
2344
  case ContainerMessageType.Alias:
2339
- this.submit(message, localOpMetadata);
2340
- break;
2341
2345
  case ContainerMessageType.IdAllocation: {
2342
- prepareLocalContainerRuntimeIdAllocationMessageForTransit(message);
2343
2346
  this.submit(message, localOpMetadata);
2344
2347
  break;
2345
2348
  }
@@ -2351,6 +2354,9 @@ export class ContainerRuntime extends TypedEventEmitter {
2351
2354
  case ContainerMessageType.Rejoin:
2352
2355
  this.submit(message);
2353
2356
  break;
2357
+ case ContainerMessageType.GC:
2358
+ // GC op is only sent in summarizer which should never reconnect.
2359
+ throw new LoggingError("GC op not expected to be resubmitted in summarizer");
2354
2360
  default: {
2355
2361
  // This case should be very rare - it would imply an op was stashed from a
2356
2362
  // future version of runtime code and now is being applied on an older version
@@ -2492,7 +2498,11 @@ export class ContainerRuntime extends TypedEventEmitter {
2492
2498
  notifyImminentClosure: props?.notifyImminentClosure,
2493
2499
  }, async (event) => {
2494
2500
  this.verifyNotClosed();
2495
- const waitBlobsToAttach = props?.notifyImminentClosure;
2501
+ // in case imminentClosure is set to true by future code, we don't
2502
+ // try to change its value
2503
+ if (!this.imminentClosure) {
2504
+ this.imminentClosure = props?.notifyImminentClosure ?? this.imminentClosure;
2505
+ }
2496
2506
  const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
2497
2507
  if (this._orderSequentiallyCalls !== 0) {
2498
2508
  throw new UsageError("can't get state during orderSequentially");
@@ -2501,16 +2511,18 @@ export class ContainerRuntime extends TypedEventEmitter {
2501
2511
  // getPendingLocalState() is only exposed through Container.closeAndGetPendingLocalState(), so it's safe
2502
2512
  // to close current batch.
2503
2513
  this.flush();
2504
- const pendingAttachmentBlobs = waitBlobsToAttach
2514
+ const pendingAttachmentBlobs = this.imminentClosure
2505
2515
  ? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
2506
2516
  : undefined;
2507
2517
  const pending = this.pendingStateManager.getLocalState();
2508
2518
  if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {
2509
2519
  return; // no pending state to save
2510
2520
  }
2521
+ const pendingIdCompressorState = this.idCompressor?.serialize(true);
2511
2522
  const pendingState = {
2512
2523
  pending,
2513
2524
  pendingAttachmentBlobs,
2525
+ pendingIdCompressorState,
2514
2526
  };
2515
2527
  event.end({
2516
2528
  attachmentBlobsSize: Object.keys(pendingAttachmentBlobs ?? {}).length,