@fluidframework/container-runtime 2.13.0 → 2.21.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 (489) hide show
  1. package/.eslintrc.cjs +71 -5
  2. package/CHANGELOG.md +84 -0
  3. package/api-report/container-runtime.legacy.alpha.api.md +38 -232
  4. package/dist/batchTracker.d.ts +1 -2
  5. package/dist/batchTracker.d.ts.map +1 -1
  6. package/dist/batchTracker.js +1 -1
  7. package/dist/batchTracker.js.map +1 -1
  8. package/dist/blobManager/blobManager.d.ts +5 -1
  9. package/dist/blobManager/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager/blobManager.js +30 -13
  11. package/dist/blobManager/blobManager.js.map +1 -1
  12. package/dist/blobManager/blobManagerSnapSum.d.ts +1 -0
  13. package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  14. package/dist/blobManager/blobManagerSnapSum.js +7 -5
  15. package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
  16. package/dist/channelCollection.d.ts +23 -12
  17. package/dist/channelCollection.d.ts.map +1 -1
  18. package/dist/channelCollection.js +85 -53
  19. package/dist/channelCollection.js.map +1 -1
  20. package/dist/connectionTelemetry.d.ts +2 -2
  21. package/dist/connectionTelemetry.d.ts.map +1 -1
  22. package/dist/connectionTelemetry.js +10 -6
  23. package/dist/connectionTelemetry.js.map +1 -1
  24. package/dist/containerHandleContext.d.ts +1 -1
  25. package/dist/containerHandleContext.d.ts.map +1 -1
  26. package/dist/containerHandleContext.js.map +1 -1
  27. package/dist/containerRuntime.d.ts +87 -94
  28. package/dist/containerRuntime.d.ts.map +1 -1
  29. package/dist/containerRuntime.js +312 -226
  30. package/dist/containerRuntime.js.map +1 -1
  31. package/dist/dataStore.d.ts +7 -3
  32. package/dist/dataStore.d.ts.map +1 -1
  33. package/dist/dataStore.js +8 -4
  34. package/dist/dataStore.js.map +1 -1
  35. package/dist/dataStoreContext.d.ts +41 -25
  36. package/dist/dataStoreContext.d.ts.map +1 -1
  37. package/dist/dataStoreContext.js +47 -29
  38. package/dist/dataStoreContext.js.map +1 -1
  39. package/dist/dataStoreContexts.d.ts +6 -2
  40. package/dist/dataStoreContexts.d.ts.map +1 -1
  41. package/dist/dataStoreContexts.js +7 -2
  42. package/dist/dataStoreContexts.js.map +1 -1
  43. package/dist/dataStoreRegistry.d.ts +1 -1
  44. package/dist/dataStoreRegistry.d.ts.map +1 -1
  45. package/dist/dataStoreRegistry.js.map +1 -1
  46. package/dist/deltaManagerProxies.d.ts +1 -17
  47. package/dist/deltaManagerProxies.d.ts.map +1 -1
  48. package/dist/deltaManagerProxies.js.map +1 -1
  49. package/dist/deltaScheduler.d.ts +9 -6
  50. package/dist/deltaScheduler.d.ts.map +1 -1
  51. package/dist/deltaScheduler.js +95 -89
  52. package/dist/deltaScheduler.js.map +1 -1
  53. package/dist/gc/garbageCollection.d.ts +21 -7
  54. package/dist/gc/garbageCollection.d.ts.map +1 -1
  55. package/dist/gc/garbageCollection.js +48 -19
  56. package/dist/gc/garbageCollection.js.map +1 -1
  57. package/dist/gc/gcConfigs.d.ts +11 -0
  58. package/dist/gc/gcConfigs.d.ts.map +1 -1
  59. package/dist/gc/gcConfigs.js +5 -2
  60. package/dist/gc/gcConfigs.js.map +1 -1
  61. package/dist/gc/gcDefinitions.d.ts +218 -70
  62. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  63. package/dist/gc/gcDefinitions.js +40 -13
  64. package/dist/gc/gcDefinitions.js.map +1 -1
  65. package/dist/gc/gcHelpers.d.ts +6 -2
  66. package/dist/gc/gcHelpers.d.ts.map +1 -1
  67. package/dist/gc/gcHelpers.js +14 -7
  68. package/dist/gc/gcHelpers.js.map +1 -1
  69. package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
  70. package/dist/gc/gcSummaryDefinitions.d.ts +18 -6
  71. package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -1
  72. package/dist/gc/gcSummaryDefinitions.js.map +1 -1
  73. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  74. package/dist/gc/gcSummaryStateTracker.js +2 -1
  75. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  76. package/dist/gc/gcTelemetry.d.ts +33 -11
  77. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  78. package/dist/gc/gcTelemetry.js +35 -17
  79. package/dist/gc/gcTelemetry.js.map +1 -1
  80. package/dist/gc/gcUnreferencedStateTracker.d.ts +42 -13
  81. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  82. package/dist/gc/gcUnreferencedStateTracker.js +27 -9
  83. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  84. package/dist/gc/index.d.ts +1 -0
  85. package/dist/gc/index.d.ts.map +1 -1
  86. package/dist/gc/index.js +3 -1
  87. package/dist/gc/index.js.map +1 -1
  88. package/dist/inboundBatchAggregator.d.ts +34 -0
  89. package/dist/inboundBatchAggregator.d.ts.map +1 -0
  90. package/dist/inboundBatchAggregator.js +185 -0
  91. package/dist/inboundBatchAggregator.js.map +1 -0
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist/layerCompatState.d.ts +19 -0
  96. package/dist/layerCompatState.d.ts.map +1 -0
  97. package/dist/layerCompatState.js +64 -0
  98. package/dist/layerCompatState.js.map +1 -0
  99. package/dist/legacy.d.ts +0 -4
  100. package/dist/messageTypes.d.ts +14 -5
  101. package/dist/messageTypes.d.ts.map +1 -1
  102. package/dist/messageTypes.js.map +1 -1
  103. package/dist/metadata.d.ts +12 -4
  104. package/dist/metadata.d.ts.map +1 -1
  105. package/dist/metadata.js +6 -2
  106. package/dist/metadata.js.map +1 -1
  107. package/dist/opLifecycle/batchManager.d.ts +9 -3
  108. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  109. package/dist/opLifecycle/batchManager.js +3 -1
  110. package/dist/opLifecycle/batchManager.js.map +1 -1
  111. package/dist/opLifecycle/duplicateBatchDetector.d.ts +9 -3
  112. package/dist/opLifecycle/duplicateBatchDetector.d.ts.map +1 -1
  113. package/dist/opLifecycle/duplicateBatchDetector.js +11 -5
  114. package/dist/opLifecycle/duplicateBatchDetector.js.map +1 -1
  115. package/dist/opLifecycle/opCompressor.d.ts +3 -2
  116. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  117. package/dist/opLifecycle/opCompressor.js +13 -19
  118. package/dist/opLifecycle/opCompressor.js.map +1 -1
  119. package/dist/opLifecycle/opDecompressor.d.ts +6 -1
  120. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  121. package/dist/opLifecycle/opDecompressor.js +16 -8
  122. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  123. package/dist/opLifecycle/opGroupingManager.d.ts +1 -2
  124. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  125. package/dist/opLifecycle/opGroupingManager.js +9 -6
  126. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  127. package/dist/opLifecycle/opSplitter.d.ts +13 -10
  128. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  129. package/dist/opLifecycle/opSplitter.js +16 -11
  130. package/dist/opLifecycle/opSplitter.js.map +1 -1
  131. package/dist/opLifecycle/outbox.d.ts +4 -4
  132. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  133. package/dist/opLifecycle/outbox.js +17 -16
  134. package/dist/opLifecycle/outbox.js.map +1 -1
  135. package/dist/opLifecycle/remoteMessageProcessor.d.ts +9 -3
  136. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  137. package/dist/opLifecycle/remoteMessageProcessor.js +3 -1
  138. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  139. package/dist/package.json +2 -1
  140. package/dist/packageVersion.d.ts +1 -1
  141. package/dist/packageVersion.js +1 -1
  142. package/dist/packageVersion.js.map +1 -1
  143. package/dist/pendingStateManager.d.ts +22 -11
  144. package/dist/pendingStateManager.d.ts.map +1 -1
  145. package/dist/pendingStateManager.js +24 -15
  146. package/dist/pendingStateManager.js.map +1 -1
  147. package/dist/summary/documentSchema.d.ts +7 -0
  148. package/dist/summary/documentSchema.d.ts.map +1 -1
  149. package/dist/summary/documentSchema.js +8 -4
  150. package/dist/summary/documentSchema.js.map +1 -1
  151. package/dist/summary/index.d.ts +1 -1
  152. package/dist/summary/index.d.ts.map +1 -1
  153. package/dist/summary/index.js.map +1 -1
  154. package/dist/summary/orderedClientElection.d.ts +94 -31
  155. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  156. package/dist/summary/orderedClientElection.js +28 -16
  157. package/dist/summary/orderedClientElection.js.map +1 -1
  158. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -0
  159. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  160. package/dist/summary/runWhileConnectedCoordinator.js +7 -2
  161. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  162. package/dist/summary/runningSummarizer.d.ts +17 -6
  163. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  164. package/dist/summary/runningSummarizer.js +48 -19
  165. package/dist/summary/runningSummarizer.js.map +1 -1
  166. package/dist/summary/summarizer.d.ts +10 -5
  167. package/dist/summary/summarizer.d.ts.map +1 -1
  168. package/dist/summary/summarizer.js +26 -11
  169. package/dist/summary/summarizer.js.map +1 -1
  170. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  171. package/dist/summary/summarizerClientElection.js +1 -0
  172. package/dist/summary/summarizerClientElection.js.map +1 -1
  173. package/dist/summary/summarizerHeuristics.d.ts +6 -2
  174. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  175. package/dist/summary/summarizerHeuristics.js +13 -5
  176. package/dist/summary/summarizerHeuristics.js.map +1 -1
  177. package/dist/summary/summarizerNode/index.d.ts.map +1 -1
  178. package/dist/summary/summarizerNode/index.js.map +1 -1
  179. package/dist/summary/summarizerNode/summarizerNode.d.ts +24 -8
  180. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  181. package/dist/summary/summarizerNode/summarizerNode.js +45 -36
  182. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  183. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +48 -16
  184. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  185. package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -1
  186. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  187. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +13 -5
  188. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  189. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +15 -7
  190. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  191. package/dist/summary/summarizerTypes.d.ts +253 -135
  192. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  193. package/dist/summary/summarizerTypes.js.map +1 -1
  194. package/dist/summary/summaryCollection.d.ts +3 -4
  195. package/dist/summary/summaryCollection.d.ts.map +1 -1
  196. package/dist/summary/summaryCollection.js +10 -8
  197. package/dist/summary/summaryCollection.js.map +1 -1
  198. package/dist/summary/summaryFormat.d.ts +28 -9
  199. package/dist/summary/summaryFormat.d.ts.map +1 -1
  200. package/dist/summary/summaryFormat.js +3 -2
  201. package/dist/summary/summaryFormat.js.map +1 -1
  202. package/dist/summary/summaryGenerator.d.ts +9 -3
  203. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  204. package/dist/summary/summaryGenerator.js +22 -9
  205. package/dist/summary/summaryGenerator.js.map +1 -1
  206. package/dist/summary/summaryManager.d.ts +8 -4
  207. package/dist/summary/summaryManager.d.ts.map +1 -1
  208. package/dist/summary/summaryManager.js +20 -9
  209. package/dist/summary/summaryManager.js.map +1 -1
  210. package/dist/throttler.d.ts +26 -10
  211. package/dist/throttler.d.ts.map +1 -1
  212. package/dist/throttler.js +12 -4
  213. package/dist/throttler.js.map +1 -1
  214. package/lib/batchTracker.d.ts +1 -2
  215. package/lib/batchTracker.d.ts.map +1 -1
  216. package/lib/batchTracker.js +2 -2
  217. package/lib/batchTracker.js.map +1 -1
  218. package/lib/blobManager/blobManager.d.ts +5 -1
  219. package/lib/blobManager/blobManager.d.ts.map +1 -1
  220. package/lib/blobManager/blobManager.js +30 -13
  221. package/lib/blobManager/blobManager.js.map +1 -1
  222. package/lib/blobManager/blobManagerSnapSum.d.ts +1 -0
  223. package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  224. package/lib/blobManager/blobManagerSnapSum.js +7 -5
  225. package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
  226. package/lib/channelCollection.d.ts +23 -12
  227. package/lib/channelCollection.d.ts.map +1 -1
  228. package/lib/channelCollection.js +88 -54
  229. package/lib/channelCollection.js.map +1 -1
  230. package/lib/connectionTelemetry.d.ts +2 -2
  231. package/lib/connectionTelemetry.d.ts.map +1 -1
  232. package/lib/connectionTelemetry.js +11 -7
  233. package/lib/connectionTelemetry.js.map +1 -1
  234. package/lib/containerHandleContext.d.ts +1 -1
  235. package/lib/containerHandleContext.d.ts.map +1 -1
  236. package/lib/containerHandleContext.js.map +1 -1
  237. package/lib/containerRuntime.d.ts +87 -94
  238. package/lib/containerRuntime.d.ts.map +1 -1
  239. package/lib/containerRuntime.js +319 -228
  240. package/lib/containerRuntime.js.map +1 -1
  241. package/lib/dataStore.d.ts +7 -3
  242. package/lib/dataStore.d.ts.map +1 -1
  243. package/lib/dataStore.js +8 -4
  244. package/lib/dataStore.js.map +1 -1
  245. package/lib/dataStoreContext.d.ts +41 -25
  246. package/lib/dataStoreContext.d.ts.map +1 -1
  247. package/lib/dataStoreContext.js +47 -29
  248. package/lib/dataStoreContext.js.map +1 -1
  249. package/lib/dataStoreContexts.d.ts +6 -2
  250. package/lib/dataStoreContexts.d.ts.map +1 -1
  251. package/lib/dataStoreContexts.js +7 -2
  252. package/lib/dataStoreContexts.js.map +1 -1
  253. package/lib/dataStoreRegistry.d.ts +1 -1
  254. package/lib/dataStoreRegistry.d.ts.map +1 -1
  255. package/lib/dataStoreRegistry.js.map +1 -1
  256. package/lib/deltaManagerProxies.d.ts +1 -17
  257. package/lib/deltaManagerProxies.d.ts.map +1 -1
  258. package/lib/deltaManagerProxies.js.map +1 -1
  259. package/lib/deltaScheduler.d.ts +9 -6
  260. package/lib/deltaScheduler.d.ts.map +1 -1
  261. package/lib/deltaScheduler.js +96 -90
  262. package/lib/deltaScheduler.js.map +1 -1
  263. package/lib/gc/garbageCollection.d.ts +21 -7
  264. package/lib/gc/garbageCollection.d.ts.map +1 -1
  265. package/lib/gc/garbageCollection.js +51 -20
  266. package/lib/gc/garbageCollection.js.map +1 -1
  267. package/lib/gc/gcConfigs.d.ts +11 -0
  268. package/lib/gc/gcConfigs.d.ts.map +1 -1
  269. package/lib/gc/gcConfigs.js +4 -2
  270. package/lib/gc/gcConfigs.js.map +1 -1
  271. package/lib/gc/gcDefinitions.d.ts +218 -70
  272. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  273. package/lib/gc/gcDefinitions.js +40 -13
  274. package/lib/gc/gcDefinitions.js.map +1 -1
  275. package/lib/gc/gcHelpers.d.ts +6 -2
  276. package/lib/gc/gcHelpers.d.ts.map +1 -1
  277. package/lib/gc/gcHelpers.js +14 -7
  278. package/lib/gc/gcHelpers.js.map +1 -1
  279. package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -1
  280. package/lib/gc/gcSummaryDefinitions.d.ts +18 -6
  281. package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -1
  282. package/lib/gc/gcSummaryDefinitions.js.map +1 -1
  283. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  284. package/lib/gc/gcSummaryStateTracker.js +2 -1
  285. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  286. package/lib/gc/gcTelemetry.d.ts +33 -11
  287. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  288. package/lib/gc/gcTelemetry.js +38 -18
  289. package/lib/gc/gcTelemetry.js.map +1 -1
  290. package/lib/gc/gcUnreferencedStateTracker.d.ts +42 -13
  291. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  292. package/lib/gc/gcUnreferencedStateTracker.js +27 -9
  293. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  294. package/lib/gc/index.d.ts +1 -0
  295. package/lib/gc/index.d.ts.map +1 -1
  296. package/lib/gc/index.js +1 -0
  297. package/lib/gc/index.js.map +1 -1
  298. package/lib/inboundBatchAggregator.d.ts +34 -0
  299. package/lib/inboundBatchAggregator.d.ts.map +1 -0
  300. package/lib/inboundBatchAggregator.js +181 -0
  301. package/lib/inboundBatchAggregator.js.map +1 -0
  302. package/lib/index.d.ts +1 -1
  303. package/lib/index.d.ts.map +1 -1
  304. package/lib/index.js.map +1 -1
  305. package/lib/layerCompatState.d.ts +19 -0
  306. package/lib/layerCompatState.d.ts.map +1 -0
  307. package/lib/layerCompatState.js +60 -0
  308. package/lib/layerCompatState.js.map +1 -0
  309. package/lib/legacy.d.ts +0 -4
  310. package/lib/messageTypes.d.ts +14 -5
  311. package/lib/messageTypes.d.ts.map +1 -1
  312. package/lib/messageTypes.js.map +1 -1
  313. package/lib/metadata.d.ts +12 -4
  314. package/lib/metadata.d.ts.map +1 -1
  315. package/lib/metadata.js +6 -2
  316. package/lib/metadata.js.map +1 -1
  317. package/lib/opLifecycle/batchManager.d.ts +9 -3
  318. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  319. package/lib/opLifecycle/batchManager.js +3 -1
  320. package/lib/opLifecycle/batchManager.js.map +1 -1
  321. package/lib/opLifecycle/duplicateBatchDetector.d.ts +9 -3
  322. package/lib/opLifecycle/duplicateBatchDetector.d.ts.map +1 -1
  323. package/lib/opLifecycle/duplicateBatchDetector.js +11 -5
  324. package/lib/opLifecycle/duplicateBatchDetector.js.map +1 -1
  325. package/lib/opLifecycle/opCompressor.d.ts +3 -2
  326. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  327. package/lib/opLifecycle/opCompressor.js +14 -20
  328. package/lib/opLifecycle/opCompressor.js.map +1 -1
  329. package/lib/opLifecycle/opDecompressor.d.ts +6 -1
  330. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  331. package/lib/opLifecycle/opDecompressor.js +17 -9
  332. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  333. package/lib/opLifecycle/opGroupingManager.d.ts +1 -2
  334. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  335. package/lib/opLifecycle/opGroupingManager.js +10 -7
  336. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  337. package/lib/opLifecycle/opSplitter.d.ts +13 -10
  338. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  339. package/lib/opLifecycle/opSplitter.js +16 -11
  340. package/lib/opLifecycle/opSplitter.js.map +1 -1
  341. package/lib/opLifecycle/outbox.d.ts +4 -4
  342. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  343. package/lib/opLifecycle/outbox.js +17 -16
  344. package/lib/opLifecycle/outbox.js.map +1 -1
  345. package/lib/opLifecycle/remoteMessageProcessor.d.ts +9 -3
  346. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  347. package/lib/opLifecycle/remoteMessageProcessor.js +3 -1
  348. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  349. package/lib/packageVersion.d.ts +1 -1
  350. package/lib/packageVersion.js +1 -1
  351. package/lib/packageVersion.js.map +1 -1
  352. package/lib/pendingStateManager.d.ts +22 -11
  353. package/lib/pendingStateManager.d.ts.map +1 -1
  354. package/lib/pendingStateManager.js +25 -16
  355. package/lib/pendingStateManager.js.map +1 -1
  356. package/lib/summary/documentSchema.d.ts +7 -0
  357. package/lib/summary/documentSchema.d.ts.map +1 -1
  358. package/lib/summary/documentSchema.js +8 -4
  359. package/lib/summary/documentSchema.js.map +1 -1
  360. package/lib/summary/index.d.ts +1 -1
  361. package/lib/summary/index.d.ts.map +1 -1
  362. package/lib/summary/index.js.map +1 -1
  363. package/lib/summary/orderedClientElection.d.ts +94 -31
  364. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  365. package/lib/summary/orderedClientElection.js +28 -16
  366. package/lib/summary/orderedClientElection.js.map +1 -1
  367. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -0
  368. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  369. package/lib/summary/runWhileConnectedCoordinator.js +7 -2
  370. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  371. package/lib/summary/runningSummarizer.d.ts +17 -6
  372. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  373. package/lib/summary/runningSummarizer.js +48 -19
  374. package/lib/summary/runningSummarizer.js.map +1 -1
  375. package/lib/summary/summarizer.d.ts +10 -5
  376. package/lib/summary/summarizer.d.ts.map +1 -1
  377. package/lib/summary/summarizer.js +26 -11
  378. package/lib/summary/summarizer.js.map +1 -1
  379. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  380. package/lib/summary/summarizerClientElection.js +1 -0
  381. package/lib/summary/summarizerClientElection.js.map +1 -1
  382. package/lib/summary/summarizerHeuristics.d.ts +6 -2
  383. package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
  384. package/lib/summary/summarizerHeuristics.js +13 -5
  385. package/lib/summary/summarizerHeuristics.js.map +1 -1
  386. package/lib/summary/summarizerNode/index.d.ts.map +1 -1
  387. package/lib/summary/summarizerNode/index.js.map +1 -1
  388. package/lib/summary/summarizerNode/summarizerNode.d.ts +24 -8
  389. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  390. package/lib/summary/summarizerNode/summarizerNode.js +45 -36
  391. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  392. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +48 -16
  393. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  394. package/lib/summary/summarizerNode/summarizerNodeUtils.js +3 -1
  395. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  396. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +13 -5
  397. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  398. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +15 -7
  399. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  400. package/lib/summary/summarizerTypes.d.ts +253 -135
  401. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  402. package/lib/summary/summarizerTypes.js.map +1 -1
  403. package/lib/summary/summaryCollection.d.ts +3 -4
  404. package/lib/summary/summaryCollection.d.ts.map +1 -1
  405. package/lib/summary/summaryCollection.js +10 -8
  406. package/lib/summary/summaryCollection.js.map +1 -1
  407. package/lib/summary/summaryFormat.d.ts +28 -9
  408. package/lib/summary/summaryFormat.d.ts.map +1 -1
  409. package/lib/summary/summaryFormat.js +2 -2
  410. package/lib/summary/summaryFormat.js.map +1 -1
  411. package/lib/summary/summaryGenerator.d.ts +9 -3
  412. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  413. package/lib/summary/summaryGenerator.js +22 -9
  414. package/lib/summary/summaryGenerator.js.map +1 -1
  415. package/lib/summary/summaryManager.d.ts +8 -4
  416. package/lib/summary/summaryManager.d.ts.map +1 -1
  417. package/lib/summary/summaryManager.js +20 -9
  418. package/lib/summary/summaryManager.js.map +1 -1
  419. package/lib/throttler.d.ts +26 -10
  420. package/lib/throttler.d.ts.map +1 -1
  421. package/lib/throttler.js +12 -4
  422. package/lib/throttler.js.map +1 -1
  423. package/package.json +22 -31
  424. package/src/batchTracker.ts +34 -36
  425. package/src/blobManager/blobManager.ts +54 -33
  426. package/src/blobManager/blobManagerSnapSum.ts +10 -10
  427. package/src/channelCollection.ts +108 -82
  428. package/src/connectionTelemetry.ts +43 -19
  429. package/src/containerHandleContext.ts +2 -2
  430. package/src/containerRuntime.ts +492 -364
  431. package/src/dataStore.ts +17 -9
  432. package/src/dataStoreContext.ts +94 -73
  433. package/src/dataStoreContexts.ts +17 -12
  434. package/src/dataStoreRegistry.ts +1 -1
  435. package/src/deltaManagerProxies.ts +5 -5
  436. package/src/deltaScheduler.ts +24 -18
  437. package/src/gc/garbageCollection.ts +89 -40
  438. package/src/gc/gcConfigs.ts +13 -5
  439. package/src/gc/gcDefinitions.ts +224 -70
  440. package/src/gc/gcHelpers.ts +22 -11
  441. package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
  442. package/src/gc/gcSummaryDefinitions.ts +18 -6
  443. package/src/gc/gcSummaryStateTracker.ts +7 -3
  444. package/src/gc/gcTelemetry.ts +73 -30
  445. package/src/gc/gcUnreferencedStateTracker.ts +40 -16
  446. package/src/gc/index.ts +1 -0
  447. package/src/{scheduleManager.ts → inboundBatchAggregator.ts} +55 -122
  448. package/src/index.ts +0 -3
  449. package/src/layerCompatState.ts +75 -0
  450. package/src/messageTypes.ts +16 -5
  451. package/src/metadata.ts +12 -4
  452. package/src/opLifecycle/README.md +43 -34
  453. package/src/opLifecycle/batchManager.ts +12 -6
  454. package/src/opLifecycle/duplicateBatchDetector.ts +12 -6
  455. package/src/opLifecycle/opCompressor.ts +22 -25
  456. package/src/opLifecycle/opDecompressor.ts +23 -11
  457. package/src/opLifecycle/opGroupingManager.ts +16 -11
  458. package/src/opLifecycle/opSplitter.ts +24 -18
  459. package/src/opLifecycle/outbox.ts +35 -33
  460. package/src/opLifecycle/remoteMessageProcessor.ts +13 -5
  461. package/src/packageVersion.ts +1 -1
  462. package/src/pendingStateManager.ts +49 -26
  463. package/src/summary/documentSchema.ts +41 -22
  464. package/src/summary/index.ts +0 -3
  465. package/src/summary/orderedClientElection.ts +114 -49
  466. package/src/summary/runWhileConnectedCoordinator.ts +12 -3
  467. package/src/summary/runningSummarizer.ts +79 -36
  468. package/src/summary/summarizer.ts +51 -25
  469. package/src/summary/summarizerClientElection.ts +4 -2
  470. package/src/summary/summarizerHeuristics.ts +23 -12
  471. package/src/summary/summarizerNode/index.ts +1 -0
  472. package/src/summary/summarizerNode/summarizerNode.ts +54 -43
  473. package/src/summary/summarizerNode/summarizerNodeUtils.ts +48 -16
  474. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +25 -15
  475. package/src/summary/summarizerTypes.ts +253 -139
  476. package/src/summary/summaryCollection.ts +41 -31
  477. package/src/summary/summaryFormat.ts +34 -13
  478. package/src/summary/summaryGenerator.ts +39 -18
  479. package/src/summary/summaryManager.ts +36 -24
  480. package/src/throttler.ts +23 -11
  481. package/container-runtime.test-files.tar +0 -0
  482. package/dist/scheduleManager.d.ts +0 -28
  483. package/dist/scheduleManager.d.ts.map +0 -1
  484. package/dist/scheduleManager.js +0 -233
  485. package/dist/scheduleManager.js.map +0 -1
  486. package/lib/scheduleManager.d.ts +0 -28
  487. package/lib/scheduleManager.d.ts.map +0 -1
  488. package/lib/scheduleManager.js +0 -229
  489. package/lib/scheduleManager.js.map +0 -1
