@fluidframework/container-runtime 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (554) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/container-runtime.api.md +471 -52
  3. package/dist/batchTracker.d.ts +1 -1
  4. package/dist/batchTracker.d.ts.map +1 -1
  5. package/dist/batchTracker.js +4 -4
  6. package/dist/batchTracker.js.map +1 -1
  7. package/dist/blobManager.d.ts +33 -30
  8. package/dist/blobManager.d.ts.map +1 -1
  9. package/dist/blobManager.js +82 -107
  10. package/dist/blobManager.js.map +1 -1
  11. package/dist/channelCollection.d.ts +27 -22
  12. package/dist/channelCollection.d.ts.map +1 -1
  13. package/dist/channelCollection.js +155 -165
  14. package/dist/channelCollection.js.map +1 -1
  15. package/dist/connectionTelemetry.d.ts +3 -3
  16. package/dist/connectionTelemetry.d.ts.map +1 -1
  17. package/dist/connectionTelemetry.js +17 -17
  18. package/dist/connectionTelemetry.js.map +1 -1
  19. package/dist/containerHandleContext.d.ts.map +1 -1
  20. package/dist/containerHandleContext.js +2 -2
  21. package/dist/containerHandleContext.js.map +1 -1
  22. package/dist/containerRuntime.d.ts +42 -39
  23. package/dist/containerRuntime.d.ts.map +1 -1
  24. package/dist/containerRuntime.js +425 -292
  25. package/dist/containerRuntime.js.map +1 -1
  26. package/dist/dataStore.d.ts +1 -1
  27. package/dist/dataStore.d.ts.map +1 -1
  28. package/dist/dataStore.js +8 -8
  29. package/dist/dataStore.js.map +1 -1
  30. package/dist/dataStoreContext.d.ts +58 -19
  31. package/dist/dataStoreContext.d.ts.map +1 -1
  32. package/dist/dataStoreContext.js +169 -114
  33. package/dist/dataStoreContext.js.map +1 -1
  34. package/dist/dataStoreContexts.d.ts +1 -0
  35. package/dist/dataStoreContexts.d.ts.map +1 -1
  36. package/dist/dataStoreContexts.js +12 -11
  37. package/dist/dataStoreContexts.js.map +1 -1
  38. package/dist/dataStoreRegistry.d.ts +5 -1
  39. package/dist/dataStoreRegistry.d.ts.map +1 -1
  40. package/dist/dataStoreRegistry.js +4 -4
  41. package/dist/dataStoreRegistry.js.map +1 -1
  42. package/dist/deltaManagerSummarizerProxy.d.ts +1 -1
  43. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
  44. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  45. package/dist/deltaScheduler.d.ts +1 -1
  46. package/dist/deltaScheduler.d.ts.map +1 -1
  47. package/dist/deltaScheduler.js +6 -6
  48. package/dist/deltaScheduler.js.map +1 -1
  49. package/dist/error.d.ts +1 -1
  50. package/dist/error.d.ts.map +1 -1
  51. package/dist/error.js +4 -4
  52. package/dist/error.js.map +1 -1
  53. package/dist/gc/garbageCollection.d.ts +3 -2
  54. package/dist/gc/garbageCollection.d.ts.map +1 -1
  55. package/dist/gc/garbageCollection.js +23 -23
  56. package/dist/gc/garbageCollection.js.map +1 -1
  57. package/dist/gc/gcConfigs.d.ts +2 -2
  58. package/dist/gc/gcConfigs.d.ts.map +1 -1
  59. package/dist/gc/gcConfigs.js +4 -5
  60. package/dist/gc/gcConfigs.js.map +1 -1
  61. package/dist/gc/gcDefinitions.d.ts +4 -5
  62. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  63. package/dist/gc/gcDefinitions.js.map +1 -1
  64. package/dist/gc/gcHelpers.d.ts +5 -1
  65. package/dist/gc/gcHelpers.d.ts.map +1 -1
  66. package/dist/gc/gcHelpers.js +21 -12
  67. package/dist/gc/gcHelpers.js.map +1 -1
  68. package/dist/gc/gcSummaryStateTracker.d.ts +2 -2
  69. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  70. package/dist/gc/gcSummaryStateTracker.js +11 -11
  71. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  72. package/dist/gc/gcTelemetry.d.ts +2 -1
  73. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  74. package/dist/gc/gcTelemetry.js +11 -9
  75. package/dist/gc/gcTelemetry.js.map +1 -1
  76. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  77. package/dist/gc/gcUnreferencedStateTracker.js +6 -6
  78. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  79. package/dist/gc/index.d.ts +1 -1
  80. package/dist/gc/index.d.ts.map +1 -1
  81. package/dist/gc/index.js +2 -1
  82. package/dist/gc/index.js.map +1 -1
  83. package/dist/index.d.ts +5 -2
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +12 -2
  86. package/dist/index.js.map +1 -1
  87. package/dist/legacy.d.ts +91 -0
  88. package/dist/messageTypes.d.ts +11 -5
  89. package/dist/messageTypes.d.ts.map +1 -1
  90. package/dist/messageTypes.js +4 -0
  91. package/dist/messageTypes.js.map +1 -1
  92. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  93. package/dist/opLifecycle/batchManager.js.map +1 -1
  94. package/dist/opLifecycle/definitions.d.ts +2 -20
  95. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  96. package/dist/opLifecycle/definitions.js.map +1 -1
  97. package/dist/opLifecycle/index.d.ts +3 -3
  98. package/dist/opLifecycle/index.d.ts.map +1 -1
  99. package/dist/opLifecycle/index.js +3 -1
  100. package/dist/opLifecycle/index.js.map +1 -1
  101. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  102. package/dist/opLifecycle/opCompressor.js +5 -6
  103. package/dist/opLifecycle/opCompressor.js.map +1 -1
  104. package/dist/opLifecycle/opDecompressor.d.ts +15 -4
  105. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  106. package/dist/opLifecycle/opDecompressor.js +62 -63
  107. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  108. package/dist/opLifecycle/opGroupingManager.d.ts +2 -1
  109. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  110. package/dist/opLifecycle/opGroupingManager.js +14 -16
  111. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  112. package/dist/opLifecycle/opSplitter.d.ts +12 -4
  113. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  114. package/dist/opLifecycle/opSplitter.js +63 -53
  115. package/dist/opLifecycle/opSplitter.js.map +1 -1
  116. package/dist/opLifecycle/outbox.d.ts +2 -1
  117. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  118. package/dist/opLifecycle/outbox.js +30 -29
  119. package/dist/opLifecycle/outbox.js.map +1 -1
  120. package/dist/opLifecycle/remoteMessageProcessor.d.ts +8 -0
  121. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  122. package/dist/opLifecycle/remoteMessageProcessor.js +36 -32
  123. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  124. package/dist/packageVersion.d.ts +1 -1
  125. package/dist/packageVersion.js +1 -1
  126. package/dist/packageVersion.js.map +1 -1
  127. package/dist/pendingStateManager.d.ts +1 -1
  128. package/dist/pendingStateManager.d.ts.map +1 -1
  129. package/dist/pendingStateManager.js +18 -18
  130. package/dist/pendingStateManager.js.map +1 -1
  131. package/dist/public.d.ts +12 -0
  132. package/dist/scheduleManager.d.ts +1 -1
  133. package/dist/scheduleManager.d.ts.map +1 -1
  134. package/dist/scheduleManager.js +28 -24
  135. package/dist/scheduleManager.js.map +1 -1
  136. package/dist/storageServiceWithAttachBlobs.d.ts +2 -2
  137. package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -1
  138. package/dist/storageServiceWithAttachBlobs.js +2 -2
  139. package/dist/storageServiceWithAttachBlobs.js.map +1 -1
  140. package/dist/summary/documentSchema.d.ts +209 -0
  141. package/dist/summary/documentSchema.d.ts.map +1 -0
  142. package/dist/summary/documentSchema.js +390 -0
  143. package/dist/summary/documentSchema.js.map +1 -0
  144. package/dist/summary/index.d.ts +2 -1
  145. package/dist/summary/index.d.ts.map +1 -1
  146. package/dist/summary/index.js +4 -1
  147. package/dist/summary/index.js.map +1 -1
  148. package/dist/summary/orderedClientElection.d.ts +2 -2
  149. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  150. package/dist/summary/orderedClientElection.js +12 -7
  151. package/dist/summary/orderedClientElection.js.map +1 -1
  152. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
  153. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  154. package/dist/summary/runWhileConnectedCoordinator.js +3 -3
  155. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  156. package/dist/summary/runningSummarizer.d.ts +3 -3
  157. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  158. package/dist/summary/runningSummarizer.js +16 -16
  159. package/dist/summary/runningSummarizer.js.map +1 -1
  160. package/dist/summary/summarizer.d.ts +3 -2
  161. package/dist/summary/summarizer.d.ts.map +1 -1
  162. package/dist/summary/summarizer.js +13 -13
  163. package/dist/summary/summarizer.js.map +1 -1
  164. package/dist/summary/summarizerClientElection.d.ts +2 -2
  165. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  166. package/dist/summary/summarizerClientElection.js.map +1 -1
  167. package/dist/summary/summarizerHeuristics.d.ts +1 -1
  168. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  169. package/dist/summary/summarizerHeuristics.js +2 -2
  170. package/dist/summary/summarizerHeuristics.js.map +1 -1
  171. package/dist/summary/summarizerNode/summarizerNode.d.ts +3 -2
  172. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  173. package/dist/summary/summarizerNode/summarizerNode.js +28 -28
  174. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  175. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
  176. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  177. package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -3
  178. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  179. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
  180. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  181. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +14 -14
  182. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  183. package/dist/summary/summarizerTypes.d.ts +5 -3
  184. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  185. package/dist/summary/summarizerTypes.js.map +1 -1
  186. package/dist/summary/summaryCollection.d.ts +2 -2
  187. package/dist/summary/summaryCollection.d.ts.map +1 -1
  188. package/dist/summary/summaryCollection.js +7 -7
  189. package/dist/summary/summaryCollection.js.map +1 -1
  190. package/dist/summary/summaryFormat.d.ts +6 -17
  191. package/dist/summary/summaryFormat.d.ts.map +1 -1
  192. package/dist/summary/summaryFormat.js +8 -8
  193. package/dist/summary/summaryFormat.js.map +1 -1
  194. package/dist/summary/summaryGenerator.d.ts +4 -3
  195. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  196. package/dist/summary/summaryGenerator.js +17 -17
  197. package/dist/summary/summaryGenerator.js.map +1 -1
  198. package/dist/summary/summaryManager.d.ts +1 -1
  199. package/dist/summary/summaryManager.d.ts.map +1 -1
  200. package/dist/summary/summaryManager.js +15 -14
  201. package/dist/summary/summaryManager.js.map +1 -1
  202. package/internal.d.ts +11 -0
  203. package/legacy.d.ts +11 -0
  204. package/lib/batchTracker.d.ts +1 -1
  205. package/lib/batchTracker.d.ts.map +1 -1
  206. package/lib/batchTracker.js +2 -2
  207. package/lib/batchTracker.js.map +1 -1
  208. package/lib/blobManager.d.ts +33 -30
  209. package/lib/blobManager.d.ts.map +1 -1
  210. package/lib/blobManager.js +48 -73
  211. package/lib/blobManager.js.map +1 -1
  212. package/lib/channelCollection.d.ts +27 -22
  213. package/lib/channelCollection.d.ts.map +1 -1
  214. package/lib/channelCollection.js +96 -106
  215. package/lib/channelCollection.js.map +1 -1
  216. package/lib/connectionTelemetry.d.ts +3 -3
  217. package/lib/connectionTelemetry.d.ts.map +1 -1
  218. package/lib/connectionTelemetry.js +3 -3
  219. package/lib/connectionTelemetry.js.map +1 -1
  220. package/lib/containerHandleContext.d.ts.map +1 -1
  221. package/lib/containerHandleContext.js +1 -1
  222. package/lib/containerHandleContext.js.map +1 -1
  223. package/lib/containerRuntime.d.ts +42 -39
  224. package/lib/containerRuntime.d.ts.map +1 -1
  225. package/lib/containerRuntime.js +276 -141
  226. package/lib/containerRuntime.js.map +1 -1
  227. package/lib/dataStore.d.ts +1 -1
  228. package/lib/dataStore.d.ts.map +1 -1
  229. package/lib/dataStore.js +3 -3
  230. package/lib/dataStore.js.map +1 -1
  231. package/lib/dataStoreContext.d.ts +58 -19
  232. package/lib/dataStoreContext.d.ts.map +1 -1
  233. package/lib/dataStoreContext.js +107 -52
  234. package/lib/dataStoreContext.js.map +1 -1
  235. package/lib/dataStoreContexts.d.ts +1 -0
  236. package/lib/dataStoreContexts.d.ts.map +1 -1
  237. package/lib/dataStoreContexts.js +3 -2
  238. package/lib/dataStoreContexts.js.map +1 -1
  239. package/lib/dataStoreRegistry.d.ts +5 -1
  240. package/lib/dataStoreRegistry.d.ts.map +1 -1
  241. package/lib/dataStoreRegistry.js +1 -1
  242. package/lib/dataStoreRegistry.js.map +1 -1
  243. package/lib/deltaManagerSummarizerProxy.d.ts +1 -1
  244. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -1
  245. package/lib/deltaManagerSummarizerProxy.js.map +1 -1
  246. package/lib/deltaScheduler.d.ts +1 -1
  247. package/lib/deltaScheduler.d.ts.map +1 -1
  248. package/lib/deltaScheduler.js +1 -1
  249. package/lib/deltaScheduler.js.map +1 -1
  250. package/lib/error.d.ts +1 -1
  251. package/lib/error.d.ts.map +1 -1
  252. package/lib/error.js +2 -2
  253. package/lib/error.js.map +1 -1
  254. package/lib/gc/garbageCollection.d.ts +3 -2
  255. package/lib/gc/garbageCollection.d.ts.map +1 -1
  256. package/lib/gc/garbageCollection.js +8 -8
  257. package/lib/gc/garbageCollection.js.map +1 -1
  258. package/lib/gc/gcConfigs.d.ts +2 -2
  259. package/lib/gc/gcConfigs.d.ts.map +1 -1
  260. package/lib/gc/gcConfigs.js +4 -5
  261. package/lib/gc/gcConfigs.js.map +1 -1
  262. package/lib/gc/gcDefinitions.d.ts +4 -5
  263. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  264. package/lib/gc/gcDefinitions.js.map +1 -1
  265. package/lib/gc/gcHelpers.d.ts +5 -1
  266. package/lib/gc/gcHelpers.d.ts.map +1 -1
  267. package/lib/gc/gcHelpers.js +10 -2
  268. package/lib/gc/gcHelpers.js.map +1 -1
  269. package/lib/gc/gcSummaryStateTracker.d.ts +2 -2
  270. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  271. package/lib/gc/gcSummaryStateTracker.js +2 -2
  272. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  273. package/lib/gc/gcTelemetry.d.ts +2 -1
  274. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  275. package/lib/gc/gcTelemetry.js +4 -2
  276. package/lib/gc/gcTelemetry.js.map +1 -1
  277. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  278. package/lib/gc/gcUnreferencedStateTracker.js +2 -2
  279. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  280. package/lib/gc/index.d.ts +1 -1
  281. package/lib/gc/index.d.ts.map +1 -1
  282. package/lib/gc/index.js +1 -1
  283. package/lib/gc/index.js.map +1 -1
  284. package/lib/index.d.ts +5 -2
  285. package/lib/index.d.ts.map +1 -1
  286. package/lib/index.js +5 -2
  287. package/lib/index.js.map +1 -1
  288. package/lib/legacy.d.ts +91 -0
  289. package/lib/messageTypes.d.ts +11 -5
  290. package/lib/messageTypes.d.ts.map +1 -1
  291. package/lib/messageTypes.js +4 -0
  292. package/lib/messageTypes.js.map +1 -1
  293. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  294. package/lib/opLifecycle/batchManager.js.map +1 -1
  295. package/lib/opLifecycle/definitions.d.ts +2 -20
  296. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  297. package/lib/opLifecycle/definitions.js.map +1 -1
  298. package/lib/opLifecycle/index.d.ts +3 -3
  299. package/lib/opLifecycle/index.d.ts.map +1 -1
  300. package/lib/opLifecycle/index.js +2 -2
  301. package/lib/opLifecycle/index.js.map +1 -1
  302. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  303. package/lib/opLifecycle/opCompressor.js +2 -3
  304. package/lib/opLifecycle/opCompressor.js.map +1 -1
  305. package/lib/opLifecycle/opDecompressor.d.ts +15 -4
  306. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  307. package/lib/opLifecycle/opDecompressor.js +61 -62
  308. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  309. package/lib/opLifecycle/opGroupingManager.d.ts +2 -1
  310. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  311. package/lib/opLifecycle/opGroupingManager.js +9 -12
  312. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  313. package/lib/opLifecycle/opSplitter.d.ts +12 -4
  314. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  315. package/lib/opLifecycle/opSplitter.js +47 -38
  316. package/lib/opLifecycle/opSplitter.js.map +1 -1
  317. package/lib/opLifecycle/outbox.d.ts +2 -1
  318. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  319. package/lib/opLifecycle/outbox.js +19 -18
  320. package/lib/opLifecycle/outbox.js.map +1 -1
  321. package/lib/opLifecycle/remoteMessageProcessor.d.ts +8 -0
  322. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  323. package/lib/opLifecycle/remoteMessageProcessor.js +36 -32
  324. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  325. package/lib/packageVersion.d.ts +1 -1
  326. package/lib/packageVersion.js +1 -1
  327. package/lib/packageVersion.js.map +1 -1
  328. package/lib/pendingStateManager.d.ts +1 -1
  329. package/lib/pendingStateManager.d.ts.map +1 -1
  330. package/lib/pendingStateManager.js +2 -2
  331. package/lib/pendingStateManager.js.map +1 -1
  332. package/lib/public.d.ts +12 -0
  333. package/lib/scheduleManager.d.ts +1 -1
  334. package/lib/scheduleManager.d.ts.map +1 -1
  335. package/lib/scheduleManager.js +7 -3
  336. package/lib/scheduleManager.js.map +1 -1
  337. package/lib/storageServiceWithAttachBlobs.d.ts +2 -2
  338. package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -1
  339. package/lib/storageServiceWithAttachBlobs.js +1 -1
  340. package/lib/storageServiceWithAttachBlobs.js.map +1 -1
  341. package/lib/summary/documentSchema.d.ts +209 -0
  342. package/lib/summary/documentSchema.d.ts.map +1 -0
  343. package/lib/summary/documentSchema.js +386 -0
  344. package/lib/summary/documentSchema.js.map +1 -0
  345. package/lib/summary/index.d.ts +2 -1
  346. package/lib/summary/index.d.ts.map +1 -1
  347. package/lib/summary/index.js +1 -0
  348. package/lib/summary/index.js.map +1 -1
  349. package/lib/summary/orderedClientElection.d.ts +2 -2
  350. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  351. package/lib/summary/orderedClientElection.js +7 -2
  352. package/lib/summary/orderedClientElection.js.map +1 -1
  353. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -1
  354. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  355. package/lib/summary/runWhileConnectedCoordinator.js +1 -1
  356. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  357. package/lib/summary/runningSummarizer.d.ts +3 -3
  358. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  359. package/lib/summary/runningSummarizer.js +3 -3
  360. package/lib/summary/runningSummarizer.js.map +1 -1
  361. package/lib/summary/summarizer.d.ts +3 -2
  362. package/lib/summary/summarizer.d.ts.map +1 -1
  363. package/lib/summary/summarizer.js +3 -3
  364. package/lib/summary/summarizer.js.map +1 -1
  365. package/lib/summary/summarizerClientElection.d.ts +2 -2
  366. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  367. package/lib/summary/summarizerClientElection.js.map +1 -1
  368. package/lib/summary/summarizerHeuristics.d.ts +1 -1
  369. package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
  370. package/lib/summary/summarizerHeuristics.js +1 -1
  371. package/lib/summary/summarizerHeuristics.js.map +1 -1
  372. package/lib/summary/summarizerNode/summarizerNode.d.ts +3 -2
  373. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  374. package/lib/summary/summarizerNode/summarizerNode.js +5 -5
  375. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  376. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
  377. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  378. package/lib/summary/summarizerNode/summarizerNodeUtils.js +1 -1
  379. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  380. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
  381. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  382. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -3
  383. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  384. package/lib/summary/summarizerTypes.d.ts +5 -3
  385. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  386. package/lib/summary/summarizerTypes.js.map +1 -1
  387. package/lib/summary/summaryCollection.d.ts +2 -2
  388. package/lib/summary/summaryCollection.d.ts.map +1 -1
  389. package/lib/summary/summaryCollection.js +1 -1
  390. package/lib/summary/summaryCollection.js.map +1 -1
  391. package/lib/summary/summaryFormat.d.ts +6 -17
  392. package/lib/summary/summaryFormat.d.ts.map +1 -1
  393. package/lib/summary/summaryFormat.js +3 -3
  394. package/lib/summary/summaryFormat.js.map +1 -1
  395. package/lib/summary/summaryGenerator.d.ts +4 -3
  396. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  397. package/lib/summary/summaryGenerator.js +4 -4
  398. package/lib/summary/summaryGenerator.js.map +1 -1
  399. package/lib/summary/summaryManager.d.ts +1 -1
  400. package/lib/summary/summaryManager.d.ts.map +1 -1
  401. package/lib/summary/summaryManager.js +9 -8
  402. package/lib/summary/summaryManager.js.map +1 -1
  403. package/package.json +57 -65
  404. package/src/batchTracker.ts +4 -3
  405. package/src/blobManager.ts +100 -77
  406. package/src/channelCollection.ts +180 -165
  407. package/src/connectionTelemetry.ts +12 -12
  408. package/src/containerHandleContext.ts +3 -2
  409. package/src/containerRuntime.ts +481 -277
  410. package/src/dataStore.ts +9 -4
  411. package/src/dataStoreContext.ts +195 -93
  412. package/src/dataStoreContexts.ts +5 -2
  413. package/src/dataStoreRegistry.ts +3 -2
  414. package/src/deltaManagerSummarizerProxy.ts +1 -1
  415. package/src/deltaScheduler.ts +2 -1
  416. package/src/error.ts +2 -2
  417. package/src/gc/garbageCollection.ts +21 -20
  418. package/src/gc/gcConfigs.ts +15 -18
  419. package/src/gc/gcDefinitions.ts +6 -8
  420. package/src/gc/gcHelpers.ts +22 -5
  421. package/src/gc/gcSummaryStateTracker.ts +7 -5
  422. package/src/gc/gcTelemetry.ts +13 -7
  423. package/src/gc/gcUnreferencedStateTracker.ts +3 -2
  424. package/src/gc/index.ts +1 -0
  425. package/src/index.ts +22 -1
  426. package/src/messageTypes.ts +20 -6
  427. package/src/opLifecycle/README.md +89 -0
  428. package/src/opLifecycle/batchManager.ts +1 -0
  429. package/src/opLifecycle/definitions.ts +3 -21
  430. package/src/opLifecycle/index.ts +3 -9
  431. package/src/opLifecycle/opCompressor.ts +6 -5
  432. package/src/opLifecycle/opDecompressor.ts +90 -100
  433. package/src/opLifecycle/opGroupingManager.ts +12 -14
  434. package/src/opLifecycle/opSplitter.ts +76 -48
  435. package/src/opLifecycle/outbox.ts +30 -38
  436. package/src/opLifecycle/remoteMessageProcessor.ts +43 -55
  437. package/src/packageVersion.ts +1 -1
  438. package/src/pendingStateManager.ts +6 -6
  439. package/src/scheduleManager.ts +10 -8
  440. package/src/storageServiceWithAttachBlobs.ts +2 -2
  441. package/src/summary/documentSchema.ts +631 -0
  442. package/src/summary/index.ts +10 -1
  443. package/src/summary/orderedClientElection.ts +7 -7
  444. package/src/summary/runWhileConnectedCoordinator.ts +3 -2
  445. package/src/summary/runningSummarizer.ts +22 -20
  446. package/src/summary/summarizer.ts +17 -15
  447. package/src/summary/summarizerClientElection.ts +3 -2
  448. package/src/summary/summarizerHeuristics.ts +4 -2
  449. package/src/summary/summarizerNode/summarizerNode.ts +20 -18
  450. package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -2
  451. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +16 -8
  452. package/src/summary/summarizerTypes.ts +7 -3
  453. package/src/summary/summaryCollection.ts +3 -3
  454. package/src/summary/summaryFormat.ts +14 -26
  455. package/src/summary/summaryGenerator.ts +12 -15
  456. package/src/summary/summaryManager.ts +16 -13
  457. package/api-extractor-cjs.json +0 -8
  458. package/dist/container-runtime-alpha.d.ts +0 -1753
  459. package/dist/container-runtime-beta.d.ts +0 -268
  460. package/dist/container-runtime-public.d.ts +0 -268
  461. package/dist/container-runtime-untrimmed.d.ts +0 -1893
  462. package/lib/container-runtime-alpha.d.ts +0 -1753
  463. package/lib/container-runtime-beta.d.ts +0 -268
  464. package/lib/container-runtime-public.d.ts +0 -268
  465. package/lib/container-runtime-untrimmed.d.ts +0 -1893
  466. package/lib/test/batchTracker.spec.js +0 -88
  467. package/lib/test/batchTracker.spec.js.map +0 -1
  468. package/lib/test/blobManager.spec.js +0 -835
  469. package/lib/test/blobManager.spec.js.map +0 -1
  470. package/lib/test/channelCollection.spec.js +0 -141
  471. package/lib/test/channelCollection.spec.js.map +0 -1
  472. package/lib/test/containerRuntime.spec.js +0 -1748
  473. package/lib/test/containerRuntime.spec.js.map +0 -1
  474. package/lib/test/dataStoreContext.spec.js +0 -801
  475. package/lib/test/dataStoreContext.spec.js.map +0 -1
  476. package/lib/test/dataStoreCreation.spec.js +0 -312
  477. package/lib/test/dataStoreCreation.spec.js.map +0 -1
  478. package/lib/test/dataStoreRegistry.spec.js +0 -26
  479. package/lib/test/dataStoreRegistry.spec.js.map +0 -1
  480. package/lib/test/fuzz/fuzzUtils.js +0 -66
  481. package/lib/test/fuzz/fuzzUtils.js.map +0 -1
  482. package/lib/test/fuzz/summarizer.fuzz.spec.js +0 -31
  483. package/lib/test/fuzz/summarizer.fuzz.spec.js.map +0 -1
  484. package/lib/test/fuzz/summarizerFuzzMocks.js +0 -162
  485. package/lib/test/fuzz/summarizerFuzzMocks.js.map +0 -1
  486. package/lib/test/fuzz/summarizerFuzzSuite.js +0 -106
  487. package/lib/test/fuzz/summarizerFuzzSuite.js.map +0 -1
  488. package/lib/test/gc/garbageCollection.spec.js +0 -1465
  489. package/lib/test/gc/garbageCollection.spec.js.map +0 -1
  490. package/lib/test/gc/gcConfigs.spec.js +0 -690
  491. package/lib/test/gc/gcConfigs.spec.js.map +0 -1
  492. package/lib/test/gc/gcHelpers.spec.js +0 -110
  493. package/lib/test/gc/gcHelpers.spec.js.map +0 -1
  494. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +0 -68
  495. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +0 -1
  496. package/lib/test/gc/gcStats.spec.js +0 -391
  497. package/lib/test/gc/gcStats.spec.js.map +0 -1
  498. package/lib/test/gc/gcSummaryStateTracker.spec.js +0 -228
  499. package/lib/test/gc/gcSummaryStateTracker.spec.js.map +0 -1
  500. package/lib/test/gc/gcTelemetry.spec.js +0 -530
  501. package/lib/test/gc/gcTelemetry.spec.js.map +0 -1
  502. package/lib/test/gc/gcUnitTestHelpers.js +0 -29
  503. package/lib/test/gc/gcUnitTestHelpers.js.map +0 -1
  504. package/lib/test/gc/gcUnreferencedStateTracker.spec.js +0 -192
  505. package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +0 -1
  506. package/lib/test/getPendingBlobs.spec.js +0 -193
  507. package/lib/test/getPendingBlobs.spec.js.map +0 -1
  508. package/lib/test/hardwareStats.spec.js +0 -93
  509. package/lib/test/hardwareStats.spec.js.map +0 -1
  510. package/lib/test/index.js +0 -6
  511. package/lib/test/index.js.map +0 -1
  512. package/lib/test/opLifecycle/OpGroupingManager.spec.js +0 -225
  513. package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +0 -1
  514. package/lib/test/opLifecycle/batchManager.spec.js +0 -189
  515. package/lib/test/opLifecycle/batchManager.spec.js.map +0 -1
  516. package/lib/test/opLifecycle/opCompressor.spec.js +0 -74
  517. package/lib/test/opLifecycle/opCompressor.spec.js.map +0 -1
  518. package/lib/test/opLifecycle/opDecompressor.spec.js +0 -218
  519. package/lib/test/opLifecycle/opDecompressor.spec.js.map +0 -1
  520. package/lib/test/opLifecycle/opSplitter.spec.js +0 -272
  521. package/lib/test/opLifecycle/opSplitter.spec.js.map +0 -1
  522. package/lib/test/opLifecycle/outbox.spec.js +0 -675
  523. package/lib/test/opLifecycle/outbox.spec.js.map +0 -1
  524. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +0 -196
  525. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +0 -1
  526. package/lib/test/pendingStateManager.spec.js +0 -329
  527. package/lib/test/pendingStateManager.spec.js.map +0 -1
  528. package/lib/test/scheduleManager.spec.js +0 -270
  529. package/lib/test/scheduleManager.spec.js.map +0 -1
  530. package/lib/test/summarizerNode.spec.js +0 -326
  531. package/lib/test/summarizerNode.spec.js.map +0 -1
  532. package/lib/test/summarizerNodeWithGc.spec.js +0 -318
  533. package/lib/test/summarizerNodeWithGc.spec.js.map +0 -1
  534. package/lib/test/summary/orderedClientElection.spec.js +0 -535
  535. package/lib/test/summary/orderedClientElection.spec.js.map +0 -1
  536. package/lib/test/summary/runningSummarizer.spec.js +0 -1349
  537. package/lib/test/summary/runningSummarizer.spec.js.map +0 -1
  538. package/lib/test/summary/summarizer.spec.js +0 -29
  539. package/lib/test/summary/summarizer.spec.js.map +0 -1
  540. package/lib/test/summary/summarizerClientElection.spec.js +0 -436
  541. package/lib/test/summary/summarizerClientElection.spec.js.map +0 -1
  542. package/lib/test/summary/summarizerHeuristics.spec.js +0 -289
  543. package/lib/test/summary/summarizerHeuristics.spec.js.map +0 -1
  544. package/lib/test/summary/summaryCollection.spec.js +0 -200
  545. package/lib/test/summary/summaryCollection.spec.js.map +0 -1
  546. package/lib/test/summary/summaryManager.spec.js +0 -430
  547. package/lib/test/summary/summaryManager.spec.js.map +0 -1
  548. package/lib/test/summary/testQuorumClients.js +0 -34
  549. package/lib/test/summary/testQuorumClients.js.map +0 -1
  550. package/lib/test/throttler.spec.js +0 -175
  551. package/lib/test/throttler.spec.js.map +0 -1
  552. package/lib/test/types/validateContainerRuntimePrevious.generated.js +0 -180
  553. package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +0 -1
  554. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -2,60 +2,57 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+
