@fluidframework/container-runtime 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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 (703) hide show
  1. package/.eslintrc.js +19 -29
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +427 -0
  4. package/README.md +69 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/container-runtime.api.md +863 -0
  8. package/dist/{batchTracker.js → batchTracker.cjs} +9 -8
  9. package/dist/batchTracker.cjs.map +1 -0
  10. package/dist/batchTracker.d.ts +6 -6
  11. package/dist/batchTracker.d.ts.map +1 -1
  12. package/dist/blobManager.cjs +704 -0
  13. package/dist/blobManager.cjs.map +1 -0
  14. package/dist/blobManager.d.ts +135 -39
  15. package/dist/blobManager.d.ts.map +1 -1
  16. package/dist/connectionTelemetry.cjs +230 -0
  17. package/dist/connectionTelemetry.cjs.map +1 -0
  18. package/dist/connectionTelemetry.d.ts +2 -2
  19. package/dist/connectionTelemetry.d.ts.map +1 -1
  20. package/dist/container-runtime-alpha.d.ts +1677 -0
  21. package/dist/container-runtime-beta.d.ts +250 -0
  22. package/dist/container-runtime-public.d.ts +250 -0
  23. package/dist/container-runtime-untrimmed.d.ts +1792 -0
  24. package/dist/{containerHandleContext.js → containerHandleContext.cjs} +4 -2
  25. package/dist/containerHandleContext.cjs.map +1 -0
  26. package/dist/containerHandleContext.d.ts.map +1 -1
  27. package/dist/containerRuntime.cjs +2531 -0
  28. package/dist/containerRuntime.cjs.map +1 -0
  29. package/dist/containerRuntime.d.ts +454 -257
  30. package/dist/containerRuntime.d.ts.map +1 -1
  31. package/dist/{dataStore.js → dataStore.cjs} +54 -45
  32. package/dist/dataStore.cjs.map +1 -0
  33. package/dist/dataStore.d.ts +2 -2
  34. package/dist/dataStore.d.ts.map +1 -1
  35. package/dist/{dataStoreContext.js → dataStoreContext.cjs} +343 -247
  36. package/dist/dataStoreContext.cjs.map +1 -0
  37. package/dist/dataStoreContext.d.ts +73 -41
  38. package/dist/dataStoreContext.d.ts.map +1 -1
  39. package/dist/{dataStoreContexts.js → dataStoreContexts.cjs} +19 -15
  40. package/dist/dataStoreContexts.cjs.map +1 -0
  41. package/dist/dataStoreContexts.d.ts +1 -1
  42. package/dist/dataStoreContexts.d.ts.map +1 -1
  43. package/dist/{dataStoreRegistry.js → dataStoreRegistry.cjs} +9 -4
  44. package/dist/dataStoreRegistry.cjs.map +1 -0
  45. package/dist/dataStoreRegistry.d.ts +3 -0
  46. package/dist/dataStoreRegistry.d.ts.map +1 -1
  47. package/dist/{dataStores.js → dataStores.cjs} +273 -124
  48. package/dist/dataStores.cjs.map +1 -0
  49. package/dist/dataStores.d.ts +53 -23
  50. package/dist/dataStores.d.ts.map +1 -1
  51. package/dist/deltaManagerProxyBase.cjs +77 -0
  52. package/dist/deltaManagerProxyBase.cjs.map +1 -0
  53. package/dist/deltaManagerProxyBase.d.ts +35 -0
  54. package/dist/deltaManagerProxyBase.d.ts.map +1 -0
  55. package/dist/deltaManagerSummarizerProxy.cjs +42 -0
  56. package/dist/deltaManagerSummarizerProxy.cjs.map +1 -0
  57. package/dist/deltaManagerSummarizerProxy.d.ts +19 -0
  58. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -0
  59. package/dist/{deltaScheduler.js → deltaScheduler.cjs} +25 -18
  60. package/dist/deltaScheduler.cjs.map +1 -0
  61. package/dist/deltaScheduler.d.ts +8 -6
  62. package/dist/deltaScheduler.d.ts.map +1 -1
  63. package/dist/error.cjs +21 -0
  64. package/dist/error.cjs.map +1 -0
  65. package/dist/error.d.ts +14 -0
  66. package/dist/error.d.ts.map +1 -0
  67. package/dist/gc/garbageCollection.cjs +861 -0
  68. package/dist/gc/garbageCollection.cjs.map +1 -0
  69. package/dist/gc/garbageCollection.d.ts +224 -0
  70. package/dist/gc/garbageCollection.d.ts.map +1 -0
  71. package/dist/gc/gcConfigs.cjs +153 -0
  72. package/dist/gc/gcConfigs.cjs.map +1 -0
  73. package/dist/gc/gcConfigs.d.ts +23 -0
  74. package/dist/gc/gcConfigs.d.ts.map +1 -0
  75. package/dist/gc/gcDefinitions.cjs +96 -0
  76. package/dist/gc/gcDefinitions.cjs.map +1 -0
  77. package/dist/gc/gcDefinitions.d.ts +437 -0
  78. package/dist/gc/gcDefinitions.d.ts.map +1 -0
  79. package/dist/gc/gcHelpers.cjs +235 -0
  80. package/dist/gc/gcHelpers.cjs.map +1 -0
  81. package/dist/gc/gcHelpers.d.ts +71 -0
  82. package/dist/gc/gcHelpers.d.ts.map +1 -0
  83. package/dist/gc/gcReferenceGraphAlgorithm.cjs +49 -0
  84. package/dist/gc/gcReferenceGraphAlgorithm.cjs.map +1 -0
  85. package/dist/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
  86. package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  87. package/dist/{summarizerTypes.js → gc/gcSummaryDefinitions.cjs} +1 -6
  88. package/dist/gc/gcSummaryDefinitions.cjs.map +1 -0
  89. package/dist/gc/gcSummaryDefinitions.d.ts +52 -0
  90. package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -0
  91. package/dist/gc/gcSummaryStateTracker.cjs +213 -0
  92. package/dist/gc/gcSummaryStateTracker.cjs.map +1 -0
  93. package/dist/gc/gcSummaryStateTracker.d.ts +94 -0
  94. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
  95. package/dist/gc/gcTelemetry.cjs +298 -0
  96. package/dist/gc/gcTelemetry.cjs.map +1 -0
  97. package/dist/gc/gcTelemetry.d.ts +92 -0
  98. package/dist/gc/gcTelemetry.d.ts.map +1 -0
  99. package/dist/gc/gcUnreferencedStateTracker.cjs +118 -0
  100. package/dist/gc/gcUnreferencedStateTracker.cjs.map +1 -0
  101. package/dist/gc/gcUnreferencedStateTracker.d.ts +40 -0
  102. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  103. package/dist/gc/index.cjs +44 -0
  104. package/dist/gc/index.cjs.map +1 -0
  105. package/dist/gc/index.d.ts +13 -0
  106. package/dist/gc/index.d.ts.map +1 -0
  107. package/dist/index.cjs +47 -0
  108. package/dist/index.cjs.map +1 -0
  109. package/dist/index.d.ts +19 -8
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/messageTypes.cjs +37 -0
  112. package/dist/messageTypes.cjs.map +1 -0
  113. package/dist/messageTypes.d.ts +142 -0
  114. package/dist/messageTypes.d.ts.map +1 -0
  115. package/dist/metadata.cjs +7 -0
  116. package/dist/metadata.cjs.map +1 -0
  117. package/dist/metadata.d.ts +24 -0
  118. package/dist/metadata.d.ts.map +1 -0
  119. package/dist/opLifecycle/batchManager.cjs +139 -0
  120. package/dist/opLifecycle/batchManager.cjs.map +1 -0
  121. package/dist/opLifecycle/batchManager.d.ts +48 -0
  122. package/dist/opLifecycle/batchManager.d.ts.map +1 -0
  123. package/dist/opLifecycle/definitions.cjs +7 -0
  124. package/dist/opLifecycle/definitions.cjs.map +1 -0
  125. package/dist/opLifecycle/definitions.d.ts +83 -0
  126. package/dist/opLifecycle/definitions.d.ts.map +1 -0
  127. package/dist/opLifecycle/index.cjs +26 -0
  128. package/dist/opLifecycle/index.cjs.map +1 -0
  129. package/dist/opLifecycle/index.d.ts +13 -0
  130. package/dist/opLifecycle/index.d.ts.map +1 -0
  131. package/dist/opLifecycle/opCompressor.cjs +84 -0
  132. package/dist/opLifecycle/opCompressor.cjs.map +1 -0
  133. package/dist/opLifecycle/opCompressor.d.ts +18 -0
  134. package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
  135. package/dist/opLifecycle/opDecompressor.cjs +132 -0
  136. package/dist/opLifecycle/opDecompressor.cjs.map +1 -0
  137. package/dist/opLifecycle/opDecompressor.d.ts +25 -0
  138. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
  139. package/dist/opLifecycle/opGroupingManager.cjs +95 -0
  140. package/dist/opLifecycle/opGroupingManager.cjs.map +1 -0
  141. package/dist/opLifecycle/opGroupingManager.d.ts +22 -0
  142. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -0
  143. package/dist/opLifecycle/opSplitter.cjs +202 -0
  144. package/dist/opLifecycle/opSplitter.cjs.map +1 -0
  145. package/dist/opLifecycle/opSplitter.d.ts +61 -0
  146. package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
  147. package/dist/opLifecycle/outbox.cjs +323 -0
  148. package/dist/opLifecycle/outbox.cjs.map +1 -0
  149. package/dist/opLifecycle/outbox.d.ts +104 -0
  150. package/dist/opLifecycle/outbox.d.ts.map +1 -0
  151. package/dist/opLifecycle/remoteMessageProcessor.cjs +136 -0
  152. package/dist/opLifecycle/remoteMessageProcessor.cjs.map +1 -0
  153. package/dist/opLifecycle/remoteMessageProcessor.d.ts +47 -0
  154. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  155. package/dist/opProperties.cjs +17 -0
  156. package/dist/opProperties.cjs.map +1 -0
  157. package/dist/opProperties.d.ts +7 -0
  158. package/dist/opProperties.d.ts.map +1 -0
  159. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  160. package/dist/packageVersion.cjs.map +1 -0
  161. package/dist/packageVersion.d.ts +1 -1
  162. package/dist/packageVersion.d.ts.map +1 -1
  163. package/dist/pendingStateManager.cjs +282 -0
  164. package/dist/pendingStateManager.cjs.map +1 -0
  165. package/dist/pendingStateManager.d.ts +32 -69
  166. package/dist/pendingStateManager.d.ts.map +1 -1
  167. package/dist/scheduleManager.cjs +258 -0
  168. package/dist/scheduleManager.cjs.map +1 -0
  169. package/dist/scheduleManager.d.ts +31 -0
  170. package/dist/scheduleManager.d.ts.map +1 -0
  171. package/dist/storageServiceWithAttachBlobs.cjs +32 -0
  172. package/dist/storageServiceWithAttachBlobs.cjs.map +1 -0
  173. package/dist/storageServiceWithAttachBlobs.d.ts +17 -0
  174. package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -0
  175. package/dist/summary/index.cjs +51 -0
  176. package/dist/summary/index.cjs.map +1 -0
  177. package/dist/summary/index.d.ts +17 -0
  178. package/dist/summary/index.d.ts.map +1 -0
  179. package/dist/{orderedClientElection.js → summary/orderedClientElection.cjs} +100 -84
  180. package/dist/summary/orderedClientElection.cjs.map +1 -0
  181. package/{lib → dist/summary}/orderedClientElection.d.ts +41 -18
  182. package/dist/summary/orderedClientElection.d.ts.map +1 -0
  183. package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.cjs} +12 -10
  184. package/dist/summary/runWhileConnectedCoordinator.cjs.map +1 -0
  185. package/{lib → dist/summary}/runWhileConnectedCoordinator.d.ts +8 -2
  186. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  187. package/dist/summary/runningSummarizer.cjs +679 -0
  188. package/dist/summary/runningSummarizer.cjs.map +1 -0
  189. package/dist/summary/runningSummarizer.d.ts +128 -0
  190. package/dist/summary/runningSummarizer.d.ts.map +1 -0
  191. package/dist/summary/summarizer.cjs +263 -0
  192. package/dist/summary/summarizer.cjs.map +1 -0
  193. package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +18 -34
  194. package/dist/summary/summarizer.d.ts.map +1 -0
  195. package/dist/{summarizerClientElection.js → summary/summarizerClientElection.cjs} +15 -46
  196. package/dist/summary/summarizerClientElection.cjs.map +1 -0
  197. package/{lib → dist/summary}/summarizerClientElection.d.ts +4 -4
  198. package/dist/summary/summarizerClientElection.d.ts.map +1 -0
  199. package/dist/summary/summarizerHeuristics.cjs +156 -0
  200. package/dist/summary/summarizerHeuristics.cjs.map +1 -0
  201. package/{lib → dist/summary}/summarizerHeuristics.d.ts +28 -6
  202. package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
  203. package/dist/summary/summarizerNode/index.cjs +12 -0
  204. package/dist/summary/summarizerNode/index.cjs.map +1 -0
  205. package/dist/summary/summarizerNode/index.d.ts +8 -0
  206. package/dist/summary/summarizerNode/index.d.ts.map +1 -0
  207. package/dist/summary/summarizerNode/summarizerNode.cjs +526 -0
  208. package/dist/summary/summarizerNode/summarizerNode.cjs.map +1 -0
  209. package/dist/summary/summarizerNode/summarizerNode.d.ts +167 -0
  210. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  211. package/dist/summary/summarizerNode/summarizerNodeUtils.cjs +130 -0
  212. package/dist/summary/summarizerNode/summarizerNodeUtils.cjs.map +1 -0
  213. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +121 -0
  214. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  215. package/dist/summary/summarizerNode/summarizerNodeWithGc.cjs +375 -0
  216. package/dist/summary/summarizerNode/summarizerNodeWithGc.cjs.map +1 -0
  217. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +153 -0
  218. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  219. package/dist/summary/summarizerTypes.cjs +7 -0
  220. package/dist/summary/summarizerTypes.cjs.map +1 -0
  221. package/{lib → dist/summary}/summarizerTypes.d.ts +233 -83
  222. package/dist/summary/summarizerTypes.d.ts.map +1 -0
  223. package/dist/{summaryCollection.js → summary/summaryCollection.cjs} +80 -49
  224. package/dist/summary/summaryCollection.cjs.map +1 -0
  225. package/dist/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +23 -5
  226. package/dist/summary/summaryCollection.d.ts.map +1 -0
  227. package/dist/{summaryFormat.js → summary/summaryFormat.cjs} +29 -26
  228. package/dist/summary/summaryFormat.cjs.map +1 -0
  229. package/{lib → dist/summary}/summaryFormat.d.ts +25 -30
  230. package/dist/summary/summaryFormat.d.ts.map +1 -0
  231. package/dist/{summaryGenerator.js → summary/summaryGenerator.cjs} +162 -74
  232. package/dist/summary/summaryGenerator.cjs.map +1 -0
  233. package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +53 -11
  234. package/dist/summary/summaryGenerator.d.ts.map +1 -0
  235. package/dist/{summaryManager.js → summary/summaryManager.cjs} +98 -55
  236. package/dist/summary/summaryManager.cjs.map +1 -0
  237. package/{lib → dist/summary}/summaryManager.d.ts +13 -11
  238. package/dist/summary/summaryManager.d.ts.map +1 -0
  239. package/dist/{throttler.js → throttler.cjs} +21 -21
  240. package/dist/throttler.cjs.map +1 -0
  241. package/dist/throttler.d.ts +2 -2
  242. package/dist/throttler.d.ts.map +1 -1
  243. package/dist/tsdoc-metadata.json +11 -0
  244. package/lib/{batchTracker.d.ts → batchTracker.d.mts} +6 -6
  245. package/lib/batchTracker.d.mts.map +1 -0
  246. package/lib/{batchTracker.js → batchTracker.mjs} +9 -8
  247. package/lib/batchTracker.mjs.map +1 -0
  248. package/lib/blobManager.d.mts +191 -0
  249. package/lib/blobManager.d.mts.map +1 -0
  250. package/lib/blobManager.mjs +699 -0
  251. package/lib/blobManager.mjs.map +1 -0
  252. package/lib/{connectionTelemetry.d.ts → connectionTelemetry.d.mts} +2 -2
  253. package/lib/connectionTelemetry.d.mts.map +1 -0
  254. package/lib/connectionTelemetry.mjs +226 -0
  255. package/lib/connectionTelemetry.mjs.map +1 -0
  256. package/lib/container-runtime-alpha.d.mts +1677 -0
  257. package/lib/container-runtime-beta.d.mts +250 -0
  258. package/lib/container-runtime-public.d.mts +250 -0
  259. package/lib/container-runtime-untrimmed.d.mts +1792 -0
  260. package/lib/{containerHandleContext.d.ts → containerHandleContext.d.mts} +1 -1
  261. package/lib/containerHandleContext.d.mts.map +1 -0
  262. package/lib/{containerHandleContext.js → containerHandleContext.mjs} +4 -2
  263. package/lib/containerHandleContext.mjs.map +1 -0
  264. package/lib/containerRuntime.d.mts +809 -0
  265. package/lib/containerRuntime.d.mts.map +1 -0
  266. package/lib/containerRuntime.mjs +2526 -0
  267. package/lib/containerRuntime.mjs.map +1 -0
  268. package/lib/{dataStore.d.ts → dataStore.d.mts} +4 -4
  269. package/lib/dataStore.d.mts.map +1 -0
  270. package/lib/{dataStore.js → dataStore.mjs} +52 -43
  271. package/lib/dataStore.mjs.map +1 -0
  272. package/lib/{dataStoreContext.d.ts → dataStoreContext.d.mts} +74 -42
  273. package/lib/dataStoreContext.d.mts.map +1 -0
  274. package/lib/{dataStoreContext.js → dataStoreContext.mjs} +309 -213
  275. package/lib/dataStoreContext.mjs.map +1 -0
  276. package/lib/{dataStoreContexts.d.ts → dataStoreContexts.d.mts} +2 -2
  277. package/lib/dataStoreContexts.d.mts.map +1 -0
  278. package/lib/{dataStoreContexts.js → dataStoreContexts.mjs} +12 -8
  279. package/lib/dataStoreContexts.mjs.map +1 -0
  280. package/lib/{dataStoreRegistry.d.ts → dataStoreRegistry.d.mts} +3 -0
  281. package/lib/dataStoreRegistry.d.mts.map +1 -0
  282. package/lib/{dataStoreRegistry.js → dataStoreRegistry.mjs} +7 -6
  283. package/lib/dataStoreRegistry.mjs.map +1 -0
  284. package/lib/{dataStores.d.ts → dataStores.d.mts} +56 -26
  285. package/lib/dataStores.d.mts.map +1 -0
  286. package/lib/{dataStores.js → dataStores.mjs} +254 -105
  287. package/lib/dataStores.mjs.map +1 -0
  288. package/lib/deltaManagerProxyBase.d.mts +35 -0
  289. package/lib/deltaManagerProxyBase.d.mts.map +1 -0
  290. package/lib/deltaManagerProxyBase.mjs +73 -0
  291. package/lib/deltaManagerProxyBase.mjs.map +1 -0
  292. package/lib/deltaManagerSummarizerProxy.d.mts +19 -0
  293. package/lib/deltaManagerSummarizerProxy.d.mts.map +1 -0
  294. package/lib/deltaManagerSummarizerProxy.mjs +38 -0
  295. package/lib/deltaManagerSummarizerProxy.mjs.map +1 -0
  296. package/lib/{deltaScheduler.d.ts → deltaScheduler.d.mts} +8 -6
  297. package/lib/deltaScheduler.d.mts.map +1 -0
  298. package/lib/{deltaScheduler.js → deltaScheduler.mjs} +22 -15
  299. package/lib/deltaScheduler.mjs.map +1 -0
  300. package/lib/error.d.mts +14 -0
  301. package/lib/error.d.mts.map +1 -0
  302. package/lib/error.mjs +17 -0
  303. package/lib/error.mjs.map +1 -0
  304. package/lib/gc/garbageCollection.d.mts +224 -0
  305. package/lib/gc/garbageCollection.d.mts.map +1 -0
  306. package/lib/gc/garbageCollection.mjs +857 -0
  307. package/lib/gc/garbageCollection.mjs.map +1 -0
  308. package/lib/gc/gcConfigs.d.mts +23 -0
  309. package/lib/gc/gcConfigs.d.mts.map +1 -0
  310. package/lib/gc/gcConfigs.mjs +149 -0
  311. package/lib/gc/gcConfigs.mjs.map +1 -0
  312. package/lib/gc/gcDefinitions.d.mts +437 -0
  313. package/lib/gc/gcDefinitions.d.mts.map +1 -0
  314. package/lib/gc/gcDefinitions.mjs +93 -0
  315. package/lib/gc/gcDefinitions.mjs.map +1 -0
  316. package/lib/gc/gcHelpers.d.mts +71 -0
  317. package/lib/gc/gcHelpers.d.mts.map +1 -0
  318. package/lib/gc/gcHelpers.mjs +222 -0
  319. package/lib/gc/gcHelpers.mjs.map +1 -0
  320. package/lib/gc/gcReferenceGraphAlgorithm.d.mts +16 -0
  321. package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +1 -0
  322. package/lib/gc/gcReferenceGraphAlgorithm.mjs +45 -0
  323. package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +1 -0
  324. package/lib/gc/gcSummaryDefinitions.d.mts +52 -0
  325. package/lib/gc/gcSummaryDefinitions.d.mts.map +1 -0
  326. package/lib/gc/gcSummaryDefinitions.mjs +6 -0
  327. package/lib/gc/gcSummaryDefinitions.mjs.map +1 -0
  328. package/lib/gc/gcSummaryStateTracker.d.mts +94 -0
  329. package/lib/gc/gcSummaryStateTracker.d.mts.map +1 -0
  330. package/lib/gc/gcSummaryStateTracker.mjs +209 -0
  331. package/lib/gc/gcSummaryStateTracker.mjs.map +1 -0
  332. package/lib/gc/gcTelemetry.d.mts +92 -0
  333. package/lib/gc/gcTelemetry.d.mts.map +1 -0
  334. package/lib/gc/gcTelemetry.mjs +293 -0
  335. package/lib/gc/gcTelemetry.mjs.map +1 -0
  336. package/lib/gc/gcUnreferencedStateTracker.d.mts +40 -0
  337. package/lib/gc/gcUnreferencedStateTracker.d.mts.map +1 -0
  338. package/lib/gc/gcUnreferencedStateTracker.mjs +114 -0
  339. package/lib/gc/gcUnreferencedStateTracker.mjs.map +1 -0
  340. package/lib/gc/index.d.mts +13 -0
  341. package/lib/gc/index.d.mts.map +1 -0
  342. package/lib/gc/index.mjs +12 -0
  343. package/lib/gc/index.mjs.map +1 -0
  344. package/lib/index.d.mts +25 -0
  345. package/lib/index.d.mts.map +1 -0
  346. package/lib/index.mjs +24 -0
  347. package/lib/index.mjs.map +1 -0
  348. package/lib/messageTypes.d.mts +142 -0
  349. package/lib/messageTypes.d.mts.map +1 -0
  350. package/lib/messageTypes.mjs +34 -0
  351. package/lib/messageTypes.mjs.map +1 -0
  352. package/lib/metadata.d.mts +24 -0
  353. package/lib/metadata.d.mts.map +1 -0
  354. package/lib/metadata.mjs +6 -0
  355. package/lib/metadata.mjs.map +1 -0
  356. package/lib/opLifecycle/batchManager.d.mts +48 -0
  357. package/lib/opLifecycle/batchManager.d.mts.map +1 -0
  358. package/lib/opLifecycle/batchManager.mjs +133 -0
  359. package/lib/opLifecycle/batchManager.mjs.map +1 -0
  360. package/lib/opLifecycle/definitions.d.mts +83 -0
  361. package/lib/opLifecycle/definitions.d.mts.map +1 -0
  362. package/lib/opLifecycle/definitions.mjs +6 -0
  363. package/lib/opLifecycle/definitions.mjs.map +1 -0
  364. package/lib/opLifecycle/index.d.mts +13 -0
  365. package/lib/opLifecycle/index.d.mts.map +1 -0
  366. package/lib/opLifecycle/index.mjs +12 -0
  367. package/lib/opLifecycle/index.mjs.map +1 -0
  368. package/lib/opLifecycle/opCompressor.d.mts +18 -0
  369. package/lib/opLifecycle/opCompressor.d.mts.map +1 -0
  370. package/lib/opLifecycle/opCompressor.mjs +80 -0
  371. package/lib/opLifecycle/opCompressor.mjs.map +1 -0
  372. package/lib/opLifecycle/opDecompressor.d.mts +25 -0
  373. package/lib/opLifecycle/opDecompressor.d.mts.map +1 -0
  374. package/lib/opLifecycle/opDecompressor.mjs +128 -0
  375. package/lib/opLifecycle/opDecompressor.mjs.map +1 -0
  376. package/lib/opLifecycle/opGroupingManager.d.mts +22 -0
  377. package/lib/opLifecycle/opGroupingManager.d.mts.map +1 -0
  378. package/lib/opLifecycle/opGroupingManager.mjs +91 -0
  379. package/lib/opLifecycle/opGroupingManager.mjs.map +1 -0
  380. package/lib/opLifecycle/opSplitter.d.mts +61 -0
  381. package/lib/opLifecycle/opSplitter.d.mts.map +1 -0
  382. package/lib/opLifecycle/opSplitter.mjs +197 -0
  383. package/lib/opLifecycle/opSplitter.mjs.map +1 -0
  384. package/lib/opLifecycle/outbox.d.mts +104 -0
  385. package/lib/opLifecycle/outbox.d.mts.map +1 -0
  386. package/lib/opLifecycle/outbox.mjs +318 -0
  387. package/lib/opLifecycle/outbox.mjs.map +1 -0
  388. package/lib/opLifecycle/remoteMessageProcessor.d.mts +47 -0
  389. package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +1 -0
  390. package/lib/opLifecycle/remoteMessageProcessor.mjs +131 -0
  391. package/lib/opLifecycle/remoteMessageProcessor.mjs.map +1 -0
  392. package/lib/opProperties.d.mts +7 -0
  393. package/lib/opProperties.d.mts.map +1 -0
  394. package/lib/opProperties.mjs +13 -0
  395. package/lib/opProperties.mjs.map +1 -0
  396. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  397. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  398. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  399. package/lib/packageVersion.mjs.map +1 -0
  400. package/lib/{pendingStateManager.d.ts → pendingStateManager.d.mts} +32 -69
  401. package/lib/pendingStateManager.d.mts.map +1 -0
  402. package/lib/pendingStateManager.mjs +275 -0
  403. package/lib/pendingStateManager.mjs.map +1 -0
  404. package/lib/scheduleManager.d.mts +27 -0
  405. package/lib/scheduleManager.d.mts.map +1 -0
  406. package/lib/scheduleManager.mjs +254 -0
  407. package/lib/scheduleManager.mjs.map +1 -0
  408. package/lib/storageServiceWithAttachBlobs.d.mts +17 -0
  409. package/lib/storageServiceWithAttachBlobs.d.mts.map +1 -0
  410. package/lib/storageServiceWithAttachBlobs.mjs +28 -0
  411. package/lib/storageServiceWithAttachBlobs.mjs.map +1 -0
  412. package/lib/summary/index.d.mts +17 -0
  413. package/lib/summary/index.d.mts.map +1 -0
  414. package/lib/summary/index.mjs +16 -0
  415. package/lib/summary/index.mjs.map +1 -0
  416. package/{dist/orderedClientElection.d.ts → lib/summary/orderedClientElection.d.mts} +41 -22
  417. package/lib/summary/orderedClientElection.d.mts.map +1 -0
  418. package/lib/{orderedClientElection.js → summary/orderedClientElection.mjs} +95 -79
  419. package/lib/summary/orderedClientElection.mjs.map +1 -0
  420. package/{dist/runWhileConnectedCoordinator.d.ts → lib/summary/runWhileConnectedCoordinator.d.mts} +9 -3
  421. package/lib/summary/runWhileConnectedCoordinator.d.mts.map +1 -0
  422. package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.mjs} +12 -10
  423. package/lib/summary/runWhileConnectedCoordinator.mjs.map +1 -0
  424. package/lib/summary/runningSummarizer.d.mts +128 -0
  425. package/lib/summary/runningSummarizer.d.mts.map +1 -0
  426. package/lib/summary/runningSummarizer.mjs +675 -0
  427. package/lib/summary/runningSummarizer.mjs.map +1 -0
  428. package/lib/{summarizer.d.ts → summary/summarizer.d.mts} +20 -36
  429. package/lib/summary/summarizer.d.mts.map +1 -0
  430. package/lib/summary/summarizer.mjs +257 -0
  431. package/lib/summary/summarizer.mjs.map +1 -0
  432. package/{dist/summarizerClientElection.d.ts → lib/summary/summarizerClientElection.d.mts} +6 -6
  433. package/lib/summary/summarizerClientElection.d.mts.map +1 -0
  434. package/lib/{summarizerClientElection.js → summary/summarizerClientElection.mjs} +14 -45
  435. package/lib/summary/summarizerClientElection.mjs.map +1 -0
  436. package/{dist/summarizerHeuristics.d.ts → lib/summary/summarizerHeuristics.d.mts} +29 -7
  437. package/lib/summary/summarizerHeuristics.d.mts.map +1 -0
  438. package/lib/summary/summarizerHeuristics.mjs +151 -0
  439. package/lib/summary/summarizerHeuristics.mjs.map +1 -0
  440. package/lib/summary/summarizerNode/index.d.mts +8 -0
  441. package/lib/summary/summarizerNode/index.d.mts.map +1 -0
  442. package/lib/summary/summarizerNode/index.mjs +7 -0
  443. package/lib/summary/summarizerNode/index.mjs.map +1 -0
  444. package/lib/summary/summarizerNode/summarizerNode.d.mts +167 -0
  445. package/lib/summary/summarizerNode/summarizerNode.d.mts.map +1 -0
  446. package/lib/summary/summarizerNode/summarizerNode.mjs +521 -0
  447. package/lib/summary/summarizerNode/summarizerNode.mjs.map +1 -0
  448. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts +121 -0
  449. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +1 -0
  450. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs +123 -0
  451. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +1 -0
  452. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts +153 -0
  453. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +1 -0
  454. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs +370 -0
  455. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +1 -0
  456. package/{dist/summarizerTypes.d.ts → lib/summary/summarizerTypes.d.mts} +234 -84
  457. package/lib/summary/summarizerTypes.d.mts.map +1 -0
  458. package/lib/summary/summarizerTypes.mjs +6 -0
  459. package/lib/summary/summarizerTypes.mjs.map +1 -0
  460. package/lib/{summaryCollection.d.ts → summary/summaryCollection.d.mts} +23 -5
  461. package/lib/summary/summaryCollection.d.mts.map +1 -0
  462. package/lib/{summaryCollection.js → summary/summaryCollection.mjs} +76 -45
  463. package/lib/summary/summaryCollection.mjs.map +1 -0
  464. package/{dist/summaryFormat.d.ts → lib/summary/summaryFormat.d.mts} +25 -30
  465. package/lib/summary/summaryFormat.d.mts.map +1 -0
  466. package/lib/{summaryFormat.js → summary/summaryFormat.mjs} +30 -26
  467. package/lib/summary/summaryFormat.mjs.map +1 -0
  468. package/lib/summary/summaryGenerator.d.mts +127 -0
  469. package/lib/summary/summaryGenerator.d.mts.map +1 -0
  470. package/lib/{summaryGenerator.js → summary/summaryGenerator.mjs} +153 -67
  471. package/lib/summary/summaryGenerator.mjs.map +1 -0
  472. package/{dist/summaryManager.d.ts → lib/summary/summaryManager.d.mts} +15 -13
  473. package/lib/summary/summaryManager.d.mts.map +1 -0
  474. package/lib/{summaryManager.js → summary/summaryManager.mjs} +94 -51
  475. package/lib/summary/summaryManager.mjs.map +1 -0
  476. package/lib/{throttler.d.ts → throttler.d.mts} +2 -2
  477. package/lib/throttler.d.mts.map +1 -0
  478. package/lib/{throttler.js → throttler.mjs} +21 -21
  479. package/lib/throttler.mjs.map +1 -0
  480. package/package.json +174 -73
  481. package/prettier.config.cjs +8 -0
  482. package/src/batchTracker.ts +60 -55
  483. package/src/blobManager.ts +937 -294
  484. package/src/connectionTelemetry.ts +342 -252
  485. package/src/containerHandleContext.ts +27 -29
  486. package/src/containerRuntime.ts +3879 -3143
  487. package/src/dataStore.ts +170 -140
  488. package/src/dataStoreContext.ts +1166 -986
  489. package/src/dataStoreContexts.ts +176 -163
  490. package/src/dataStoreRegistry.ts +29 -21
  491. package/src/dataStores.ts +921 -678
  492. package/src/deltaManagerProxyBase.ts +111 -0
  493. package/src/deltaManagerSummarizerProxy.ts +49 -0
  494. package/src/deltaScheduler.ts +161 -156
  495. package/src/error.ts +21 -0
  496. package/src/gc/garbageCollection.md +106 -0
  497. package/src/gc/garbageCollection.ts +1153 -0
  498. package/src/gc/gcConfigs.ts +216 -0
  499. package/src/gc/gcDefinitions.ts +502 -0
  500. package/src/gc/gcHelpers.ts +284 -0
  501. package/src/gc/gcReferenceGraphAlgorithm.ts +52 -0
  502. package/src/gc/gcSummaryDefinitions.ts +54 -0
  503. package/src/gc/gcSummaryStateTracker.ts +299 -0
  504. package/src/gc/gcTelemetry.ts +423 -0
  505. package/src/gc/gcUnreferencedStateTracker.ts +153 -0
  506. package/src/gc/index.ts +59 -0
  507. package/src/index.ts +101 -74
  508. package/src/messageTypes.ts +238 -0
  509. package/src/metadata.ts +26 -0
  510. package/src/opLifecycle/README.md +321 -0
  511. package/src/opLifecycle/batchManager.ts +179 -0
  512. package/src/opLifecycle/definitions.ts +89 -0
  513. package/src/opLifecycle/index.ts +19 -0
  514. package/src/opLifecycle/opCompressor.ts +99 -0
  515. package/src/opLifecycle/opDecompressor.ts +190 -0
  516. package/src/opLifecycle/opGroupingManager.ts +133 -0
  517. package/src/opLifecycle/opSplitter.ts +279 -0
  518. package/src/opLifecycle/outbox.ts +471 -0
  519. package/src/opLifecycle/remoteMessageProcessor.ts +175 -0
  520. package/src/opProperties.ts +21 -0
  521. package/src/packageVersion.ts +1 -1
  522. package/src/pendingStateManager.ts +396 -465
  523. package/src/scheduleManager.ts +358 -0
  524. package/src/storageServiceWithAttachBlobs.ts +38 -0
  525. package/src/summary/index.ts +109 -0
  526. package/src/summary/orderedClientElection.ts +571 -0
  527. package/src/summary/runWhileConnectedCoordinator.ts +117 -0
  528. package/src/summary/runningSummarizer.ts +920 -0
  529. package/src/summary/summarizer.ts +352 -0
  530. package/src/summary/summarizerClientElection.ts +140 -0
  531. package/src/summary/summarizerHeuristics.ts +227 -0
  532. package/src/summary/summarizerNode/index.ts +12 -0
  533. package/src/summary/summarizerNode/summarizerNode.ts +725 -0
  534. package/src/summary/summarizerNode/summarizerNodeUtils.ts +206 -0
  535. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +571 -0
  536. package/src/summary/summarizerTypes.ts +631 -0
  537. package/src/summary/summaryCollection.ts +474 -0
  538. package/src/summary/summaryFormat.ts +249 -0
  539. package/src/summary/summaryGenerator.ts +539 -0
  540. package/src/summary/summaryManager.ts +452 -0
  541. package/src/throttler.ts +131 -122
  542. package/tsc-multi.test.json +4 -0
  543. package/tsconfig.json +11 -13
  544. package/dist/batchTracker.js.map +0 -1
  545. package/dist/blobManager.js +0 -249
  546. package/dist/blobManager.js.map +0 -1
  547. package/dist/connectionTelemetry.js +0 -178
  548. package/dist/connectionTelemetry.js.map +0 -1
  549. package/dist/containerHandleContext.js.map +0 -1
  550. package/dist/containerRuntime.js +0 -2174
  551. package/dist/containerRuntime.js.map +0 -1
  552. package/dist/dataStore.js.map +0 -1
  553. package/dist/dataStoreContext.js.map +0 -1
  554. package/dist/dataStoreContexts.js.map +0 -1
  555. package/dist/dataStoreRegistry.js.map +0 -1
  556. package/dist/dataStores.js.map +0 -1
  557. package/dist/deltaScheduler.js.map +0 -1
  558. package/dist/garbageCollection.d.ts +0 -319
  559. package/dist/garbageCollection.d.ts.map +0 -1
  560. package/dist/garbageCollection.js +0 -993
  561. package/dist/garbageCollection.js.map +0 -1
  562. package/dist/index.js +0 -33
  563. package/dist/index.js.map +0 -1
  564. package/dist/opTelemetry.d.ts +0 -22
  565. package/dist/opTelemetry.d.ts.map +0 -1
  566. package/dist/opTelemetry.js +0 -60
  567. package/dist/opTelemetry.js.map +0 -1
  568. package/dist/orderedClientElection.d.ts.map +0 -1
  569. package/dist/orderedClientElection.js.map +0 -1
  570. package/dist/packageVersion.js.map +0 -1
  571. package/dist/pendingStateManager.js +0 -346
  572. package/dist/pendingStateManager.js.map +0 -1
  573. package/dist/runWhileConnectedCoordinator.d.ts.map +0 -1
  574. package/dist/runWhileConnectedCoordinator.js.map +0 -1
  575. package/dist/runningSummarizer.d.ts +0 -93
  576. package/dist/runningSummarizer.d.ts.map +0 -1
  577. package/dist/runningSummarizer.js +0 -384
  578. package/dist/runningSummarizer.js.map +0 -1
  579. package/dist/serializedSnapshotStorage.d.ts +0 -58
  580. package/dist/serializedSnapshotStorage.d.ts.map +0 -1
  581. package/dist/serializedSnapshotStorage.js +0 -108
  582. package/dist/serializedSnapshotStorage.js.map +0 -1
  583. package/dist/summarizer.d.ts.map +0 -1
  584. package/dist/summarizer.js +0 -348
  585. package/dist/summarizer.js.map +0 -1
  586. package/dist/summarizerClientElection.d.ts.map +0 -1
  587. package/dist/summarizerClientElection.js.map +0 -1
  588. package/dist/summarizerHandle.d.ts +0 -12
  589. package/dist/summarizerHandle.d.ts.map +0 -1
  590. package/dist/summarizerHandle.js +0 -22
  591. package/dist/summarizerHandle.js.map +0 -1
  592. package/dist/summarizerHeuristics.d.ts.map +0 -1
  593. package/dist/summarizerHeuristics.js +0 -84
  594. package/dist/summarizerHeuristics.js.map +0 -1
  595. package/dist/summarizerTypes.d.ts.map +0 -1
  596. package/dist/summarizerTypes.js.map +0 -1
  597. package/dist/summaryCollection.d.ts.map +0 -1
  598. package/dist/summaryCollection.js.map +0 -1
  599. package/dist/summaryFormat.d.ts.map +0 -1
  600. package/dist/summaryFormat.js.map +0 -1
  601. package/dist/summaryGenerator.d.ts.map +0 -1
  602. package/dist/summaryGenerator.js.map +0 -1
  603. package/dist/summaryManager.d.ts.map +0 -1
  604. package/dist/summaryManager.js.map +0 -1
  605. package/dist/throttler.js.map +0 -1
  606. package/garbageCollection.md +0 -41
  607. package/lib/batchTracker.d.ts.map +0 -1
  608. package/lib/batchTracker.js.map +0 -1
  609. package/lib/blobManager.d.ts +0 -95
  610. package/lib/blobManager.d.ts.map +0 -1
  611. package/lib/blobManager.js +0 -244
  612. package/lib/blobManager.js.map +0 -1
  613. package/lib/connectionTelemetry.d.ts.map +0 -1
  614. package/lib/connectionTelemetry.js +0 -174
  615. package/lib/connectionTelemetry.js.map +0 -1
  616. package/lib/containerHandleContext.d.ts.map +0 -1
  617. package/lib/containerHandleContext.js.map +0 -1
  618. package/lib/containerRuntime.d.ts +0 -616
  619. package/lib/containerRuntime.d.ts.map +0 -1
  620. package/lib/containerRuntime.js +0 -2166
  621. package/lib/containerRuntime.js.map +0 -1
  622. package/lib/dataStore.d.ts.map +0 -1
  623. package/lib/dataStore.js.map +0 -1
  624. package/lib/dataStoreContext.d.ts.map +0 -1
  625. package/lib/dataStoreContext.js.map +0 -1
  626. package/lib/dataStoreContexts.d.ts.map +0 -1
  627. package/lib/dataStoreContexts.js.map +0 -1
  628. package/lib/dataStoreRegistry.d.ts.map +0 -1
  629. package/lib/dataStoreRegistry.js.map +0 -1
  630. package/lib/dataStores.d.ts.map +0 -1
  631. package/lib/dataStores.js.map +0 -1
  632. package/lib/deltaScheduler.d.ts.map +0 -1
  633. package/lib/deltaScheduler.js.map +0 -1
  634. package/lib/garbageCollection.d.ts +0 -319
  635. package/lib/garbageCollection.d.ts.map +0 -1
  636. package/lib/garbageCollection.js +0 -989
  637. package/lib/garbageCollection.js.map +0 -1
  638. package/lib/index.d.ts +0 -14
  639. package/lib/index.d.ts.map +0 -1
  640. package/lib/index.js +0 -13
  641. package/lib/index.js.map +0 -1
  642. package/lib/opTelemetry.d.ts +0 -22
  643. package/lib/opTelemetry.d.ts.map +0 -1
  644. package/lib/opTelemetry.js +0 -56
  645. package/lib/opTelemetry.js.map +0 -1
  646. package/lib/orderedClientElection.d.ts.map +0 -1
  647. package/lib/orderedClientElection.js.map +0 -1
  648. package/lib/packageVersion.js.map +0 -1
  649. package/lib/pendingStateManager.d.ts.map +0 -1
  650. package/lib/pendingStateManager.js +0 -339
  651. package/lib/pendingStateManager.js.map +0 -1
  652. package/lib/runWhileConnectedCoordinator.d.ts.map +0 -1
  653. package/lib/runWhileConnectedCoordinator.js.map +0 -1
  654. package/lib/runningSummarizer.d.ts +0 -93
  655. package/lib/runningSummarizer.d.ts.map +0 -1
  656. package/lib/runningSummarizer.js +0 -380
  657. package/lib/runningSummarizer.js.map +0 -1
  658. package/lib/serializedSnapshotStorage.d.ts +0 -58
  659. package/lib/serializedSnapshotStorage.d.ts.map +0 -1
  660. package/lib/serializedSnapshotStorage.js +0 -104
  661. package/lib/serializedSnapshotStorage.js.map +0 -1
  662. package/lib/summarizer.d.ts.map +0 -1
  663. package/lib/summarizer.js +0 -342
  664. package/lib/summarizer.js.map +0 -1
  665. package/lib/summarizerClientElection.d.ts.map +0 -1
  666. package/lib/summarizerClientElection.js.map +0 -1
  667. package/lib/summarizerHandle.d.ts +0 -12
  668. package/lib/summarizerHandle.d.ts.map +0 -1
  669. package/lib/summarizerHandle.js +0 -18
  670. package/lib/summarizerHandle.js.map +0 -1
  671. package/lib/summarizerHeuristics.d.ts.map +0 -1
  672. package/lib/summarizerHeuristics.js +0 -79
  673. package/lib/summarizerHeuristics.js.map +0 -1
  674. package/lib/summarizerTypes.d.ts.map +0 -1
  675. package/lib/summarizerTypes.js +0 -9
  676. package/lib/summarizerTypes.js.map +0 -1
  677. package/lib/summaryCollection.d.ts.map +0 -1
  678. package/lib/summaryCollection.js.map +0 -1
  679. package/lib/summaryFormat.d.ts.map +0 -1
  680. package/lib/summaryFormat.js.map +0 -1
  681. package/lib/summaryGenerator.d.ts +0 -85
  682. package/lib/summaryGenerator.d.ts.map +0 -1
  683. package/lib/summaryGenerator.js.map +0 -1
  684. package/lib/summaryManager.d.ts.map +0 -1
  685. package/lib/summaryManager.js.map +0 -1
  686. package/lib/throttler.d.ts.map +0 -1
  687. package/lib/throttler.js.map +0 -1
  688. package/src/garbageCollection.ts +0 -1434
  689. package/src/opTelemetry.ts +0 -71
  690. package/src/orderedClientElection.ts +0 -511
  691. package/src/runWhileConnectedCoordinator.ts +0 -106
  692. package/src/runningSummarizer.ts +0 -550
  693. package/src/serializedSnapshotStorage.ts +0 -146
  694. package/src/summarizer.ts +0 -438
  695. package/src/summarizerClientElection.ts +0 -161
  696. package/src/summarizerHandle.ts +0 -21
  697. package/src/summarizerHeuristics.ts +0 -108
  698. package/src/summarizerTypes.ts +0 -462
  699. package/src/summaryCollection.ts +0 -406
  700. package/src/summaryFormat.ts +0 -239
  701. package/src/summaryGenerator.ts +0 -427
  702. package/src/summaryManager.ts +0 -368
  703. package/tsconfig.esnext.json +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"garbageCollection.js","sourceRoot":"","sources":["../src/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8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OAAO,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;KAC5C;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CACnB,SAAiB,EACjB,SAAqB,EACrB,UAA0D;IAE1D,yDAAyD;IACzD,MAAM,UAAU,GAAG,UAAU,CAAC;IAC9B,IAAI,KAAoC,CAAC;IACzC,IAAI,SAAS,GAAG,UAAU,EAAE;QACxB,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;QAC5C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;KAC7F;SAAM;QACH,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC;KACpD;IACD,UAAU,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger, ITelemetryPerformanceEvent } from \"@fluidframework/common-definitions\";\nimport { assert, LazyPromise, Timer } from \"@fluidframework/common-utils\";\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { ClientSessionExpiredError, DataProcessingError, UsageError } from \"@fluidframework/container-utils\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport {\n cloneGCData,\n concatGarbageCollectionStates,\n concatGarbageCollectionData,\n IGCResult,\n runGarbageCollection,\n unpackChildNodesGCDetails,\n} from \"@fluidframework/garbage-collector\";\nimport { ISnapshotTree, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n gcBlobKey,\n IGarbageCollectionData,\n IGarbageCollectionState,\n IGarbageCollectionDetailsBase,\n ISummarizeResult,\n ITelemetryContext,\n IGarbageCollectionNodeData,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n mergeStats,\n ReadAndParseBlob,\n RefreshSummaryResult,\n SummaryTreeBuilder,\n} from \"@fluidframework/runtime-utils\";\nimport {\n ChildLogger,\n loggerToMonitoringContext,\n MonitoringContext,\n PerformanceEvent,\n TelemetryDataTag,\n} from \"@fluidframework/telemetry-utils\";\n\nimport { IGCRuntimeOptions, RuntimeHeaders } from \"./containerRuntime\";\nimport { getSummaryForDatastores } from \"./dataStores\";\nimport {\n getGCVersion,\n GCVersion,\n IContainerRuntimeMetadata,\n metadataBlobName,\n ReadFluidDataStoreAttributes,\n dataStoreAttributesBlobName,\n IGCMetadata,\n} from \"./summaryFormat\";\n\n/** This is the current version of garbage collection. */\nconst GCVersion = 1;\n\n// The key for the GC tree in summary.\nexport const gcTreeKey = \"gc\";\n// They prefix for GC blobs in the GC tree in summary.\nexport const gcBlobPrefix = \"__gc\";\n\n// Feature gate key to turn GC on / off.\nconst runGCKey = \"Fluid.GarbageCollection.RunGC\";\n// Feature gate key to turn GC sweep on / off.\nconst runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n// Feature gate key to turn GC test mode on / off.\nconst gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n// Feature gate key to write GC data at the root of the summary tree.\nconst writeAtRootKey = \"Fluid.GarbageCollection.WriteDataAtRoot\";\n// Feature gate key to expire a session after a set period of time.\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n// Feature gate key to disable expiring session after a set period of time, even if expiry value is present\nexport const disableSessionExpiryKey = \"Fluid.GarbageCollection.DisableSessionExpiry\";\n// Feature gate key to write the gc blob as a handle if the data is the same.\nexport const trackGCStateKey = \"Fluid.GarbageCollection.TrackGCState\";\n// Feature gate key to turn GC sweep log off.\nconst disableSweepLogKey = \"Fluid.GarbageCollection.DisableSweepLog\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\nconst defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\n\n/** The statistics of the system state after a garbage collection run. */\nexport interface IGCStats {\n /** The number of nodes in the container. */\n nodeCount: number;\n /** The number of data stores in the container. */\n dataStoreCount: number;\n /** The number of attachment blobs in the container. */\n attachmentBlobCount: number;\n /** The number of unreferenced nodes in the container. */\n unrefNodeCount: number;\n /** The number of unreferenced data stores in the container. */\n unrefDataStoreCount: number;\n /** The number of unreferenced attachment blobs in the container. */\n unrefAttachmentBlobCount: number;\n /** The number of nodes whose reference state updated since last GC run. */\n updatedNodeCount: number;\n /** The number of data stores whose reference state updated since last GC run. */\n updatedDataStoreCount: number;\n /** The number of attachment blobs whose reference state updated since last GC run. */\n updatedAttachmentBlobCount: number;\n}\n\n/** The types of GC nodes in the GC reference graph. */\nexport const GCNodeType = {\n // Nodes that are for data stores.\n DataStore: \"DataStore\",\n // Nodes that are within a data store. For example, DDS nodes.\n SubDataStore: \"SubDataStore\",\n // Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.\n Blob: \"Blob\",\n // Nodes that are neither of the above. For example, root node.\n Other: \"Other\",\n};\nexport type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];\n\n/** Defines the APIs for the runtime object to be passed to the garbage collector. */\nexport interface IGarbageCollectionRuntime {\n /** Before GC runs, called to notify the runtime to update any pending GC state. */\n updateStateBeforeGC(): Promise<void>;\n /** Returns the garbage collection data of the runtime. */\n getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n /** After GC has run, called to notify the runtime of routes that are used in it. */\n updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;\n /** After GC has run, called to delete objects in the runtime whose routes are unused. */\n deleteUnusedRoutes(unusedRoutes: string[]): void;\n /** Returns a referenced timestamp to be used to track unreferenced nodes. */\n getCurrentReferenceTimestampMs(): number | undefined;\n /** Returns the type of the GC node. */\n getNodeType(nodePath: string): GCNodeType;\n /** Called when the runtime should close because of an error. */\n closeFn(error?: ICriticalContainerError): void;\n}\n\n/** Defines the contract for the garbage collector. */\nexport interface IGarbageCollector {\n /** Tells whether GC should run or not. */\n readonly shouldRunGC: boolean;\n /** Tells whether the GC state in summary needs to be reset in the next summary. */\n readonly summaryStateNeedsReset: boolean;\n /** Tells whether GC data should be written to the root of the summary tree. */\n readonly writeDataAtRoot: boolean;\n readonly trackGCState: boolean;\n /** Run garbage collection and update the reference / used state of the system. */\n collectGarbage(\n options: { logger?: ITelemetryLogger; runSweep?: boolean; fullGC?: boolean; },\n ): Promise<IGCStats>;\n /** Summarizes the GC data and returns it as a summary tree. */\n summarize(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): ISummarizeResult | undefined;\n /** Returns the garbage collector specific metadata to be written into the summary. */\n getMetadata(): IGCMetadata;\n /** Returns a map of each node id to its base GC details in the base summary. */\n getBaseGCDetails(): Promise<Map<string, IGarbageCollectionDetailsBase>>;\n /** Called when the latest summary of the system has been refreshed. */\n latestSummaryStateRefreshed(result: RefreshSummaryResult, readAndParseBlob: ReadAndParseBlob): Promise<void>;\n /** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */\n nodeUpdated(\n nodePath: string,\n reason: \"Loaded\" | \"Changed\",\n timestampMs?: number,\n packagePath?: readonly string[],\n requestHeaders?: IRequestHeader,\n ): void;\n /** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */\n addedOutboundReference(fromNodePath: string, toNodePath: string): void;\n dispose(): void;\n}\n\n/** Parameters necessary for creating a GarbageCollector. */\nexport interface IGarbageCollectorCreateParams {\n readonly runtime: IGarbageCollectionRuntime;\n readonly gcOptions: IGCRuntimeOptions;\n readonly baseLogger: ITelemetryLogger;\n readonly existing: boolean;\n readonly metadata: IContainerRuntimeMetadata | undefined;\n readonly baseSnapshot: ISnapshotTree | undefined;\n readonly isSummarizerClient: boolean;\n readonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n readonly getLastSummaryTimestampMs: () => number | undefined;\n readonly readAndParseBlob: ReadAndParseBlob;\n readonly snapshotCacheExpiryMs?: number;\n}\n\n/** The state of node that is unreferenced. */\nconst UnreferencedState = {\n /** The node is active, i.e., it can become referenced again. */\n Active: \"Active\",\n /** The node is inactive, i.e., it should not become referenced. */\n Inactive: \"Inactive\",\n /** The node is ready to be deleted by the sweep phase. */\n SweepReady: \"SweepReady\",\n};\nexport type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];\n\n/** The event that is logged when unreferenced node is used after a certain time. */\ninterface IUnreferencedEventProps {\n usageType: \"Changed\" | \"Loaded\" | \"Revived\";\n state: UnreferencedState;\n id: string;\n type: GCNodeType;\n unrefTime: number;\n age: number;\n completedGCRuns: number;\n fromId?: string;\n timeout?: number;\n lastSummaryTime?: number;\n externalRequest?: boolean;\n viaHandle?: boolean;\n}\n\n/**\n * Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can\n * be deleted by the sweep phase.\n */\nclass UnreferencedStateTracker {\n private _state: UnreferencedState = UnreferencedState.Active;\n public get state(): UnreferencedState {\n return this._state;\n }\n\n private inactiveTimer: Timer | undefined;\n private sweepTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(\n public readonly unreferencedTimestampMs: number,\n /** The time after which node transitions to Inactive state. */\n private readonly inactiveTimeoutMs: number,\n /** The time after which node transitions to SweepReady state; undefined if session expiry is disabled. */\n private readonly sweepTimeoutMs?: number,\n /** The current reference timestamp; undefined if no ops have ever been processed which can happen in tests. */\n currentReferenceTimestampMs?: number,\n ) {\n // If there is no current reference timestamp, don't track the node's unreferenced state. This will happen\n // later when updateTracking is called with a reference timestamp.\n if (currentReferenceTimestampMs !== undefined) {\n this.updateTracking(currentReferenceTimestampMs);\n }\n }\n\n /* Updates the unreferenced state based on the provided timestamp. */\n public updateTracking(currentReferenceTimestampMs: number) {\n const unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;\n\n // If the node has been unreferenced for sweep timeout amount of time, update the state to SweepReady.\n if (this.sweepTimeoutMs !== undefined && unreferencedDurationMs >= this.sweepTimeoutMs) {\n this._state = UnreferencedState.SweepReady;\n this.clearTimers();\n return;\n }\n\n // If the node has been unreferenced for inactive timeoutMs amount of time, update the state to inactive.\n // Also, start a timer for the sweep timeout.\n if (unreferencedDurationMs >= this.inactiveTimeoutMs) {\n this._state = UnreferencedState.Inactive;\n this.clearTimers();\n\n if (this.sweepTimeoutMs !== undefined) {\n setLongTimeout(\n this.sweepTimeoutMs - unreferencedDurationMs,\n () => { this._state = UnreferencedState.SweepReady; },\n (timer) => { this.sweepTimer = timer; },\n );\n }\n return;\n }\n\n // The node is still active. Start the inactive timer for the remaining duration.\n const remainingDurationMs = this.inactiveTimeoutMs - unreferencedDurationMs;\n if (this.inactiveTimer === undefined) {\n const inactiveTimeoutHandler = () => {\n this._state = UnreferencedState.Inactive;\n // After the node becomes inactive, start the sweep timer after which the node will be ready for sweep.\n if (this.sweepTimeoutMs !== undefined) {\n setLongTimeout(\n this.sweepTimeoutMs - this.inactiveTimeoutMs,\n () => { this._state = UnreferencedState.SweepReady; },\n (timer) => { this.sweepTimer = timer; },\n );\n }\n };\n this.inactiveTimer = new Timer(remainingDurationMs, () => inactiveTimeoutHandler());\n }\n this.inactiveTimer.restart(remainingDurationMs);\n }\n\n private clearTimers() {\n this.inactiveTimer?.clear();\n if (this.sweepTimer !== undefined) {\n clearTimeout(this.sweepTimer);\n }\n }\n\n /** Stop tracking this node. Reset the unreferenced timers and state, if any. */\n public stopTracking() {\n this.clearTimers();\n this._state = UnreferencedState.Active;\n }\n}\n\n/**\n * The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains\n * its state across summaries.\n *\n * Node - represented as nodeId, it's a node on the GC graph\n * Outbound Route - a path from one node to another node, think `nodeA` -\\> `nodeB`\n * Graph - all nodes with their respective routes\n * GC Graph\n *\n * Node\n * NodeId = \"datastore1\"\n * / \\\\\n * OutboundRoute OutboundRoute\n * / \\\\\n * Node Node\n * NodeId = \"dds1\" NodeId = \"dds2\"\n */\nexport class GarbageCollector implements IGarbageCollector {\n public static create(createParams: IGarbageCollectorCreateParams): IGarbageCollector {\n return new GarbageCollector(createParams);\n }\n\n /**\n * Tells whether the GC state needs to be reset in the next summary. We need to do this if:\n * 1. GC was enabled and is now disabled. The GC state needs to be removed and everything becomes referenced.\n * 2. GC was disabled and is now enabled. The GC state needs to be regenerated and added to summary.\n * 3. The GC version in the latest summary is different from the current GC version. This can happen if:\n * 3.1. The summary this client loaded with has data from a different GC version.\n * 3.2. This client's latest summary was updated from a snapshot that has a different GC version.\n */\n public get summaryStateNeedsReset(): boolean {\n return this.initialStateNeedsReset ||\n (this.shouldRunGC && this.latestSummaryGCVersion !== this.currentGCVersion);\n }\n\n /**\n * Tracks if GC is enabled for this document. This is specified during document creation and doesn't change\n * throughout its lifetime.\n */\n private readonly gcEnabled: boolean;\n /**\n * Tracks if sweep phase is enabled for this document. This is specified during document creation and doesn't change\n * throughout its lifetime.\n */\n private readonly sweepEnabled: boolean;\n\n /**\n * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly\n * disabled via runtime options or feature flags.\n */\n public readonly shouldRunGC: boolean;\n /**\n * Tracks if sweep phase should run or not. Even if the sweep phase is enabled for a document (see sweepEnabled), it\n * can be explicitly disabled via feature flags. It also won't run if session expiry is not enabled.\n */\n private readonly shouldRunSweep: boolean;\n\n public readonly trackGCState: boolean;\n\n private readonly testMode: boolean;\n private readonly mc: MonitoringContext;\n\n /**\n * Tells whether the GC data should be written to the root of the summary tree.\n */\n private _writeDataAtRoot: boolean = true;\n public get writeDataAtRoot(): boolean {\n return this._writeDataAtRoot;\n }\n\n /**\n * Tells whether the initial GC state needs to be reset. This can happen under 2 conditions:\n * 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after\n * it was enabled before. GC state needs to be removed from summary and all nodes should be marked referenced.\n * 2. The base snapshot does not have GC state but GC is enabled. This will happen the very first time GC runs on\n * a document and the first time GC is enabled after is was disabled before.\n *\n * Note that the state needs reset only for the very first time summary is generated by this client. After that, the\n * state will be up-to-date and this flag will be reset.\n */\n private initialStateNeedsReset: boolean = false;\n\n // The current GC version that this container is running.\n private readonly currentGCVersion = GCVersion;\n // This is the version of GC data in the latest summary being tracked.\n private latestSummaryGCVersion: GCVersion;\n\n // Keeps track of the GC state from the last run.\n private previousGCDataFromLastRun: IGarbageCollectionData | undefined;\n /**\n * Keeps track of the serialized GC blob from the latest summary successfully submitted to the server.\n */\n private latestSerializedSummaryState: string | undefined;\n /**\n * Keeps track of the serialized GC blob from the last GC run of the client.\n */\n private pendingSerializedSummaryState: string | undefined;\n // Keeps a list of references (edges in the GC graph) between GC runs. Each entry has a node id and a list of\n // outbound routes from that node.\n private readonly newReferencesSinceLastRun: Map<string, string[]> = new Map();\n\n // Promise when resolved initializes the base state of the nodes from the base summary state.\n private readonly initializeBaseStateP: Promise<void>;\n // The map of data store ids to their GC details in the base summary returned in getDataStoreGCDetails().\n private readonly baseGCDetailsP: Promise<Map<string, IGarbageCollectionDetailsBase>>;\n // Map of node ids to their unreferenced state tracker.\n private readonly unreferencedNodesState: Map<string, UnreferencedStateTracker> = new Map();\n // The timeout responsible for closing the container when the session has expired\n private sessionExpiryTimer?: ReturnType<typeof setTimeout>;\n\n // Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one\n // per event per node.\n private readonly loggedUnreferencedEvents: Set<string> = new Set();\n // Queue for unreferenced events that should be logged the next time GC runs.\n private pendingEventsQueue: IUnreferencedEventProps[] = [];\n\n // The number of times GC has successfully completed on this instance of GarbageCollector.\n private completedRuns = 0;\n\n private readonly runtime: IGarbageCollectionRuntime;\n private readonly gcOptions: IGCRuntimeOptions;\n private readonly isSummarizerClient: boolean;\n\n /** The time in ms to expire a session for a client for gc. */\n private readonly sessionExpiryTimeoutMs: number | undefined;\n /** The time after which an unreferenced node is inactive. */\n private readonly inactiveTimeoutMs: number;\n /** The time after which an unreferenced node is ready to be swept. */\n private readonly sweepTimeoutMs: number | undefined;\n\n /** For a given node path, returns the node's package path. */\n private readonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n /** Returns the timestamp of the last summary generated for this container. */\n private readonly getLastSummaryTimestampMs: () => number | undefined;\n\n protected constructor(createParams: IGarbageCollectorCreateParams) {\n this.runtime = createParams.runtime;\n this.isSummarizerClient = createParams.isSummarizerClient;\n this.gcOptions = createParams.gcOptions;\n this.getNodePackagePath = createParams.getNodePackagePath;\n this.getLastSummaryTimestampMs = createParams.getLastSummaryTimestampMs;\n\n const baseSnapshot = createParams.baseSnapshot;\n const metadata = createParams.metadata;\n const readAndParseBlob = createParams.readAndParseBlob;\n\n this.mc = loggerToMonitoringContext(ChildLogger.create(\n createParams.baseLogger, \"GarbageCollector\", { all: { completedGCRuns: () => this.completedRuns } },\n ));\n\n let prevSummaryGCVersion: number | undefined;\n\n /**\n * The following GC state is enabled during container creation and cannot be changed throughout its lifetime:\n * 1. Whether running GC mark phase is allowed or not.\n * 2. Whether running GC sweep phase is allowed or not.\n * 3. Whether GC session expiry is enabled or not.\n * For existing containers, we get this information from the metadata blob of its summary.\n */\n if (createParams.existing) {\n prevSummaryGCVersion = getGCVersion(metadata);\n // Existing documents which did not have metadata blob or had GC disabled have version as 0. For all\n // other existing documents, GC is enabled.\n this.gcEnabled = prevSummaryGCVersion > 0;\n this.sweepEnabled = metadata?.sweepEnabled ?? false;\n this.sessionExpiryTimeoutMs = metadata?.sessionExpiryTimeoutMs;\n } else {\n // Sweep should not be enabled without enabling GC mark phase. We could silently disable sweep in this\n // scenario but explicitly failing makes it clearer and promotes correct usage.\n if (this.gcOptions.sweepAllowed && this.gcOptions.gcAllowed === false) {\n throw new UsageError(\"GC sweep phase cannot be enabled without enabling GC mark phase\");\n }\n\n // For new documents, GC is enabled by default. It can be explicitly disabled by setting the gcAllowed\n // flag in GC options to false.\n this.gcEnabled = this.gcOptions.gcAllowed !== false;\n // The sweep phase has to be explicitly enabled by setting the sweepAllowed flag in GC options to true.\n this.sweepEnabled = this.gcOptions.sweepAllowed === true;\n\n // Set the Session Expiry only if the flag is enabled or the test option is set.\n if (this.mc.config.getBoolean(runSessionExpiryKey) && this.gcEnabled) {\n this.sessionExpiryTimeoutMs = defaultSessionExpiryDurationMs;\n }\n }\n\n // If session expiry is enabled, we need to close the container when the session expiry timeout expires.\n if (this.sessionExpiryTimeoutMs !== undefined && this.mc.config.getBoolean(disableSessionExpiryKey) !== true) {\n // If Test Override config is set, override Session Expiry timeout.\n const overrideSessionExpiryTimeoutMs =\n this.mc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.SessionExpiryMs\");\n const timeoutMs = overrideSessionExpiryTimeoutMs ?? this.sessionExpiryTimeoutMs;\n\n setLongTimeout(\n timeoutMs,\n () => { this.runtime.closeFn(new ClientSessionExpiredError(`Client session expired.`, timeoutMs)); },\n (timer) => { this.sessionExpiryTimer = timer; },\n );\n\n /**\n * Sweep timeout is the time after which unreferenced content can be swept.\n * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + one day buffer. The buffer is\n * added to account for any clock skew. We use server timestamps throughout so the skew should be minimal\n * but make it one day to be safe.\n */\n if (createParams.snapshotCacheExpiryMs !== undefined) {\n this.sweepTimeoutMs = this.sessionExpiryTimeoutMs + createParams.snapshotCacheExpiryMs + oneDayMs;\n }\n }\n\n // For existing document, the latest summary is the one that we loaded from. So, use its GC version as the\n // latest tracked GC version. For new documents, we will be writing the first summary with the current version.\n this.latestSummaryGCVersion = prevSummaryGCVersion ?? this.currentGCVersion;\n\n /**\n * Whether GC should run or not. The following conditions have to be met to run sweep:\n * 1. GC should be enabled for this container.\n * 2. GC should not be disabled via disableGC GC option.\n * These conditions can be overridden via runGCKey feature flag.\n */\n this.shouldRunGC = this.mc.config.getBoolean(runGCKey) ?? (\n // GC must be enabled for the document.\n this.gcEnabled\n // GC must not be disabled via GC options.\n && !this.gcOptions.disableGC\n );\n\n /**\n * Whether sweep should run or not. The following conditions have to be met to run sweep:\n * 1. Overall GC or mark phase must be enabled (this.shouldRunGC).\n * 2. Sweep timeout should be available. Without this, we wouldn't know when an object should be deleted.\n * 3. Sweep should be enabled for this container (this.sweepEnabled). This can be overridden via runSweep\n * feature flag.\n */\n this.shouldRunSweep = this.shouldRunGC\n && this.sweepTimeoutMs !== undefined\n && (this.mc.config.getBoolean(runSweepKey) ?? this.sweepEnabled);\n\n this.trackGCState = this.mc.config.getBoolean(trackGCStateKey) === true;\n\n // Override inactive timeout if test config or gc options to override it is set.\n this.inactiveTimeoutMs = this.mc.config.getNumber(\"Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs\") ??\n this.gcOptions.inactiveTimeoutMs ??\n defaultInactiveTimeoutMs;\n\n // Inactive timeout must be greater than sweep timeout since a node goes from active -> inactive -> sweep ready.\n if (this.sweepTimeoutMs !== undefined && this.inactiveTimeoutMs > this.sweepTimeoutMs) {\n throw new UsageError(\"inactive timeout should not be greated than the sweep timeout\");\n }\n\n // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.\n this.testMode = this.mc.config.getBoolean(gcTestModeKey) ?? this.gcOptions.runGCInTestMode === true;\n\n // GC state is written into root of the summary tree by default. Can be overridden via feature flag for now.\n this._writeDataAtRoot = this.mc.config.getBoolean(writeAtRootKey) ?? true;\n\n if (this._writeDataAtRoot) {\n // The GC state needs to be reset if the base snapshot contains GC tree and GC is disabled or it doesn't\n // contain GC tree and GC is enabled.\n const gcTreePresent = baseSnapshot?.trees[gcTreeKey] !== undefined;\n this.initialStateNeedsReset = gcTreePresent !== this.shouldRunGC;\n }\n\n // Get the GC state from the GC blob in the base snapshot. Use LazyPromise because we only want to do\n // this once since it involves fetching blobs from storage which is expensive.\n const baseSummaryStateP = new LazyPromise<IGarbageCollectionState | undefined>(async () => {\n if (baseSnapshot === undefined) {\n return undefined;\n }\n\n // For newer documents, GC data should be present in the GC tree in the root of the snapshot.\n const gcSnapshotTree = baseSnapshot.trees[gcTreeKey];\n if (gcSnapshotTree !== undefined) {\n // If the GC tree is written at root, we should also do the same.\n this._writeDataAtRoot = true;\n const baseGCState = await getGCStateFromSnapshot(\n gcSnapshotTree,\n readAndParseBlob,\n );\n if (this.trackGCState) {\n this.latestSerializedSummaryState = JSON.stringify(generateSortedGCState(baseGCState));\n }\n return baseGCState;\n }\n\n // back-compat - Older documents will have the GC blobs in each data store's summary tree. Get them and\n // consolidate into IGarbageCollectionState format.\n // Add a node for the root node that is not present in older snapshot format.\n const gcState: IGarbageCollectionState = { gcNodes: { \"/\": { outboundRoutes: [] } } };\n const dataStoreSnapshotTree = getSummaryForDatastores(baseSnapshot, metadata);\n assert(dataStoreSnapshotTree !== undefined,\n 0x2a8 /* \"Expected data store snapshot tree in base snapshot\" */);\n for (const [dsId, dsSnapshotTree] of Object.entries(dataStoreSnapshotTree.trees)) {\n const blobId = dsSnapshotTree.blobs[gcBlobKey];\n if (blobId === undefined) {\n continue;\n }\n\n const gcSummaryDetails = await readAndParseBlob<IGarbageCollectionDetailsBase>(blobId);\n // If there are no nodes for this data store, skip it.\n if (gcSummaryDetails.gcData?.gcNodes === undefined) {\n continue;\n }\n\n const dsRootId = `/${dsId}`;\n // Since we used to write GC data at data store level, we won't have an entry for the root (\"/\").\n // Construct that entry by adding root data store ids to its outbound routes.\n const initialSnapshotDetails = await readAndParseBlob<ReadFluidDataStoreAttributes>(\n dsSnapshotTree.blobs[dataStoreAttributesBlobName],\n );\n if (initialSnapshotDetails.isRootDataStore) {\n gcState.gcNodes[\"/\"].outboundRoutes.push(dsRootId);\n }\n\n for (const [id, outboundRoutes] of Object.entries(gcSummaryDetails.gcData.gcNodes)) {\n // Prefix the data store id to the GC node ids to make them relative to the root from being\n // relative to the data store. Similar to how its done in DataStore::getGCData.\n const rootId = id === \"/\" ? dsRootId : `${dsRootId}${id}`;\n gcState.gcNodes[rootId] = { outboundRoutes: Array.from(outboundRoutes) };\n }\n assert(gcState.gcNodes[dsRootId] !== undefined,\n 0x2a9 /* GC nodes for data store not in GC blob */);\n gcState.gcNodes[dsRootId].unreferencedTimestampMs = gcSummaryDetails.unrefTimestamp;\n }\n\n // If there is only one node (root node just added above), either GC is disabled or we are loading from the\n // very first summary generated by detached container. In both cases, GC was not run - return undefined.\n return Object.keys(gcState.gcNodes).length === 1 ? undefined : gcState;\n });\n\n /**\n * Set up the initializer which initializes the base GC state from the base snapshot. Note that the reference\n * timestamp maybe from old ops which were not summarized and stored in the file. So, the unreferenced state\n * may be out of date. This is fine because the state is updated every time GC runs based on the time then.\n */\n this.initializeBaseStateP = new LazyPromise<void>(async () => {\n const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n const baseState = await baseSummaryStateP;\n if (baseState === undefined) {\n return;\n }\n\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(baseState.gcNodes)) {\n if (nodeData.unreferencedTimestampMs !== undefined) {\n this.unreferencedNodesState.set(\n nodeId,\n new UnreferencedStateTracker(\n nodeData.unreferencedTimestampMs,\n this.inactiveTimeoutMs,\n this.sweepTimeoutMs,\n currentReferenceTimestampMs,\n ),\n );\n }\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n this.previousGCDataFromLastRun = { gcNodes };\n });\n\n // Get the GC details for each node from the GC state in the base summary. This is returned in getBaseGCDetails\n // which the caller uses to initialize each node's GC state.\n this.baseGCDetailsP = new LazyPromise<Map<string, IGarbageCollectionDetailsBase>>(async () => {\n const baseState = await baseSummaryStateP;\n if (baseState === undefined) {\n return new Map();\n }\n\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(baseState.gcNodes)) {\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n // Run GC on the nodes in the base summary to get the routes used in each node in the container.\n // This is an optimization for space (vs performance) wherein we don't need to store the used routes of\n // each node in the summary.\n const usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n\n const baseGCDetailsMap = unpackChildNodesGCDetails({ gcData: { gcNodes }, usedRoutes });\n // Currently, the nodes may write the GC data. So, we need to update it's base GC details with the\n // unreferenced timestamp. Once we start writing the GC data here, we won't need to do this anymore.\n for (const [nodeId, nodeData] of Object.entries(baseState.gcNodes)) {\n if (nodeData.unreferencedTimestampMs !== undefined) {\n const dataStoreGCDetails = baseGCDetailsMap.get(nodeId.slice(1));\n if (dataStoreGCDetails !== undefined) {\n dataStoreGCDetails.unrefTimestamp = nodeData.unreferencedTimestampMs;\n }\n }\n }\n return baseGCDetailsMap;\n });\n\n // Log all the GC options and the state determined by the garbage collector. This is interesting only for the\n // summarizer client since it is the only one that runs GC. It also helps keep the telemetry less noisy.\n const gcConfigProps = JSON.stringify({\n gcEnabled: this.gcEnabled,\n sweepEnabled: this.sweepEnabled,\n runGC: this.shouldRunGC,\n runSweep: this.shouldRunSweep,\n writeAtRoot: this._writeDataAtRoot,\n testMode: this.testMode,\n sessionExpiry: this.sessionExpiryTimeoutMs,\n inactiveTimeout: this.inactiveTimeoutMs,\n existing: createParams.existing,\n trackGCState: this.trackGCState,\n ...this.gcOptions,\n });\n if (this.isSummarizerClient) {\n this.mc.logger.sendTelemetryEvent({\n eventName: \"GarbageCollectorLoaded\",\n gcConfigs: gcConfigProps,\n });\n }\n\n // Initialize the base state that is used to detect when inactive objects are used.\n if (this.shouldRunGC) {\n this.initializeBaseStateP.catch((error) => {\n const dpe = DataProcessingError.wrapIfUnrecognized(\n error,\n \"FailedToInitializeGC\",\n );\n dpe.addTelemetryProperties({ gcConfigs: gcConfigProps });\n throw dpe;\n });\n }\n }\n\n /**\n * Runs garbage collection and updates the reference / used state of the nodes in the container.\n * @returns the number of data stores that have been marked as unreferenced.\n */\n public async collectGarbage(\n options: {\n /** Logger to use for logging GC events */\n logger?: ITelemetryLogger;\n /** True to run GC sweep phase after the mark phase */\n runSweep?: boolean;\n /** True to generate full GC data */\n fullGC?: boolean;\n },\n ): Promise<IGCStats> {\n const {\n fullGC = this.gcOptions.runFullGC === true || this.summaryStateNeedsReset,\n } = options;\n\n const logger = options.logger\n ? ChildLogger.create(options.logger, undefined, { all: { completedGCRuns: () => this.completedRuns } })\n : this.mc.logger;\n\n return PerformanceEvent.timedExecAsync(logger, { eventName: \"GarbageCollection\" }, async (event) => {\n await this.runPreGCSteps();\n\n // Get the runtime's GC data and run GC on the reference graph in it.\n const gcData = await this.runtime.getGCData(fullGC);\n const gcResult = runGarbageCollection(gcData.gcNodes, [\"/\"]);\n\n const gcStats = await this.runPostGCSteps(gcData, gcResult, logger);\n event.end({ ...gcStats });\n this.completedRuns++;\n return gcStats;\n }, { end: true, cancel: \"error\" });\n }\n\n private async runPreGCSteps() {\n // Ensure that base state has been initialized.\n await this.initializeBaseStateP;\n // Let the runtime update its pending state before GC runs.\n await this.runtime.updateStateBeforeGC();\n }\n\n private async runPostGCSteps(gcData: IGarbageCollectionData, gcResult: IGCResult, logger: ITelemetryLogger) {\n // Generate statistics from the current run. This is done before updating the current state because it\n // generates some of its data based on previous state of the system.\n const gcStats = this.generateStats(gcResult);\n\n // Update the state since the last GC run. There can be nodes that were referenced between the last and\n // the current run. We need to identify than and update their unreferenced state if needed.\n this.updateStateSinceLastRun(gcData, logger);\n\n // Update the current state and update the runtime of all routes or ids that used as per the GC run.\n const currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs();\n this.updateCurrentState(gcData, gcResult, currentReferenceTimestampMs);\n this.runtime.updateUsedRoutes(gcResult.referencedNodeIds, currentReferenceTimestampMs);\n\n // Log events for objects that are ready to be deleted by sweep. When we have sweep enabled, we will\n // delete these objects here instead.\n this.logSweepEvents(logger, currentReferenceTimestampMs);\n\n // If we are running in GC test mode, delete objects for unused routes. This enables testing scenarios\n // involving access to deleted data.\n if (this.testMode) {\n this.runtime.deleteUnusedRoutes(gcResult.deletedNodeIds);\n }\n\n // Log pending unreferenced events such as a node being used after inactive. This is done after GC runs and\n // updates its state so that we don't send false positives based on intermediate state. For example, we may get\n // reference to an unreferenced node from another unreferenced node which means the node wasn't revived.\n await this.logUnreferencedEvents(logger);\n\n return gcStats;\n }\n\n /**\n * Summarizes the GC data and returns it as a summary tree.\n * We current write the entire GC state in a single blob. This can be modified later to write multiple\n * blobs. All the blob keys should start with `gcBlobPrefix`.\n */\n public summarize(\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ): ISummarizeResult | undefined {\n if (!this.shouldRunGC || this.previousGCDataFromLastRun === undefined) {\n return;\n }\n\n const gcState: IGarbageCollectionState = { gcNodes: {} };\n for (const [nodeId, outboundRoutes] of Object.entries(this.previousGCDataFromLastRun.gcNodes)) {\n gcState.gcNodes[nodeId] = {\n outboundRoutes,\n unreferencedTimestampMs: this.unreferencedNodesState.get(nodeId)?.unreferencedTimestampMs,\n };\n }\n\n const newSerializedSummaryState = JSON.stringify(generateSortedGCState(gcState));\n\n /**\n * As an optimization if the GC tree hasn't changed and we're tracking the gc state, return a tree handle\n * instead of returning the whole GC tree. If there are changes, then we want to return the whole tree.\n */\n if (this.trackGCState) {\n this.pendingSerializedSummaryState = newSerializedSummaryState;\n if (\n this.latestSerializedSummaryState !== undefined &&\n this.latestSerializedSummaryState === newSerializedSummaryState &&\n !fullTree &&\n trackState\n ) {\n const stats = mergeStats();\n stats.handleNodeCount++;\n return {\n summary: {\n type: SummaryType.Handle,\n handle: `/${gcTreeKey}`,\n handleType: SummaryType.Tree,\n },\n stats,\n };\n }\n }\n\n const builder = new SummaryTreeBuilder();\n builder.addBlob(`${gcBlobPrefix}_root`, newSerializedSummaryState);\n return builder.getSummaryTree();\n }\n\n public getMetadata(): IGCMetadata {\n return {\n /**\n * If GC is enabled, the GC data is written using the current GC version and that is the gcFeature that goes\n * into the metadata blob. If GC is disabled, the gcFeature is 0.\n */\n gcFeature: this.gcEnabled ? this.currentGCVersion : 0,\n sessionExpiryTimeoutMs: this.sessionExpiryTimeoutMs,\n sweepEnabled: this.sweepEnabled,\n };\n }\n\n /**\n * Returns a map of node ids to their base GC details generated from the base summary. This is used by the caller\n * to initialize the GC state of the nodes.\n */\n public async getBaseGCDetails(): Promise<Map<string, IGarbageCollectionDetailsBase>> {\n return this.baseGCDetailsP;\n }\n\n /**\n * Called when the latest summary of the system has been refreshed. This will be used to update the state of the\n * latest summary tracked.\n */\n public async latestSummaryStateRefreshed(\n result: RefreshSummaryResult,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n if (!this.shouldRunGC || !result.latestSummaryUpdated) {\n return;\n }\n\n // If the summary was tracked by this client, it was the one that generated the summary in the first place.\n // Basically, it was written in the current GC version.\n if (result.wasSummaryTracked) {\n this.latestSummaryGCVersion = this.currentGCVersion;\n this.initialStateNeedsReset = false;\n if (this.trackGCState) {\n this.latestSerializedSummaryState = this.pendingSerializedSummaryState;\n this.pendingSerializedSummaryState = undefined;\n }\n return;\n }\n // If the summary was not tracked by this client, update latest GC version and blob from the snapshot in the\n // result as that is now the latest summary.\n const snapshot = result.snapshot;\n const metadataBlobId = snapshot.blobs[metadataBlobName];\n if (metadataBlobId) {\n const metadata = await readAndParseBlob<IContainerRuntimeMetadata>(metadataBlobId);\n this.latestSummaryGCVersion = getGCVersion(metadata);\n }\n\n const gcSnapshotTree = snapshot.trees[gcTreeKey];\n if (gcSnapshotTree !== undefined && this.trackGCState) {\n const latestGCState = await getGCStateFromSnapshot(\n gcSnapshotTree,\n readAndParseBlob,\n );\n this.latestSerializedSummaryState = JSON.stringify(generateSortedGCState(latestGCState));\n } else {\n this.latestSerializedSummaryState = undefined;\n }\n this.pendingSerializedSummaryState = undefined;\n }\n\n /**\n * Called when a node with the given id is updated. If the node is inactive, log an error.\n * @param nodePath - The id of the node that changed.\n * @param reason - Whether the node was loaded or changed.\n * @param timestampMs - The timestamp when the node changed.\n * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.\n * @param requestHeaders - If the node was loaded via request path, the headers in the request.\n */\n public nodeUpdated(\n nodePath: string,\n reason: \"Loaded\" | \"Changed\",\n timestampMs?: number,\n packagePath?: readonly string[],\n requestHeaders?: IRequestHeader,\n ) {\n if (!this.shouldRunGC) {\n return;\n }\n\n const nodeStateTracker = this.unreferencedNodesState.get(nodePath);\n if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {\n this.inactiveNodeUsed(\n reason,\n nodePath,\n nodeStateTracker,\n undefined /* fromNodeId */,\n packagePath,\n timestampMs,\n requestHeaders,\n );\n }\n }\n\n /**\n * Called when an outbound reference is added to a node. This is used to identify all nodes that have been\n * referenced between summaries so that their unreferenced timestamp can be reset.\n *\n * @param fromNodePath - The node from which the reference is added.\n * @param toNodePath - The node to which the reference is added.\n */\n public addedOutboundReference(fromNodePath: string, toNodePath: string) {\n if (!this.shouldRunGC) {\n return;\n }\n\n const outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];\n outboundRoutes.push(toNodePath);\n this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);\n\n const nodeStateTracker = this.unreferencedNodesState.get(toNodePath);\n if (nodeStateTracker && nodeStateTracker.state !== UnreferencedState.Active) {\n this.inactiveNodeUsed(\"Revived\", toNodePath, nodeStateTracker, fromNodePath);\n }\n }\n\n public dispose(): void {\n if (this.sessionExpiryTimer !== undefined) {\n clearTimeout(this.sessionExpiryTimer);\n this.sessionExpiryTimer = undefined;\n }\n }\n\n /**\n * Updates the state of the system as per the current GC run. It does the following:\n * 1. Sets up the current GC state as per the gcData.\n * 2. Starts tracking for nodes that have become unreferenced in this run.\n * 3. Clears tracking for nodes that were unreferenced but became referenced in this run.\n * @param gcData - The data representing the reference graph on which GC is run.\n * @param gcResult - The result of the GC run on the gcData.\n * @param currentReferenceTimestampMs - The timestamp to be used for unreferenced nodes' timestamp.\n */\n private updateCurrentState(\n gcData: IGarbageCollectionData,\n gcResult: IGCResult,\n currentReferenceTimestampMs?: number,\n ) {\n this.previousGCDataFromLastRun = cloneGCData(gcData);\n this.newReferencesSinceLastRun.clear();\n\n // Iterate through the referenced nodes and stop tracking if they were unreferenced before.\n for (const nodeId of gcResult.referencedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker !== undefined) {\n // Stop tracking so as to clear out any running timers.\n nodeStateTracker.stopTracking();\n // Delete the node as we don't need to track it any more.\n this.unreferencedNodesState.delete(nodeId);\n }\n }\n\n /**\n * If there is no current reference time, skip tracking when a node becomes unreferenced. This would happen\n * if no ops have been processed ever and we still try to run GC. If so, there is nothing interesting to track\n * anyway.\n */\n if (currentReferenceTimestampMs === undefined) {\n return;\n }\n\n /**\n * If a node became unreferenced in this run, start tracking it.\n * If a node was already unreferenced, update its tracking information. Since the current reference time is\n * from the ops seen, this will ensure that we keep updating the unreferenced state as time moves forward.\n */\n for (const nodeId of gcResult.deletedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker === undefined) {\n this.unreferencedNodesState.set(\n nodeId,\n new UnreferencedStateTracker(\n currentReferenceTimestampMs,\n this.inactiveTimeoutMs,\n this.sweepTimeoutMs,\n currentReferenceTimestampMs,\n ),\n );\n } else {\n nodeStateTracker.updateTracking(currentReferenceTimestampMs);\n }\n }\n }\n\n /**\n * Since GC runs periodically, the GC data that is generated only tells us the state of the world at that point in\n * time. It's possible that nodes transition from `unreferenced -> referenced -> unreferenced` between two runs. The\n * unreferenced timestamp of such nodes needs to be reset as they may have been accessed when they were referenced.\n *\n * This function identifies nodes that were referenced since last run and removes their unreferenced state, if any.\n * If these nodes are currently unreferenced, they will be assigned new unreferenced state by the current run.\n */\n private updateStateSinceLastRun(currentGCData: IGarbageCollectionData, logger: ITelemetryLogger) {\n // If we haven't run GC before there is nothing to do.\n if (this.previousGCDataFromLastRun === undefined) {\n return;\n }\n\n // Find any references that haven't been identified correctly.\n const missingExplicitReferences = this.findMissingExplicitReferences(\n currentGCData,\n this.previousGCDataFromLastRun,\n this.newReferencesSinceLastRun,\n );\n\n if (this.writeDataAtRoot && missingExplicitReferences.length > 0) {\n missingExplicitReferences.forEach((missingExplicitReference) => {\n const event: ITelemetryPerformanceEvent = {\n eventName: \"gcUnknownOutboundReferences\",\n gcNodeId: missingExplicitReference[0],\n gcRoutes: JSON.stringify(missingExplicitReference[1]),\n };\n logger.sendPerformanceEvent(event);\n });\n }\n\n // No references were added since the last run so we don't have to update reference states of any unreferenced\n // nodes\n if (this.newReferencesSinceLastRun.size === 0) {\n return;\n }\n\n /**\n * Generate a super set of the GC data that contains the nodes and edges from last run, plus any new node and\n * edges that have been added since then. To do this, combine the GC data from the last run and the current\n * run, and then add the references since last run.\n *\n * Note on why we need to combine the data from previous run, current run and all references in between -\n * 1. We need data from last run because some of its references may have been deleted since then. If those\n * references added new outbound references before getting deleted, we need to detect them.\n * 2. We need new outbound references since last run because some of them may have been deleted later. If those\n * references added new outbound references before getting deleted, we need to detect them.\n * 3. We need data from the current run because currently we may not detect when DDSes are referenced:\n * - We don't require DDSes handles to be stored in a referenced DDS. For this, we need GC at DDS level\n * which is tracked by https://github.com/microsoft/FluidFramework/issues/8470.\n * - A new data store may have \"root\" DDSes already created and we don't detect them today.\n */\n const gcDataSuperSet = concatGarbageCollectionData(this.previousGCDataFromLastRun, currentGCData);\n this.newReferencesSinceLastRun.forEach((outboundRoutes: string[], sourceNodeId: string) => {\n if (gcDataSuperSet.gcNodes[sourceNodeId] === undefined) {\n gcDataSuperSet.gcNodes[sourceNodeId] = outboundRoutes;\n } else {\n gcDataSuperSet.gcNodes[sourceNodeId].push(...outboundRoutes);\n }\n });\n\n /**\n * Run GC on the above reference graph to find all nodes that are referenced. For each one, if they are\n * unreferenced, stop tracking them and remove from unreferenced list.\n * Some of these nodes may be unreferenced now and if so, the current run will add unreferenced state for them.\n */\n const gcResult = runGarbageCollection(gcDataSuperSet.gcNodes, [\"/\"]);\n for (const nodeId of gcResult.referencedNodeIds) {\n const nodeStateTracker = this.unreferencedNodesState.get(nodeId);\n if (nodeStateTracker !== undefined) {\n // Stop tracking so as to clear out any running timers.\n nodeStateTracker.stopTracking();\n // Delete the node as we don't need to track it any more.\n this.unreferencedNodesState.delete(nodeId);\n }\n }\n }\n\n /**\n * Finds all new references or outbound routes in the current graph that haven't been explicitly notified to GC.\n * The principle is that every new reference or outbound route must be notified to GC via the\n * addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.\n *\n * In more simple terms:\n * Missing Explicit References = Current References - Previous References - Explicitly Added References;\n *\n * @param currentGCData - The GC data (reference graph) from the current GC run.\n * @param previousGCData - The GC data (reference graph) from the previous GC run.\n * @param explicitReferences - New references added explicity between the previous and the current run.\n * @returns - a list of missing explicit references\n */\n private findMissingExplicitReferences(\n currentGCData: IGarbageCollectionData,\n previousGCData: IGarbageCollectionData,\n explicitReferences: Map<string, string[]>,\n ): [string, string[]][] {\n assert(\n previousGCData !== undefined,\n 0x2b7, /* \"Can't validate correctness without GC data from last run\" */\n );\n\n const currentGraph = Object.entries(currentGCData.gcNodes);\n const missingExplicitReferences: [string, string[]][] = [];\n currentGraph.forEach(([nodeId, currentOutboundRoutes]) => {\n const previousRoutes = previousGCData.gcNodes[nodeId] ?? [];\n const explicitRoutes = explicitReferences.get(nodeId) ?? [];\n const missingExplicitRoutes: string[] = [];\n currentOutboundRoutes.forEach((route) => {\n const isBlobOrDataStoreRoute =\n this.runtime.getNodeType(route) === GCNodeType.Blob ||\n this.runtime.getNodeType(route) === GCNodeType.DataStore;\n // Ignore implicitly added DDS routes to their parent datastores\n const notRouteFromDDSToParentDataStore = !nodeId.startsWith(route);\n if (\n isBlobOrDataStoreRoute &&\n notRouteFromDDSToParentDataStore &&\n (!previousRoutes.includes(route) && !explicitRoutes.includes(route))\n ) {\n missingExplicitRoutes.push(route);\n }\n });\n if (missingExplicitRoutes.length > 0) {\n missingExplicitReferences.push([nodeId, missingExplicitRoutes]);\n }\n });\n\n // Ideally missingExplicitReferences should always have a size 0\n return missingExplicitReferences;\n }\n\n /**\n * Generates the stats of a garbage collection run from the given results of the run.\n * @param gcResult - The result of a GC run.\n * @returns the GC stats of the GC run.\n */\n private generateStats(gcResult: IGCResult): IGCStats {\n const gcStats: IGCStats = {\n nodeCount: 0,\n dataStoreCount: 0,\n attachmentBlobCount: 0,\n unrefNodeCount: 0,\n unrefDataStoreCount: 0,\n unrefAttachmentBlobCount: 0,\n updatedNodeCount: 0,\n updatedDataStoreCount: 0,\n updatedAttachmentBlobCount: 0,\n };\n\n const updateNodeStats = (nodeId: string, referenced: boolean) => {\n gcStats.nodeCount++;\n // If there is no previous GC data, every node's state is generated and is considered as updated.\n // Otherwise, find out if any node went from referenced to unreferenced or vice-versa.\n const stateUpdated = this.previousGCDataFromLastRun === undefined ||\n this.unreferencedNodesState.has(nodeId) === referenced;\n if (stateUpdated) {\n gcStats.updatedNodeCount++;\n }\n if (!referenced) {\n gcStats.unrefNodeCount++;\n }\n\n if (this.runtime.getNodeType(nodeId) === GCNodeType.DataStore) {\n gcStats.dataStoreCount++;\n if (stateUpdated) {\n gcStats.updatedDataStoreCount++;\n }\n if (!referenced) {\n gcStats.unrefDataStoreCount++;\n }\n }\n if (this.runtime.getNodeType(nodeId) === GCNodeType.Blob) {\n gcStats.attachmentBlobCount++;\n if (stateUpdated) {\n gcStats.updatedAttachmentBlobCount++;\n }\n if (!referenced) {\n gcStats.unrefAttachmentBlobCount++;\n }\n }\n };\n\n for (const nodeId of gcResult.referencedNodeIds) {\n updateNodeStats(nodeId, true /* referenced */);\n }\n\n for (const nodeId of gcResult.deletedNodeIds) {\n updateNodeStats(nodeId, false /* referenced */);\n }\n\n return gcStats;\n }\n\n /**\n * For nodes that are ready to sweep, log an event for now. Until we start running sweep which deletes objects,\n * this will give us a view into how much deleted content a container has.\n */\n private logSweepEvents(logger: ITelemetryLogger, currentReferenceTimestampMs?: number) {\n if (this.mc.config.getBoolean(disableSweepLogKey) === true\n || currentReferenceTimestampMs === undefined\n || this.sweepTimeoutMs === undefined) {\n return;\n }\n\n this.unreferencedNodesState.forEach((nodeStateTracker, nodeId) => {\n if (nodeStateTracker.state !== UnreferencedState.SweepReady) {\n return;\n }\n\n const nodeType = this.runtime.getNodeType(nodeId);\n if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {\n return;\n }\n\n // Log deleted event for each node only once to reduce noise in telemetry.\n const uniqueEventId = `Deleted-${nodeId}`;\n if (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n return;\n }\n this.loggedUnreferencedEvents.add(uniqueEventId);\n logger.sendTelemetryEvent({\n eventName: \"GCObjectDeleted\",\n id: nodeId,\n type: nodeType,\n age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,\n timeout: this.sweepTimeoutMs,\n completedGCRuns: this.completedRuns,\n lastSummaryTime: this.getLastSummaryTimestampMs(),\n });\n });\n }\n\n /**\n * Called when an inactive node is used after. Queue up an event that will be logged next time GC runs.\n */\n private inactiveNodeUsed(\n usageType: \"Changed\" | \"Loaded\" | \"Revived\",\n nodeId: string,\n nodeStateTracker: UnreferencedStateTracker,\n fromNodeId?: string,\n packagePath?: readonly string[],\n currentReferenceTimestampMs = this.runtime.getCurrentReferenceTimestampMs(),\n requestHeaders?: IRequestHeader,\n ) {\n // If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n // logging as nothing interesting would have happened worth logging.\n // If the node is active, skip logging.\n if (currentReferenceTimestampMs === undefined || nodeStateTracker.state === UnreferencedState.Active) {\n return;\n }\n\n // For non-summarizer clients, only log \"Loaded\" type events since these objects may not be loaded in the\n // summarizer clients if they are based off of user actions (such as scrolling to content for these objects).\n if (!this.isSummarizerClient && usageType !== \"Loaded\") {\n return;\n }\n\n // We only care about data stores and attachment blobs for this telemetry since GC only marks these objects\n // as unreferenced. Also, if an inactive DDS is used, the corresponding data store store will also be used.\n const nodeType = this.runtime.getNodeType(nodeId);\n if (nodeType !== GCNodeType.DataStore && nodeType !== GCNodeType.Blob) {\n return;\n }\n\n const state = nodeStateTracker.state;\n const uniqueEventId = `${state}-${nodeId}-${usageType}`;\n if (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n return;\n }\n this.loggedUnreferencedEvents.add(uniqueEventId);\n\n const propsToLog = {\n id: nodeId,\n type: nodeType,\n unrefTime: nodeStateTracker.unreferencedTimestampMs,\n age: currentReferenceTimestampMs - nodeStateTracker.unreferencedTimestampMs,\n timeout: nodeStateTracker.state === UnreferencedState.Inactive\n ? this.inactiveTimeoutMs\n : this.sweepTimeoutMs,\n completedGCRuns: this.completedRuns,\n lastSummaryTime: this.getLastSummaryTimestampMs(),\n externalRequest: requestHeaders?.[RuntimeHeaders.externalRequest],\n viaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],\n fromId: fromNodeId,\n };\n\n // For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.\n // For non-summarizer client, log the event now since GC won't run on it. This may result in false positives\n // but it's a good signal nonetheless and we can consume it with a grain of salt.\n if (this.isSummarizerClient) {\n this.pendingEventsQueue.push({ ...propsToLog, usageType, state });\n } else {\n this.mc.logger.sendErrorEvent({\n ...propsToLog,\n eventName: `${state}Object_${usageType}`,\n pkg: packagePath ? { value: packagePath.join(\"/\"), tag: TelemetryDataTag.CodeArtifact } : undefined,\n });\n }\n }\n\n private async logUnreferencedEvents(logger: ITelemetryLogger) {\n for (const eventProps of this.pendingEventsQueue) {\n const { usageType, state, ...propsToLog } = eventProps;\n /**\n * Revived event is logged only if the node is active. If the node is not active, the reference to it was\n * from another unreferenced node and this scenario is not interesting to log.\n * Loaded and Changed events are logged only if the node is not active. If the node is active, it was\n * revived and a Revived event will be logged for it.\n */\n const nodeStateTracker = this.unreferencedNodesState.get(eventProps.id);\n const active = nodeStateTracker === undefined || nodeStateTracker.state === UnreferencedState.Active;\n if ((usageType === \"Revived\") === active) {\n const pkg = await this.getNodePackagePath(eventProps.id);\n const fromPkg = eventProps.fromId ? await this.getNodePackagePath(eventProps.fromId) : undefined;\n logger.sendErrorEvent({\n ...propsToLog,\n eventName: `${state}Object_${usageType}`,\n pkg: pkg ? { value: pkg.join(\"/\"), tag: TelemetryDataTag.CodeArtifact } : undefined,\n fromPkg: fromPkg ? { value: fromPkg.join(\"/\"), tag: TelemetryDataTag.CodeArtifact } : undefined,\n });\n }\n }\n this.pendingEventsQueue = [];\n }\n}\n\n/**\n * Gets the garbage collection state from the given snapshot tree. The GC state may be written into multiple blobs.\n * Merge the GC state from all such blobs and return the merged GC state.\n */\nasync function getGCStateFromSnapshot(\n gcSnapshotTree: ISnapshotTree,\n readAndParseBlob: ReadAndParseBlob,\n): Promise<IGarbageCollectionState> {\n let rootGCState: IGarbageCollectionState = { gcNodes: {} };\n for (const key of Object.keys(gcSnapshotTree.blobs)) {\n // Skip blobs that do not start with the GC prefix.\n if (!key.startsWith(gcBlobPrefix)) {\n continue;\n }\n\n const blobId = gcSnapshotTree.blobs[key];\n if (blobId === undefined) {\n continue;\n }\n const gcState = await readAndParseBlob<IGarbageCollectionState>(blobId);\n assert(gcState !== undefined, 0x2ad /* \"GC blob missing from snapshot\" */);\n // Merge the GC state of this blob into the root GC state.\n rootGCState = concatGarbageCollectionStates(rootGCState, gcState);\n }\n return rootGCState;\n}\n\nfunction generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState {\n const sortableArray: [string, IGarbageCollectionNodeData][] = Object.entries(gcState.gcNodes);\n sortableArray.sort(([a], [b]) => a.localeCompare(b));\n const sortedGCState: IGarbageCollectionState = { gcNodes: {} };\n for (const [nodeId, nodeData] of sortableArray) {\n nodeData.outboundRoutes.sort();\n sortedGCState.gcNodes[nodeId] = nodeData;\n }\n return sortedGCState;\n}\n\n/**\n * setLongTimeout is used for timeouts longer than setTimeout's ~24.8 day max\n * @param timeoutMs - the total time the timeout needs to last in ms\n * @param timeoutFn - the function to execute when the timer ends\n * @param setTimerFn - the function used to update your timer variable\n */\nfunction setLongTimeout(\n timeoutMs: number,\n timeoutFn: () => void,\n setTimerFn: (timer: ReturnType<typeof setTimeout>) => void,\n) {\n // The setTimeout max is 24.8 days before looping occurs.\n const maxTimeout = 2147483647;\n let timer: ReturnType<typeof setTimeout>;\n if (timeoutMs > maxTimeout) {\n const newTimeoutMs = timeoutMs - maxTimeout;\n timer = setTimeout(() => setLongTimeout(newTimeoutMs, timeoutFn, setTimerFn), maxTimeout);\n } else {\n timer = setTimeout(() => timeoutFn(), timeoutMs);\n }\n setTimerFn(timer);\n}\n"]}
