@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
@@ -1 +1 @@
1
- {"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAIN,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GACV,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAgCrC,MAAM,eAAe;IA8CpB;;;;;;;OAOG;IACH;IACC;;;;;;OAMG;IACK,QAA4B;IACpC;;OAEG;IACc,YAA+B;IAChD;;OAEG;IACH,sBAA+D;IAC/D;;OAEG;IACH,MAA2B;QAZnB,aAAQ,GAAR,QAAQ,CAAoB;QAInB,iBAAY,GAAZ,YAAY,CAAmB;QA7DzC,yBAAoB,GAA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S;gBACpB,qFAAqF;gBACrF,OAAO,EAAE;oBACR,iFAAiF;oBACjF,yDAAyD;oBACzD,gBAAgB,EAAE,eAAe,CAAC,yBAAyB;oBAC3D,kGAAkG;oBAClG,eAAe,EAAE,IAAI,CAAC,2BAA2B;oBACjD,oFAAoF;oBACpF,iBAAiB,EAAE,IAAI,CAAC,qBAAqB;iBAC7C;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;;AA5VuB,sCAAsB,GAAG,GAAG,AAAN,CAAO;AAG7B,yCAAyB,GAAG,GAAG,AAAN,CAAO;AAGhC,yCAAyB,GAAG,GAAG,AAAN,CAAO;AA4YzD;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACpC,QAA4B,EAC5B,YAA+B,EAC/B,sBAA+D,EAC/D,MAA2B;IAE3B,IAAI,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { IDeltaManagerFull } from \"@fluidframework/container-definitions/internal\";\nimport { IContainerRuntimeEvents } from \"@fluidframework/container-runtime-definitions/internal\";\nimport { IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIEventSampler,\n\tITelemetryLoggerExt,\n\tISampledTelemetryLogger,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp is added to DeltaManager (DM) buffer.\n// 2.\tOp is sent to service (op leaves outbound queue).\n// \t - Note: We do not know for sure when op is sent, we only track when it is added to outbound queue.\n// If outbound queue is paused, time queue is paused is counted as network time.\n// 3.\tOp received from service back (pushed to inbound queue).\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n\t/** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */\n\tdurationOutboundBatching: number; // was durationOutboundQueue in previous versions\n\t/** Measure time between (2) and (3) - Track how long it took for op to be acked by service */\n\tdurationNetwork: number; // was durationInboundQueue\n\t/** Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event */\n\tdurationInboundToProcessing: number;\n\t/** Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3) */\n\tlengthInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\ninterface IOpPerfTimings {\n\t/** Starting time for (1) */\n\tsubmitOpEventTime: number;\n\t/** Starting time for (2) */\n\toutboundPushEventTime: number;\n\t/** Starting time for (3) */\n\tinboundPushEventTime: number;\n}\n\nclass OpPerfTelemetry {\n\tprivate pingLatency: number | undefined;\n\n\t// Collab window tracking. This is timestamp of %1000 message.\n\tprivate sequenceNumberForMsnTracking: number | undefined;\n\tprivate msnTrackingTimestamp: number = 0;\n\t// To track round trip time for every %500 client message.\n\tprivate clientSequenceNumberForLatencyStatistics: number | undefined;\n\t// Performance Data to be reported for ops round trips and processing.\n\tprivate readonly latencyStatistics = new Map<\n\t\tnumber,\n\t\t{\n\t\t\topProcessingTimes: Partial<IOpPerfTimings>;\n\t\t\topPerfData: Partial<IOpPerfTelemetryProperties>;\n\t\t}\n\t>();\n\n\tprivate firstConnection = true;\n\tprivate connectionOpSeqNumber: number | undefined;\n\tprivate readonly bootTime = performance.now();\n\tprivate connectionStartTime = 0;\n\tprivate gap = 0;\n\n\t/** Count of no-ops sent by this client. This variable is reset everytime the OpStats sampled event is logged */\n\tprivate noOpCountForTelemetry = 0;\n\t/** Cumulative size of the ops processed by this client. This variable is reset everytime the OpStats sampled event is logged */\n\tprivate processedOpSizeForTelemetry = 0;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tprivate static readonly OP_LATENCY_SAMPLE_RATE = 500;\n\tprivate readonly opLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly DELTA_LATENCY_SAMPLE_RATE = 100;\n\tprivate readonly deltaLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly PROCESSED_OPS_SAMPLE_RATE = 500;\n\n\t/**\n\t * A sampled logger to log Ops that have been processed by the current client, the NoOp sent and the\n\t * size of the ops processed within one sampling window of this log event.\n\t * The data from this logger will be used to monitor the efficiency of NoOp-heuristics or to get approximate collab window size.\n\t * Note: no log events are sent when sampling is disabled, because logging at every op will be too noisy.\n\t */\n\tprivate readonly opsLogger: ISampledTelemetryLogger;\n\n\t/**\n\t * Create an instance of OpPerfTelemetry which starts monitoring and generating telemetry related to op performance.\n\t *\n\t * @param clientId - The clientId of the current container.\n\t * @param deltaManager - DeltaManager instance to monitor.\n\t * @param containerRuntimeEvents - Emitter of events for the container runtime.\n\t * @param logger - Telemetry logger to write events to.\n\t */\n\tpublic constructor(\n\t\t/**\n\t\t * The clientId of the current container.\n\t\t *\n\t\t * @remarks Until the container connects to the server and receives an ack for its own join op, this can be undefined.\n\t\t * It gets updated in response to event changes once the value provided by the server is available.\n\t\t * If the container loses its connection, this could be the last known clientId.\n\t\t */\n\t\tprivate clientId: string | undefined,\n\t\t/**\n\t\t * DeltaManager instance to monitor.\n\t\t */\n\t\tprivate readonly deltaManager: IDeltaManagerFull,\n\t\t/**\n\t\t * Emitter of events for the container runtime.\n\t\t */\n\t\tcontainerRuntimeEvents: IEventProvider<IContainerRuntimeEvents>,\n\t\t/**\n\t\t * Telemetry logger to write events to.\n\t\t */\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OpPerf\" });\n\n\t\tconst deltaLatencyEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = -1;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample = eventCount % OpPerfTelemetry.DELTA_LATENCY_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\n\t\tthis.deltaLatencyLogger = createSampledLogger(logger, deltaLatencyEventSampler);\n\n\t\t// The SampledLogger here is used get access to the isSamplingDisabled property derived from\n\t\t// telemetry config properties. The actual sampling logic for op messages happens outside this SampledLogger\n\t\t// due to complexity of the different asynchronus scenarios of the op message lifecycle.\n\t\tthis.opLatencyLogger = createSampledLogger(logger);\n\n\t\tconst opsEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = 0;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample = eventCount % OpPerfTelemetry.PROCESSED_OPS_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t\tthis.noOpCountForTelemetry = 0;\n\t\t\t\t\t\tthis.processedOpSizeForTelemetry = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\t\tthis.opsLogger = createSampledLogger(\n\t\t\tlogger,\n\t\t\topsEventSampler,\n\t\t\ttrue /* skipLoggingWhenSamplingIsDisabled */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n\t\tthis.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\t\tthis.deltaManager.on(\"connect\", (details, opsBehind) => {\n\t\t\tif (opsBehind !== undefined) {\n\t\t\t\tthis.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\tthis.gap = opsBehind;\n\t\t\t\tthis.connectionStartTime = performance.now();\n\n\t\t\t\t// We might be already up-today. If so, report it right away.\n\t\t\t\tif (this.gap <= 0) {\n\t\t\t\t\tthis.reportGettingUpToDate();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.deltaManager.on(\"disconnect\", () => {\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.connectionOpSeqNumber = undefined;\n\t\t\tthis.firstConnection = false;\n\t\t\tthis.latencyStatistics.clear();\n\t\t});\n\n\t\tthis.deltaManager.outbound.on(\"push\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (\n\t\t\t\t\tmsg.type === MessageType.Operation &&\n\t\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber)\n\t\t\t\t) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst latencyStats = this.latencyStatistics.get(msg.clientSequenceNumber)!;\n\t\t\t\t\tassert(latencyStats !== undefined, 0x7c2 /* Latency stats for op should exist */);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime === undefined,\n\t\t\t\t\t\t0x2c8 /* \"outboundPushEventTime should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationNetwork === undefined,\n\t\t\t\t\t\t0x2c9 /* \"durationNetwork should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime = Date.now();\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching === undefined,\n\t\t\t\t\t\t0x2ca /* \"durationOutboundBatching should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t\t\t0x2cb /* \"submitOpEventTime should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\tthis.clientId === message.clientId &&\n\t\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t\t) {\n\t\t\t\t// We do an explicit check for undefined right after this\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst latencyStats = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\t\tassert(latencyStats !== undefined, 0x7c3 /* Latency stats for op should exist */);\n\t\t\t\tif (latencyStats.opProcessingTimes.outboundPushEventTime !== undefined) {\n\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime = Date.now();\n\t\t\t\t\tlatencyStats.opPerfData.durationNetwork =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime;\n\t\t\t\t\tlatencyStats.opPerfData.lengthInboundQueue = this.deltaManager.inbound.length;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isRuntimeMessage(message) && typeof message.contents === \"string\") {\n\t\t\t\tthis.processedOpSizeForTelemetry += message.contents.length;\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n\t\t\t// Do not want to log zero for sure.\n\t\t\t// We are more interested in aggregates, so logging only if we are processing some number of ops\n\t\t\t// Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n\t\t\t// want to get answered\n\t\t\t// back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n\t\t\t// we can remove typeof check.\n\t\t\tif (typeof count === \"number\" && count >= 100) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"GetDeltas_OpProcessing\",\n\t\t\t\t\tcount,\n\t\t\t\t\tduration,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tcontainerRuntimeEvents.on(\"connected\", (newClientId) => {\n\t\t\tthis.clientId = newClientId;\n\t\t});\n\t}\n\n\tprivate reportGettingUpToDate() {\n\t\tthis.connectionOpSeqNumber = undefined;\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName: \"ConnectionSpeed\",\n\t\t\tduration: performance.now() - this.connectionStartTime,\n\t\t\tops: this.gap,\n\t\t\t// track time to connect only for first connection.\n\t\t\ttimeToConnect: this.firstConnection\n\t\t\t\t? formatTick(this.connectionStartTime - this.bootTime)\n\t\t\t\t: undefined,\n\t\t\tfirstConnection: this.firstConnection,\n\t\t});\n\t}\n\n\tprivate recordPingTime(latency: number) {\n\t\tthis.pingLatency = latency;\n\n\t\t// Log if latency is longer than 1 min\n\t\tif (latency > 1000 * 60) {\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"LatencyTooLong\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\n\t\t// logging one in every DELTA_LATENCY_SAMPLE_RATE pongs, including the first time, if it is a \"write\" client.\n\t\tif (this.deltaManager.active) {\n\t\t\tthis.deltaLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"DeltaLatency\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate beforeOpSubmit(message: IDocumentMessage) {\n\t\t// start with first client op and measure latency every 500 client ops\n\t\tif (\n\t\t\tthis.opLatencyLogger.isSamplingDisabled ||\n\t\t\t(this.clientSequenceNumberForLatencyStatistics === undefined &&\n\t\t\t\tmessage.clientSequenceNumber % OpPerfTelemetry.OP_LATENCY_SAMPLE_RATE === 1)\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.latencyStatistics.get(message.clientSequenceNumber) === undefined,\n\t\t\t\t0x7c4 /* Existing op perf data for client sequence number */,\n\t\t\t);\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n\t\t\tthis.latencyStatistics.set(message.clientSequenceNumber, {\n\t\t\t\topProcessingTimes: {\n\t\t\t\t\tsubmitOpEventTime: Date.now(),\n\t\t\t\t},\n\t\t\t\topPerfData: {},\n\t\t\t});\n\t\t}\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\t// Count the number of no-ops submitted by this client.\n\t\t\t// The value is reset when we log the OpStats sampled event.\n\t\t\tthis.noOpCountForTelemetry++;\n\t\t}\n\t}\n\n\tprivate afterProcessingOp(message: ISequencedDocumentMessage) {\n\t\tconst sequenceNumber = message.sequenceNumber;\n\n\t\tif (sequenceNumber === this.connectionOpSeqNumber) {\n\t\t\tthis.reportGettingUpToDate();\n\t\t}\n\n\t\t// Record collab window max size after every 1000th op.\n\t\tif (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n\t\t\tthis.sequenceNumberForMsnTracking = sequenceNumber;\n\t\t\tthis.msnTrackingTimestamp = message.timestamp;\n\t\t}\n\t\tif (\n\t\t\tthis.sequenceNumberForMsnTracking !== undefined &&\n\t\t\tmessage.minimumSequenceNumber >= this.sequenceNumberForMsnTracking\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.msnTrackingTimestamp !== undefined,\n\t\t\t\t0x2ce /* \"msnTrackingTimestamp should not be undefined\" */,\n\t\t\t);\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"MsnStatistics\",\n\t\t\t\tsequenceNumber,\n\t\t\t\tmsnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n\t\t\t\tduration: message.timestamp - this.msnTrackingTimestamp,\n\t\t\t});\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t}\n\n\t\tif (\n\t\t\tthis.clientId === message.clientId &&\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t) {\n\t\t\t// We do an explicit check for undefined right after this\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst latencyData = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\tassert(latencyData !== undefined, 0x7c5 /* Undefined latency statistics for op */);\n\t\t\tassert(\n\t\t\t\tlatencyData.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t0x120 /* \"Undefined latency statistics for op (op send time)\" */,\n\t\t\t);\n\t\t\tconst currentTime = Date.now();\n\t\t\tif (latencyData.opProcessingTimes.inboundPushEventTime !== undefined) {\n\t\t\t\tlatencyData.opPerfData.durationInboundToProcessing =\n\t\t\t\t\tcurrentTime - latencyData.opProcessingTimes.inboundPushEventTime;\n\t\t\t}\n\t\t\tconst duration = currentTime - latencyData.opProcessingTimes.submitOpEventTime;\n\n\t\t\t// One of the core expectations for Fluid service is to be fast.\n\t\t\t// When it's not the case, we want to learn about it and be able to investigate, so\n\t\t\t// raise awareness.\n\t\t\t// This also helps identify cases where it's due to client behavior (sending too many ops)\n\t\t\t// that results in overwhelming ordering service and thus starting to see long latencies.\n\t\t\t// The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n\t\t\t// performance impacts all workloads relying on service.\n\t\t\tconst category = duration > latencyThreshold ? \"error\" : \"performance\";\n\t\t\tthis.opLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpRoundtripTime\",\n\t\t\t\tsequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tcategory,\n\t\t\t\tpingLatency: this.pingLatency,\n\t\t\t\tmsnDistance:\n\t\t\t\t\tthis.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n\t\t\t\t...latencyData.opPerfData,\n\t\t\t});\n\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.latencyStatistics.delete(message.clientSequenceNumber);\n\t\t}\n\n\t\tif (isRuntimeMessage(message)) {\n\t\t\t// Sampled logging of Ops that have been processed by the current client, the NoOp sent and the\n\t\t\t// size of the ops processed within one sampling window of this log event.\n\t\t\t// This data will be used to monitor the efficiency of NoOp-heuristics or to get approximate collab window size.\n\t\t\tthis.opsLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpStats\",\n\t\t\t\t// Logging as 'details' property to avoid adding new column name to the log tables */\n\t\t\t\tdetails: {\n\t\t\t\t\t// Count of the ops processed by the current client. Note: these counts are after\n\t\t\t\t\t// compression/grouping/chunking (if enabled) of the ops.\n\t\t\t\t\tprocessedOpCount: OpPerfTelemetry.PROCESSED_OPS_SAMPLE_RATE,\n\t\t\t\t\t// Cumulative size of all the ops processed by the current client since the last OpStats event log\n\t\t\t\t\tprocessedOpSize: this.processedOpSizeForTelemetry,\n\t\t\t\t\t// Count of all the NoOp sent by the current client since the last OpStats event log\n\t\t\t\t\tsubmitedNoOpCount: this.noOpCountForTelemetry,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n}\nexport interface IPerfSignalReport {\n\t/**\n\t * Identifier to track broadcast signals being submitted in order to\n\t * allow collection of data around the roundtrip of signal messages.\n\t */\n\tbroadcastSignalSequenceNumber: number;\n\n\t/**\n\t * Accumulates the total number of broadcast signals sent during the current signal latency measurement window.\n\t * This value represents the total number of signals sent since the latency measurement began and is used\n\t * logged in telemetry when the latency measurement completes.\n\t */\n\ttotalSignalsSentInLatencyWindow: number;\n\n\t/**\n\t * Counts the number of broadcast signals sent since the last latency measurement was initiated.\n\t * This counter increments with each broadcast signal sent. When a new latency measurement starts,\n\t * this counter is added to `totalSignalsSentInLatencyWindow` and then reset to zero.\n\t */\n\tsignalsSentSinceLastLatencyMeasurement: number;\n\n\t/**\n\t * Number of signals that were expected but not received.\n\t */\n\tsignalsLost: number;\n\n\t/**\n\t * Number of signals received out of order/non-sequentially.\n\t */\n\tsignalsOutOfOrder: number;\n\n\t/**\n\t * Timestamp before submitting the signal we will trace.\n\t */\n\tsignalTimestamp: number;\n\n\t/**\n\t * Signal we will trace for roundtrip latency.\n\t */\n\troundTripSignalSequenceNumber: number | undefined;\n\n\t/**\n\t * Next expected signal sequence number to be received.\n\t */\n\ttrackingSignalSequenceNumber: number | undefined;\n\n\t/**\n\t * Inclusive lower bound of signal monitoring window.\n\t */\n\tminimumTrackingSignalSequenceNumber: number | undefined;\n}\n\n/**\n * Starts monitoring and generation of telemetry related to op performance.\n *\n * @param clientId - The clientId of the current container.\n * @param deltaManager - DeltaManager instance to monitor.\n * @param containerRuntimeEvents - Emitter of events for the container runtime.\n * @param logger - Telemetry logger to write events to.\n */\nexport function ReportOpPerfTelemetry(\n\tclientId: string | undefined,\n\tdeltaManager: IDeltaManagerFull,\n\tcontainerRuntimeEvents: IEventProvider<IContainerRuntimeEvents>,\n\tlogger: ITelemetryLoggerExt,\n): void {\n\tnew OpPerfTelemetry(clientId, deltaManager, containerRuntimeEvents, logger);\n}\n"]}
1
+ {"version":3,"file":"connectionTelemetry.js","sourceRoot":"","sources":["../src/connectionTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,WAAW,GAEX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAIN,iBAAiB,EACjB,mBAAm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AAC;YAEH,IAAI,CAAC,wCAAwC,GAAG,SAAS,CAAC;YAC1D,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,+FAA+F;YAC/F,0EAA0E;YAC1E,gHAAgH;YAChH,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;gBACnC,SAAS,EAAE,SAAS;gBACpB,qFAAqF;gBACrF,OAAO,EAAE;oBACR,iFAAiF;oBACjF,yDAAyD;oBACzD,gBAAgB,EAAE,eAAe,CAAC,yBAAyB;oBAC3D,kGAAkG;oBAClG,eAAe,EAAE,IAAI,CAAC,2BAA2B;oBACjD,oFAAoF;oBACpF,iBAAiB,EAAE,IAAI,CAAC,qBAAqB;iBAC7C;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;;AA5VuB,sCAAsB,GAAG,GAAG,AAAN,CAAO;AAG7B,yCAAyB,GAAG,GAAG,AAAN,CAAO;AAGhC,yCAAyB,GAAG,GAAG,AAAN,CAAO;AA4YzD;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACpC,QAA4B,EAC5B,YAA+B,EAC/B,sBAA+D,EAC/D,MAA4B;IAE5B,IAAI,eAAe,CAClB,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAC7B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport { IDeltaManagerFull } from \"@fluidframework/container-definitions/internal\";\nimport { IContainerRuntimeEvents } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentMessage,\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIEventSampler,\n\tITelemetryLoggerExt,\n\tISampledTelemetryLogger,\n\tcreateChildLogger,\n\tcreateSampledLogger,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * We report various latency-related errors when waiting for op roundtrip takes longer than that amout of time.\n */\nexport const latencyThreshold = 5000;\n\n// Phases in OpPerfTelemetry:\n// 1.\tOp is added to DeltaManager (DM) buffer.\n// 2.\tOp is sent to service (op leaves outbound queue).\n// \t - Note: We do not know for sure when op is sent, we only track when it is added to outbound queue.\n// If outbound queue is paused, time queue is paused is counted as network time.\n// 3.\tOp received from service back (pushed to inbound queue).\n// 4.\tOp is processed.\ninterface IOpPerfTelemetryProperties {\n\t/**\n\t * Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch\n\t */\n\tdurationOutboundBatching: number; // was durationOutboundQueue in previous versions\n\t/**\n\t * Measure time between (2) and (3) - Track how long it took for op to be acked by service\n\t */\n\tdurationNetwork: number; // was durationInboundQueue\n\t/**\n\t * Measure time between (3) and (4) - Time between DM's inbound \"push\" event until DM's \"op\" event\n\t */\n\tdurationInboundToProcessing: number;\n\t/**\n\t * Length of the DeltaManager's inbound queue at the time of the DM's inbound \"push\" event (3)\n\t */\n\tlengthInboundQueue: number;\n}\n\n/**\n * Timings collected at various moments during the op processing.\n */\ninterface IOpPerfTimings {\n\t/**\n\t * Starting time for (1)\n\t */\n\tsubmitOpEventTime: number;\n\t/**\n\t * Starting time for (2)\n\t */\n\toutboundPushEventTime: number;\n\t/**\n\t * Starting time for (3)\n\t */\n\tinboundPushEventTime: number;\n}\n\nclass OpPerfTelemetry {\n\tprivate pingLatency: number | undefined;\n\n\t// Collab window tracking. This is timestamp of %1000 message.\n\tprivate sequenceNumberForMsnTracking: number | undefined;\n\tprivate msnTrackingTimestamp: number = 0;\n\t// To track round trip time for every %500 client message.\n\tprivate clientSequenceNumberForLatencyStatistics: number | undefined;\n\t// Performance Data to be reported for ops round trips and processing.\n\tprivate readonly latencyStatistics = new Map<\n\t\tnumber,\n\t\t{\n\t\t\topProcessingTimes: Partial<IOpPerfTimings>;\n\t\t\topPerfData: Partial<IOpPerfTelemetryProperties>;\n\t\t}\n\t>();\n\n\tprivate firstConnection = true;\n\tprivate connectionOpSeqNumber: number | undefined;\n\tprivate readonly bootTime = performanceNow();\n\tprivate connectionStartTime = 0;\n\tprivate gap = 0;\n\n\t/**\n\t * Count of no-ops sent by this client. This variable is reset everytime the OpStats sampled event is logged\n\t */\n\tprivate noOpCountForTelemetry = 0;\n\t/**\n\t * Cumulative size of the ops processed by this client. This variable is reset everytime the OpStats sampled event is logged\n\t */\n\tprivate processedOpSizeForTelemetry = 0;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tprivate static readonly OP_LATENCY_SAMPLE_RATE = 500;\n\tprivate readonly opLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly DELTA_LATENCY_SAMPLE_RATE = 100;\n\tprivate readonly deltaLatencyLogger: ISampledTelemetryLogger;\n\n\tprivate static readonly PROCESSED_OPS_SAMPLE_RATE = 500;\n\n\t/**\n\t * A sampled logger to log Ops that have been processed by the current client, the NoOp sent and the\n\t * size of the ops processed within one sampling window of this log event.\n\t * The data from this logger will be used to monitor the efficiency of NoOp-heuristics or to get approximate collab window size.\n\t * Note: no log events are sent when sampling is disabled, because logging at every op will be too noisy.\n\t */\n\tprivate readonly opsLogger: ISampledTelemetryLogger;\n\n\t/**\n\t * Create an instance of OpPerfTelemetry which starts monitoring and generating telemetry related to op performance.\n\t *\n\t * @param clientId - The clientId of the current container.\n\t * @param deltaManager - DeltaManager instance to monitor.\n\t * @param containerRuntimeEvents - Emitter of events for the container runtime.\n\t * @param logger - Telemetry logger to write events to.\n\t */\n\tpublic constructor(\n\t\t/**\n\t\t * The clientId of the current container.\n\t\t *\n\t\t * @remarks Until the container connects to the server and receives an ack for its own join op, this can be undefined.\n\t\t * It gets updated in response to event changes once the value provided by the server is available.\n\t\t * If the container loses its connection, this could be the last known clientId.\n\t\t */\n\t\tprivate clientId: string | undefined,\n\t\t/**\n\t\t * DeltaManager instance to monitor.\n\t\t */\n\t\tprivate readonly deltaManager: IDeltaManagerFull,\n\t\t/**\n\t\t * Emitter of events for the container runtime.\n\t\t */\n\t\tcontainerRuntimeEvents: IEventProvider<IContainerRuntimeEvents>,\n\t\t/**\n\t\t * Telemetry logger to write events to.\n\t\t */\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OpPerf\" });\n\n\t\tconst deltaLatencyEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = -1;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample = eventCount % OpPerfTelemetry.DELTA_LATENCY_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\n\t\tthis.deltaLatencyLogger = createSampledLogger(logger, deltaLatencyEventSampler);\n\n\t\t// The SampledLogger here is used get access to the isSamplingDisabled property derived from\n\t\t// telemetry config properties. The actual sampling logic for op messages happens outside this SampledLogger\n\t\t// due to complexity of the different asynchronus scenarios of the op message lifecycle.\n\t\tthis.opLatencyLogger = createSampledLogger(logger);\n\n\t\tconst opsEventSampler: IEventSampler = (() => {\n\t\t\tlet eventCount = 0;\n\t\t\treturn {\n\t\t\t\tsample: () => {\n\t\t\t\t\teventCount++;\n\t\t\t\t\tconst shouldSample = eventCount % OpPerfTelemetry.PROCESSED_OPS_SAMPLE_RATE === 0;\n\t\t\t\t\tif (shouldSample) {\n\t\t\t\t\t\teventCount = 0;\n\t\t\t\t\t\tthis.noOpCountForTelemetry = 0;\n\t\t\t\t\t\tthis.processedOpSizeForTelemetry = 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn shouldSample;\n\t\t\t\t},\n\t\t\t};\n\t\t})();\n\t\tthis.opsLogger = createSampledLogger(\n\t\t\tlogger,\n\t\t\topsEventSampler,\n\t\t\ttrue /* skipLoggingWhenSamplingIsDisabled */,\n\t\t);\n\n\t\tthis.deltaManager.on(\"pong\", (latency) => this.recordPingTime(latency));\n\t\tthis.deltaManager.on(\"submitOp\", (message) => this.beforeOpSubmit(message));\n\t\tthis.deltaManager.on(\"op\", (message) => this.afterProcessingOp(message));\n\t\tthis.deltaManager.on(\"connect\", (details, opsBehind) => {\n\t\t\tif (opsBehind !== undefined) {\n\t\t\t\tthis.connectionOpSeqNumber = this.deltaManager.lastKnownSeqNumber;\n\t\t\t\tthis.gap = opsBehind;\n\t\t\t\tthis.connectionStartTime = performanceNow();\n\n\t\t\t\t// We might be already up-today. If so, report it right away.\n\t\t\t\tif (this.gap <= 0) {\n\t\t\t\t\tthis.reportGettingUpToDate();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.deltaManager.on(\"disconnect\", () => {\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.connectionOpSeqNumber = undefined;\n\t\t\tthis.firstConnection = false;\n\t\t\tthis.latencyStatistics.clear();\n\t\t});\n\n\t\tthis.deltaManager.outbound.on(\"push\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (\n\t\t\t\t\tmsg.type === MessageType.Operation &&\n\t\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === msg.clientSequenceNumber)\n\t\t\t\t) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst latencyStats = this.latencyStatistics.get(msg.clientSequenceNumber)!;\n\t\t\t\t\tassert(latencyStats !== undefined, 0x7c2 /* Latency stats for op should exist */);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime === undefined,\n\t\t\t\t\t\t0x2c8 /* \"outboundPushEventTime should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationNetwork === undefined,\n\t\t\t\t\t\t0x2c9 /* \"durationNetwork should be undefined\" */,\n\t\t\t\t\t);\n\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime = Date.now();\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching === undefined,\n\t\t\t\t\t\t0x2ca /* \"durationOutboundBatching should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tassert(\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t\t\t0x2cb /* \"submitOpEventTime should be undefined\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tlatencyStats.opPerfData.durationOutboundBatching =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.submitOpEventTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\tthis.clientId === message.clientId &&\n\t\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t\t) {\n\t\t\t\t// We do an explicit check for undefined right after this\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst latencyStats = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\t\tassert(latencyStats !== undefined, 0x7c3 /* Latency stats for op should exist */);\n\t\t\t\tif (latencyStats.opProcessingTimes.outboundPushEventTime !== undefined) {\n\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime = Date.now();\n\t\t\t\t\tlatencyStats.opPerfData.durationNetwork =\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.inboundPushEventTime -\n\t\t\t\t\t\tlatencyStats.opProcessingTimes.outboundPushEventTime;\n\t\t\t\t\tlatencyStats.opPerfData.lengthInboundQueue = this.deltaManager.inbound.length;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isRuntimeMessage(message) && typeof message.contents === \"string\") {\n\t\t\t\tthis.processedOpSizeForTelemetry += message.contents.length;\n\t\t\t}\n\t\t});\n\n\t\tthis.deltaManager.inbound.on(\"idle\", (count: number, duration: number) => {\n\t\t\t// Do not want to log zero for sure.\n\t\t\t// We are more interested in aggregates, so logging only if we are processing some number of ops\n\t\t\t// Cut-off is arbitrary - can be increased or decreased based on amount of data collected and questions we\n\t\t\t// want to get answered\n\t\t\t// back-compat: Once 0.36 loader version saturates (count & duration args were added there),\n\t\t\t// we can remove typeof check.\n\t\t\tif (typeof count === \"number\" && count >= 100) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"GetDeltas_OpProcessing\",\n\t\t\t\t\tcount,\n\t\t\t\t\tduration,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tcontainerRuntimeEvents.on(\"connected\", (newClientId) => {\n\t\t\tthis.clientId = newClientId;\n\t\t});\n\t}\n\n\tprivate reportGettingUpToDate(): void {\n\t\tthis.connectionOpSeqNumber = undefined;\n\t\tthis.logger.sendPerformanceEvent({\n\t\t\teventName: \"ConnectionSpeed\",\n\t\t\tduration: performanceNow() - this.connectionStartTime,\n\t\t\tops: this.gap,\n\t\t\t// track time to connect only for first connection.\n\t\t\ttimeToConnect: this.firstConnection\n\t\t\t\t? formatTick(this.connectionStartTime - this.bootTime)\n\t\t\t\t: undefined,\n\t\t\tfirstConnection: this.firstConnection,\n\t\t});\n\t}\n\n\tprivate recordPingTime(latency: number): void {\n\t\tthis.pingLatency = latency;\n\n\t\t// Log if latency is longer than 1 min\n\t\tif (latency > 1000 * 60) {\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"LatencyTooLong\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\n\t\t// logging one in every DELTA_LATENCY_SAMPLE_RATE pongs, including the first time, if it is a \"write\" client.\n\t\tif (this.deltaManager.active) {\n\t\t\tthis.deltaLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"DeltaLatency\",\n\t\t\t\tduration: latency,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate beforeOpSubmit(message: IDocumentMessage): void {\n\t\t// start with first client op and measure latency every 500 client ops\n\t\tif (\n\t\t\tthis.opLatencyLogger.isSamplingDisabled ||\n\t\t\t(this.clientSequenceNumberForLatencyStatistics === undefined &&\n\t\t\t\tmessage.clientSequenceNumber % OpPerfTelemetry.OP_LATENCY_SAMPLE_RATE === 1)\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.latencyStatistics.get(message.clientSequenceNumber) === undefined,\n\t\t\t\t0x7c4 /* Existing op perf data for client sequence number */,\n\t\t\t);\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = message.clientSequenceNumber;\n\t\t\tthis.latencyStatistics.set(message.clientSequenceNumber, {\n\t\t\t\topProcessingTimes: {\n\t\t\t\t\tsubmitOpEventTime: Date.now(),\n\t\t\t\t},\n\t\t\t\topPerfData: {},\n\t\t\t});\n\t\t}\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\t// Count the number of no-ops submitted by this client.\n\t\t\t// The value is reset when we log the OpStats sampled event.\n\t\t\tthis.noOpCountForTelemetry++;\n\t\t}\n\t}\n\n\tprivate afterProcessingOp(message: ISequencedDocumentMessage): void {\n\t\tconst sequenceNumber = message.sequenceNumber;\n\n\t\tif (sequenceNumber === this.connectionOpSeqNumber) {\n\t\t\tthis.reportGettingUpToDate();\n\t\t}\n\n\t\t// Record collab window max size after every 1000th op.\n\t\tif (this.sequenceNumberForMsnTracking === undefined && sequenceNumber % 1000 === 0) {\n\t\t\tthis.sequenceNumberForMsnTracking = sequenceNumber;\n\t\t\tthis.msnTrackingTimestamp = message.timestamp;\n\t\t}\n\t\tif (\n\t\t\tthis.sequenceNumberForMsnTracking !== undefined &&\n\t\t\tmessage.minimumSequenceNumber >= this.sequenceNumberForMsnTracking\n\t\t) {\n\t\t\tassert(\n\t\t\t\tthis.msnTrackingTimestamp !== undefined,\n\t\t\t\t0x2ce /* \"msnTrackingTimestamp should not be undefined\" */,\n\t\t\t);\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"MsnStatistics\",\n\t\t\t\tsequenceNumber,\n\t\t\t\tmsnDistance: sequenceNumber - this.sequenceNumberForMsnTracking,\n\t\t\t\tduration: message.timestamp - this.msnTrackingTimestamp,\n\t\t\t});\n\t\t\tthis.sequenceNumberForMsnTracking = undefined;\n\t\t}\n\n\t\tif (\n\t\t\tthis.clientId === message.clientId &&\n\t\t\tmessage.type === MessageType.Operation &&\n\t\t\t(this.opLatencyLogger.isSamplingDisabled ||\n\t\t\t\tthis.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber)\n\t\t) {\n\t\t\t// We do an explicit check for undefined right after this\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst latencyData = this.latencyStatistics.get(message.clientSequenceNumber)!;\n\t\t\tassert(latencyData !== undefined, 0x7c5 /* Undefined latency statistics for op */);\n\t\t\tassert(\n\t\t\t\tlatencyData.opProcessingTimes.submitOpEventTime !== undefined,\n\t\t\t\t0x120 /* \"Undefined latency statistics for op (op send time)\" */,\n\t\t\t);\n\t\t\tconst currentTime = Date.now();\n\t\t\tif (latencyData.opProcessingTimes.inboundPushEventTime !== undefined) {\n\t\t\t\tlatencyData.opPerfData.durationInboundToProcessing =\n\t\t\t\t\tcurrentTime - latencyData.opProcessingTimes.inboundPushEventTime;\n\t\t\t}\n\t\t\tconst duration = currentTime - latencyData.opProcessingTimes.submitOpEventTime;\n\n\t\t\t// One of the core expectations for Fluid service is to be fast.\n\t\t\t// When it's not the case, we want to learn about it and be able to investigate, so\n\t\t\t// raise awareness.\n\t\t\t// This also helps identify cases where it's due to client behavior (sending too many ops)\n\t\t\t// that results in overwhelming ordering service and thus starting to see long latencies.\n\t\t\t// The threshold could be adjusted, but ideally it stays workload-agnostic, as service\n\t\t\t// performance impacts all workloads relying on service.\n\t\t\tconst category = duration > latencyThreshold ? \"error\" : \"performance\";\n\t\t\tthis.opLatencyLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpRoundtripTime\",\n\t\t\t\tsequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tduration,\n\t\t\t\tcategory,\n\t\t\t\tpingLatency: this.pingLatency,\n\t\t\t\tmsnDistance:\n\t\t\t\t\tthis.deltaManager.lastSequenceNumber - this.deltaManager.minimumSequenceNumber,\n\t\t\t\t...latencyData.opPerfData,\n\t\t\t});\n\n\t\t\tthis.clientSequenceNumberForLatencyStatistics = undefined;\n\t\t\tthis.latencyStatistics.delete(message.clientSequenceNumber);\n\t\t}\n\n\t\tif (isRuntimeMessage(message)) {\n\t\t\t// Sampled logging of Ops that have been processed by the current client, the NoOp sent and the\n\t\t\t// size of the ops processed within one sampling window of this log event.\n\t\t\t// This data will be used to monitor the efficiency of NoOp-heuristics or to get approximate collab window size.\n\t\t\tthis.opsLogger.sendPerformanceEvent({\n\t\t\t\teventName: \"OpStats\",\n\t\t\t\t// Logging as 'details' property to avoid adding new column name to the log tables */\n\t\t\t\tdetails: {\n\t\t\t\t\t// Count of the ops processed by the current client. Note: these counts are after\n\t\t\t\t\t// compression/grouping/chunking (if enabled) of the ops.\n\t\t\t\t\tprocessedOpCount: OpPerfTelemetry.PROCESSED_OPS_SAMPLE_RATE,\n\t\t\t\t\t// Cumulative size of all the ops processed by the current client since the last OpStats event log\n\t\t\t\t\tprocessedOpSize: this.processedOpSizeForTelemetry,\n\t\t\t\t\t// Count of all the NoOp sent by the current client since the last OpStats event log\n\t\t\t\t\tsubmitedNoOpCount: this.noOpCountForTelemetry,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n}\nexport interface IPerfSignalReport {\n\t/**\n\t * Identifier to track broadcast signals being submitted in order to\n\t * allow collection of data around the roundtrip of signal messages.\n\t */\n\tbroadcastSignalSequenceNumber: number;\n\n\t/**\n\t * Accumulates the total number of broadcast signals sent during the current signal latency measurement window.\n\t * This value represents the total number of signals sent since the latency measurement began and is used\n\t * logged in telemetry when the latency measurement completes.\n\t */\n\ttotalSignalsSentInLatencyWindow: number;\n\n\t/**\n\t * Counts the number of broadcast signals sent since the last latency measurement was initiated.\n\t * This counter increments with each broadcast signal sent. When a new latency measurement starts,\n\t * this counter is added to `totalSignalsSentInLatencyWindow` and then reset to zero.\n\t */\n\tsignalsSentSinceLastLatencyMeasurement: number;\n\n\t/**\n\t * Number of signals that were expected but not received.\n\t */\n\tsignalsLost: number;\n\n\t/**\n\t * Number of signals received out of order/non-sequentially.\n\t */\n\tsignalsOutOfOrder: number;\n\n\t/**\n\t * Timestamp before submitting the signal we will trace.\n\t */\n\tsignalTimestamp: number;\n\n\t/**\n\t * Signal we will trace for roundtrip latency.\n\t */\n\troundTripSignalSequenceNumber: number | undefined;\n\n\t/**\n\t * Next expected signal sequence number to be received.\n\t */\n\ttrackingSignalSequenceNumber: number | undefined;\n\n\t/**\n\t * Inclusive lower bound of signal monitoring window.\n\t */\n\tminimumTrackingSignalSequenceNumber: number | undefined;\n}\n\n/**\n * Starts monitoring and generation of telemetry related to op performance.\n *\n * @param clientId - The clientId of the current container.\n * @param deltaManager - DeltaManager instance to monitor.\n * @param containerRuntimeEvents - Emitter of events for the container runtime.\n * @param logger - Telemetry logger to write events to.\n */\nexport function ReportOpPerfTelemetry(\n\tclientId: string | undefined,\n\tdeltaManager: IDeltaManagerFull,\n\tcontainerRuntimeEvents: IEventProvider<IContainerRuntimeEvents>,\n\tlogger: ITelemetryBaseLogger,\n): void {\n\tnew OpPerfTelemetry(\n\t\tclientId,\n\t\tdeltaManager,\n\t\tcontainerRuntimeEvents,\n\t\tcreateChildLogger({ logger }),\n\t);\n}\n"]}
@@ -13,7 +13,7 @@ export declare class ContainerFluidHandleContext implements IFluidHandleContext
13
13
  readonly path: string;
14
14
  private readonly runtime;
15
15
  readonly routeContext?: IFluidHandleContext | undefined;
16
- get IFluidHandleContext(): this;
16
+ get IFluidHandleContext(): IFluidHandleContext;
17
17
  readonly absolutePath: string;
18
18
  /**
19
19
  * Creates a new ContainerFluidHandleContext.
@@ -1 +1 @@
1
- {"version":3,"file":"containerHandleContext.d.ts","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,MAAM,WAAW,8BAA8B;IAC9C,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACrD;AAED,qBAAa,2BAA4B,YAAW,mBAAmB;aAarD,IAAI,EAAE,MAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,YAAY,CAAC;IAd9B,IAAW,mBAAmB,SAE7B;IACD,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC;;;;;OAKG;gBAEc,IAAI,EAAE,MAAM,EACX,OAAO,EAAE,8BAA8B,EACxC,YAAY,CAAC,iCAAqB;IAK5C,WAAW,IAAI,IAAI;IAI1B,IAAW,UAAU,YAEpB;IAEY,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAGjE"}
1
+ {"version":3,"file":"containerHandleContext.d.ts","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,MAAM,WAAW,8BAA8B;IAC9C,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACrD;AAED,qBAAa,2BAA4B,YAAW,mBAAmB;aAarD,IAAI,EAAE,MAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,YAAY,CAAC;IAd9B,IAAW,mBAAmB,IAAI,mBAAmB,CAEpD;IACD,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC;;;;;OAKG;gBAEc,IAAI,EAAE,MAAM,EACX,OAAO,EAAE,8BAA8B,EACxC,YAAY,CAAC,iCAAqB;IAK5C,WAAW,IAAI,IAAI;IAI1B,IAAW,UAAU,IAAI,OAAO,CAE/B;IAEY,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAGjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAOnF,MAAM,OAAO,2BAA2B;IACvC,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAGD;;;;;OAKG;IACH,YACiB,IAAY,EACX,OAAuC,EACxC,YAAkC;QAFlC,SAAI,GAAJ,IAAI,CAAQ;QACX,YAAO,GAAP,OAAO,CAAgC;QACxC,iBAAY,GAAZ,YAAY,CAAsB;QAElD,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACxE,CAAC;IAEM,WAAW;QACjB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC1E,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils/internal\";\n\nexport interface IContainerHandleContextRuntime {\n\tattachState: AttachState;\n\tresolveHandle(request: IRequest): Promise<IResponse>;\n}\n\nexport class ContainerFluidHandleContext implements IFluidHandleContext {\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\tpublic readonly absolutePath: string;\n\n\t/**\n\t * Creates a new ContainerFluidHandleContext.\n\t * @param path - The path to this handle relative to the routeContext.\n\t * @param runtime - The IRuntime object this context represents.\n\t * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n\t */\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tprivate readonly runtime: IContainerHandleContextRuntime,\n\t\tpublic readonly routeContext?: IFluidHandleContext,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph(): void {\n\t\tthrow new Error(\"can't attach container runtime form within container!\");\n\t}\n\n\tpublic get isAttached() {\n\t\treturn this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\treturn this.runtime.resolveHandle(request);\n\t}\n}\n"]}
1
+ {"version":3,"file":"containerHandleContext.js","sourceRoot":"","sources":["../src/containerHandleContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAOnF,MAAM,OAAO,2BAA2B;IACvC,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAGD;;;;;OAKG;IACH,YACiB,IAAY,EACX,OAAuC,EACxC,YAAkC;QAFlC,SAAI,GAAJ,IAAI,CAAQ;QACX,YAAO,GAAP,OAAO,CAAgC;QACxC,iBAAY,GAAZ,YAAY,CAAsB;QAElD,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACxE,CAAC;IAEM,WAAW;QACjB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC1E,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { generateHandleContextPath } from \"@fluidframework/runtime-utils/internal\";\n\nexport interface IContainerHandleContextRuntime {\n\tattachState: AttachState;\n\tresolveHandle(request: IRequest): Promise<IResponse>;\n}\n\nexport class ContainerFluidHandleContext implements IFluidHandleContext {\n\tpublic get IFluidHandleContext(): IFluidHandleContext {\n\t\treturn this;\n\t}\n\tpublic readonly absolutePath: string;\n\n\t/**\n\t * Creates a new ContainerFluidHandleContext.\n\t * @param path - The path to this handle relative to the routeContext.\n\t * @param runtime - The IRuntime object this context represents.\n\t * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n\t */\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tprivate readonly runtime: IContainerHandleContextRuntime,\n\t\tpublic readonly routeContext?: IFluidHandleContext,\n\t) {\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic attachGraph(): void {\n\t\tthrow new Error(\"can't attach container runtime form within container!\");\n\t}\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.runtime.attachState !== AttachState.Detached;\n\t}\n\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\treturn this.runtime.resolveHandle(request);\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
5
+ import { TypedEventEmitter, type ILayerCompatDetails, type IProvideLayerCompatDetails } from "@fluid-internal/client-utils";
6
6
  import { AttachState, IAudience, ICriticalContainerError } from "@fluidframework/container-definitions";
7
7
  import { IContainerContext, IGetPendingLocalStateProps, IRuntime, IDeltaManager } from "@fluidframework/container-definitions/internal";
8
8
  import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions/internal";
@@ -12,14 +12,14 @@ import { IClientDetails, IQuorumClients, ISummaryTree } from "@fluidframework/dr
12
12
  import { IDocumentStorageService, IDocumentMessage, ISnapshotTree, MessageType, ISequencedDocumentMessage, ISignalMessage } from "@fluidframework/driver-definitions/internal";
13
13
  import type { IIdCompressor } from "@fluidframework/id-compressor";
14
14
  import type { IIdCompressorCore, SerializedIdCompressorWithOngoingSession } from "@fluidframework/id-compressor/internal";
15
- import { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeParam, FlushMode, IDataStore, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
15
+ import { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeParam, FlushMode, IDataStore, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, SummarizeInternalFn, type ISummarizerNodeWithGC } from "@fluidframework/runtime-definitions/internal";
16
16
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
17
17
  import { IPendingBlobs, type IBlobManagerLoadInfo } from "./blobManager/index.js";
18
18
  import { GCNodeType, IGCRuntimeOptions, IGCStats } from "./gc/index.js";
19
19
  import { ContainerMessageType } from "./messageTypes.js";
20
20
  import { IBatch } from "./opLifecycle/index.js";
21
21
  import { IPendingLocalState } from "./pendingStateManager.js";
22
- import { DocumentsSchemaController, EnqueueSummarizeResult, IContainerRuntimeMetadata, type IDocumentSchemaCurrent, IEnqueueSummarizeOptions, IOnDemandSummarizeOptions, IRefreshSummaryAckOptions, ISerializedElection, ISubmitSummaryOptions, ISummarizeResults, ISummarizerInternalsProvider, ISummarizerRuntime, IdCompressorMode, SubmitSummaryResult } from "./summary/index.js";
22
+ import { DocumentsSchemaController, EnqueueSummarizeResult, IContainerRuntimeMetadata, type IDocumentSchemaCurrent, IEnqueueSummarizeOptions, IOnDemandSummarizeOptions, IRefreshSummaryAckOptions, ISerializedElection, ISubmitSummaryOptions, ISummarizeResults, ISummarizerInternalsProvider, ISummarizerRuntime, IdCompressorMode, SubmitSummaryResult, type IDocumentSchemaFeatures } from "./summary/index.js";
23
23
  /**
24
24
  * @legacy
25
25
  * @alpha
@@ -122,6 +122,7 @@ export interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConf
122
122
  * @alpha
123
123
  */
124
124
  export type ISummaryConfiguration = ISummaryConfigurationDisableSummarizer | ISummaryConfigurationDisableHeuristics | ISummaryConfigurationHeuristics;
125
+ export declare function isSummariesDisabled(config: ISummaryConfiguration): config is ISummaryConfigurationDisableSummarizer;
125
126
  /**
126
127
  * @legacy
127
128
  * @alpha
@@ -132,7 +133,9 @@ export declare const DefaultSummaryConfiguration: ISummaryConfiguration;
132
133
  * @alpha
133
134
  */
134
135
  export interface ISummaryRuntimeOptions {
135
- /** Override summary configurations set by the server. */
136
+ /**
137
+ * Override summary configurations set by the server.
138
+ */
136
139
  summaryConfigOverrides?: ISummaryConfiguration;
137
140
  /**
138
141
  * Delay before first attempt to spawn summarizing container.
@@ -176,15 +179,6 @@ export interface IContainerRuntimeOptions {
176
179
  * 3. "bypass" will skip the check entirely. This is not recommended.
177
180
  */
178
181
  readonly loadSequenceNumberVerification?: "close" | "log" | "bypass";
179
- /**
180
- * Sets the flush mode for the runtime. In Immediate flush mode the runtime will immediately
181
- * send all operations to the driver layer, while in TurnBased the operations will be buffered
182
- * and then sent them as a single batch at the end of the turn.
183
- * By default, flush mode is TurnBased.
184
- *
185
- * @deprecated Only the default value TurnBased is supported. This option will be removed in the future.
186
- */
187
- readonly flushMode?: FlushMode;
188
182
  /**
189
183
  * Enables the runtime to compress ops. See {@link ICompressionRuntimeOptions}.
190
184
  */
@@ -224,8 +218,8 @@ export interface IContainerRuntimeOptions {
224
218
  * message to be sent to the service.
225
219
  * The grouping and ungrouping of such messages is handled by the "OpGroupingManager".
226
220
  *
227
- * By default, the feature is enabled.
228
- * @deprecated The ability to disable Grouped Batching is deprecated and will be removed in v2.20.0. This feature is required for the proper functioning of the Fluid Framework.
221
+ * By default, the feature is enabled. This feature can only be disabled when compression is also disabled.
222
+ * @deprecated The ability to disable Grouped Batching is deprecated and will be removed in a future release. This feature is required for the proper functioning of the Fluid Framework.
229
223
  */
230
224
  readonly enableGroupedBatching?: boolean;
231
225
  /**
@@ -264,6 +258,7 @@ export interface IContainerRuntimeOptionsInternal extends IContainerRuntimeOptio
264
258
  * Error responses when requesting a deleted object will have this header set to true
265
259
  * @legacy
266
260
  * @alpha
261
+ * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
267
262
  */
268
263
  export declare const DeletedResponseHeaderKey = "wasDeleted";
269
264
  /**
@@ -290,7 +285,9 @@ export interface RuntimeHeaderData {
290
285
  viaHandle?: boolean;
291
286
  allowTombstone?: boolean;
292
287
  }
293
- /** Default values for Runtime Headers */
288
+ /**
289
+ * Default values for Runtime Headers
290
+ */
294
291
  export declare const defaultRuntimeHeaderData: Required<RuntimeHeaderData>;
295
292
  /**
296
293
  * Available compression algorithms for op compression.
@@ -328,9 +325,13 @@ export interface IPendingRuntimeState {
328
325
  */
329
326
  sessionExpiryTimerStarted?: number | undefined;
330
327
  }
331
- /** The default time to wait for pending ops to be processed during summarization */
328
+ /**
329
+ * The default time to wait for pending ops to be processed during summarization
330
+ */
332
331
  export declare const defaultPendingOpsWaitTimeoutMs = 1000;
333
- /** The default time to delay a summarization retry attempt when there are pending ops */
332
+ /**
333
+ * The default time to delay a summarization retry attempt when there are pending ops
334
+ */
334
335
  export declare const defaultPendingOpsRetryDelayMs = 1000;
335
336
  /**
336
337
  * Checks whether a message.type is one of the values in ContainerMessageType
@@ -344,18 +345,15 @@ export declare function isUnpackedRuntimeMessage(message: ISequencedDocumentMess
344
345
  */
345
346
  export declare const agentSchedulerId = "_scheduler";
346
347
  export declare function getDeviceSpec(): {
347
- deviceMemory: any;
348
- hardwareConcurrency: number;
349
- } | {
350
- deviceMemory?: undefined;
351
- hardwareConcurrency?: undefined;
348
+ deviceMemory?: number | undefined;
349
+ hardwareConcurrency?: number | undefined;
352
350
  };
353
351
  /**
354
352
  * Older loader doesn't have a submitBatchFn member, this is the older way of submitting a batch.
355
353
  * Rather than exposing the submitFn (now deprecated) and IDeltaManager (dangerous to hand out) to the Outbox,
356
354
  * we can provide a partially-applied function to keep those items private to the ContainerRuntime.
357
355
  */
358
- export declare const makeLegacySendBatchFn: (submitFn: (type: MessageType, contents: any, batch: boolean, appData?: any) => number, deltaManager: Pick<IDeltaManager<unknown, unknown>, "flush">) => (batch: IBatch) => number;
356
+ export declare const makeLegacySendBatchFn: (submitFn: (type: MessageType, contents: unknown, batch: boolean, appData?: unknown) => number, deltaManager: Pick<IDeltaManager<unknown, unknown>, "flush">) => (batch: IBatch) => number;
359
357
  /**
360
358
  * There is some ancient back-compat code that we'd like to instrument
361
359
  * to understand if/when it is hit.
@@ -411,13 +409,9 @@ export declare function loadContainerRuntime(params: LoadContainerRuntimeParams)
411
409
  * Represents the runtime of the container. Contains helper functions/state of the container.
412
410
  * It will define the store level mappings.
413
411
  *
414
- * @deprecated To be removed from the Legacy-Alpha API in version 2.20.0.
415
- * Use the loadContainerRuntime function and interfaces IContainerRuntime / IRuntime instead.
416
- *
417
- * @legacy
418
- * @alpha
412
+ * @internal
419
413
  */
420
- export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents> implements IContainerRuntime, IRuntime, ISummarizerRuntime, ISummarizerInternalsProvider, IProvideFluidHandleContext {
414
+ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents> implements IContainerRuntime, IRuntime, ISummarizerRuntime, ISummarizerInternalsProvider, IProvideFluidHandleContext, IProvideLayerCompatDetails {
421
415
  private readonly registry;
422
416
  private readonly metadata;
423
417
  private readonly containerScope;
@@ -426,7 +420,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
426
420
  private readonly createIdCompressor;
427
421
  private readonly documentsSchemaController;
428
422
  private readonly requestHandler?;
429
- private readonly summaryConfiguration;
430
423
  /**
431
424
  * Load the stores from a snapshot and returns the runtime.
432
425
  * @param params - An object housing the runtime properties:
@@ -449,22 +442,19 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
449
442
  runtimeOptions?: IContainerRuntimeOptions;
450
443
  containerScope?: FluidObject;
451
444
  containerRuntimeCtor?: typeof ContainerRuntime;
452
- /** @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
445
+ /**
446
+ * @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
447
+ */
453
448
  requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
454
449
  provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;
455
450
  }): Promise<ContainerRuntime>;
456
- readonly options: Record<string | number, any>;
451
+ readonly options: Record<string | number, unknown>;
457
452
  private imminentClosure;
458
453
  private readonly _getClientId;
459
454
  get clientId(): string | undefined;
460
455
  readonly clientDetails: IClientDetails;
461
456
  get storage(): IDocumentStorageService;
462
- get containerRuntime(): this;
463
- private readonly submitFn;
464
- /**
465
- * Although current IContainerContext guarantees submitBatchFn, it is not available on older loaders.
466
- */
467
- private readonly submitBatchFn;
457
+ get containerRuntime(): ContainerRuntime;
468
458
  private readonly submitSummaryFn;
469
459
  /**
470
460
  * Do not call directly - use submitAddressesSignal
@@ -485,36 +475,27 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
485
475
  * has to deal with compressed ops as other clients might send them.
486
476
  * And in reverse, session schema can have compression Off, but feature gates / runtime options want it On.
487
477
  * In such case it will be off in session schema, however this client will propose change to schema, and once / if
488
- * this op rountrips, compression will be On. Client can't send compressed ops until it's change in schema.
478
+ * this op roundtrips, compression will be On. Client can't send compressed ops until it's change in schema.
489
479
  */
490
480
  get sessionSchema(): {
491
- explicitSchemaControl?: true | undefined;
492
- compressionLz4?: true | undefined;
493
- idCompressorMode?: IdCompressorMode;
494
- opGroupingEnabled?: true | undefined;
495
- disallowedVersions?: string[] | undefined;
481
+ [P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean ? true : IDocumentSchemaFeatures[P];
496
482
  };
497
483
  private _idCompressor;
498
484
  private pendingIdCompressorOps;
499
485
  private readonly skipSavedCompressorOps;
500
- get idCompressorMode(): IdCompressorMode;
501
486
  /**
502
- * See IContainerRuntimeBase.idCompressor() for details.
487
+ * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.idCompressor}
503
488
  */
504
489
  get idCompressor(): (IIdCompressor & IIdCompressorCore) | undefined;
505
490
  /**
506
491
  * True if we have ID compressor loading in-flight (async operation). Useful only for
507
- * this.idCompressorMode === "delayed" mode
492
+ * this.sessionSchema.idCompressorMode === "delayed" mode
508
493
  */
509
494
  protected _loadIdCompressor: Promise<void> | undefined;
510
495
  /**
511
- * See IContainerRuntimeBase.generateDocumentUniqueId() for details.
496
+ * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.generateDocumentUniqueId}
512
497
  */
513
- generateDocumentUniqueId(): string | (number & {
514
- readonly SessionUnique: "cea55054-6b82-4cbf-ad19-1fa645ea3b3e";
515
- } & {
516
- readonly OpNormalized: "9209432d-a959-4df7-b2ad-767ead4dbcae";
517
- });
498
+ generateDocumentUniqueId(): string | number;
518
499
  get IFluidHandleContext(): IFluidHandleContext;
519
500
  private readonly handleContext;
520
501
  /**
@@ -538,11 +519,8 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
538
519
  * do not create it (see SummarizerClientElection.clientDetailsPermitElection() for details)
539
520
  */
540
521
  private readonly summaryManager?;
541
- private readonly summaryCollection;
542
522
  private readonly summarizerNode;
543
- private readonly logger;
544
523
  private readonly maxConsecutiveReconnects;
545
- private readonly defaultMaxConsecutiveReconnects;
546
524
  private _orderSequentiallyCalls;
547
525
  private readonly _flushMode;
548
526
  private readonly offlineEnabled;
@@ -565,16 +543,16 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
565
543
  */
566
544
  ensureNoDataModelChanges<T>(callback: () => T): T;
567
545
  get connected(): boolean;
568
- /** clientId of parent (non-summarizing) container that owns summarizer container */
546
+ /**
547
+ * clientId of parent (non-summarizing) container that owns summarizer container
548
+ */
569
549
  get summarizerClientId(): string | undefined;
570
550
  private _disposed;
571
551
  get disposed(): boolean;
572
552
  private dirtyContainer;
573
553
  private emitDirtyDocumentEvent;
574
- private readonly disableAttachReorder;
575
554
  private readonly useDeltaManagerOpsProxy;
576
555
  private readonly closeSummarizerDelayMs;
577
- private readonly defaultTelemetrySignalSampleCount;
578
556
  private readonly _signalTracking;
579
557
  /**
580
558
  * Summarizer is responsible for coordinating when to send generate and send summaries.
@@ -582,7 +560,8 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
582
560
  * It is created only by summarizing container (i.e. one with clientType === "summarizer")
583
561
  */
584
562
  private readonly _summarizer?;
585
- private readonly scheduleManager;
563
+ private readonly deltaScheduler;
564
+ private readonly inboundBatchAggregator;
586
565
  private readonly blobManager;
587
566
  private readonly pendingStateManager;
588
567
  private readonly duplicateBatchDetector;
@@ -590,15 +569,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
590
569
  private readonly garbageCollector;
591
570
  private readonly channelCollection;
592
571
  private readonly remoteMessageProcessor;
593
- /** The last message processed at the time of the last summary. */
572
+ /**
573
+ * The last message processed at the time of the last summary.
574
+ */
594
575
  private messageAtLastSummary;
595
- private get summarizer();
596
576
  private readonly summariesDisabled;
597
- private isSummariesDisabled;
598
- private readonly maxOpsSinceLastSummary;
599
- private getMaxOpsSinceLastSummary;
600
- private readonly initialSummarizerDelayMs;
601
- private getInitialSummarizerDelayMs;
602
577
  private readonly createContainerMetadata;
603
578
  /**
604
579
  * The summary number of the next summary that will be generated for this container. This is incremented every time
@@ -620,10 +595,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
620
595
  * ! Note: should not be used for anything other than telemetry and is not considered a stable GUID
621
596
  */
622
597
  private readonly telemetryDocumentId;
623
- /**
624
- * Whether this client is the summarizer client itself (type is summarizerClientType)
625
- */
626
- private readonly isSummarizerClient;
627
598
  /**
628
599
  * The id of the version used to initially load this runtime, or undefined if it's newly created.
629
600
  */
@@ -638,14 +609,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
638
609
  * Starting with 1 min and based on recorded usage we can tweak it later on.
639
610
  */
640
611
  private readonly snapshotCacheForLoadingGroupIds;
641
- /**
642
- * The options to apply to this ContainerRuntime instance (including internal options hidden from the public API)
643
- */
644
- private readonly runtimeOptions;
612
+ get ILayerCompatDetails(): ILayerCompatDetails;
645
613
  /***/
646
- protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], runtimeOptions: Readonly<Required<Omit<IContainerRuntimeOptions, "flushMode" | "enableGroupedBatching">> & IContainerRuntimeOptions>, containerScope: FluidObject, baseLogger: ITelemetryBaseLogger, existing: boolean, blobManagerSnapshot: IBlobManagerLoadInfo, _storage: IDocumentStorageService, createIdCompressor: () => Promise<IIdCompressor & IIdCompressorCore>, documentsSchemaController: DocumentsSchemaController, featureGatesForTelemetry: Record<string, boolean | number | undefined>, provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>, requestHandler?: ((request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>) | undefined, summaryConfiguration?: ISummaryConfiguration, recentBatchInfo?: [number, string][]);
614
+ protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], baseRuntimeOptions: Readonly<Required<IContainerRuntimeOptions>>, containerScope: FluidObject, baseLogger: ITelemetryBaseLogger, existing: boolean, blobManagerSnapshot: IBlobManagerLoadInfo, _storage: IDocumentStorageService, createIdCompressor: () => Promise<IIdCompressor & IIdCompressorCore>, documentsSchemaController: DocumentsSchemaController, featureGatesForTelemetry: Record<string, boolean | number | undefined>, provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>, requestHandler?: ((request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>) | undefined, summaryConfiguration?: ISummaryConfiguration, recentBatchInfo?: [number, string][]);
647
615
  onSchemaChange(schema: IDocumentSchemaCurrent): void;
648
- getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>) => import("@fluidframework/runtime-definitions/internal").ISummarizerNodeWithGC;
616
+ getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>) => ISummarizerNodeWithGC;
649
617
  deleteChildSummarizerNode(id: string): void;
650
618
  makeLocallyVisible(): void;
651
619
  setChannelDirty(address: string): void;
@@ -690,7 +658,9 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
690
658
  getEntryPoint(): Promise<FluidObject>;
691
659
  private readonly entryPoint;
692
660
  private internalId;
693
- /** Adds the container's metadata to the given summary tree. */
661
+ /**
662
+ * Adds the container's metadata to the given summary tree.
663
+ */
694
664
  private addMetadataToSummary;
695
665
  protected addContainerStateToSummary(summaryTree: ISummaryTreeWithStats, fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): void;
696
666
  private shouldContinueReconnecting;
@@ -714,7 +684,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
714
684
  process({ ...messageCopy }: ISequencedDocumentMessage, local: boolean): void;
715
685
  private _processedClientSequenceNumber;
716
686
  /**
717
- * Processes inbound message(s). It calls schedule manager according to the messages' location in the batch.
687
+ * Processes inbound message(s). It calls delta scheduler according to the messages' location in the batch.
718
688
  * @param messagesWithMetadata - messages to process along with their metadata.
719
689
  * @param locationInBatch - Are we processing the start and/or end of a batch?
720
690
  * @param local - true if the messages were originally generated by the client receiving it.
@@ -770,10 +740,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
770
740
  getAliasedDataStoreEntryPoint(alias: string): Promise<IFluidHandle<FluidObject> | undefined>;
771
741
  createDetachedDataStore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;
772
742
  createDataStore(pkg: Readonly<string | string[]>, loadingGroupId?: string): Promise<IDataStore>;
773
- /**
774
- * @deprecated 0.16 Issue #1537, #3631
775
- */
776
- _createDataStoreWithProps(pkg: Readonly<string | string[]>, props?: any): Promise<IDataStore>;
777
743
  private canSendOps;
778
744
  /**
779
745
  * Typically ops are batched and later flushed together, but in some cases we want to flush immediately.
@@ -815,22 +781,40 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
815
781
  */
816
782
  createSummary(blobRedirectTable?: Map<string, string>, telemetryContext?: ITelemetryContext): ISummaryTree;
817
783
  readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
784
+ /**
785
+ * Builds the Summary tree including all the channels and the container state.
786
+ *
787
+ * @remarks - Unfortunately, this function is accessed in a non-typesafe way by a legacy first-party partner,
788
+ * so until we can provide a proper API for their scenario, we need to ensure this function doesn't change.
789
+ */
818
790
  private summarizeInternal;
819
791
  /**
820
792
  * Returns a summary of the runtime at the current sequence number.
821
793
  */
822
794
  summarize(options: {
823
- /** True to generate the full tree with no handle reuse optimizations; defaults to false */
795
+ /**
796
+ * True to generate the full tree with no handle reuse optimizations; defaults to false
797
+ */
824
798
  fullTree?: boolean;
825
- /** True to track the state for this summary in the SummarizerNodes; defaults to true */
799
+ /**
800
+ * True to track the state for this summary in the SummarizerNodes; defaults to true
801
+ */
826
802
  trackState?: boolean;
827
- /** Logger to use for correlated summary events */
803
+ /**
804
+ * Logger to use for correlated summary events
805
+ */
828
806
  summaryLogger?: ITelemetryLoggerExt;
829
- /** True to run garbage collection before summarizing; defaults to true */
807
+ /**
808
+ * True to run garbage collection before summarizing; defaults to true
809
+ */
830
810
  runGC?: boolean;
831
- /** True to generate full GC data */
811
+ /**
812
+ * True to generate full GC data
813
+ */
832
814
  fullGC?: boolean;
833
- /** True to run GC sweep phase after the mark phase */
815
+ /**
816
+ * True to run GC sweep phase after the mark phase
817
+ */
834
818
  runSweep?: boolean;
835
819
  }): Promise<ISummaryTreeWithStats>;
836
820
  private getGCDataInternal;
@@ -887,11 +871,17 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
887
871
  * @returns the statistics of the garbage collection run; undefined if GC did not run.
888
872
  */
889
873
  collectGarbage(options: {
890
- /** Logger to use for logging GC events */
874
+ /**
875
+ * Logger to use for logging GC events
876
+ */
891
877
  logger?: ITelemetryLoggerExt;
892
- /** True to run GC sweep phase after the mark phase */
878
+ /**
879
+ * True to run GC sweep phase after the mark phase
880
+ */
893
881
  runSweep?: boolean;
894
- /** True to generate full GC data */
882
+ /**
883
+ * True to generate full GC data
884
+ */
895
885
  fullGC?: boolean;
896
886
  }, telemetryContext?: ITelemetryContext): Promise<IGCStats | undefined>;
897
887
  /**
@@ -953,8 +943,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
953
943
  */
954
944
  private reSubmitCore;
955
945
  private rollback;
956
- /** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
946
+ /**
947
+ * Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck
948
+ */
957
949
  refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;
950
+ private readonly readAndParseBlob;
958
951
  /**
959
952
  * Fetches the latest snapshot from storage. If the fetched snapshot is same or newer than the one for which ack
960
953
  * was received, close this client. Fetching the snapshot will update the cache for this client so if it's