6
+ import { Trace, TypedEventEmitter } from "@fluid-internal/client-utils";
5
7
  import {
6
- ITelemetryBaseLogger,
7
- FluidObject,
8
- IFluidHandle,
9
- IFluidHandleContext,
10
- IRequest,
11
- IResponse,
12
- IProvideFluidHandleContext,
13
- ISignalEnvelope,
14
- } from "@fluidframework/core-interfaces";
15
- import {
8
+ AttachState,
16
9
  IAudience,
10
+ ICriticalContainerError,
11
+ IDeltaManager,
12
+ } from "@fluidframework/container-definitions";
13
+ import {
17
14
  IBatchMessage,
18
15
  IContainerContext,
19
- IDeltaManager,
20
- IRuntime,
21
- ICriticalContainerError,
22
- AttachState,
16
+ IGetPendingLocalStateProps,
23
17
  ILoader,
18
+ IRuntime,
24
19
  LoaderHeader,
25
- IGetPendingLocalStateProps,
26
- } from "@fluidframework/container-definitions";
20
+ } from "@fluidframework/container-definitions/internal";
27
21
  import {
28
22
  IContainerRuntime,
29
23
  IContainerRuntimeEvents,
30
- } from "@fluidframework/container-runtime-definitions";
31
- import { assert, Deferred, delay, LazyPromise, PromiseCache } from "@fluidframework/core-utils";
32
- import { Trace, TypedEventEmitter } from "@fluid-internal/client-utils";
24
+ } from "@fluidframework/container-runtime-definitions/internal";
33
25
  import {
34
- createChildLogger,
35
- createChildMonitoringContext,
36
- DataCorruptionError,
37
- DataProcessingError,
38
- GenericError,
39
- raiseConnectedEvent,
40
- PerformanceEvent,
41
- TaggedLoggerAdapter,
42
- MonitoringContext,
43
- wrapError,
44
- ITelemetryLoggerExt,
45
- UsageError,
46
- LoggingError,
47
- createSampledLogger,
48
- IEventSampler,
49
- type ITelemetryGenericEventExt,
50
- loggerToMonitoringContext,
51
- } from "@fluidframework/telemetry-utils";
26
+ FluidObject,
27
+ IFluidHandle,
28
+ IFluidHandleContext,
29
+ IProvideFluidHandleContext,
30
+ IRequest,
31
+ IResponse,
32
+ ITelemetryBaseLogger,
33
+ } from "@fluidframework/core-interfaces";
34
+ import { ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
35
+ import {
36
+ assert,
37
+ Deferred,
38
+ LazyPromise,
39
+ PromiseCache,
40
+ delay,
41
+ } from "@fluidframework/core-utils/internal";
52
42
  import {
53
43
  DriverHeader,
54
44
  FetchSource,
55
45
  IDocumentStorageService,
56
46
  type ISnapshot,
57
- } from "@fluidframework/driver-definitions";
58
- import { readAndParse } from "@fluidframework/driver-utils";
47
+ } from "@fluidframework/driver-definitions/internal";
48
+ import { readAndParse } from "@fluidframework/driver-utils/internal";
49
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
50
+ import type {
51
+ IIdCompressorCore,
52
+ IdCreationRange,
53
+ SerializedIdCompressorWithNoSession,
54
+ SerializedIdCompressorWithOngoingSession,
55
+ } from "@fluidframework/id-compressor/internal";
59
56
  import {
60
57
  IClientDetails,
61
58
  IDocumentMessage,
@@ -69,134 +66,155 @@ import {
69
66
  SummaryType,
70
67
  } from "@fluidframework/protocol-definitions";
71
68
  import {
69
+ IGarbageCollectionData,
70
+ IInboundSignalMessage,
71
+ ISummaryTreeWithStats,
72
+ ITelemetryContext,
73
+ } from "@fluidframework/runtime-definitions";
74
+ import {
75
+ CreateChildSummarizerNodeParam,
72
76
  FlushMode,
73
77
  FlushModeExperimental,
74
- gcTreeKey,
75
- InboundAttachMessage,
78
+ IDataStore,
79
+ IEnvelope,
76
80
  IFluidDataStoreContextDetached,
77
81
  IFluidDataStoreRegistry,
78
- IGarbageCollectionData,
79
- IInboundSignalMessage,
80
- NamedFluidDataStoreRegistryEntries,
81
- ISummaryTreeWithStats,
82
82
  ISummarizeInternalResult,
83
- CreateChildSummarizerNodeParam,
83
+ InboundAttachMessage,
84
+ NamedFluidDataStoreRegistryEntries,
84
85
  SummarizeInternalFn,
85
86
  channelsTreeName,
86
- IDataStore,
87
- ITelemetryContext,
88
- IEnvelope,
89
- } from "@fluidframework/runtime-definitions";
90
- import type {
91
- SerializedIdCompressorWithNoSession,
92
- IIdCompressor,
93
- IIdCompressorCore,
94
- SerializedIdCompressorWithOngoingSession,
95
- IdCreationRange,
96
- } from "@fluidframework/id-compressor";
87
+ gcTreeKey,
88
+ } from "@fluidframework/runtime-definitions/internal";
97
89
  import {
90
+ GCDataBuilder,
91
+ ReadAndParseBlob,
92
+ RequestParser,
93
+ TelemetryContext,
98
94
  addBlobToSummary,
99
95
  addSummarizeResultToSummary,
100
- RequestParser,
96
+ calculateStats,
101
97
  create404Response,
102
98
  exceptionToResponse,
103
- GCDataBuilder,
104
- seqFromTree,
105
- calculateStats,
106
- TelemetryContext,
107
- ReadAndParseBlob,
108
99
  responseToException,
109
- } from "@fluidframework/runtime-utils";
110
- import { v4 as uuid } from "uuid";
111
- import { ContainerFluidHandleContext } from "./containerHandleContext.js";
112
- import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
113
- import { ReportOpPerfTelemetry, IPerfSignalReport } from "./connectionTelemetry.js";
100
+ seqFromTree,
101
+ } from "@fluidframework/runtime-utils/internal";
114
102
  import {
115
- IPendingBatchMessage,
116
- IPendingLocalState,
117
- PendingStateManager,
118
- } from "./pendingStateManager.js";
119
- import { pkgVersion } from "./packageVersion.js";
103
+ type ITelemetryGenericEventExt,
104
+ ITelemetryLoggerExt,
105
+ } from "@fluidframework/telemetry-utils";
106
+ import {
107
+ DataCorruptionError,
108
+ DataProcessingError,
109
+ GenericError,
110
+ IEventSampler,
111
+ LoggingError,
112
+ MonitoringContext,
113
+ PerformanceEvent,
114
+ // eslint-disable-next-line import/no-deprecated
115
+ TaggedLoggerAdapter,
116
+ UsageError,
117
+ createChildLogger,
118
+ createChildMonitoringContext,
119
+ createSampledLogger,
120
+ loggerToMonitoringContext,
121
+ raiseConnectedEvent,
122
+ wrapError,
123
+ } from "@fluidframework/telemetry-utils/internal";
124
+ import { v4 as uuid } from "uuid";
125
+
126
+ import { BindBatchTracker } from "./batchTracker.js";
120
127
  import { BlobManager, IBlobManagerLoadInfo, IPendingBlobs } from "./blobManager.js";