package/lib/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { ContainerMessageType, IChunkedOp, ContainerRuntimeMessage, IGCRuntimeOptions, ISummaryRuntimeOptions, ISummaryBaseConfiguration, ISummaryConfigurationHeuristics, ISummaryConfigurationDisableSummarizer, ISummaryConfigurationDisableHeuristics, IContainerRuntimeOptions, IPendingRuntimeState, IRootSummaryTreeWithStats, isRuntimeMessage, RuntimeMessage, unpackRuntimeMessage, ScheduleManager, agentSchedulerId, ContainerRuntime, RuntimeHeaders, ISummaryConfiguration, DefaultSummaryConfiguration, } from "./containerRuntime";
6
- export { DeltaScheduler } from "./deltaScheduler";
7
- export { FluidDataStoreRegistry } from "./dataStoreRegistry";
8
- export { gcBlobPrefix, gcTreeKey, IGarbageCollectionRuntime, IGCStats, } from "./garbageCollection";
9
- export { IPendingFlush, IPendingFlushMode, IPendingLocalState, IPendingMessage, IPendingState, } from "./pendingStateManager";
10
- export { Summarizer } from "./summarizer";
11
- export { EnqueueSummarizeResult, IAckSummaryResult, IBaseSummarizeResult, IBroadcastSummaryResult, ICancellationToken, IConnectableRuntime, IEnqueueSummarizeOptions, IGenerateSummaryTreeResult, IGeneratedSummaryStats, INackSummaryResult, IOnDemandSummarizeOptions, IProvideSummarizer, ISubmitSummaryOpResult, ISubmitSummaryOptions, ISummarizeOptions, ISummarizeResults, ISummarizer, ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, ISummaryCancellationToken, IUploadSummaryResult, SubmitSummaryResult, SummarizeResultPart, SummarizerStopReason, } from "./summarizerTypes";
12
- export { IAckedSummary, IClientSummaryWatcher, ISummary, ISummaryCollectionOpEvents, ISummaryAckMessage, ISummaryNackMessage, ISummaryOpMessage, OpActionEventListener, OpActionEventName, SummaryCollection, } from "./summaryCollection";
13
- export { ICancellableSummarizerController, neverCancelledSummaryToken } from "./runWhileConnectedCoordinator";
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EACpB,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,2BAA2B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,QAAQ,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,aAAa,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACH,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"}
package/lib/index.js DELETED
@@ -1,13 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { ContainerMessageType, isRuntimeMessage, RuntimeMessage, unpackRuntimeMessage, ScheduleManager, agentSchedulerId, ContainerRuntime, RuntimeHeaders, DefaultSummaryConfiguration, } from "./containerRuntime";
6
- export { DeltaScheduler } from "./deltaScheduler";
7
- export { FluidDataStoreRegistry } from "./dataStoreRegistry";
8
- export { gcBlobPrefix, gcTreeKey, } from "./garbageCollection";
9
- export { Summarizer } from "./summarizer";
10
- export { ISummarizer, } from "./summarizerTypes";
11
- export { SummaryCollection, } from "./summaryCollection";
12
- export { neverCancelledSummaryToken } from "./runWhileConnectedCoordinator";
13
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EAYpB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EAEd,2BAA2B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,YAAY,EACZ,SAAS,GAGZ,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAiBH,WAAW,GAUd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAUH,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAoC,0BAA0B,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n ContainerMessageType,\n IChunkedOp,\n ContainerRuntimeMessage,\n IGCRuntimeOptions,\n ISummaryRuntimeOptions,\n ISummaryBaseConfiguration,\n ISummaryConfigurationHeuristics,\n ISummaryConfigurationDisableSummarizer,\n ISummaryConfigurationDisableHeuristics,\n IContainerRuntimeOptions,\n IPendingRuntimeState,\n IRootSummaryTreeWithStats,\n isRuntimeMessage,\n RuntimeMessage,\n unpackRuntimeMessage,\n ScheduleManager,\n agentSchedulerId,\n ContainerRuntime,\n RuntimeHeaders,\n ISummaryConfiguration,\n DefaultSummaryConfiguration,\n} from \"./containerRuntime\";\nexport { DeltaScheduler } from \"./deltaScheduler\";\nexport { FluidDataStoreRegistry } from \"./dataStoreRegistry\";\nexport {\n gcBlobPrefix,\n gcTreeKey,\n IGarbageCollectionRuntime,\n IGCStats,\n} from \"./garbageCollection\";\nexport {\n IPendingFlush,\n IPendingFlushMode,\n IPendingLocalState,\n IPendingMessage,\n IPendingState,\n} from \"./pendingStateManager\";\nexport { Summarizer } from \"./summarizer\";\nexport {\n EnqueueSummarizeResult,\n IAckSummaryResult,\n IBaseSummarizeResult,\n IBroadcastSummaryResult,\n ICancellationToken,\n IConnectableRuntime,\n IEnqueueSummarizeOptions,\n IGenerateSummaryTreeResult,\n IGeneratedSummaryStats,\n INackSummaryResult,\n IOnDemandSummarizeOptions,\n IProvideSummarizer,\n ISubmitSummaryOpResult,\n ISubmitSummaryOptions,\n ISummarizeOptions,\n ISummarizeResults,\n ISummarizer,\n ISummarizerEvents,\n ISummarizerInternalsProvider,\n ISummarizerRuntime,\n ISummarizingWarning,\n ISummaryCancellationToken,\n IUploadSummaryResult,\n SubmitSummaryResult,\n SummarizeResultPart,\n SummarizerStopReason,\n} from \"./summarizerTypes\";\nexport {\n IAckedSummary,\n IClientSummaryWatcher,\n ISummary,\n ISummaryCollectionOpEvents,\n ISummaryAckMessage,\n ISummaryNackMessage,\n ISummaryOpMessage,\n OpActionEventListener,\n OpActionEventName,\n SummaryCollection,\n} from \"./summaryCollection\";\nexport { ICancellableSummarizerController, neverCancelledSummaryToken } from \"./runWhileConnectedCoordinator\";\n"]}
@@ -1,22 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IDeltaManager } from "@fluidframework/container-definitions";
6
- import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
- export declare class OpTracker {
8
- /**
9
- * Used for storing the message content size when
10
- * the message is pushed onto the inbound queue.
11
- */
12
- private readonly messageSize;
13
- private _nonSystemOpCount;
14
- get nonSystemOpCount(): number;
15
- private _opsSizeAccumulator;
16
- get opsSizeAccumulator(): number;
17
- constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, disabled: boolean);
18
- private static messageId;
19
- private static messageHasData;
20
- reset(): void;
21
- }
22
- //# sourceMappingURL=opTelemetry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opTelemetry.d.ts","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAG9C,qBAAa,SAAS;IAClB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD,OAAO,CAAC,iBAAiB,CAAa;IACtC,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED,OAAO,CAAC,mBAAmB,CAAa;IACxC,IAAW,kBAAkB,IAAI,MAAM,CAEtC;gBAGG,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,EACxE,QAAQ,EAAE,OAAO;IA2BrB,OAAO,CAAC,MAAM,CAAC,SAAS;IAIxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAItB,KAAK;CAIf"}
@@ -1,56 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { isRuntimeMessage } from "@fluidframework/driver-utils";
6
- export class OpTracker {
7
- constructor(deltaManager, disabled) {
8
- /**
9
- * Used for storing the message content size when
10
- * the message is pushed onto the inbound queue.
11
- */
12
- this.messageSize = new Map();
13
- this._nonSystemOpCount = 0;
14
- this._opsSizeAccumulator = 0;
15
- if (disabled) {
16
- return;
17
- }
18
- // Record the message content size when we receive it.
19
- // We should not log this value, as summarization can happen between the time the message
20
- // is received and until it is processed (the 'op' event).
21
- deltaManager.inbound.on("push", (message) => {
22
- var _a;
23
- // Some messages my already have string contents at this point,
24
- // so stringifying them again will add inaccurate overhead.
25
- const messageContent = typeof message.contents === "string" ?
26
- message.contents :
27
- (_a = JSON.stringify(message.contents)) !== null && _a !== void 0 ? _a : "";
28
- const messageData = OpTracker.messageHasData(message) ? message.data : "";
29
- this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;
30
- });
31
- deltaManager.on("op", (message) => {
32
- var _a;
33
- this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;
34
- const id = OpTracker.messageId(message);
35
- this._opsSizeAccumulator += (_a = this.messageSize[id]) !== null && _a !== void 0 ? _a : 0;
36
- this.messageSize.delete(id);
37
- });
38
- }
39
- get nonSystemOpCount() {
40
- return this._nonSystemOpCount;
41
- }
42
- get opsSizeAccumulator() {
43
- return this._opsSizeAccumulator;
44
- }
45
- static messageId(message) {
46
- return message.sequenceNumber;
47
- }
48
- static messageHasData(message) {
49
- return message.data !== undefined;
50
- }
51
- reset() {
52
- this._nonSystemOpCount = 0;
53
- this._opsSizeAccumulator = 0;
54
- }
55
- }
56
- //# sourceMappingURL=opTelemetry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opTelemetry.js","sourceRoot":"","sources":["../src/opTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,OAAO,SAAS;IAgBlB,YACI,YAAwE,EACxE,QAAiB;QAjBrB;;;WAGG;QACc,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QACjD,sBAAiB,GAAW,CAAC,CAAC;QAK9B,wBAAmB,GAAW,CAAC,CAAC;QASpC,IAAI,QAAQ,EAAE;YACV,OAAO;SACV;QAED,sDAAsD;QACtD,yFAAyF;QACzF,0DAA0D;QAC1D,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,OAAkC,EAAE,EAAE;;YACnE,+DAA+D;YAC/D,2DAA2D;YAC3D,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;gBACzD,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAClB,MAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAC;YAC3C,MAAM,WAAW,GAAG,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAChG,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,OAAkC,EAAE,EAAE;;YACzD,IAAI,CAAC,iBAAiB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,IAAI,MAAA,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAC;YACtD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACP,CAAC;IApCD,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAGD,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IA+BO,MAAM,CAAC,SAAS,CAAC,OAAkC;QACvD,OAAO,OAAO,CAAC,cAAc,CAAC;IAClC,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,OAAkC;QAC5D,OAAQ,OAA2C,CAAC,IAAI,KAAK,SAAS,CAAC;IAC3E,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IACjC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport {\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISequencedDocumentSystemMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\n\nexport class OpTracker {\n /**\n * Used for storing the message content size when\n * the message is pushed onto the inbound queue.\n */\n private readonly messageSize = new Map<number, number>();\n private _nonSystemOpCount: number = 0;\n public get nonSystemOpCount(): number {\n return this._nonSystemOpCount;\n }\n\n private _opsSizeAccumulator: number = 0;\n public get opsSizeAccumulator(): number {\n return this._opsSizeAccumulator;\n }\n\n public constructor(\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n disabled: boolean,\n ) {\n if (disabled) {\n return;\n }\n\n // Record the message content size when we receive it.\n // We should not log this value, as summarization can happen between the time the message\n // is received and until it is processed (the 'op' event).\n deltaManager.inbound.on(\"push\", (message: ISequencedDocumentMessage) => {\n // Some messages my already have string contents at this point,\n // so stringifying them again will add inaccurate overhead.\n const messageContent = typeof message.contents === \"string\" ?\n message.contents :\n JSON.stringify(message.contents) ?? \"\";\n const messageData = OpTracker.messageHasData(message) ? message.data : \"\";\n this.messageSize[OpTracker.messageId(message)] = messageContent.length + messageData.length;\n });\n\n deltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n this._nonSystemOpCount += !isRuntimeMessage(message) ? 0 : 1;\n const id = OpTracker.messageId(message);\n this._opsSizeAccumulator += this.messageSize[id] ?? 0;\n this.messageSize.delete(id);\n });\n }\n\n private static messageId(message: ISequencedDocumentMessage): number {\n return message.sequenceNumber;\n }\n\n private static messageHasData(message: ISequencedDocumentMessage): message is ISequencedDocumentSystemMessage {\n return (message as ISequencedDocumentSystemMessage).data !== undefined;\n }\n\n public reset() {\n this._nonSystemOpCount = 0;\n this._opsSizeAccumulator = 0;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"orderedClientElection.d.ts","sourceRoot":"","sources":["../src/orderedClientElection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAoB,MAAM,sCAAsC,CAAC;AAMjG,oBAAY,mBAAmB,GAAG,SAAS,GA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IAED;;OAEG;IACI,kBAAkB,CAAC,cAAsB;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC5F,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc,EAAE;YAClF,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;SACvD;aAAM;YACH,4FAA4F;YAC5F,wDAAwD;YACxD,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;SACvD;IACL,CAAC;IAEM,qBAAqB;;QACxB,OAAO,MAAA,IAAI,CAAC,uBAAuB,CAAC,MAAA,IAAI,CAAC,cAAc,0CAAE,aAAa,CAAC,mCACnE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAChF,CAAC;IAEM,SAAS;;QACZ,OAAO;YACH,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,eAAe,EAAE,MAAA,IAAI,CAAC,aAAa,0CAAE,QAAQ;YAC7C,eAAe,EAAE,MAAA,IAAI,CAAC,aAAa,0CAAE,QAAQ;SAChD,CAAC;IACN,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @rushstack/no-new-null */\nimport { IEvent, IEventProvider, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { IClient, IQuorumClients, ISequencedClient } from \"@fluidframework/protocol-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { summarizerClientType } from \"./summarizerClientElection\";\n\n// helper types for recursive readonly.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ImmutablePrimitives = undefined | null | boolean | string | number | Function;\nexport type Immutable<T> = T extends ImmutablePrimitives\n ? T\n : T extends (infer A)[]\n ? readonly Immutable<A>[]\n : T extends Map<infer K, infer V>\n ? ReadonlyMap<Immutable<K>, Immutable<V>>\n : T extends Set<infer V>\n ? ReadonlySet<Immutable<V>>\n : { readonly [K in keyof T]: Immutable<T[K]> };\n\n/** Minimum information for a client tracked for election consideration. */\nexport interface ITrackedClient {\n readonly clientId: string;\n readonly sequenceNumber: number;\n readonly client: Immutable<IClient>;\n}\n\n/** Common contract for link nodes within an OrderedClientCollection. */\nexport interface ILinkNode {\n readonly sequenceNumber: number;\n youngerClient: ILinkedClient | undefined;\n}\n\n/** Placeholder root node within an OrderedClientCollection; does not represent a client. */\nexport interface IRootLinkNode extends ILinkNode {\n readonly sequenceNumber: -1;\n readonly olderClient: undefined;\n}\n\n/** Additional information required to keep track of the client within the doubly-linked list. */\nexport interface ILinkedClient extends ILinkNode, ITrackedClient {\n olderClient: LinkNode;\n}\n\n/** Any link node within OrderedClientCollection including the placeholder root node. */\nexport type LinkNode = IRootLinkNode | ILinkedClient;\n\n/** Events raised by an OrderedClientCollection. */\nexport interface IOrderedClientCollectionEvents extends IEvent {\n /** Event fires when client is being added. */\n (event: \"addClient\" | \"removeClient\", listener: (client: ILinkedClient, sequenceNumber: number) => void);\n}\n\n/** Contract for a sorted collection of all clients in the quorum. */\nexport interface IOrderedClientCollection extends IEventProvider<IOrderedClientCollectionEvents> {\n /** Count of clients in the collection. */\n readonly count: number;\n /** Pointer to the oldest client in the collection. */\n readonly oldestClient: ILinkedClient | undefined;\n /** Returns a sorted array of all the clients in the collection. */\n getAllClients(): ILinkedClient[];\n}\n\n/**\n * Tracks clients in the Quorum. It maintains their order using their join op\n * sequence numbers.\n * Internally, the collection of clients is maintained in a doubly-linked list,\n * with pointers to both the first and last nodes.\n * The first (root) node is a placeholder to simplify logic and reduce null checking.\n */\nexport class OrderedClientCollection\n extends TypedEventEmitter<IOrderedClientCollectionEvents>\n implements IOrderedClientCollection {\n /** Collection of ALL clients currently in the quorum, with client ids as keys. */\n private readonly clientMap = new Map<string, ILinkedClient>();\n /** Placeholder head node of linked list, for simplified null checking. */\n private readonly rootNode: IRootLinkNode = {\n sequenceNumber: -1,\n olderClient: undefined,\n youngerClient: undefined,\n };\n /** Pointer to end of linked list, for optimized client adds. */\n private _youngestClient: LinkNode = this.rootNode;\n private readonly logger: ITelemetryLogger;\n\n public get count() {\n return this.clientMap.size;\n }\n public get oldestClient() {\n return this.rootNode.youngerClient;\n }\n\n constructor(\n logger: ITelemetryLogger,\n deltaManager: Pick<IDeltaManager<unknown, unknown>, \"lastSequenceNumber\">,\n quorum: Pick<IQuorumClients, \"getMembers\" | \"on\">,\n ) {\n super();\n this.logger = ChildLogger.create(logger, \"OrderedClientCollection\");\n const members = quorum.getMembers();\n for (const [clientId, client] of members) {\n this.addClient(clientId, client);\n }\n\n quorum.on(\"addMember\", (clientId, client) => {\n const newClient = this.addClient(clientId, client);\n this.emit(\"addClient\", newClient, deltaManager.lastSequenceNumber);\n });\n quorum.on(\"removeMember\", (clientId) => {\n const sequenceNumber = deltaManager.lastSequenceNumber;\n const removeClient = this.removeClient(clientId);\n if (removeClient === undefined) {\n this.logger.sendErrorEvent({ eventName: \"ClientNotFound\", clientId, sequenceNumber });\n } else {\n this.emit(\"removeClient\", removeClient, sequenceNumber);\n }\n });\n }\n\n private addClient(clientId: string, client: ISequencedClient): ITrackedClient {\n // Normal case is adding the latest client, which will bypass loop.\n // Find where it belongs otherwise (maybe possible during initial load?).\n assert(client.sequenceNumber > -1, 0x1f6 /* \"Negative client sequence number not allowed\" */);\n let currClient = this._youngestClient;\n while (currClient.sequenceNumber > client.sequenceNumber) {\n assert(currClient.olderClient !== undefined, 0x1f7 /* \"Previous client should always be defined\" */);\n // Note: If adding a client older than the elected client, it will not be automatically elected.\n currClient = currClient.olderClient;\n }\n\n // Now currClient is the node right before where the new client node should be.\n const newClient: ILinkedClient = {\n clientId,\n sequenceNumber: client.sequenceNumber,\n client: { ...client.client }, // shallow clone\n olderClient: currClient,\n youngerClient: currClient.youngerClient,\n };\n\n // Update prev node to point to this new node.\n newClient.olderClient.youngerClient = newClient;\n\n if (newClient.youngerClient === undefined) {\n // Update linked list end pointer to youngest client.\n this._youngestClient = newClient;\n } else {\n // Update next node to point back to this new node.\n newClient.youngerClient.olderClient = newClient;\n }\n\n this.clientMap.set(clientId, newClient);\n return newClient;\n }\n\n private removeClient(clientId: string): ITrackedClient | undefined {\n const removeClient = this.clientMap.get(clientId);\n if (removeClient === undefined) {\n return;\n }\n\n // Update prev node to point to next node.\n removeClient.olderClient.youngerClient = removeClient.youngerClient;\n\n if (removeClient.youngerClient === undefined) {\n // Update linked list end pointer to youngest client.\n this._youngestClient = removeClient.olderClient;\n } else {\n // Update next node to point back to previous node.\n removeClient.youngerClient.olderClient = removeClient.olderClient;\n }\n\n this.clientMap.delete(clientId);\n return removeClient;\n }\n\n /** Returns an array of all clients being tracked in order from oldest to newest. */\n public getAllClients(): ILinkedClient[] {\n const result: ILinkedClient[] = [];\n let currClient: LinkNode = this.rootNode;\n while (currClient.youngerClient !== undefined) {\n result.push(currClient.youngerClient);\n currClient = currClient.youngerClient;\n }\n return result;\n }\n}\n\n/** Events raised by an OrderedClientElection. */\nexport interface IOrderedClientElectionEvents extends IEvent {\n /** Event fires when the currently elected client changes. */\n (event: \"election\", listener: (\n /** Newly elected client. */\n client: ITrackedClient | undefined,\n /** Sequence number where election took place. */\n sequenceNumber: number,\n /** Previously elected client. */\n prevClient: ITrackedClient | undefined,\n ) => void);\n}\n\n/** Serialized state of IOrderedClientElection. */\nexport interface ISerializedElection {\n /** Sequence number at the time of the latest election. */\n readonly electionSequenceNumber: number;\n /** Most recently elected client id. This is either:\n * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n * and the SummaryManager on the elected client will spawn a summarizer client, or\n * 2. the non-interactive summarizer client itself. */\n readonly electedClientId: string | undefined;\n /** Most recently elected parent client id. This is always an interactive client. */\n readonly electedParentId: string | undefined;\n}\n\n/** Contract for maintaining a deterministic client election based on eligibility. */\nexport interface IOrderedClientElection extends IEventProvider<IOrderedClientElectionEvents> {\n /** Count of eligible clients in the collection. */\n readonly eligibleCount: number;\n /** Currently elected client. This is either:\n * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n * and the SummaryManager on the elected client will spawn a summarizer client, or\n * 2. the non-interactive summarizer client itself. */\n readonly electedClient: ITrackedClient | undefined;\n /** Currently elected parent client. This is always an interactive client. */\n readonly electedParent: ITrackedClient | undefined;\n /** Sequence number of most recent election. */\n readonly electionSequenceNumber: number;\n /** Marks the currently elected client as invalid, and elects the next eligible client. */\n incrementElectedClient(sequenceNumber: number): void;\n /** Resets the currently elected client back to the oldest eligible client. */\n resetElectedClient(sequenceNumber: number): void;\n /** Peeks at what the next elected client would be if incrementElectedClient were called. */\n peekNextElectedClient(): ITrackedClient | undefined;\n /** Returns a sorted array of all the eligible clients in the collection. */\n getAllEligibleClients(): ITrackedClient[];\n /** Serialize election data */\n serialize(): ISerializedElection;\n}\n\n/**\n * Adapter for OrderedClientCollection, with the purpose of deterministically maintaining\n * a currently elected client, excluding ineligible clients, in a distributed fashion.\n * This can be true as long as incrementElectedClient and resetElectedClient calls\n * are called under the same conditions for all clients.\n */\nexport class OrderedClientElection\n extends TypedEventEmitter<IOrderedClientElectionEvents>\n implements IOrderedClientElection {\n private _eligibleCount: number = 0;\n private _electedClient: ILinkedClient | undefined;\n private _electedParent: ILinkedClient | undefined;\n private _electionSequenceNumber: number;\n\n public get eligibleCount() {\n return this._eligibleCount;\n }\n public get electionSequenceNumber() {\n return this._electionSequenceNumber;\n }\n\n /**\n * OrderedClientCollection tracks electedClient and electedParent separately. This allows us to handle the case\n * where a new interactive parent client has been elected, but the summarizer is still doing work, so\n * a new summarizer should not yet be spawned. In this case, changing electedParent will cause SummaryManager\n * to stop the current summarizer, but a new summarizer will not be spawned until the old summarizer client has\n * left the quorum.\n *\n * Details:\n *\n * electedParent is the interactive client that has been elected to spawn a summarizer. It is typically the oldest\n * eligible interactive client in the quorum. Only the electedParent is permitted to spawn a summarizer.\n * Once elected, this client will remain the electedParent until it leaves the quorum or the summarizer that\n * it spawned stops producing summaries, at which point a new electedParent will be chosen.\n *\n * electedClient is the non-interactive summarizer client if one exists. If not, then electedClient is equal to\n * electedParent. If electedParent === electedClient, this is the signal for electedParent to spawn a new\n * electedClient. Once a summarizer client becomes electedClient, a new summarizer will not be spawned until\n * electedClient leaves the quorum.\n *\n * A typical sequence looks like this:\n * i. Begin by electing A. electedParent === A, electedClient === A.\n * ii. SummaryManager running on A spawns a summarizer client, A'. electedParent === A, electedClient === A'\n * iii. A' stops producing summaries. A new parent client, B, is elected. electedParent === B, electedClient === A'\n * iv. SummaryManager running on A detects the change to electedParent and tells the summarizer to stop, but A'\n * is in mid-summarization. No new summarizer is spawned, as electedParent !== electedClient.\n * v. A' completes its summary, and the summarizer and backing client are torn down.\n * vi. A' leaves the quorum, and B takes its place as electedClient. electedParent === B, electedClient === B\n * vii. SummaryManager running on B spawns a summarizer client, B'. electedParent === B, electedClient === B'\n */\n public get electedClient() {\n return this._electedClient;\n }\n public get electedParent() {\n return this._electedParent;\n }\n\n constructor(\n logger: ITelemetryLogger,\n private readonly orderedClientCollection: IOrderedClientCollection,\n /** Serialized state from summary or current sequence number at time of load if new. */\n initialState: ISerializedElection | number,\n private readonly isEligibleFn: (c: ITrackedClient) => boolean,\n ) {\n super();\n let initialClient: ILinkedClient | undefined;\n let initialParent: ILinkedClient | undefined;\n for (const client of orderedClientCollection.getAllClients()) {\n this.addClient(client, 0);\n if (typeof initialState !== \"number\") {\n if (client.clientId === initialState.electedClientId) {\n initialClient = client;\n if (initialState.electedParentId === undefined &&\n client.client.details.type !== summarizerClientType) {\n // If there was no elected parent in the serialized data, use this one.\n initialParent = client;\n }\n }\n if (client.clientId === initialState.electedParentId) {\n initialParent = client;\n }\n }\n }\n orderedClientCollection.on(\"addClient\", (client, seq) => this.addClient(client, seq));\n orderedClientCollection.on(\"removeClient\", (client, seq) => this.removeClient(client, seq));\n\n if (typeof initialState === \"number\") {\n this._electionSequenceNumber = initialState;\n } else {\n // Override the initially elected client with the initial state.\n if (initialClient?.clientId !== initialState.electedClientId) {\n // Cannot find initially elected client, so elect undefined.\n logger.sendErrorEvent({\n eventName: \"InitialElectedClientNotFound\",\n electionSequenceNumber: initialState.electionSequenceNumber,\n expectedClientId: initialState.electedClientId,\n electedClientId: initialClient?.clientId,\n clientCount: orderedClientCollection.count,\n });\n } else if (initialClient !== undefined && !isEligibleFn(initialClient)) {\n // Initially elected client is ineligible, so elect next eligible client.\n initialClient = initialParent = this.findFirstEligibleParent(initialParent);\n logger.sendErrorEvent({\n eventName: \"InitialElectedClientIneligible\",\n electionSequenceNumber: initialState.electionSequenceNumber,\n expectedClientId: initialState.electedClientId,\n electedClientId: initialClient?.clientId,\n });\n }\n this._electedParent = initialParent;\n this._electedClient = initialClient;\n this._electionSequenceNumber = initialState.electionSequenceNumber;\n }\n }\n\n /** Tries changing the elected client, raising an event if it is different.\n * Note that this function does no eligibility or suitability checks. If we get here, then\n * we will set _electedClient, and we will set _electedParent if this is an interactive client.\n */\n private tryElectingClient(client: ILinkedClient | undefined, sequenceNumber: number): void {\n let change = false;\n const isSummarizerClient = client?.client.details.type === summarizerClientType;\n const prevClient = this._electedClient;\n if (this._electedClient !== client) {\n // Changing the elected client. Record the sequence number and note that we have to fire an event.\n this._electionSequenceNumber = sequenceNumber;\n this._electedClient = client;\n change = true;\n }\n if (this._electedParent !== client && !isSummarizerClient) {\n // Changing the elected parent as well.\n this._electedParent = client;\n change = true;\n }\n if (change) {\n this.emit(\"election\", client, sequenceNumber, prevClient);\n }\n }\n\n private tryElectingParent(client: ILinkedClient | undefined, sequenceNumber: number): void {\n if (this._electedParent !== client) {\n this._electedParent = client;\n this.emit(\"election\", this._electedClient, sequenceNumber, this._electedClient);\n }\n }\n\n /**\n * Helper function to find the first eligible parent client starting with the passed in client,\n * or undefined if none are eligible.\n * @param client - client to start checking\n * @returns oldest eligible client starting with passed in client or undefined if none.\n */\n private findFirstEligibleParent(client: ILinkedClient | undefined): ILinkedClient | undefined {\n let candidateClient = client;\n while (candidateClient !== undefined &&\n (!this.isEligibleFn(candidateClient) || candidateClient.client.details.type === summarizerClientType)) {\n candidateClient = candidateClient.youngerClient;\n }\n return candidateClient;\n }\n\n /**\n * Updates tracking for when a new client is added to the collection.\n * Will automatically elect that new client if none is elected currently.\n * @param client - client added to the collection\n * @param sequenceNumber - sequence number when client was added\n */\n private addClient(client: ILinkedClient, sequenceNumber: number): void {\n if (this.isEligibleFn(client)) {\n this._eligibleCount++;\n const newClientIsSummarizer = client.client.details.type === summarizerClientType;\n const electedClientIsSummarizer = this._electedClient?.client.details.type === summarizerClientType;\n // Note that we allow a summarizer client to supercede an interactive client as elected client.\n if (this._electedClient === undefined || (!electedClientIsSummarizer && newClientIsSummarizer)) {\n this.tryElectingClient(client, sequenceNumber);\n } else if (this._electedParent === undefined && !newClientIsSummarizer) {\n // This is an odd case. If the _electedClient is set, the _electedParent should be as well.\n this.tryElectingParent(client, sequenceNumber);\n }\n }\n }\n\n /**\n * Updates tracking for when an existing client is removed from the collection.\n * Will automatically elect next oldest client if currently elected is removed.\n * @param client - client removed from the collection\n * @param sequenceNumber - sequence number when client was removed\n */\n private removeClient(client: ILinkedClient, sequenceNumber: number): void {\n if (this.isEligibleFn(client)) {\n this._eligibleCount--;\n if (this._electedClient === client) {\n // Removing the _electedClient. There are 2 possible cases:\n if (this._electedParent !== client) {\n // 1. The _electedClient is a summarizer that we've been allowing to finish its work.\n // Let the _electedParent become the _electedClient so that it can start its own summarizer.\n if (this._electedClient.client.details.type !== summarizerClientType) {\n throw new UsageError(\"Elected client should be a summarizer client 1\");\n }\n this.tryElectingClient(this._electedParent, sequenceNumber);\n } else {\n // 2. The _electedClient is an interactive client that has left the quorum.\n // Automatically shift to next oldest client.\n const nextClient = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n this.tryElectingClient(nextClient, sequenceNumber);\n }\n } else if (this._electedParent === client) {\n // Removing the _electedParent (but not _electedClient).\n // Shift to the next oldest parent, but do not replace the _electedClient,\n // which is a summarizer that is still doing work.\n if (this._electedClient?.client.details.type !== summarizerClientType) {\n throw new UsageError(\"Elected client should be a summarizer client 2\");\n }\n const nextParent = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n this.tryElectingParent(nextParent, sequenceNumber);\n }\n }\n }\n\n public getAllEligibleClients(): ITrackedClient[] {\n return this.orderedClientCollection.getAllClients().filter(this.isEligibleFn);\n }\n\n /** Advance election to the next-oldest client. This is called if the current parent is leaving the quorum,\n * or if the current summarizer is not responsive and we want to stop it and spawn a new one.\n */\n public incrementElectedClient(sequenceNumber: number): void {\n const nextClient = this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n if (this._electedClient === undefined || this._electedClient === this._electedParent) {\n this.tryElectingClient(nextClient, sequenceNumber);\n } else {\n // The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n // Changing the _electedParent will stop the summarizer.\n this.tryElectingParent(nextClient, sequenceNumber);\n }\n }\n\n /** (Re-)start election with the oldest client in the quorum. This is called if we need to summarize\n * and no client has been elected.\n */\n public resetElectedClient(sequenceNumber: number): void {\n const firstClient = this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n if (this._electedClient === undefined || this._electedClient === this._electedParent) {\n this.tryElectingClient(firstClient, sequenceNumber);\n } else {\n // The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n // Changing the _electedParent will stop the summarizer.\n this.tryElectingParent(firstClient, sequenceNumber);\n }\n }\n\n public peekNextElectedClient(): ITrackedClient | undefined {\n return this.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n this.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n }\n\n public serialize(): ISerializedElection {\n return {\n electionSequenceNumber: this.electionSequenceNumber,\n electedClientId: this.electedClient?.clientId,\n electedParentId: this.electedParent?.clientId,\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"1.4.0-115997\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pendingStateManager.d.ts","sourceRoot":"","sources":["../src/pendingStateManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EACH,yBAAyB,EAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAGhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,oBAAoB,CAAC;IAClC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE,GAAG,CAAC;IACb,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC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