@@ -3,24 +3,18 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { EventEmitter } from "@fluid-internal/client-utils";
7
- import { performance } from "@fluid-internal/client-utils";
6
+ import { performanceNow } from "@fluid-internal/client-utils";
8
7
  import { IDeltaManagerFull } from "@fluidframework/container-definitions/internal";
9
8
  import { assert } from "@fluidframework/core-utils/internal";
10
- import {
11
- IDocumentMessage,
12
- ISequencedDocumentMessage,
13
- } from "@fluidframework/driver-definitions/internal";
9
+ import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
14
10
  import { isRuntimeMessage } from "@fluidframework/driver-utils/internal";
15
11
  import {
16
12
  ITelemetryLoggerExt,
17
13
  DataCorruptionError,
18
14
  DataProcessingError,
19
- createChildLogger,
20
15
  extractSafePropertiesFromMessage,
21
16
  } from "@fluidframework/telemetry-utils/internal";
22
17
 
23
- import { DeltaScheduler } from "./deltaScheduler.js";
24
18
  import { IBatchMetadata } from "./metadata.js";
25
19
  import { pkgVersion } from "./packageVersion.js";
26
20
 
@@ -31,46 +25,10 @@ type IRuntimeMessageMetadata =
31
25
  };
32
26
 
33
27
  /**
34
- * This class has the following responsibilities:
35
- *
36
- * 1. It tracks batches as we process ops and raises "batchBegin" and "batchEnd" events.
37
- * As part of it, it validates batch correctness (i.e. no system ops in the middle of batch)
38
- *
39
- * 2. It creates instance of ScheduleManagerCore that ensures we never start processing ops from batch
40
- * unless all ops of the batch are in.
28
+ * This class ensures that we aggregate a complete batch of incoming ops before processing them. It basically ensures
29
+ * that we never start processing ops in a batch IF we do not have all ops in the batch.
41
30
  */