121
128
  import { ChannelCollection, getSummaryForDatastores, wrapContext } from "./channelCollection.js";
129
+ import { IPerfSignalReport, ReportOpPerfTelemetry } from "./connectionTelemetry.js";
130
+ import { ContainerFluidHandleContext } from "./containerHandleContext.js";
131
+ import { channelToDataStore } from "./dataStore.js";
132
+ import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
133
+ import { DeltaManagerSummarizerProxy } from "./deltaManagerSummarizerProxy.js";
122
134
  import {
123
- aliasBlobName,
124
- blobsTreeName,
125
- chunksBlobName,
126
- createRootSummarizerNodeWithGC,
127
- electedSummarizerBlobName,
128
- extractSummaryMetadataMessage,
129
- IContainerRuntimeMetadata,
130
- ICreateContainerMetadata,
131
- idCompressorBlobName,
132
- IRootSummarizerNodeWithGC,
133
- ISummaryMetadataMessage,
134
- metadataBlobName,
135
- Summarizer,
136
- SummaryManager,
137
- wrapSummaryInChannelsTree,
138
- SummaryCollection,
139
- ISerializedElection,
140
- OrderedClientCollection,
141
- OrderedClientElection,
142
- SummarizerClientElection,
143
- summarizerClientType,
144
- SubmitSummaryResult,
145
- IConnectableRuntime,
146
- IGeneratedSummaryStats,
147
- ISubmitSummaryOptions,
148
- ISummarizerInternalsProvider,
149
- ISummarizerRuntime,
150
- IRefreshSummaryAckOptions,
151
- RunWhileConnectedCoordinator,
152
- IGenerateSummaryTreeResult,
153
- RetriableSummaryError,
154
- IOnDemandSummarizeOptions,
155
- ISummarizeResults,
156
- IEnqueueSummarizeOptions,
157
- EnqueueSummarizeResult,
158
- ISummarizerEvents,
159
- IBaseSummarizeResult,
160
- ISummarizer,
161
- rootHasIsolatedChannels,
162
- IdCompressorMode,
163
- } from "./summary/index.js";
164
- import { formExponentialFn, Throttler } from "./throttler.js";
165
- import {
166
- GarbageCollector,
167
135
  GCNodeType,
168
- gcGenerationOptionName,
169
- IGarbageCollector,
136
+ GarbageCollector,
170
137
  IGCRuntimeOptions,
171
138
  IGCStats,
139
+ IGarbageCollector,
140
+ gcGenerationOptionName,
172
141
  } from "./gc/index.js";
173
- import { channelToDataStore } from "./dataStore.js";
174
- import { BindBatchTracker } from "./batchTracker.js";
175
- import { ScheduleManager } from "./scheduleManager.js";
142
+ import {
143
+ ContainerMessageType,
144
+ type ContainerRuntimeDocumentSchemaMessage,
145
+ ContainerRuntimeGCMessage,
146
+ type ContainerRuntimeIdAllocationMessage,
147
+ type InboundSequencedContainerRuntimeMessage,
148
+ type InboundSequencedContainerRuntimeMessageOrSystemMessage,
149
+ type LocalContainerRuntimeMessage,
150
+ type OutboundContainerRuntimeMessage,
151
+ type UnknownContainerRuntimeMessage,
152
+ } from "./messageTypes.js";
153
+ import { IBatchMetadata, IIdAllocationMetadata } from "./metadata.js";
176
154
  import {
177
155
  BatchMessage,
178
156
  IBatch,
179
157
  IBatchCheckpoint,
180
158
  OpCompressor,
181
159
  OpDecompressor,
182
- Outbox,
160
+ OpGroupingManager,
183
161
  OpSplitter,
162
+ Outbox,
184
163
  RemoteMessageProcessor,
185
- OpGroupingManager,
186
164
  getLongStack,
187
165
  } from "./opLifecycle/index.js";
188
- import { DeltaManagerSummarizerProxy } from "./deltaManagerSummarizerProxy.js";
189
- import { IBatchMetadata, IIdAllocationMetadata } from "./metadata.js";
166
+ import { pkgVersion } from "./packageVersion.js";
190
167
  import {
191
- ContainerMessageType,
192
- type InboundSequencedContainerRuntimeMessage,
193
- type InboundSequencedContainerRuntimeMessageOrSystemMessage,
194
- type ContainerRuntimeIdAllocationMessage,
195
- type LocalContainerRuntimeMessage,
196
- type OutboundContainerRuntimeMessage,
197
- type UnknownContainerRuntimeMessage,
198
- ContainerRuntimeGCMessage,
199
- } from "./messageTypes.js";
168
+ IPendingBatchMessage,
169
+ IPendingLocalState,
170
+ PendingStateManager,
171
+ } from "./pendingStateManager.js";
172
+ import { ScheduleManager } from "./scheduleManager.js";
173
+ import {
174
+ DocumentsSchemaController,
175
+ EnqueueSummarizeResult,
176
+ IBaseSummarizeResult,
177
+ IConnectableRuntime,
178
+ IContainerRuntimeMetadata,
179
+ ICreateContainerMetadata,
180
+ type IDocumentSchemaCurrent,
181
+ IEnqueueSummarizeOptions,
182
+ IGenerateSummaryTreeResult,
183
+ IGeneratedSummaryStats,
184
+ IOnDemandSummarizeOptions,
185
+ IRefreshSummaryAckOptions,
186
+ IRootSummarizerNodeWithGC,
187
+ ISerializedElection,
188
+ ISubmitSummaryOptions,
189
+ ISummarizeResults,
190
+ ISummarizer,
191
+ ISummarizerEvents,
192
+ ISummarizerInternalsProvider,
193
+ ISummarizerRuntime,
194
+ ISummaryMetadataMessage,
195
+ IdCompressorMode,
196
+ OrderedClientCollection,
197
+ OrderedClientElection,
198
+ RetriableSummaryError,
199
+ RunWhileConnectedCoordinator,
200
+ SubmitSummaryResult,
201
+ Summarizer,
202
+ SummarizerClientElection,
203
+ SummaryCollection,
204
+ SummaryManager,
205
+ aliasBlobName,
206
+ blobsTreeName,
207
+ chunksBlobName,
208
+ createRootSummarizerNodeWithGC,
209
+ electedSummarizerBlobName,
210
+ extractSummaryMetadataMessage,
211
+ idCompressorBlobName,
212
+ metadataBlobName,
213
+ rootHasIsolatedChannels,
214
+ summarizerClientType,
215
+ wrapSummaryInChannelsTree,
216
+ } from "./summary/index.js";
217
+ import { Throttler, formExponentialFn } from "./throttler.js";
200
218
 