42
- export class ScheduleManager {
43
- private readonly deltaScheduler: DeltaScheduler;
44
-
45
- constructor(
46
- private readonly deltaManager: IDeltaManagerFull,
47
- private readonly emitter: EventEmitter,
48
- readonly getClientId: () => string | undefined,
49
- private readonly logger: ITelemetryLoggerExt,
50
- ) {
51
- this.deltaScheduler = new DeltaScheduler(
52
- this.deltaManager,
53
- createChildLogger({ logger: this.logger, namespace: "DeltaScheduler" }),
54
- );
55
- void new ScheduleManagerCore(deltaManager, getClientId, logger);
56
- }
57
-
58
- public batchBegin(message: ISequencedDocumentMessage) {
59
- this.emitter.emit("batchBegin", message);
60
- this.deltaScheduler.batchBegin(message);
61
- }
62
-
63
- public batchEnd(error: any | undefined, message: ISequencedDocumentMessage) {
64
- this.emitter.emit("batchEnd", error, message);
65
- this.deltaScheduler.batchEnd(message);
66
- }
67
- }
68
-
69
- /**
70
- * This class controls pausing and resuming of inbound queue to ensure that we never
71
- * start processing ops in a batch IF we do not have all ops in the batch.
72
- */
73
- class ScheduleManagerCore {
31
+ export class InboundBatchAggregator {
74
32
  private pauseSequenceNumber: number | undefined;
75
33
  private currentBatchClientId: string | undefined;
76
34
  private localPaused = false;
@@ -82,38 +40,8 @@ class ScheduleManagerCore {
82
40
  private readonly getClientId: () => string | undefined,
83
41
  private readonly logger: ITelemetryLoggerExt,
84
42
  ) {
85
- // Listen for delta manager sends and add batch metadata to messages
86
- this.deltaManager.on("prepareSend", (messages: IDocumentMessage[]) => {
87
- if (messages.length === 0) {
88
- return;
89
- }
90
-
91
- // First message will have the batch flag set to true if doing a batched send
92
- const firstMessageMetadata = messages[0].metadata as IRuntimeMessageMetadata;
93
- if (!firstMessageMetadata?.batch) {
94
- return;
95
- }
96
-
97
- // If the batch contains only a single op, clear the batch flag.
98
- if (messages.length === 1) {
99
- delete firstMessageMetadata.batch;
100
- return;
101
- }
102
-
103
- // Set the batch flag to false on the last message to indicate the end of the send batch
104
- const lastMessage = messages[messages.length - 1];
105
- // TODO: It's not clear if this shallow clone is required, as opposed to just setting "batch" to false.
106
-
107
- lastMessage.metadata = { ...(lastMessage.metadata as any), batch: false };
108
- });
109
-
110
43
  // Listen for updates and peek at the inbound
111
- this.deltaManager.inbound.on("push", (message: ISequencedDocumentMessage) => {
112
- this.trackPending(message);
113
- });
114
-
115
- // Start with baseline - empty inbound queue.
116
- assert(!this.localPaused, 0x293 /* "initial state" */);
44
+ this.deltaManager.inbound.on("push", this.trackPending);
117
45
 
118
46
  const allPending = this.deltaManager.inbound.toArray();
119
47
  for (const pending of allPending) {
@@ -121,16 +49,21 @@ class ScheduleManagerCore {
121
49
  }
122
50
 
123
51
  // We are intentionally directly listening to the "op" to inspect system ops as well.
124
- // If we do not observe system ops, we are likely to hit 0x296 assert when system ops
52
+ // If we do not observe system ops, we are likely to hit an error when system ops
125
53
  // precedes start of incomplete batch.
126
- this.deltaManager.on("op", (message) => this.afterOpProcessing(message));
54
+ this.deltaManager.on("op", this.afterOpProcessing);
55
+ }
56
+
57
+ public dispose(): void {
58
+ this.deltaManager.off("op", this.afterOpProcessing);
59
+ this.deltaManager.inbound.off("push", this.trackPending);
127
60
  }
128
61
 
129
62
  /**
130
- * The only public function in this class - called when we processed an op,
131
- * to make decision if op processing should be paused or not after that.
63
+ * Callback for DeltaManager's "op" event, for us to make decision if op processing should
64
+ * be paused or not after that.
132
65
  */
133
- public afterOpProcessing(message: ISequencedDocumentMessage) {
66
+ private readonly afterOpProcessing = (message: ISequencedDocumentMessage): void => {
134
67
  assert(
135
68
  !this.localPaused,
136
69
  0x294 /* "can't have op processing paused if we are processing an op" */,
@@ -157,7 +90,7 @@ class ScheduleManagerCore {
157
90
  throw DataProcessingError.create(
158
91
  // Former assert 0x296
159
92
  "Incomplete batch",
160
- "ScheduleManager",
93
+ "InboundBatchAggregator",
161
94
  message,
162
95
  {
163
96
  type: message.type,
@@ -174,49 +107,14 @@ class ScheduleManagerCore {
174
107
  this.pauseQueue();
175
108
  }
176
109
  }
177
- }
178
-
179
- private pauseQueue() {
180
- assert(!this.localPaused, 0x297 /* "always called from resumed state" */);
181
- this.localPaused = true;
182
- this.timePaused = performance.now();
183
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
184
- this.deltaManager.inbound.pause();
185
- }
186
-
187
- private resumeQueue(startBatch: number, messageEndBatch: ISequencedDocumentMessage) {
188
- const endBatch = messageEndBatch.sequenceNumber;
189
- const duration = this.localPaused ? performance.now() - this.timePaused : undefined;
190
-
191
- this.batchCount++;
192
- if (this.batchCount % 1000 === 1) {
193
- this.logger.sendTelemetryEvent({
194
- eventName: "BatchStats",
195
- sequenceNumber: endBatch,
196
- length: endBatch - startBatch + 1,
197
- msnDistance: endBatch - messageEndBatch.minimumSequenceNumber,
198
- duration,
199
- batchCount: this.batchCount,
200
- interrupted: this.localPaused,
201
- });
202
- }
203
-
204
- // Return early if no change in value
205
- if (!this.localPaused) {
206
- return;
207
- }
208
-
209
- this.localPaused = false;
210
-
211
- this.deltaManager.inbound.resume();
212
- }
110
+ };
213
111
 
214
112
  /**
215
113
  * Called for each incoming op (i.e. inbound "push" notification)
216
114
  */
217
- private trackPending(message: ISequencedDocumentMessage) {
115
+ private readonly trackPending = (message: ISequencedDocumentMessage): void => {
218
116
  assert(
219
- this.deltaManager.inbound.length !== 0,
117
+ this.deltaManager.inbound.length > 0,
220
118
  0x298 /* "we have something in the queue that generates this event" */,
221
119
  );
222
120
 
@@ -324,5 +222,40 @@ class ScheduleManagerCore {
324
222
  // Continuation of current batch. Do nothing
325
223
  assert(this.currentBatchClientId !== undefined, 0x2a1 /* "logic error" */);
326
224
  }
225
+ };
226
+
227
+ private pauseQueue(): void {
228
+ assert(!this.localPaused, 0x297 /* "always called from resumed state" */);
229
+ this.localPaused = true;
230
+ this.timePaused = performanceNow();
231
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
232
+ this.deltaManager.inbound.pause();
233
+ }
234
+
235
+ private resumeQueue(startBatch: number, messageEndBatch: ISequencedDocumentMessage): void {
236
+ const endBatch = messageEndBatch.sequenceNumber;
237
+ const duration = this.localPaused ? performanceNow() - this.timePaused : undefined;
238
+
239
+ this.batchCount++;
240
+ if (this.batchCount % 1000 === 1) {
241
+ this.logger.sendTelemetryEvent({
242
+ eventName: "BatchStats",
243
+ sequenceNumber: endBatch,
244
+ length: endBatch - startBatch + 1,
245
+ msnDistance: endBatch - messageEndBatch.minimumSequenceNumber,
246
+ duration,
247
+ batchCount: this.batchCount,
248
+ interrupted: this.localPaused,
249
+ });
250
+ }
251
+
252
+ // Return early if no change in value
253
+ if (!this.localPaused) {
254
+ return;
255
+ }
256
+
257
+ this.localPaused = false;
258
+
259
+ this.deltaManager.inbound.resume();
327
260
  }
328
261
  }
package/src/index.ts CHANGED
@@ -55,7 +55,6 @@ export {
55
55
  ISummaryCancellationToken,
56
56
  neverCancelledSummaryToken,
57
57
  Summarizer,
58
- SummarizerStopReason,
59
58
  SummaryCollection,
60
59
  EnqueueSummarizeResult,
61
60
  IAckSummaryResult,
@@ -75,7 +74,6 @@ export {
75
74
  ISubmitSummaryOptions,
76
75
  ISerializedElection,
77
76
  ISummarizeOptions,
78
- ISummarizerEvents,
79
77
  ISummarizerInternalsProvider,
80
78
  ISummarizerRuntime,
81
79
  ISummarizingWarning,
@@ -95,7 +93,6 @@ export {
95
93
  SubmitSummaryFailureData,
96
94
  SummaryStage,
97
95
  IRetriableFailureError,
98
- ISummarizeEventProps,
99
96
  IdCompressorMode,
100
97
  IDocumentSchema,
101
98
  DocumentSchemaValueType,
@@ -0,0 +1,75 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ checkLayerCompatibility,
8
+ type ILayerCompatDetails,
9
+ type ILayerCompatSupportRequirements,
10
+ } from "@fluid-internal/client-utils";
11
+ import type { ICriticalContainerError } from "@fluidframework/container-definitions";
12
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
13
+
14
+ import { pkgVersion } from "./packageVersion.js";
15
+
16
+ /**
17
+ * Runtime's compatibility details that is exposed to the Loader layer.
18
+ */
19
+ export const RuntimeCompatDetails: ILayerCompatDetails = {
20
+ /**
21
+ * The package version of the Runtime layer.
22
+ */
23
+ pkgVersion,
24
+ /**
25
+ * The current generation of the Runtime layer.
26
+ */
27
+ generation: 1,
28
+ /**
29
+ * The features supported by the Runtime layer across the Runtime / Loader boundary.
30
+ */
31
+ supportedFeatures: new Set<string>(),
32
+ };
33
+
34
+ /**
35
+ * The requirements that the Loader layer must meet to be compatible with this Runtime.
36
+ */
37
+ export const LoaderSupportRequirements: ILayerCompatSupportRequirements = {
38
+ /**
39
+ * Minimum generation that Loader must be at to be compatible with Runtime.
40
+ */
41
+ minSupportedGeneration: 0,
42
+ /**
43
+ * The features that the Loader must support to be compatible with Runtime. Note that 0 is used here for
44
+ * Loader layers before the introduction of the layer compatibility enforcement.
45
+ */
46
+ requiredFeatures: [],
47
+ };
48
+
49
+ /**
50
+ * Validates that the Loader layer is compatible with this Runtime.
51
+ */
52
+ export function validateLoaderCompatibility(
53
+ maybeLoaderCompatDetails: ILayerCompatDetails | undefined,
54
+ disposeFn: (error?: ICriticalContainerError) => void,
55
+ ): void {
56
+ const layerCheckResult = checkLayerCompatibility(
57
+ LoaderSupportRequirements,
58
+ maybeLoaderCompatDetails,
59
+ );
60
+ if (!layerCheckResult.isCompatible) {
61
+ const error = new UsageError("Runtime is not compatible with Loader", {
62
+ errorDetails: JSON.stringify({
63
+ runtimeVersion: RuntimeCompatDetails.pkgVersion,
64
+ loaderVersion: maybeLoaderCompatDetails?.pkgVersion,
65
+ runtimeGeneration: RuntimeCompatDetails.generation,
66
+ loaderGeneration: maybeLoaderCompatDetails?.generation,
67
+ minSupportedGeneration: LoaderSupportRequirements.minSupportedGeneration,
68
+ isGenerationCompatible: layerCheckResult.isGenerationCompatible,
69
+ unsupportedFeatures: layerCheckResult.unsupportedFeatures,
70
+ }),
71
+ });
72
+ disposeFn(error);
73
+ throw error;
74
+ }
75
+ }
@@ -14,6 +14,7 @@ import {
14
14
  import { IDataStoreAliasMessage } from "./dataStore.js";
15
15
  import { GarbageCollectionMessage } from "./gc/index.js";
16
16
  import { IChunkedOp } from "./opLifecycle/index.js";
17
+ // eslint-disable-next-line import/no-deprecated
17
18
  import { IDocumentSchemaChangeMessage } from "./summary/index.js";
18
19
 
19
20
  /**
@@ -66,9 +67,13 @@ export enum ContainerMessageType {
66
67
  * This way stringified values can be compared.
67
68
  */
68
69
  interface TypedContainerRuntimeMessage<TType extends ContainerMessageType, TContents> {
69
- /** Type of the op, within the ContainerRuntime's domain */
70
+ /**
71
+ * Type of the op, within the ContainerRuntime's domain
72
+ */
70
73
  type: TType;
71
- /** Domain-specific contents, interpreted according to the type */
74
+ /**
75
+ * Domain-specific contents, interpreted according to the type
76
+ */
72
77
  contents: TContents;
73
78
  }
74
79
 
@@ -110,6 +115,7 @@ export type ContainerRuntimeGCMessage = TypedContainerRuntimeMessage<
110
115
  >;
111
116
  export type ContainerRuntimeDocumentSchemaMessage = TypedContainerRuntimeMessage<
112
117
  ContainerMessageType.DocumentSchemaChange,
118
+ // eslint-disable-next-line import/no-deprecated
113
119
  IDocumentSchemaChangeMessage
114
120
  >;
115
121
 
@@ -118,13 +124,16 @@ export type ContainerRuntimeDocumentSchemaMessage = TypedContainerRuntimeMessage
118
124
  * @internal
119
125
  */
120
126
  export interface UnknownContainerRuntimeMessage {
121
- /** Invalid type of the op, within the ContainerRuntime's domain. This value should never exist at runtime.
127
+ /**
128
+ * Invalid type of the op, within the ContainerRuntime's domain. This value should never exist at runtime.
122
129
  * This is useful for type narrowing but should never be used as an actual message type at runtime.
123
130
  * Actual value will not be "__unknown...", but the type `Exclude<string, ContainerMessageType>` is not supported.
124
131
  */
125
132
  type: "__unknown_container_message_type__never_use_as_value__";
126
133
 
127
- /** Domain-specific contents, but not decipherable by an unknown op. */
134
+ /**
135
+ * Domain-specific contents, but not decipherable by an unknown op.
136
+ */
128
137
  contents: unknown;
129
138
  }
130
139
 
@@ -160,7 +169,9 @@ export type LocalContainerRuntimeMessage =
160
169
  | UnknownContainerRuntimeMessage
161
170
  | ContainerRuntimeDocumentSchemaMessage;
162
171
 
163
- /** A {@link TypedContainerRuntimeMessage} that is being sent to the server from the container runtime. */
172
+ /**
173
+ * A {@link TypedContainerRuntimeMessage} that is being sent to the server from the container runtime.
174
+ */
164
175
  export type OutboundContainerRuntimeMessage =
165
176
  | ContainerRuntimeDataStoreOpMessage
166
177
  | OutboundContainerRuntimeAttachMessage
package/src/metadata.ts CHANGED
@@ -5,12 +5,16 @@
5
5
 
6
6
  import type { BatchId } from "./opLifecycle/index.js";
7
7
 
8
- /** Syntactic sugar for casting */
8
+ /**
9
+ * Syntactic sugar for casting
10
+ */
9
11
  export function asBatchMetadata(metadata: unknown): Partial<IBatchMetadata> | undefined {
10
12
  return metadata as Partial<IBatchMetadata> | undefined;
11
13
  }
12
14
 
13
- /** Syntactic sugar for casting */
15
+ /**
16
+ * Syntactic sugar for casting
17
+ */
14
18
  export function asEmptyBatchLocalOpMetadata(
15
19
  localOpMetadata: unknown,
16
20
  ): IEmptyBatchMetadata | undefined {
@@ -28,9 +32,13 @@ export interface IEmptyBatchMetadata {
28
32
  * Properties put on the op metadata object for batch tracking
29
33
  */
30
34
  export interface IBatchMetadata {
31
- /** Set on first/last messages of a multi-message batch, to true/false respectively */
35
+ /**
36
+ * Set on first/last messages of a multi-message batch, to true/false respectively
37
+ */
32
38
  batch?: boolean;
33
- /** Maybe set on first message of a batch, to the batchId generated when resubmitting (set/fixed on first resubmit) */
39
+ /**
40
+ * Maybe set on first message of a batch, to the batchId generated when resubmitting (set/fixed on first resubmit)
41
+ */
34
42
  batchId?: BatchId;
35
43
  }
36
44
 
@@ -2,21 +2,23 @@
2
2
 
3
3
  ## Table of contents
4
4
 
5
- - [Configs and feature gates for solving the 1MB limit.](#configs-and-feature-gates-for-solving-the-1mb-limit)
6
- - [Table of contents](#table-of-contents)
7
- - [Introduction](#introduction)
8
- - [How batching works](#how-batching-works)
9
- - [Compression](#compression)
10
- - [Grouped batching](#grouped-batching)
11
- - [Changes in op semantics](#changes-in-op-semantics)
12
- - [Chunking for compression](#chunking-for-compression)
13
- - [Configuration](#configuration)
14
- - [Note about performance and latency](#note-about-performance-and-latency)
15
- - [How it works](#how-it-works)
16
- - [How it works (Grouped Batching disabled)](#how-it-works-grouped-batching-disabled)
17
- - [How the overall op flow works](#how-the-overall-op-flow-works)
18
- - [Outbound](#outbound)
19
- - [Inbound](#inbound)
5
+ - [Configs and feature gates for solving the 1MB limit.](#configs-and-feature-gates-for-solving-the-1mb-limit)
6
+ - [Table of contents](#table-of-contents)
7
+ - [Introduction](#introduction)
8
+ - [How batching works](#how-batching-works)
9
+ - [Grouped batching](#grouped-batching)
10
+ - [Changes in op semantics](#changes-in-op-semantics)
11
+ - [Compression](#compression)
12
+ - [Only single-message batches are compressed](#only-single-message-batches-are-compressed)
13
+ - [Chunking for compression](#chunking-for-compression)
14
+ - [Configuration](#configuration)
15
+ - [Note about performance and latency](#note-about-performance-and-latency)
16
+ - [How it works](#how-it-works)
17
+ - [Legacy behavior - How it used to work (Compression+Chunking without Grouped Batching)](#legacy-behavior---how-it-used-to-work-compressionchunking-without-grouped-batching)
18
+ - [IMPORTANT - As of 2.20.0, we no longer compress ungrouped batches, but we do need to read such ops - read on to learn what these legacy ops look like](#important---as-of-2200-we-no-longer-compress-ungrouped-batches-but-we-do-need-to-read-such-ops---read-on-to-learn-what-these-legacy-ops-look-like)
19
+ - [How the overall op flow works](#how-the-overall-op-flow-works)
20
+ - [Outbound](#outbound)
21
+ - [Inbound](#inbound)
20
22
 
21
23
  ## Introduction
22
24
 
@@ -56,20 +58,6 @@ What this means is that `FlushMode.Immediate` will send each op in its own paylo
56
58
 
57
59
  As `FlushMode.TurnBased` accumulates ops, it is the most vulnerable to run into the 1MB socket limit.
58
60
 
59
- ## Compression
60
-
61
- **Compression targets payloads which exceed the max batch size and it is enabled by default.**. The `IContainerRuntimeOptions.compressionOptions` property, of type `ICompressionRuntimeOptions` is the configuration governing how compression works.
62
-
63
- `ICompressionRuntimeOptions` has two properties:
64
-
65
- - `minimumBatchSizeInBytes` – the minimum size of the batch for which compression should kick in. If the payload is too small, compression may not yield too many benefits. To target the original 1MB issue, a good value here would be to match the default maxBatchSizeInBytes (972800), however, experimentally, a good lower value could be at around 614400 bytes. Setting this value to `Number.POSITIVE_INFINITY` will disable compression.
66
- - `compressionAlgorithm` – currently, only `lz4` is supported.
67
-
68
- Compression is relevant for both `FlushMode.TurnBased` and `FlushMode.Immediate` as it only targets the contents of the ops and not the number of ops in a batch. Compression is opaque to the server and implementations of the Fluid protocol do not need to alter their behavior to support this client feature.
69
-
70
- Compressing a batch yields a batch with the same number of messages. It compresses all the content, shifting the compressed payload into the first op,
71
- leaving the rest of the batch's messages as empty placeholders to reserve sequence numbers for the compressed messages.
72
-
73
61
  ## Grouped batching
74
62
 
75
63
  With Grouped Batching enabled (it's on by default), all batch messages are combined under a single "grouped" message _before compression_. Upon receiving this new "grouped" message, the batch messages will be extracted, and they each will be given the same sequence number - that of the parent "grouped" message.
@@ -78,9 +66,7 @@ The purpose for enabling grouped batching before compression is to eliminate the
78
66
 
79
67
  Grouped batching is only relevant for `FlushMode.TurnBased`, since `OpGroupingManagerConfig.opCountThreshold` defaults to 2. Grouped batching is opaque to the server and implementations of the Fluid protocol do not need to alter their behavior to support this client feature.
80
68
 
81
- Grouped Batching can be disabled by setting `IContainerRuntimeOptions.enableGroupedBatching` to `false`.
82
-
83
- See [below](#how-grouped-batching-works) for an example.
69
+ See [below](#how-it-works) for an example.
84
70
 
85
71
  ### Changes in op semantics
86
72
 
@@ -92,6 +78,27 @@ Grouped Batching changed a couple of expectations around message structure and r
92
78
  - All ops in a batch must also have the same reference sequence number to ensure eventualy consistency of the model. The runtime will "rebase" ops in a batch with different ref sequence number to satisfy that requirement.
93
79
  - What causes ops in a single JS turn (and thus in a batch) to have different reference sequence number? "Op reentrancy", where changes are made to a DDS inside a DDS 'onChanged' event handler.
94
80
 
81
+ ## Compression
82
+
83
+ **Compression targets payloads which exceed the max batch size and it is enabled by default.**. The `IContainerRuntimeOptions.compressionOptions` property, of type `ICompressionRuntimeOptions` is the configuration governing how compression works.
84
+
85
+ `ICompressionRuntimeOptions` has two properties:
86
+
87
+ - `minimumBatchSizeInBytes` – the minimum size of the batch for which compression should kick in. If the payload is too small, compression may not yield too many benefits. To target the original 1MB issue, a good value here would be to match the default maxBatchSizeInBytes (972800), however, experimentally, a good lower value could be at around 614400 bytes. Setting this value to `Number.POSITIVE_INFINITY` will disable compression.
88
+ - `compressionAlgorithm` – currently, only `lz4` is supported.
89
+
90
+ Compression is relevant for both `FlushMode.TurnBased` and `FlushMode.Immediate` as it only targets the contents of the ops and not the number of ops in a batch. Compression is opaque to the server and implementations of the Fluid protocol do not need to alter their behavior to support this client feature.
91
+
92
+ ### Only single-message batches are compressed
93
+
94
+ The batch to compress has to have only one message and it yields a batch with a single message. It compresses all the content, replacing the op's original contents with the compressed payload and the appropriate metadata to indicate it's compressed.
95
+
96
+ Compression is only enabled if Grouped Batching is enabled.
97
+
98
+ Legacy compressed batches could contain multiple messages, compressing all the content and shifting the compressed payload into the first op, leaving the rest of the batch's messages as empty placeholders to reserve sequence numbers for the compressed messages.
99
+
100
+ While it remains possible to read compressed batches with empty ops, the system will no longer create said type of batches.
101
+
95
102
  ## Chunking for compression
96
103
 
97
104
  **Op chunking for compression targets payloads which exceed the max batch size after compression.** So, only payloads which are already compressed. By default, the feature is enabled.
@@ -200,7 +207,9 @@ Ungrouped batch:
200
207
  +-----------------+-----------------+-----------------+-----------------+-----------------+
201
208
  ```
202
209
 
203
- ## How it works (Grouped Batching disabled)
210
+ ## Legacy behavior - How it used to work (Compression+Chunking without Grouped Batching)
211
+
212
+ ### IMPORTANT - As of 2.20.0, we no longer compress ungrouped batches, but we do need to read such ops - read on to learn what these legacy ops look like
204
213
 
205
214
  If we have a batch with a size larger than the configured minimum required for compression (in the example let’s say it’s 850 bytes), as following:
206
215
 
@@ -311,7 +320,7 @@ stateDiagram-v2
311
320
  groupBatch --> if_compression
312
321
  flushInternal --> if_compression
313
322
  if_compression --> post
314
- if_compression --> compress: if compression is enabled
323
+ if_compression --> compress: if compression and grouped batching are enabled
315
324
  compress --> post
316
325
  compress --> opSplitter.split: if the compressed payload is larger than the chunk size
317
326
  opSplitter.split --> post
@@ -21,7 +21,9 @@ export interface IBatchManagerOptions {
21
21
  */
22
22
  readonly canRebase: boolean;
23
23
 
24
- /** If true, don't compare batchID of incoming batches to this. e.g. ID Allocation Batch IDs should be ignored */
24
+ /**
25
+ * If true, don't compare batchID of incoming batches to this. e.g. ID Allocation Batch IDs should be ignored
26
+ */
25
27
  readonly ignoreBatchId?: boolean;
26
28
  }
27
29
 
@@ -30,10 +32,14 @@ export interface BatchSequenceNumbers {
30
32
  clientSequenceNumber?: number;
31
33
  }
32
34
 
33
- /** Type alias for the batchId stored in batch metadata */
35
+ /**
36
+ * Type alias for the batchId stored in batch metadata
37
+ */
34
38
  export type BatchId = string;
35
39
 
36
- /** Compose original client ID and client sequence number into BatchId to stamp on the message during reconnect */
40
+ /**
41
+ * Compose original client ID and client sequence number into BatchId to stamp on the message during reconnect
42
+ */
37
43
  export function generateBatchId(originalClientId: string, batchStartCsn: number): BatchId {
38
44
  return `${originalClientId}_[${batchStartCsn}]`;
39
45
  }
@@ -76,10 +82,10 @@ export class BatchManager {
76
82
  private batchContentSize = 0;
77
83
  private hasReentrantOps = false;
78
84
 
79
- public get length() {
85
+ public get length(): number {
80
86
  return this.pendingBatch.length;
81
87
  }
82
- public get contentSizeInBytes() {
88
+ public get contentSizeInBytes(): number {
83
89
  return this.batchContentSize;
84
90
  }
85
91
 
@@ -133,7 +139,7 @@ export class BatchManager {
133
139
  return true;
134
140
  }
135
141
 
136
- public get empty() {
142
+ public get empty(): boolean {
137
143
  return this.pendingBatch.length === 0;
138
144
  }
139
145
 
@@ -13,13 +13,19 @@ import { type BatchStartInfo } from "./remoteMessageProcessor.js";
13
13
  * This class tracks recent batchIds we've seen, and checks incoming batches for duplicates.
14
14
  */
15
15
  export class DuplicateBatchDetector {
16
- /** All batchIds we've seen recently enough (based on MSN) that we need to watch for duplicates */
16
+ /**
17
+ * All batchIds we've seen recently enough (based on MSN) that we need to watch for duplicates
18
+ */
17
19
  private readonly batchIdsAll = new Set<string>();
18
20
 
19
- /** We map from sequenceNumber to batchId to find which ones we can stop tracking as MSN advances */
21
+ /**
22
+ * We map from sequenceNumber to batchId to find which ones we can stop tracking as MSN advances
23
+ */
20
24
  private readonly batchIdsBySeqNum = new Map<number, string>();
21
25
 
22
- /** Initialize from snapshot data if provided - otherwise initialize empty */
26
+ /**
27
+ * Initialize from snapshot data if provided - otherwise initialize empty
28
+ */
23
29
  constructor(batchIdsFromSnapshot: [number, string][] | undefined) {
24
30
  if (batchIdsFromSnapshot) {
25
31
  this.batchIdsBySeqNum = new Map(batchIdsFromSnapshot);
@@ -78,13 +84,13 @@ export class DuplicateBatchDetector {
78
84
  * Batches that started before the MSN are not at risk for a sequenced duplicate to arrive,
79
85
  * since the batch start has been processed by all clients, and local batches are deduped and the forked client would close.
80
86
  */
81
- private clearOldBatchIds(msn: number) {
82
- this.batchIdsBySeqNum.forEach((batchId, sequenceNumber) => {
87
+ private clearOldBatchIds(msn: number): void {
88
+ for (const [sequenceNumber, batchId] of this.batchIdsBySeqNum) {
83
89
  if (sequenceNumber < msn) {
84
90
  this.batchIdsBySeqNum.delete(sequenceNumber);
85
91
  this.batchIdsAll.delete(batchId);
86
92
  }
87
- });
93
+ }
88
94
  }
89
95
 
90
96
  /**