201
219
  /**
202
220
  * Utility to implement compat behaviors given an unknown message type
@@ -415,7 +433,7 @@ export interface IContainerRuntimeOptions {
415
433
  * If specified, when in FlushMode.TurnBased, if the size of the ops between JS turns exceeds this value,
416
434
  * an error will be thrown and the container will close.
417
435
  *
418
- * If unspecified, the limit is 950 * 1024.
436
+ * If unspecified, the limit is 700Kb.
419
437
  *
420
438
  * 'Infinity' will disable any limit.
421
439
  *
@@ -464,6 +482,15 @@ export interface IContainerRuntimeOptions {
464
482
  * @experimental Not ready for use.
465
483
  */
466
484
  readonly enableGroupedBatching?: boolean;
485
+
486
+ /**
487
+ * When this property is set to true, it requires runtime to control is document schema properly through ops
488
+ * The benefit of this mode is that clients who do not understand schema will fail in predictable way, with predictable message,
489
+ * and will not attempt to limp along, which could cause data corruptions and crashes in random places.
490
+ * When this property is not set (or set to false), runtime operates in legacy mode, where new features (modifying document schema)
491
+ * are engaged as they become available, without giving legacy clients any chance to fail predictably.
492
+ */
493
+ readonly explicitSchemaControl?: boolean;
467
494
  }
468
495
 
469
496
  /**
@@ -479,6 +506,7 @@ export const InactiveResponseHeaderKey = "isInactive";
479
506
 
480
507
  /**
481
508
  * The full set of parsed header data that may be found on Runtime requests
509
+ * @internal
482
510
  */
483
511
  export interface RuntimeHeaderData {
484
512
  wait?: boolean;
@@ -503,6 +531,12 @@ export enum CompressionAlgorithms {
503
531
  lz4 = "lz4",
504
532
  }
505
533
 
534
+ /** @alpha */
535
+ export const disabledCompressionConfig: ICompressionRuntimeOptions = {
536
+ minimumBatchSizeInBytes: Infinity,
537
+ compressionAlgorithm: CompressionAlgorithms.lz4,
538
+ };
539
+
506
540
  /**
507
541
  * @deprecated
508
542
  * Untagged logger is unsupported going forward. There are old loaders with old ContainerContexts that only
@@ -569,26 +603,12 @@ export const defaultPendingOpsRetryDelayMs = 1000;
569
603
  */
570
604
  const defaultCloseSummarizerDelayMs = 5000; // 5 seconds
571
605
 
572
- /**
573
- * @deprecated use ContainerRuntimeMessageType instead
574
- * @internal
575
- */
576
- export enum RuntimeMessage {
577
- FluidDataStoreOp = "component",
578
- Attach = "attach",
579
- ChunkedOp = "chunkedOp",
580
- BlobAttach = "blobAttach",
581
- Rejoin = "rejoin",
582
- Alias = "alias",
583
- Operation = "op",
584
- }
585
-
586
606
  /**
587
607
  * @deprecated please use version in driver-utils
588
608
  * @internal
589
609
  */
590
610
  export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean {
591
- return (Object.values(RuntimeMessage) as string[]).includes(message.type);
611
+ return (Object.values(ContainerMessageType) as string[]).includes(message.type);
592
612
  }
593
613
 
594
614
  /**
@@ -695,6 +715,18 @@ async function createSummarizer(loader: ILoader, url: string): Promise<ISummariz
695
715
  return fluidObject.ISummarizer;
696
716
  }
697
717
 
718
+ /**
719
+ * Extract last message from the snapshot metadata.
720
+ * Uses legacy property if not using explicit schema control, otherwise uses the new property.
721
+ * This allows new runtime to make documents not openable for old runtimes, one explicit document schema control is enabled.
722
+ * Please see addMetadataToSummary() as well
723
+ */
724
+ function lastMessageFromMetadata(metadata: IContainerRuntimeMetadata | undefined) {
725
+ return metadata?.documentSchema?.runtime?.explicitSchemaControl
726
+ ? metadata?.lastMessage
727
+ : metadata?.message;
728
+ }
729
+
698
730
  /**
699
731
  * Represents the runtime of the container. Contains helper functions/state of the container.
700
732
  * It will define the store level mappings.
@@ -741,7 +773,7 @@ export class ContainerRuntime
741
773
  existing,
742
774
  requestHandler,
743
775
  provideEntryPoint,
744
- runtimeOptions = {},
776
+ runtimeOptions = {} satisfies IContainerRuntimeOptions,
745
777
  containerScope = {},
746
778
  containerRuntimeCtor = ContainerRuntime,
747
779
  } = params;
@@ -751,6 +783,7 @@ export class ContainerRuntime
751
783
  const backCompatContext: IContainerContext | OldContainerContextWithLogger = context;
752
784
  const passLogger =
753
785
  backCompatContext.taggedLogger ??
786
+ // eslint-disable-next-line import/no-deprecated
754
787
  new TaggedLoggerAdapter((backCompatContext as OldContainerContextWithLogger).logger);
755
788
  const logger = createChildLogger({
756
789
  logger: passLogger,
@@ -770,10 +803,11 @@ export class ContainerRuntime
770
803
  flushMode = defaultFlushMode,
771
804
  compressionOptions = defaultCompressionConfig,
772
805
  maxBatchSizeInBytes = defaultMaxBatchSizeInBytes,
773
- enableRuntimeIdCompressor = "off",
806
+ enableRuntimeIdCompressor,
774
807
  chunkSizeInBytes = defaultChunkSizeInBytes,
775
808
  enableOpReentryCheck = false,
776
809
  enableGroupedBatching = false,
810
+ explicitSchemaControl = false,
777
811
  } = runtimeOptions;
778
812
 
779
813
  const registry = new FluidDataStoreRegistry(registryEntries);
@@ -814,8 +848,10 @@ export class ContainerRuntime
814
848
  },
815
849
  );
816
850
 
851
+ const messageAtLastSummary = lastMessageFromMetadata(metadata);
852
+
817
853
  // Verify summary runtime sequence number matches protocol sequence number.
818
- const runtimeSequenceNumber = metadata?.message?.sequenceNumber;
854
+ const runtimeSequenceNumber = messageAtLastSummary?.sequenceNumber;
819
855
  // When we load with pending state, we reuse an old snapshot so we don't expect these numbers to match
820
856
  if (!context.pendingLocalState && runtimeSequenceNumber !== undefined) {
821
857
  const protocolSequenceNumber = context.deltaManager.initialSequenceNumber;
@@ -824,6 +860,13 @@ export class ContainerRuntime
824
860
  loadSequenceNumberVerification !== "bypass" &&
825
861
  runtimeSequenceNumber !== protocolSequenceNumber
826
862
  ) {
863
+ // Message to OCEs:
864
+ // You can hit this error with runtimeSequenceNumber === -1 in < 2.0 RC3 builds.
865
+ // This would indicate that explicit schema control is enabled in current (2.0 RC3+) builds and it
866
+ // results in addMetadataToSummary() creating a poison pill for older runtimes in the form of a -1 sequence number.
867
+ // Older runtimes do not understand new schema, and thus could corrupt document if they proceed, thus we are using
868
+ // this poison pill to prevent them from proceeding.
869
+
827
870
  // "Load from summary, runtime metadata sequenceNumber !== initialSequenceNumber"
828
871
  const error = new DataCorruptionError(
829
872
  // pre-0.58 error message: SummaryMetadataMismatch
@@ -839,8 +882,21 @@ export class ContainerRuntime
839
882
  }
840
883
  }
841
884
 
885
+ let desiredIdCompressorMode: IdCompressorMode;
886
+ switch (mc.config.getBoolean("Fluid.ContainerRuntime.IdCompressorEnabled")) {
887
+ case true:
888
+ desiredIdCompressorMode = "on";
889
+ break;
890
+ case false:
891
+ desiredIdCompressorMode = undefined;
892
+ break;
893
+ default:
894
+ desiredIdCompressorMode = enableRuntimeIdCompressor;
895
+ break;
896
+ }
897
+
842
898
  // Enabling the IdCompressor is a one-way operation and we only want to
843
- // allow new containers to turn it on
899
+ // allow new containers to turn it on.
844
900
  let idCompressorMode: IdCompressorMode;
845
901
  if (existing) {
846
902
  // This setting has to be sticky for correctness:
@@ -849,29 +905,34 @@ export class ContainerRuntime
849
905
  // 2) if it's ON, then all sessions should load compressor right away
850
906
  // 3) Same logic applies for "delayed" mode
851
907
  // Maybe in the future we will need to enabled (and figure how to do it safely) "delayed" -> "on" change.
852
- // We could do "off" -> "on" transtition too, if all clients start loading compressor (but not using it initially) and do so for a while -
853
- // this will allow clients to eventually to disregard "off" setting (when it's safe so) and start using compressor in future sessions.
908
+ // We could do "off" -> "on" transition too, if all clients start loading compressor (but not using it initially) and
909
+ // do so for a while - this will allow clients to eventually disregard "off" setting (when it's safe so) and start
910
+ // using compressor in future sessions.
854
911
  // Everyting is possible, but it needs to be designed and executed carefully, when such need arises.
855
- idCompressorMode = metadata?.idCompressorMode ?? "off";
856
- } else {
857
- // FG overwrite
858
- const enabled = mc.config.getBoolean("Fluid.ContainerRuntime.IdCompressorEnabled");
859
- switch (enabled) {
860
- case true:
861
- idCompressorMode = "on";
862
- break;
863
- case false:
864
- idCompressorMode = "off";
865
- break;
866
- default:
867
- idCompressorMode = enableRuntimeIdCompressor;
868
- break;
912
+ idCompressorMode = metadata?.documentSchema?.runtime
913
+ ?.idCompressorMode as IdCompressorMode;
914
+
915
+ // This is the only exception to the rule above - we have proper plumbing to load ID compressor on schema change
916
+ // event. It is loaded async (relative to op processing), so this conversion is only safe for off -> delayed conversion!
917
+ // Clients do not expect ID compressor ops unless ID compressor is On for them, and that could be achieved only through
918
+ // explicit schema change, i.e. only if explicitSchemaControl is on.
919
+ // Note: it would be better if we throw on combination of options (explicitSchemaControl = off, desiredIdCompressorMode === "delayed")
920
+ // that is not supported. But our service tests are oblivious to these problems and throwing here will cause a ton of failures
921
+ // We ignored incompatible ID compressor changes from the start (they were sticky), so that's not a new problem being introduced...
922
+ if (
923
+ idCompressorMode === undefined &&
924
+ desiredIdCompressorMode === "delayed" &&
925
+ explicitSchemaControl
926
+ ) {
927
+ idCompressorMode = desiredIdCompressorMode;
869
928
  }
929
+ } else {
930
+ idCompressorMode = desiredIdCompressorMode;
870
931
  }
871
932
 
872
933
  const createIdCompressorFn = async () => {
873
934
  const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import(
874
- "@fluidframework/id-compressor"
935
+ "@fluidframework/id-compressor/internal"
875
936
  );
876
937
 
877
938
  /**
@@ -906,6 +967,39 @@ export class ContainerRuntime
906
967
  }
907
968
  };
908
969
 
970
+ const disableGroupedBatching = mc.config.getBoolean(
971
+ "Fluid.ContainerRuntime.DisableGroupedBatching",
972
+ );
973
+ const disableCompression = mc.config.getBoolean(
974
+ "Fluid.ContainerRuntime.CompressionDisabled",
975
+ );
976
+ const compressionLz4 =
977
+ disableCompression !== true &&
978
+ compressionOptions.minimumBatchSizeInBytes !== Infinity &&
979
+ compressionOptions.compressionAlgorithm === "lz4";
980
+
981
+ const opGroupingEnabled = disableGroupedBatching !== true && enableGroupedBatching;
982
+
983
+ const documentSchemaController = new DocumentsSchemaController(
984
+ existing,
985
+ metadata?.documentSchema,
986
+ {
987
+ explicitSchemaControl,
988
+ compressionLz4,
989
+ idCompressorMode,
990
+ opGroupingEnabled,
991
+ disallowedVersions: [],
992
+ },
993
+ (schema) => {
994
+ runtime.onSchemaChange(schema);
995
+ },
996
+ );
997
+
998
+ const featureGatesForTelemetry: Record<string, boolean | number | undefined> = {
999
+ disableGroupedBatching,
1000
+ disableCompression,
1001
+ };
1002
+
909
1003
  const runtime = new containerRuntimeCtor(
910
1004
  context,
911
1005
  registry,
@@ -921,9 +1015,11 @@ export class ContainerRuntime
921
1015
  compressionOptions,
922
1016
  maxBatchSizeInBytes,
923
1017
  chunkSizeInBytes,
924
- enableRuntimeIdCompressor,
1018
+ // Requires<> drops undefined from IdCompressorType
1019
+ enableRuntimeIdCompressor: enableRuntimeIdCompressor as "on" | "delayed",
925
1020
  enableOpReentryCheck,
926
1021
  enableGroupedBatching,
1022
+ explicitSchemaControl,
927
1023
  },
928
1024
  containerScope,
929
1025
  logger,
@@ -931,12 +1027,24 @@ export class ContainerRuntime
931
1027
  blobManagerSnapshot,
932
1028
  context.storage,
933
1029
  createIdCompressorFn,
934
- idCompressorMode,
1030
+ documentSchemaController,
1031
+ featureGatesForTelemetry,
935
1032
  provideEntryPoint,
936
1033
  requestHandler,
937
1034
  undefined, // summaryConfiguration
938
1035
  );
939
1036
 
1037
+ runtime.blobManager.trackPendingStashedUploads().then(
1038
+ () => {
1039
+ // make sure we didn't reconnect before the promise resolved
1040
+ if (runtime.delayConnectClientId !== undefined && !runtime.disposed) {
1041
+ runtime.delayConnectClientId = undefined;
1042
+ runtime.setConnectionStateCore(true, runtime.delayConnectClientId);
1043
+ }
1044
+ },
1045
+ (error) => runtime.closeFn(error),
1046
+ );
1047
+
940
1048
  // Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,
941
1049
  // or zero. This must be done before Container replays saved ops.
942
1050
  await runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);
@@ -981,7 +1089,7 @@ export class ContainerRuntime
981
1089
  summaryOp: ISummaryContent,
982
1090
  referenceSequenceNumber?: number,
983
1091
  ) => number;
984
- private readonly submitSignalFn: (content: any, targetClientId?: string) => void;
1092
+ private readonly submitSignalFn: (content: ISignalEnvelope, targetClientId?: string) => void;
985
1093
  public readonly disposeFn: (error?: ICriticalContainerError) => void;
986
1094
  public readonly closeFn: (error?: ICriticalContainerError) => void;
987
1095
 
@@ -1002,6 +1110,10 @@ export class ContainerRuntime
1002
1110
  return this._getAttachState();
1003
1111
  }
1004
1112
 
1113
+ public get documentSchema() {
1114
+ return this.documentsSchemaController.sessionSchema.runtime;
1115
+ }
1116
+
1005
1117
  private _idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
1006
1118
 
1007
1119
  // We accumulate Id compressor Ops while Id compressor is not loaded yet (only for "delayed" mode)
@@ -1014,6 +1126,9 @@ export class ContainerRuntime
1014
1126
  // In such case we have to process all ops, including those marked with saveOp === true.
1015
1127
  private readonly skipSavedCompressorOps: boolean;
1016
1128
 
1129
+ public get idCompressorMode() {
1130
+ return this.documentSchema.idCompressorMode;
1131
+ }
1017
1132
  /**
1018
1133
  * See IContainerRuntimeBase.idCompressor() for details.
1019
1134
  */
@@ -1035,7 +1150,7 @@ export class ContainerRuntime
1035
1150
  * True if we have ID compressor loading in-flight (async operation). Useful only for
1036
1151
  * this.idCompressorMode === "delayed" mode
1037
1152
  */
1038
- protected compressorLoadInitiated = false;
1153
+ protected _loadIdCompressor: Promise<void> | undefined;
1039
1154
 
1040
1155
  /**
1041
1156
  * See IContainerRuntimeBase.generateDocumentUniqueId() for details.
@@ -1257,7 +1372,8 @@ export class ContainerRuntime
1257
1372
  blobManagerSnapshot: IBlobManagerLoadInfo,
1258
1373
  private readonly _storage: IDocumentStorageService,
1259
1374
  private readonly createIdCompressor: () => Promise<IIdCompressor & IIdCompressorCore>,
1260
- private readonly idCompressorMode: IdCompressorMode,
1375
+ private readonly documentsSchemaController: DocumentsSchemaController,
1376
+ featureGatesForTelemetry: Record<string, boolean | number | undefined>,
1261
1377
  provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>,
1262
1378
  private readonly requestHandler?: (
1263
1379
  request: IRequest,
@@ -1291,6 +1407,22 @@ export class ContainerRuntime
1291
1407
  supportedFeatures,
1292
1408
  } = context;
1293
1409
 
1410
+ this.mc = createChildMonitoringContext({
1411
+ logger: this.logger,
1412
+ namespace: "ContainerRuntime",
1413
+ });
1414
+
1415
+ // If we support multiple algorithms in the future, then we would need to manage it here carefully.
1416
+ // We can use runtimeOptions.compressionOptions.compressionAlgorithm, but only if it's in the schema list!
1417
+ // If it's not in the list, then we will need to either use no compression, or fallback to some other (supported by format)
1418
+ // compression.
1419
+ const compressionOptions: ICompressionRuntimeOptions = {
1420
+ minimumBatchSizeInBytes: this.documentSchema.compressionLz4
1421
+ ? runtimeOptions.compressionOptions.minimumBatchSizeInBytes
1422
+ : Number.POSITIVE_INFINITY,
1423
+ compressionAlgorithm: CompressionAlgorithms.lz4,
1424
+ };
1425
+
1294
1426
  this.innerDeltaManager = deltaManager;
1295
1427
  this.deltaManager = new DeltaManagerSummarizerProxy(this.innerDeltaManager);
1296
1428
 
@@ -1328,11 +1460,6 @@ export class ContainerRuntime
1328
1460
  // In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container
1329
1461
  this.closeFn = this.isSummarizerClient ? this.disposeFn : closeFn;
1330
1462
 
1331
- this.mc = createChildMonitoringContext({
1332
- logger: this.logger,
1333
- namespace: "ContainerRuntime",
1334
- });
1335
-
1336
1463
  let loadSummaryNumber: number;
1337
1464
  // Get the container creation metadata. For new container, we initialize these. For existing containers,
1338
1465
  // get the values from the metadata blob.
@@ -1353,7 +1480,7 @@ export class ContainerRuntime
1353
1480
  }
1354
1481
  this.nextSummaryNumber = loadSummaryNumber + 1;
1355
1482
 
1356
- this.messageAtLastSummary = metadata?.message;
1483
+ this.messageAtLastSummary = lastMessageFromMetadata(metadata);
1357
1484
 
1358
1485
  // Note that we only need to pull the *initial* connected state from the context.
1359
1486
  // Later updates come through calls to setConnectionState.
@@ -1498,7 +1625,7 @@ export class ContainerRuntime
1498
1625
  // Due to a mismatch between different layers in terms of
1499
1626
  // what is the interface of passing signals, we need the
1500
1627
  // downstream stores to wrap the signal.
1501
- parentContext.submitSignal = (type: string, content: any, targetClientId?: string) => {
1628
+ parentContext.submitSignal = (type: string, content: unknown, targetClientId?: string) => {
1502
1629
  const envelope1 = content as IEnvelope;
1503
1630
  const envelope2 = this.createNewSignalEnvelope(
1504
1631
  envelope1.address,
@@ -1533,11 +1660,11 @@ export class ContainerRuntime
1533
1660
  async (runtime: ChannelCollection) => provideEntryPoint,
1534
1661
  );
1535
1662
 
1536
- this.blobManager = new BlobManager(
1537
- this.handleContext,
1538
- blobManagerSnapshot,
1539
- () => this.storage,
1540
- (localId: string, blobId?: string) => {
1663
+ this.blobManager = new BlobManager({
1664
+ routeContext: this.handleContext,
1665
+ snapshot: blobManagerSnapshot,
1666
+ getStorage: () => this.storage,
1667
+ sendBlobAttachOp: (localId: string, blobId?: string) => {
1541
1668
  if (!this.disposed) {
1542
1669
  this.submit(
1543
1670
  { type: ContainerMessageType.BlobAttach, contents: undefined },
@@ -1549,12 +1676,13 @@ export class ContainerRuntime
1549
1676
  );
1550
1677
  }
1551
1678
  },
1552
- (blobPath: string) => this.garbageCollector.nodeUpdated(blobPath, "Loaded"),
1553
- (blobPath: string) => this.garbageCollector.isNodeDeleted(blobPath),
1554
- this,
1555
- pendingRuntimeState?.pendingAttachmentBlobs,
1556
- (error?: ICriticalContainerError) => this.closeFn(error),
1557
- );
1679
+ blobRequested: (blobPath: string) =>
1680
+ this.garbageCollector.nodeUpdated(blobPath, "Loaded"),
1681
+ isBlobDeleted: (blobPath: string) => this.garbageCollector.isNodeDeleted(blobPath),
1682
+ runtime: this,
1683
+ stashedBlobs: pendingRuntimeState?.pendingAttachmentBlobs,
1684
+ closeContainer: (error?: ICriticalContainerError) => this.closeFn(error),
1685
+ });
1558
1686
 
1559
1687
  this.scheduleManager = new ScheduleManager(
1560
1688
  this.innerDeltaManager,
@@ -1569,7 +1697,10 @@ export class ContainerRuntime
1569
1697
  clientId: () => this.clientId,
1570
1698
  close: this.closeFn,
1571
1699
  connected: () => this.connected,
1572
- reSubmit: this.reSubmit.bind(this),
1700
+ reSubmit: (message: IPendingBatchMessage) => {
1701
+ this.reSubmit(message);
1702
+ this.flush();
1703
+ },
1573
1704
  reSubmitBatch: this.reSubmitBatch.bind(this),
1574
1705
  isActiveConnection: () => this.innerDeltaManager.active,
1575
1706
  isAttached: () => this.attachState !== AttachState.Detached,
@@ -1578,17 +1709,6 @@ export class ContainerRuntime
1578
1709
  this.logger,
1579
1710
  );
1580
1711
 
1581
- const disableCompression = this.mc.config.getBoolean(
1582
- "Fluid.ContainerRuntime.CompressionDisabled",
1583
- );
1584
- const compressionOptions =
1585
- disableCompression === true
1586
- ? {
1587
- minimumBatchSizeInBytes: Number.POSITIVE_INFINITY,
1588
- compressionAlgorithm: CompressionAlgorithms.lz4,
1589
- }
1590
- : runtimeOptions.compressionOptions;
1591
-
1592
1712
  const disablePartialFlush = this.mc.config.getBoolean(
1593
1713
  "Fluid.ContainerRuntime.DisablePartialFlush",
1594
1714
  );
@@ -1742,10 +1862,10 @@ export class ContainerRuntime
1742
1862
  disableIsolatedChannels: metadata?.disableIsolatedChannels,
1743
1863
  gcVersion: metadata?.gcFeature,
1744
1864
  options: JSON.stringify(runtimeOptions),
1745
- idCompressorModeMetadata: metadata?.idCompressorMode,
1865
+ idCompressorModeMetadata: metadata?.documentSchema?.runtime?.idCompressorMode,
1746
1866
  idCompressorMode: this.idCompressorMode,
1747
1867
  featureGates: JSON.stringify({
1748
- disableCompression,
1868
+ ...featureGatesForTelemetry,
1749
1869
  disableOpReentryCheck,
1750
1870
  disableChunking,
1751
1871
  disableAttachReorder: this.disableAttachReorder,
@@ -1775,6 +1895,21 @@ export class ContainerRuntime
1775
1895
  this.skipSavedCompressorOps = pendingRuntimeState?.pendingIdCompressorState !== undefined;
1776
1896
  }
1777
1897
 
1898
+ public onSchemaChange(schema: IDocumentSchemaCurrent) {
1899
+ // Most of the settings will be picked up only by new sessions (i.e. after reload).
1900
+ // We can make it better in the future (i.e. start to use op compression right away), but for simplicity
1901
+ // this is not done.
1902
+ // But ID compressor is special. It's possible, that in future, we will remove "stickiness" of ID compressor setting
1903
+ // and will allow to start using it. If that were to happen, we want to ensure that we do not break eventual consistency
1904
+ // promises. To do so, we need to initialize id compressor right away.
1905
+ // As it's implemented right now (with async initialization), this will only work for "off" -> "delayed" transitions.
1906
+ // Anything else is too risky, and requires ability to initialize ID compressor synchronously!
1907
+ if (schema.runtime.idCompressorMode !== undefined) {
1908
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
1909
+ this.loadIdCompressor();
1910
+ }
1911
+ }
1912
+
1778
1913
  public getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam) {
1779
1914
  return (
1780
1915
  summarizeInternal: SummarizeInternalFn,
@@ -1793,10 +1928,15 @@ export class ContainerRuntime
1793
1928
  return this.summarizerNode.deleteChild(id);
1794
1929
  }
1795
1930
 
1931
+ /* IFluidParentContext APIs that should not be called on Root */
1796
1932
  public makeLocallyVisible() {
1797
1933
  assert(false, 0x8eb /* should not be called */);
1798
1934
  }
1799
1935
 
1936
+ public setChannelDirty(address: string) {
1937
+ assert(false, 0x909 /* should not be called */);
1938
+ }
1939
+
1800
1940
  /**
1801
1941
  * Initializes the state from the base snapshot this container runtime loaded from.
1802
1942
  */
@@ -2052,20 +2192,38 @@ export class ContainerRuntime
2052
2192
 
2053
2193
  /** Adds the container's metadata to the given summary tree. */
2054
2194
  private addMetadataToSummary(summaryTree: ISummaryTreeWithStats) {
2195
+ // The last message processed at the time of summary. If there are no new messages, use the message from the
2196
+ // last summary.
2197
+ const message =
2198
+ extractSummaryMetadataMessage(this.deltaManager.lastMessage) ??
2199
+ this.messageAtLastSummary;
2200
+
2201
+ const documentSchema = this.documentsSchemaController.summarizeDocumentSchema(
2202
+ this.deltaManager.lastSequenceNumber,
2203
+ );
2204
+
2205
+ // Is document schema explicit control on?
2206
+ const explitiSchemaControl = documentSchema?.runtime.explicitSchemaControl;
2207
+
2055
2208
  const metadata: IContainerRuntimeMetadata = {
2056
2209
  ...this.createContainerMetadata,
2057
2210
  // Increment the summary number for the next summary that will be generated.
2058
2211
  summaryNumber: this.nextSummaryNumber++,
2059
2212
  summaryFormatVersion: 1,
2060
2213
  ...this.garbageCollector.getMetadata(),
2061
- // The last message processed at the time of summary. If there are no new messages, use the message from the
2062
- // last summary.
2063
- message:
2064
- extractSummaryMetadataMessage(this.deltaManager.lastMessage) ??
2065
- this.messageAtLastSummary,
2066
2214
  telemetryDocumentId: this.telemetryDocumentId,
2067
- idCompressorMode: this.idCompressorMode,
2215
+ // If explicit document schema control is not on, use legacy way to supply last message (using 'message' property).
2216
+ // Otherwise use new 'lastMessage' property, but also put content into the 'message' property that cases old
2217
+ // runtimes (that preceed document schema control capabilities) to close container on load due to mismatch in
2218
+ // last message's sequence number.
2219
+ // See also lastMessageFromMetadata()
2220
+ message: explitiSchemaControl
2221
+ ? ({ sequenceNumber: -1 } as any as ISummaryMetadataMessage)
2222
+ : message,
2223
+ lastMessage: explitiSchemaControl ? message : undefined,
2224
+ documentSchema,
2068
2225
  };
2226
+
2069
2227
  addBlobToSummary(summaryTree, metadataBlobName, JSON.stringify(metadata));
2070
2228
  }
2071
2229
 
@@ -2144,14 +2302,8 @@ export class ContainerRuntime
2144
2302
  return this.consecutiveReconnects < this.maxConsecutiveReconnects;
2145
2303
  }
2146
2304
 
2147
- private resetReconnectCount(message?: ISequencedDocumentMessage) {
2148
- // Chunked ops don't count towards making progress as they are sent
2149
- // in their own batches before the originating batch is sent.
2150
- // Therefore, receiving them while attempting to send the originating batch
2151
- // does not mean that the container is making any progress.
2152
- if (message?.type !== ContainerMessageType.ChunkedOp) {
2153
- this.consecutiveReconnects = 0;
2154
- }
2305
+ private resetReconnectCount() {
2306
+ this.consecutiveReconnects = 0;
2155
2307
  }
2156
2308
 
2157
2309
  private replayPendingStates() {
@@ -2207,7 +2359,21 @@ export class ContainerRuntime
2207
2359
  case ContainerMessageType.Alias:
2208
2360
  return this.channelCollection.applyStashedOp(opContents);
2209
2361
  case ContainerMessageType.IdAllocation:
2210
- assert(this.idCompressorMode !== "off", 0x8f1 /* ID compressor should be in use */);
2362
+ // IDs allocation ops in stashed state are ignored because the tip state of the compressor
2363
+ // is serialized into the pending state. This is done because generation of new IDs during
2364
+ // stashed op application (or, later, resubmit) must generate new IDs and if the compressor
2365
+ // was loaded from a state serialized at the same time as the summary tree in the stashed state
2366
+ // then it would generate IDs that collide with any in later stashed ops.
2367
+ // In the future, IdCompressor could be extended to have an "applyStashedOp" or similar method
2368
+ // and the runtime could filter out all ID allocation ops from the stashed state and apply them
2369
+ // before applying the rest of the stashed ops. This would accomplish the same thing but with
2370
+ // better performance in future incremental stashed state creation.
2371
+ assert(
2372
+ this.idCompressorMode !== undefined,
2373
+ 0x8f1 /* ID compressor should be in use */,
2374
+ );
2375
+ return;
2376
+ case ContainerMessageType.DocumentSchemaChange:
2211
2377
  return;
2212
2378
  case ContainerMessageType.BlobAttach:
2213
2379
  return;
@@ -2244,12 +2410,16 @@ export class ContainerRuntime
2244
2410
  }
2245
2411
  }
2246
2412
 
2247
- public setConnectionState(connected: boolean, clientId?: string) {
2248
- if (connected && this.idCompressorMode === "delayed" && !this.compressorLoadInitiated) {
2249
- this.compressorLoadInitiated = true;
2250
- this.createIdCompressor()
2413
+ private async loadIdCompressor() {
2414
+ if (
2415
+ this._idCompressor === undefined &&
2416
+ this.idCompressorMode !== undefined &&
2417
+ this._loadIdCompressor === undefined
2418
+ ) {
2419
+ this._loadIdCompressor = this.createIdCompressor()
2251
2420
  .then((compressor) => {
2252
2421
  this._idCompressor = compressor;
2422
+ // Finalize any ranges we received while the compressor was turned off.
2253
2423
  for (const range of this.pendingIdCompressorOps) {
2254
2424
  this._idCompressor.finalizeCreationRange(range);
2255
2425
  }
@@ -2257,8 +2427,17 @@ export class ContainerRuntime
2257
2427
  })
2258
2428
  .catch((error) => {
2259
2429
  this.logger.sendErrorEvent({ eventName: "IdCompressorDelayedLoad" }, error);
2430
+ throw error;
2260
2431
  });
2261
2432
  }
2433
+ return this._loadIdCompressor;
2434
+ }
2435
+
2436
+ public setConnectionState(connected: boolean, clientId?: string) {
2437
+ if (connected && this.idCompressorMode === "delayed") {
2438
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
2439
+ this.loadIdCompressor();
2440
+ }
2262
2441
  if (connected === false && this.delayConnectClientId !== undefined) {
2263
2442
  this.delayConnectClientId = undefined;
2264
2443
  this.mc.logger.sendTelemetryEvent({
@@ -2268,27 +2447,21 @@ export class ContainerRuntime
2268
2447
  return;
2269
2448
  }
2270
2449
 
2450
+ if (!connected) {
2451
+ this.documentsSchemaController.onDisconnect();
2452
+ }
2453
+
2271
2454
  // If there are stashed blobs in the pending state, we need to delay
2272
2455
  // propagation of the "connected" event until we have uploaded them to
2273
2456
  // ensure we don't submit ops referencing a blob that has not been uploaded
2274
2457
  const connecting = connected && !this._connected;
2275
- if (connecting && this.blobManager.hasPendingStashedBlobs()) {
2458
+ if (connecting && this.blobManager.hasPendingStashedUploads()) {
2276
2459
  assert(
2277
2460
  !this.delayConnectClientId,
2278
2461
  0x791 /* Connect event delay must be canceled before subsequent connect event */,
2279
2462
  );
2280
2463
  assert(!!clientId, 0x792 /* Must have clientId when connecting */);
2281
2464
  this.delayConnectClientId = clientId;
2282
- this.blobManager.processStashedChanges().then(
2283
- () => {
2284
- // make sure we didn't reconnect before the promise resolved
2285
- if (this.delayConnectClientId === clientId && !this.disposed) {
2286
- this.delayConnectClientId = undefined;
2287
- this.setConnectionStateCore(connected, clientId);
2288
- }
2289
- },
2290
- (error) => this.closeFn(error),
2291
- );
2292
2465
  return;
2293
2466
  }
2294
2467
 
@@ -2407,12 +2580,17 @@ export class ContainerRuntime
2407
2580
  this._processedClientSequenceNumber = message.clientSequenceNumber;
2408
2581
 
2409
2582
  try {
2583
+ // See commit that added this assert for more details.
2584
+ // These calls should be made for all but chunked ops:
2585
+ // 1) this.pendingStateManager.processPendingLocalMessage() below
2586
+ // 2) this.resetReconnectCount() below
2587
+ assert(
2588
+ message.type !== ContainerMessageType.ChunkedOp,
2589
+ 0x93b /* we should never get here with chunked ops */,
2590
+ );
2591
+
2410
2592
  let localOpMetadata: unknown;
2411
- if (
2412
- local &&
2413
- messageWithContext.modernRuntimeMessage &&
2414
- message.type !== ContainerMessageType.ChunkedOp
2415
- ) {
2593
+ if (local && messageWithContext.modernRuntimeMessage) {
2416
2594
  localOpMetadata = this.pendingStateManager.processPendingLocalMessage(
2417
2595
  messageWithContext.message,
2418
2596
  );
@@ -2434,7 +2612,7 @@ export class ContainerRuntime
2434
2612
  // If we have processed a local op, this means that the container is
2435
2613
  // making progress and we can reset the counter for how many times
2436
2614
  // we have consecutively replayed the pending states
2437
- this.resetReconnectCount(message);
2615
+ this.resetReconnectCount();
2438
2616
  }
2439
2617
  } catch (e) {
2440
2618
  this.scheduleManager.afterOpProcessing(e, message);
@@ -2479,7 +2657,13 @@ export class ContainerRuntime
2479
2657
  )
2480
2658
  ) {
2481
2659
  const range = messageWithContext.message.contents;
2660
+ // Some other client turned on the id compressor. If we have not turned it on,
2661
+ // put it in a pending queue and delay finalization.
2482
2662
  if (this._idCompressor === undefined) {
2663
+ assert(
2664
+ this.idCompressorMode !== undefined,
2665
+ 0x93c /* id compressor should be enabled */,
2666
+ );
2483
2667
  this.pendingIdCompressorOps.push(range);
2484
2668
  } else {
2485
2669
  this._idCompressor.finalizeCreationRange(range);
@@ -2490,8 +2674,18 @@ export class ContainerRuntime
2490
2674
  this.garbageCollector.processMessage(messageWithContext.message, local);
2491
2675
  break;
2492
2676
  case ContainerMessageType.ChunkedOp:
2677
+ // From observability POV, we should not exppse the rest of the system (including "op" events on object) to these messages.
2678
+ // Also resetReconnectCount() would be wrong - see comment that was there before this change was made.
2679
+ assert(false, 0x93d /* should not even get here */);
2493
2680
  case ContainerMessageType.Rejoin:
2494
2681
  break;
2682
+ case ContainerMessageType.DocumentSchemaChange:
2683
+ this.documentsSchemaController.processDocumentSchemaOp(
2684
+ messageWithContext.message.contents,
2685
+ messageWithContext.local,
2686
+ messageWithContext.message.sequenceNumber,
2687
+ );
2688
+ break;
2495
2689
  default: {
2496
2690
  // If we didn't necessarily expect a runtime message type, then no worries - just return
2497
2691
  // e.g. this case applies to system ops, or legacy ops that would have fallen into the above cases anyway.
@@ -2720,14 +2914,14 @@ export class ContainerRuntime
2720
2914
  pkg: Readonly<string[]>,
2721
2915
  loadingGroupId?: string,
2722
2916
  ): IFluidDataStoreContextDetached {
2723
- return this.channelCollection.createDetachedDataStoreCore(pkg, loadingGroupId);
2917
+ return this.channelCollection.createDetachedDataStore(pkg, loadingGroupId);
2724
2918
  }
2725
2919
 
2726
2920
  public async createDataStore(
2727
2921
  pkg: Readonly<string | string[]>,
2728
2922
  loadingGroupId?: string,
2729
2923
  ): Promise<IDataStore> {
2730
- const context = this.channelCollection._createFluidDataStoreContext(
2924
+ const context = this.channelCollection.createDataStoreContext(
2731
2925
  Array.isArray(pkg) ? pkg : [pkg],
2732
2926
  undefined, // props
2733
2927
  loadingGroupId,
@@ -2747,7 +2941,7 @@ export class ContainerRuntime
2747
2941
  pkg: Readonly<string | string[]>,
2748
2942
  props?: any,
2749
2943
  ): Promise<IDataStore> {
2750
- const context = this.channelCollection._createFluidDataStoreContext(
2944
+ const context = this.channelCollection.createDataStoreContext(
2751
2945
  Array.isArray(pkg) ? pkg : [pkg],
2752
2946
  props,
2753
2947
  );
@@ -2810,6 +3004,8 @@ export class ContainerRuntime
2810
3004
  }
2811
3005
  break;
2812
3006
  }
3007
+ case ContainerMessageType.IdAllocation:
3008
+ case ContainerMessageType.DocumentSchemaChange:
2813
3009
  case ContainerMessageType.GC: {
2814
3010
  return false;
2815
3011
  }
@@ -2846,10 +3042,10 @@ export class ContainerRuntime
2846
3042
  /**
2847
3043
  * Submits the signal to be sent to other clients.
2848
3044
  * @param type - Type of the signal.
2849
- * @param content - Content of the signal.
3045
+ * @param content - Content of the signal. Should be a JSON serializable object or primitive.
2850
3046
  * @param targetClientId - When specified, the signal is only sent to the provided client id.
2851
3047
  */
2852
- public submitSignal(type: string, content: any, targetClientId?: string) {
3048
+ public submitSignal(type: string, content: unknown, targetClientId?: string) {
2853
3049
  this.verifyNotClosed();
2854
3050
  const envelope = this.createNewSignalEnvelope(undefined /* address */, type, content);
2855
3051
  return this.submitSignalFn(envelope, targetClientId);
@@ -2894,6 +3090,10 @@ export class ContainerRuntime
2894
3090
  // We can finalize any allocated IDs since we're the only client
2895
3091
  const idRange = this._idCompressor?.takeNextCreationRange();
2896
3092
  if (idRange !== undefined) {
3093
+ assert(
3094
+ idRange.ids === undefined || idRange.ids.firstGenCount === 1,
3095
+ 0x93e /* No other ranges should be taken while container is detached. */,
3096
+ );
2897
3097
  this._idCompressor?.finalizeCreationRange(idRange);
2898
3098
  }
2899
3099
 
@@ -2927,6 +3127,9 @@ export class ContainerRuntime
2927
3127
  wrapSummaryInChannelsTree(summarizeResult);
2928
3128
  const pathPartsForChildren = [channelsTreeName];
2929
3129
 
3130
+ // Ensure that ID compressor had a chance to load, if we are using delayed mode.
3131
+ await this.loadIdCompressor();
3132
+
2930
3133
  this.addContainerStateToSummary(summarizeResult, fullTree, trackState, telemetryContext);
2931
3134
  return {
2932
3135
  ...summarizeResult,
@@ -3045,24 +3248,6 @@ export class ContainerRuntime
3045
3248
  this.channelCollection.updateUsedRoutes(dataStoreRoutes);
3046
3249
  }
3047
3250
 
3048
- /**
3049
- * This is called to update objects whose routes are unused.
3050
- * @param unusedRoutes - Data store and attachment blob routes that are unused in this Container.
3051
- */
3052
- public updateUnusedRoutes(unusedRoutes: readonly string[]) {
3053
- const { blobManagerRoutes, dataStoreRoutes } =
3054
- this.getDataStoreAndBlobManagerRoutes(unusedRoutes);
3055
- this.blobManager.updateUnusedRoutes(blobManagerRoutes);
3056
- this.channelCollection.updateUnusedRoutes(dataStoreRoutes);
3057
- }
3058
-
3059
- /**
3060
- * @deprecated Replaced by deleteSweepReadyNodes.
3061
- */
3062
- public deleteUnusedNodes(unusedRoutes: readonly string[]): string[] {
3063
- throw new Error("deleteUnusedRoutes should not be called");
3064
- }
3065
-
3066
3251
  /**
3067
3252
  * After GC has run and identified nodes that are sweep ready, this is called to delete the sweep ready nodes.
3068
3253
  * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.
@@ -3678,9 +3863,6 @@ export class ContainerRuntime
3678
3863
  const idAllocationBatchMessage: BatchMessage = {
3679
3864
  contents: JSON.stringify(idAllocationMessage),
3680
3865
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
3681
- metadata: undefined,
3682
- localOpMetadata: undefined,
3683
- type: ContainerMessageType.IdAllocation,
3684
3866
  };
3685
3867
  this.outbox.submitIdAllocation(idAllocationBatchMessage);
3686
3868
  }
@@ -3690,7 +3872,7 @@ export class ContainerRuntime
3690
3872
  private submit(
3691
3873
  containerRuntimeMessage: OutboundContainerRuntimeMessage,
3692
3874
  localOpMetadata: unknown = undefined,
3693
- metadata: Record<string, unknown> | undefined = undefined,
3875
+ metadata?: { localId: string; blobId?: string },
3694
3876
  ): void {
3695
3877
  this.verifyNotClosed();
3696
3878
  this.verifyCanSubmitOps();
@@ -3701,6 +3883,12 @@ export class ContainerRuntime
3701
3883
  0x132 /* "sending ops in detached container" */,
3702
3884
  );
3703
3885
 
3886
+ assert(
3887
+ metadata === undefined ||
3888
+ containerRuntimeMessage.type === ContainerMessageType.BlobAttach,
3889
+ 0x93f /* metadata */,
3890
+ );
3891
+
3704
3892
  const serializedContent = JSON.stringify(containerRuntimeMessage);
3705
3893
 
3706
3894
  // Note that the real (non-proxy) delta manager is used here to get the readonly info. This is because
@@ -3715,7 +3903,6 @@ export class ContainerRuntime
3715
3903
  const type = containerRuntimeMessage.type;
3716
3904
  const message: BatchMessage = {
3717
3905
  contents: serializedContent,
3718
- type,
3719
3906
  metadata,
3720
3907
  localOpMetadata,
3721
3908
  referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
@@ -3731,6 +3918,21 @@ export class ContainerRuntime
3731
3918
  } else {
3732
3919
  this.submitIdAllocationOpIfNeeded();
3733
3920
 
3921
+ // Allow document schema controller to send a message if it needs to propose change in document schema.
3922
+ // If it needs to send a message, it will call provided callback with payload of such message and rely
3923
+ // on this callback to do actual sending.
3924
+ const contents = this.documentsSchemaController.maybeSendSchemaMessage();
3925
+ if (contents) {
3926
+ const msg: ContainerRuntimeDocumentSchemaMessage = {
3927
+ type: ContainerMessageType.DocumentSchemaChange,
3928
+ contents,
3929
+ };
3930
+ this.outbox.submit({
3931
+ contents: JSON.stringify(msg),
3932
+ referenceSequenceNumber: this.deltaManager.lastSequenceNumber,
3933
+ });
3934
+ }
3935
+
3734
3936
  // If this is attach message for new data store, and we are in a batch, send this op out of order
3735
3937
  // Is it safe:
3736
3938
  // Yes, this should be safe reordering. Newly created data stores are not visible through API surface.
@@ -3931,6 +4133,11 @@ export class ContainerRuntime
3931
4133
  case ContainerMessageType.GC:
3932
4134
  this.submit(message);
3933
4135
  break;
4136
+ case ContainerMessageType.DocumentSchemaChange:
4137
+ // There is no need to resend this message. Document schema controller will properly resend it again (if needed)
4138
+ // on a first occasion (any ops sent after reconnect). There is a good chance, though, that it will not want to
4139
+ // send any ops, as some other client already changed schema.
4140
+ break;
3934
4141
  default: {
3935
4142
  // This case should be very rare - it would imply an op was stashed from a
3936
4143
  // future version of runtime code and now is being applied on an older version.
@@ -4220,9 +4427,6 @@ export class ContainerRuntime
4220
4427
  }
4221
4428
 
4222
4429
  private get groupedBatchingEnabled(): boolean {
4223
- const killSwitch = this.mc.config.getBoolean(
4224
- "Fluid.ContainerRuntime.DisableGroupedBatching",
4225
- );
4226
- return killSwitch !== true && this.runtimeOptions.enableGroupedBatching;
4430
+ return this.documentSchema.opGroupingEnabled === true;
4227
4431
  }
4228
4432
  }