@fluidframework/container-runtime 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (690) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +5 -5
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +54 -0
  4. package/README.md +45 -0
  5. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  6. package/api-extractor-lint.json +1 -1
  7. package/api-extractor.json +1 -1
  8. package/api-report/container-runtime.api.md +68 -30
  9. package/dist/batchTracker.d.ts +1 -2
  10. package/dist/batchTracker.d.ts.map +1 -1
  11. package/dist/batchTracker.js.map +1 -1
  12. package/dist/blobManager.js.map +1 -1
  13. package/dist/channelCollection.d.ts +223 -0
  14. package/dist/channelCollection.d.ts.map +1 -0
  15. package/dist/{dataStores.js → channelCollection.js} +399 -83
  16. package/dist/channelCollection.js.map +1 -0
  17. package/dist/connectionTelemetry.d.ts +11 -1
  18. package/dist/connectionTelemetry.d.ts.map +1 -1
  19. package/dist/connectionTelemetry.js +42 -4
  20. package/dist/connectionTelemetry.js.map +1 -1
  21. package/dist/container-runtime-alpha.d.ts +98 -40
  22. package/dist/container-runtime-beta.d.ts +27 -9
  23. package/dist/container-runtime-public.d.ts +27 -9
  24. package/dist/container-runtime-untrimmed.d.ts +123 -40
  25. package/dist/containerHandleContext.d.ts +1 -1
  26. package/dist/containerHandleContext.d.ts.map +1 -1
  27. package/dist/containerHandleContext.js.map +1 -1
  28. package/dist/containerRuntime.d.ts +79 -55
  29. package/dist/containerRuntime.d.ts.map +1 -1
  30. package/dist/containerRuntime.js +541 -411
  31. package/dist/containerRuntime.js.map +1 -1
  32. package/dist/dataStore.d.ts +2 -3
  33. package/dist/dataStore.d.ts.map +1 -1
  34. package/dist/dataStore.js +12 -11
  35. package/dist/dataStore.js.map +1 -1
  36. package/dist/dataStoreContext.d.ts +71 -30
  37. package/dist/dataStoreContext.d.ts.map +1 -1
  38. package/dist/dataStoreContext.js +182 -141
  39. package/dist/dataStoreContext.js.map +1 -1
  40. package/dist/dataStoreContexts.d.ts +1 -1
  41. package/dist/dataStoreContexts.d.ts.map +1 -1
  42. package/dist/dataStoreContexts.js.map +1 -1
  43. package/dist/deltaManagerSummarizerProxy.d.ts +29 -4
  44. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
  45. package/dist/deltaManagerSummarizerProxy.js +91 -5
  46. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  47. package/dist/gc/garbageCollection.d.ts +22 -5
  48. package/dist/gc/garbageCollection.d.ts.map +1 -1
  49. package/dist/gc/garbageCollection.js +134 -75
  50. package/dist/gc/garbageCollection.js.map +1 -1
  51. package/dist/gc/gcConfigs.d.ts +2 -2
  52. package/dist/gc/gcConfigs.d.ts.map +1 -1
  53. package/dist/gc/gcConfigs.js +21 -21
  54. package/dist/gc/gcConfigs.js.map +1 -1
  55. package/dist/gc/gcDefinitions.d.ts +29 -6
  56. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  57. package/dist/gc/gcDefinitions.js +5 -1
  58. package/dist/gc/gcDefinitions.js.map +1 -1
  59. package/dist/gc/gcHelpers.d.ts +2 -2
  60. package/dist/gc/gcHelpers.d.ts.map +1 -1
  61. package/dist/gc/gcHelpers.js.map +1 -1
  62. package/dist/gc/gcReferenceGraphAlgorithm.d.ts +1 -1
  63. package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -1
  64. package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
  65. package/dist/gc/gcSummaryStateTracker.d.ts +12 -5
  66. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  67. package/dist/gc/gcSummaryStateTracker.js +18 -6
  68. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  69. package/dist/gc/gcTelemetry.d.ts +7 -7
  70. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  71. package/dist/gc/gcTelemetry.js +20 -20
  72. package/dist/gc/gcTelemetry.js.map +1 -1
  73. package/dist/gc/gcUnreferencedStateTracker.d.ts +6 -1
  74. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  75. package/dist/gc/gcUnreferencedStateTracker.js +22 -11
  76. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  77. package/dist/gc/index.d.ts +8 -8
  78. package/dist/gc/index.d.ts.map +1 -1
  79. package/dist/gc/index.js +40 -38
  80. package/dist/gc/index.js.map +1 -1
  81. package/dist/index.d.ts +8 -20
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +28 -40
  84. package/dist/index.js.map +1 -1
  85. package/dist/messageTypes.d.ts +4 -4
  86. package/dist/messageTypes.d.ts.map +1 -1
  87. package/dist/messageTypes.js.map +1 -1
  88. package/dist/opLifecycle/batchManager.d.ts +2 -2
  89. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  90. package/dist/opLifecycle/batchManager.js.map +1 -1
  91. package/dist/opLifecycle/definitions.d.ts +2 -2
  92. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  93. package/dist/opLifecycle/definitions.js.map +1 -1
  94. package/dist/opLifecycle/index.d.ts +8 -8
  95. package/dist/opLifecycle/index.d.ts.map +1 -1
  96. package/dist/opLifecycle/index.js +18 -18
  97. package/dist/opLifecycle/index.js.map +1 -1
  98. package/dist/opLifecycle/opCompressor.d.ts +1 -1
  99. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  100. package/dist/opLifecycle/opCompressor.js +4 -4
  101. package/dist/opLifecycle/opCompressor.js.map +1 -1
  102. package/dist/opLifecycle/opDecompressor.d.ts +1 -1
  103. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  104. package/dist/opLifecycle/opDecompressor.js +3 -3
  105. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  106. package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
  107. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  108. package/dist/opLifecycle/opGroupingManager.js +1 -10
  109. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  110. package/dist/opLifecycle/opSplitter.d.ts +1 -1
  111. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  112. package/dist/opLifecycle/opSplitter.js +5 -5
  113. package/dist/opLifecycle/opSplitter.js.map +1 -1
  114. package/dist/opLifecycle/outbox.d.ts +7 -7
  115. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  116. package/dist/opLifecycle/outbox.js +20 -12
  117. package/dist/opLifecycle/outbox.js.map +1 -1
  118. package/dist/opLifecycle/remoteMessageProcessor.d.ts +4 -4
  119. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  120. package/dist/opLifecycle/remoteMessageProcessor.js +2 -2
  121. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  122. package/dist/package.json +3 -0
  123. package/dist/packageVersion.d.ts +1 -1
  124. package/dist/packageVersion.js +1 -1
  125. package/dist/packageVersion.js.map +1 -1
  126. package/dist/pendingStateManager.d.ts +2 -1
  127. package/dist/pendingStateManager.d.ts.map +1 -1
  128. package/dist/pendingStateManager.js +18 -10
  129. package/dist/pendingStateManager.js.map +1 -1
  130. package/dist/scheduleManager.d.ts +1 -2
  131. package/dist/scheduleManager.d.ts.map +1 -1
  132. package/dist/scheduleManager.js +5 -5
  133. package/dist/scheduleManager.js.map +1 -1
  134. package/dist/summary/index.d.ts +12 -12
  135. package/dist/summary/index.d.ts.map +1 -1
  136. package/dist/summary/index.js +43 -43
  137. package/dist/summary/index.js.map +1 -1
  138. package/dist/summary/orderedClientElection.js +8 -8
  139. package/dist/summary/orderedClientElection.js.map +1 -1
  140. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
  141. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  142. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  143. package/dist/summary/runningSummarizer.d.ts +11 -10
  144. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  145. package/dist/summary/runningSummarizer.js +114 -81
  146. package/dist/summary/runningSummarizer.js.map +1 -1
  147. package/dist/summary/summarizer.d.ts +4 -4
  148. package/dist/summary/summarizer.d.ts.map +1 -1
  149. package/dist/summary/summarizer.js +6 -6
  150. package/dist/summary/summarizer.js.map +1 -1
  151. package/dist/summary/summarizerClientElection.d.ts +2 -2
  152. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  153. package/dist/summary/summarizerClientElection.js.map +1 -1
  154. package/dist/summary/summarizerHeuristics.d.ts +3 -3
  155. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  156. package/dist/summary/summarizerHeuristics.js.map +1 -1
  157. package/dist/summary/summarizerNode/index.d.ts +3 -3
  158. package/dist/summary/summarizerNode/index.d.ts.map +1 -1
  159. package/dist/summary/summarizerNode/index.js +4 -4
  160. package/dist/summary/summarizerNode/index.js.map +1 -1
  161. package/dist/summary/summarizerNode/summarizerNode.d.ts +17 -7
  162. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  163. package/dist/summary/summarizerNode/summarizerNode.js +45 -57
  164. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  165. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +10 -19
  166. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  167. package/dist/summary/summarizerNode/summarizerNodeUtils.js +1 -21
  168. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  169. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
  170. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  171. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +16 -16
  172. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  173. package/dist/summary/summarizerTypes.d.ts +10 -21
  174. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  175. package/dist/summary/summarizerTypes.js.map +1 -1
  176. package/dist/summary/summaryFormat.d.ts +15 -2
  177. package/dist/summary/summaryFormat.d.ts.map +1 -1
  178. package/dist/summary/summaryFormat.js.map +1 -1
  179. package/dist/summary/summaryGenerator.d.ts +6 -5
  180. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  181. package/dist/summary/summaryGenerator.js +10 -1
  182. package/dist/summary/summaryGenerator.js.map +1 -1
  183. package/dist/summary/summaryManager.d.ts +5 -6
  184. package/dist/summary/summaryManager.d.ts.map +1 -1
  185. package/dist/summary/summaryManager.js +4 -5
  186. package/dist/summary/summaryManager.js.map +1 -1
  187. package/dist/tsdoc-metadata.json +1 -1
  188. package/lib/{batchTracker.d.mts → batchTracker.d.ts} +2 -3
  189. package/lib/batchTracker.d.ts.map +1 -0
  190. package/lib/{batchTracker.mjs → batchTracker.js} +1 -1
  191. package/lib/batchTracker.js.map +1 -0
  192. package/lib/{blobManager.d.mts → blobManager.d.ts} +1 -1
  193. package/lib/blobManager.d.ts.map +1 -0
  194. package/lib/{blobManager.mjs → blobManager.js} +1 -1
  195. package/lib/blobManager.js.map +1 -0
  196. package/lib/channelCollection.d.ts +223 -0
  197. package/lib/channelCollection.d.ts.map +1 -0
  198. package/lib/{dataStores.mjs → channelCollection.js} +384 -71
  199. package/lib/channelCollection.js.map +1 -0
  200. package/lib/{connectionTelemetry.d.mts → connectionTelemetry.d.ts} +12 -2
  201. package/lib/connectionTelemetry.d.ts.map +1 -0
  202. package/lib/{connectionTelemetry.mjs → connectionTelemetry.js} +43 -5
  203. package/lib/connectionTelemetry.js.map +1 -0
  204. package/lib/{container-runtime-alpha.d.mts → container-runtime-alpha.d.ts} +98 -40
  205. package/lib/{container-runtime-public.d.mts → container-runtime-beta.d.ts} +27 -9
  206. package/lib/{container-runtime-beta.d.mts → container-runtime-public.d.ts} +27 -9
  207. package/lib/{container-runtime-untrimmed.d.mts → container-runtime-untrimmed.d.ts} +123 -40
  208. package/lib/{containerHandleContext.d.mts → containerHandleContext.d.ts} +2 -2
  209. package/lib/containerHandleContext.d.ts.map +1 -0
  210. package/lib/{containerHandleContext.mjs → containerHandleContext.js} +1 -1
  211. package/lib/containerHandleContext.js.map +1 -0
  212. package/lib/{containerRuntime.d.mts → containerRuntime.d.ts} +84 -56
  213. package/lib/containerRuntime.d.ts.map +1 -0
  214. package/lib/{containerRuntime.mjs → containerRuntime.js} +460 -332
  215. package/lib/containerRuntime.js.map +1 -0
  216. package/lib/{dataStore.d.mts → dataStore.d.ts} +3 -4
  217. package/lib/dataStore.d.ts.map +1 -0
  218. package/lib/{dataStore.mjs → dataStore.js} +13 -12
  219. package/lib/dataStore.js.map +1 -0
  220. package/lib/{dataStoreContext.d.mts → dataStoreContext.d.ts} +72 -31
  221. package/lib/dataStoreContext.d.ts.map +1 -0
  222. package/lib/{dataStoreContext.mjs → dataStoreContext.js} +174 -133
  223. package/lib/dataStoreContext.js.map +1 -0
  224. package/lib/{dataStoreContexts.d.mts → dataStoreContexts.d.ts} +2 -2
  225. package/lib/dataStoreContexts.d.ts.map +1 -0
  226. package/lib/{dataStoreContexts.mjs → dataStoreContexts.js} +1 -1
  227. package/lib/dataStoreContexts.js.map +1 -0
  228. package/lib/{dataStoreRegistry.d.mts → dataStoreRegistry.d.ts} +1 -1
  229. package/lib/dataStoreRegistry.d.ts.map +1 -0
  230. package/lib/{dataStoreRegistry.mjs → dataStoreRegistry.js} +5 -1
  231. package/lib/dataStoreRegistry.js.map +1 -0
  232. package/{dist/deltaManagerProxyBase.d.ts → lib/deltaManagerSummarizerProxy.d.ts} +16 -7
  233. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
  234. package/lib/deltaManagerSummarizerProxy.js +124 -0
  235. package/lib/deltaManagerSummarizerProxy.js.map +1 -0
  236. package/lib/{deltaScheduler.d.mts → deltaScheduler.d.ts} +1 -1
  237. package/lib/deltaScheduler.d.ts.map +1 -0
  238. package/lib/{deltaScheduler.mjs → deltaScheduler.js} +1 -1
  239. package/lib/deltaScheduler.js.map +1 -0
  240. package/lib/{error.d.mts → error.d.ts} +1 -1
  241. package/lib/error.d.ts.map +1 -0
  242. package/lib/{error.mjs → error.js} +1 -1
  243. package/lib/error.js.map +1 -0
  244. package/lib/gc/{garbageCollection.d.mts → garbageCollection.d.ts} +23 -6
  245. package/lib/gc/garbageCollection.d.ts.map +1 -0
  246. package/lib/gc/{garbageCollection.mjs → garbageCollection.js} +103 -44
  247. package/lib/gc/garbageCollection.js.map +1 -0
  248. package/lib/gc/{gcConfigs.d.mts → gcConfigs.d.ts} +3 -3
  249. package/lib/gc/gcConfigs.d.ts.map +1 -0
  250. package/lib/gc/{gcConfigs.mjs → gcConfigs.js} +3 -3
  251. package/lib/gc/gcConfigs.js.map +1 -0
  252. package/lib/gc/{gcDefinitions.d.mts → gcDefinitions.d.ts} +30 -7
  253. package/lib/gc/gcDefinitions.d.ts.map +1 -0
  254. package/lib/gc/{gcDefinitions.mjs → gcDefinitions.js} +5 -1
  255. package/lib/gc/gcDefinitions.js.map +1 -0
  256. package/lib/gc/{gcHelpers.d.mts → gcHelpers.d.ts} +3 -3
  257. package/lib/gc/{gcHelpers.d.mts.map → gcHelpers.d.ts.map} +1 -1
  258. package/lib/gc/{gcHelpers.mjs → gcHelpers.js} +1 -1
  259. package/lib/gc/gcHelpers.js.map +1 -0
  260. package/lib/gc/{gcReferenceGraphAlgorithm.d.mts → gcReferenceGraphAlgorithm.d.ts} +2 -2
  261. package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  262. package/lib/gc/{gcReferenceGraphAlgorithm.mjs → gcReferenceGraphAlgorithm.js} +1 -1
  263. package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
  264. package/lib/gc/{gcSummaryDefinitions.d.mts → gcSummaryDefinitions.d.ts} +1 -1
  265. package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
  266. package/lib/gc/{gcSummaryDefinitions.mjs → gcSummaryDefinitions.js} +1 -1
  267. package/lib/gc/gcSummaryDefinitions.js.map +1 -0
  268. package/lib/gc/{gcSummaryStateTracker.d.mts → gcSummaryStateTracker.d.ts} +13 -6
  269. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
  270. package/lib/gc/{gcSummaryStateTracker.mjs → gcSummaryStateTracker.js} +17 -5
  271. package/lib/gc/gcSummaryStateTracker.js.map +1 -0
  272. package/lib/gc/{gcTelemetry.d.mts → gcTelemetry.d.ts} +8 -8
  273. package/lib/gc/gcTelemetry.d.ts.map +1 -0
  274. package/lib/gc/{gcTelemetry.mjs → gcTelemetry.js} +5 -5
  275. package/lib/gc/gcTelemetry.js.map +1 -0
  276. package/lib/gc/{gcUnreferencedStateTracker.d.mts → gcUnreferencedStateTracker.d.ts} +7 -2
  277. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  278. package/lib/gc/{gcUnreferencedStateTracker.mjs → gcUnreferencedStateTracker.js} +12 -2
  279. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
  280. package/lib/gc/{index.d.mts → index.d.ts} +9 -9
  281. package/lib/gc/index.d.ts.map +1 -0
  282. package/lib/gc/{index.mjs → index.js} +8 -8
  283. package/lib/gc/index.js.map +1 -0
  284. package/lib/{index.d.mts → index.d.ts} +9 -21
  285. package/lib/index.d.ts.map +1 -0
  286. package/lib/index.js +12 -0
  287. package/lib/index.js.map +1 -0
  288. package/lib/{messageTypes.d.mts → messageTypes.d.ts} +5 -5
  289. package/lib/messageTypes.d.ts.map +1 -0
  290. package/lib/{messageTypes.mjs → messageTypes.js} +1 -1
  291. package/lib/messageTypes.js.map +1 -0
  292. package/lib/{metadata.d.mts → metadata.d.ts} +1 -1
  293. package/lib/metadata.d.ts.map +1 -0
  294. package/lib/{metadata.mjs → metadata.js} +1 -1
  295. package/lib/metadata.js.map +1 -0
  296. package/lib/opLifecycle/{batchManager.d.mts → batchManager.d.ts} +3 -3
  297. package/lib/opLifecycle/batchManager.d.ts.map +1 -0
  298. package/lib/opLifecycle/{batchManager.mjs → batchManager.js} +1 -1
  299. package/lib/opLifecycle/batchManager.js.map +1 -0
  300. package/lib/opLifecycle/{definitions.d.mts → definitions.d.ts} +3 -3
  301. package/lib/opLifecycle/definitions.d.ts.map +1 -0
  302. package/lib/opLifecycle/{definitions.mjs → definitions.js} +1 -1
  303. package/lib/opLifecycle/definitions.js.map +1 -0
  304. package/lib/opLifecycle/index.d.ts +13 -0
  305. package/lib/opLifecycle/index.d.ts.map +1 -0
  306. package/lib/opLifecycle/index.js +12 -0
  307. package/lib/opLifecycle/index.js.map +1 -0
  308. package/lib/opLifecycle/{opCompressor.d.mts → opCompressor.d.ts} +2 -2
  309. package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
  310. package/lib/opLifecycle/{opCompressor.mjs → opCompressor.js} +3 -3
  311. package/lib/opLifecycle/opCompressor.js.map +1 -0
  312. package/lib/opLifecycle/{opDecompressor.d.mts → opDecompressor.d.ts} +2 -2
  313. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
  314. package/lib/opLifecycle/{opDecompressor.mjs → opDecompressor.js} +2 -2
  315. package/lib/opLifecycle/opDecompressor.js.map +1 -0
  316. package/lib/opLifecycle/{opGroupingManager.d.mts → opGroupingManager.d.ts} +2 -2
  317. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -0
  318. package/lib/opLifecycle/{opGroupingManager.mjs → opGroupingManager.js} +2 -11
  319. package/lib/opLifecycle/opGroupingManager.js.map +1 -0
  320. package/lib/opLifecycle/{opSplitter.d.mts → opSplitter.d.ts} +2 -2
  321. package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
  322. package/lib/opLifecycle/{opSplitter.mjs → opSplitter.js} +3 -3
  323. package/lib/opLifecycle/opSplitter.js.map +1 -0
  324. package/lib/opLifecycle/{outbox.d.mts → outbox.d.ts} +8 -8
  325. package/lib/opLifecycle/outbox.d.ts.map +1 -0
  326. package/lib/opLifecycle/{outbox.mjs → outbox.js} +12 -4
  327. package/lib/opLifecycle/outbox.js.map +1 -0
  328. package/lib/opLifecycle/{remoteMessageProcessor.d.mts → remoteMessageProcessor.d.ts} +5 -5
  329. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  330. package/lib/opLifecycle/{remoteMessageProcessor.mjs → remoteMessageProcessor.js} +2 -2
  331. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
  332. package/lib/{opProperties.d.mts → opProperties.d.ts} +1 -1
  333. package/lib/opProperties.d.ts.map +1 -0
  334. package/lib/{opProperties.mjs → opProperties.js} +1 -1
  335. package/lib/opProperties.js.map +1 -0
  336. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  337. package/lib/packageVersion.d.ts.map +1 -0
  338. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  339. package/lib/packageVersion.js.map +1 -0
  340. package/lib/{pendingStateManager.d.mts → pendingStateManager.d.ts} +3 -2
  341. package/lib/pendingStateManager.d.ts.map +1 -0
  342. package/lib/{pendingStateManager.mjs → pendingStateManager.js} +18 -10
  343. package/lib/pendingStateManager.js.map +1 -0
  344. package/lib/{scheduleManager.d.mts → scheduleManager.d.ts} +6 -3
  345. package/lib/scheduleManager.d.ts.map +1 -0
  346. package/lib/{scheduleManager.mjs → scheduleManager.js} +3 -3
  347. package/lib/scheduleManager.js.map +1 -0
  348. package/lib/{storageServiceWithAttachBlobs.d.mts → storageServiceWithAttachBlobs.d.ts} +1 -1
  349. package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
  350. package/lib/{storageServiceWithAttachBlobs.mjs → storageServiceWithAttachBlobs.js} +1 -1
  351. package/lib/storageServiceWithAttachBlobs.js.map +1 -0
  352. package/lib/summary/{index.d.mts → index.d.ts} +13 -13
  353. package/lib/summary/index.d.ts.map +1 -0
  354. package/lib/summary/{index.mjs → index.js} +12 -12
  355. package/lib/summary/index.js.map +1 -0
  356. package/lib/summary/{orderedClientElection.d.mts → orderedClientElection.d.ts} +5 -1
  357. package/lib/summary/orderedClientElection.d.ts.map +1 -0
  358. package/lib/summary/{orderedClientElection.mjs → orderedClientElection.js} +2 -2
  359. package/lib/summary/orderedClientElection.js.map +1 -0
  360. package/lib/summary/{runWhileConnectedCoordinator.d.mts → runWhileConnectedCoordinator.d.ts} +2 -2
  361. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  362. package/lib/summary/{runWhileConnectedCoordinator.mjs → runWhileConnectedCoordinator.js} +1 -1
  363. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
  364. package/lib/summary/{runningSummarizer.d.mts → runningSummarizer.d.ts} +12 -11
  365. package/lib/summary/runningSummarizer.d.ts.map +1 -0
  366. package/lib/summary/{runningSummarizer.mjs → runningSummarizer.js} +108 -75
  367. package/lib/summary/runningSummarizer.js.map +1 -0
  368. package/lib/summary/{summarizer.d.mts → summarizer.d.ts} +5 -5
  369. package/lib/summary/summarizer.d.ts.map +1 -0
  370. package/lib/summary/{summarizer.mjs → summarizer.js} +4 -4
  371. package/lib/summary/summarizer.js.map +1 -0
  372. package/lib/summary/{summarizerClientElection.d.mts → summarizerClientElection.d.ts} +3 -3
  373. package/lib/summary/summarizerClientElection.d.ts.map +1 -0
  374. package/lib/summary/{summarizerClientElection.mjs → summarizerClientElection.js} +1 -1
  375. package/lib/summary/summarizerClientElection.js.map +1 -0
  376. package/lib/summary/{summarizerHeuristics.d.mts → summarizerHeuristics.d.ts} +4 -4
  377. package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
  378. package/lib/summary/{summarizerHeuristics.mjs → summarizerHeuristics.js} +1 -1
  379. package/lib/summary/summarizerHeuristics.js.map +1 -0
  380. package/lib/summary/summarizerNode/{index.d.mts → index.d.ts} +4 -4
  381. package/lib/summary/summarizerNode/index.d.ts.map +1 -0
  382. package/lib/summary/summarizerNode/index.js +7 -0
  383. package/lib/summary/summarizerNode/index.js.map +1 -0
  384. package/lib/summary/summarizerNode/{summarizerNode.d.mts → summarizerNode.d.ts} +18 -8
  385. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  386. package/lib/summary/summarizerNode/{summarizerNode.mjs → summarizerNode.js} +41 -53
  387. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
  388. package/lib/summary/summarizerNode/{summarizerNodeUtils.d.mts → summarizerNodeUtils.d.ts} +11 -20
  389. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  390. package/lib/summary/summarizerNode/{summarizerNodeUtils.mjs → summarizerNodeUtils.js} +1 -20
  391. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
  392. package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.mts → summarizerNodeWithGc.d.ts} +6 -7
  393. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  394. package/lib/summary/summarizerNode/{summarizerNodeWithGc.mjs → summarizerNodeWithGc.js} +12 -12
  395. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
  396. package/lib/summary/{summarizerTypes.d.mts → summarizerTypes.d.ts} +11 -22
  397. package/lib/summary/summarizerTypes.d.ts.map +1 -0
  398. package/lib/summary/{summarizerTypes.mjs → summarizerTypes.js} +1 -1
  399. package/lib/summary/summarizerTypes.js.map +1 -0
  400. package/lib/summary/{summaryCollection.d.mts → summaryCollection.d.ts} +1 -1
  401. package/lib/summary/summaryCollection.d.ts.map +1 -0
  402. package/lib/summary/{summaryCollection.mjs → summaryCollection.js} +1 -1
  403. package/lib/summary/summaryCollection.js.map +1 -0
  404. package/lib/summary/{summaryFormat.d.mts → summaryFormat.d.ts} +16 -3
  405. package/lib/summary/summaryFormat.d.ts.map +1 -0
  406. package/lib/summary/{summaryFormat.mjs → summaryFormat.js} +1 -1
  407. package/lib/summary/summaryFormat.js.map +1 -0
  408. package/lib/summary/{summaryGenerator.d.mts → summaryGenerator.d.ts} +7 -6
  409. package/lib/summary/summaryGenerator.d.ts.map +1 -0
  410. package/lib/summary/{summaryGenerator.mjs → summaryGenerator.js} +11 -2
  411. package/lib/summary/summaryGenerator.js.map +1 -0
  412. package/lib/summary/{summaryManager.d.mts → summaryManager.d.ts} +6 -7
  413. package/lib/summary/summaryManager.d.ts.map +1 -0
  414. package/lib/summary/{summaryManager.mjs → summaryManager.js} +4 -5
  415. package/lib/summary/summaryManager.js.map +1 -0
  416. package/lib/test/batchTracker.spec.js +88 -0
  417. package/lib/test/batchTracker.spec.js.map +1 -0
  418. package/lib/test/blobManager.spec.js +835 -0
  419. package/lib/test/blobManager.spec.js.map +1 -0
  420. package/lib/test/channelCollection.spec.js +141 -0
  421. package/lib/test/channelCollection.spec.js.map +1 -0
  422. package/lib/test/containerRuntime.spec.js +1748 -0
  423. package/lib/test/containerRuntime.spec.js.map +1 -0
  424. package/lib/test/dataStoreContext.spec.js +801 -0
  425. package/lib/test/dataStoreContext.spec.js.map +1 -0
  426. package/lib/test/dataStoreCreation.spec.js +312 -0
  427. package/lib/test/dataStoreCreation.spec.js.map +1 -0
  428. package/lib/test/dataStoreRegistry.spec.js +26 -0
  429. package/lib/test/dataStoreRegistry.spec.js.map +1 -0
  430. package/lib/test/fuzz/fuzzUtils.js +66 -0
  431. package/lib/test/fuzz/fuzzUtils.js.map +1 -0
  432. package/lib/test/fuzz/summarizer.fuzz.spec.js +31 -0
  433. package/lib/test/fuzz/summarizer.fuzz.spec.js.map +1 -0
  434. package/lib/test/fuzz/summarizerFuzzMocks.js +162 -0
  435. package/lib/test/fuzz/summarizerFuzzMocks.js.map +1 -0
  436. package/lib/test/fuzz/summarizerFuzzSuite.js +106 -0
  437. package/lib/test/fuzz/summarizerFuzzSuite.js.map +1 -0
  438. package/lib/test/gc/garbageCollection.spec.js +1465 -0
  439. package/lib/test/gc/garbageCollection.spec.js.map +1 -0
  440. package/lib/test/gc/gcConfigs.spec.js +690 -0
  441. package/lib/test/gc/gcConfigs.spec.js.map +1 -0
  442. package/lib/test/gc/gcHelpers.spec.js +110 -0
  443. package/lib/test/gc/gcHelpers.spec.js.map +1 -0
  444. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +68 -0
  445. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +1 -0
  446. package/lib/test/gc/gcStats.spec.js +391 -0
  447. package/lib/test/gc/gcStats.spec.js.map +1 -0
  448. package/lib/test/gc/gcSummaryStateTracker.spec.js +228 -0
  449. package/lib/test/gc/gcSummaryStateTracker.spec.js.map +1 -0
  450. package/lib/test/gc/gcTelemetry.spec.js +530 -0
  451. package/lib/test/gc/gcTelemetry.spec.js.map +1 -0
  452. package/lib/test/gc/gcUnitTestHelpers.js +29 -0
  453. package/lib/test/gc/gcUnitTestHelpers.js.map +1 -0
  454. package/lib/test/gc/gcUnreferencedStateTracker.spec.js +192 -0
  455. package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +1 -0
  456. package/lib/test/getPendingBlobs.spec.js +193 -0
  457. package/lib/test/getPendingBlobs.spec.js.map +1 -0
  458. package/lib/test/hardwareStats.spec.js +93 -0
  459. package/lib/test/hardwareStats.spec.js.map +1 -0
  460. package/lib/test/index.js +6 -0
  461. package/lib/test/index.js.map +1 -0
  462. package/lib/test/opLifecycle/OpGroupingManager.spec.js +225 -0
  463. package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +1 -0
  464. package/lib/test/opLifecycle/batchManager.spec.js +189 -0
  465. package/lib/test/opLifecycle/batchManager.spec.js.map +1 -0
  466. package/lib/test/opLifecycle/opCompressor.spec.js +74 -0
  467. package/lib/test/opLifecycle/opCompressor.spec.js.map +1 -0
  468. package/lib/test/opLifecycle/opDecompressor.spec.js +218 -0
  469. package/lib/test/opLifecycle/opDecompressor.spec.js.map +1 -0
  470. package/lib/test/opLifecycle/opSplitter.spec.js +272 -0
  471. package/lib/test/opLifecycle/opSplitter.spec.js.map +1 -0
  472. package/lib/test/opLifecycle/outbox.spec.js +675 -0
  473. package/lib/test/opLifecycle/outbox.spec.js.map +1 -0
  474. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +196 -0
  475. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +1 -0
  476. package/lib/test/pendingStateManager.spec.js +329 -0
  477. package/lib/test/pendingStateManager.spec.js.map +1 -0
  478. package/lib/test/scheduleManager.spec.js +270 -0
  479. package/lib/test/scheduleManager.spec.js.map +1 -0
  480. package/lib/test/summarizerNode.spec.js +326 -0
  481. package/lib/test/summarizerNode.spec.js.map +1 -0
  482. package/lib/test/summarizerNodeWithGc.spec.js +318 -0
  483. package/lib/test/summarizerNodeWithGc.spec.js.map +1 -0
  484. package/lib/test/summary/orderedClientElection.spec.js +535 -0
  485. package/lib/test/summary/orderedClientElection.spec.js.map +1 -0
  486. package/lib/test/summary/runningSummarizer.spec.js +1349 -0
  487. package/lib/test/summary/runningSummarizer.spec.js.map +1 -0
  488. package/lib/test/summary/summarizer.spec.js +29 -0
  489. package/lib/test/summary/summarizer.spec.js.map +1 -0
  490. package/lib/test/summary/summarizerClientElection.spec.js +436 -0
  491. package/lib/test/summary/summarizerClientElection.spec.js.map +1 -0
  492. package/lib/test/summary/summarizerHeuristics.spec.js +289 -0
  493. package/lib/test/summary/summarizerHeuristics.spec.js.map +1 -0
  494. package/lib/test/summary/summaryCollection.spec.js +200 -0
  495. package/lib/test/summary/summaryCollection.spec.js.map +1 -0
  496. package/lib/test/summary/summaryManager.spec.js +430 -0
  497. package/lib/test/summary/summaryManager.spec.js.map +1 -0
  498. package/lib/test/summary/testQuorumClients.js +34 -0
  499. package/lib/test/summary/testQuorumClients.js.map +1 -0
  500. package/lib/test/throttler.spec.js +175 -0
  501. package/lib/test/throttler.spec.js.map +1 -0
  502. package/lib/test/types/validateContainerRuntimePrevious.generated.js +180 -0
  503. package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +1 -0
  504. package/lib/{throttler.d.mts → throttler.d.ts} +1 -1
  505. package/lib/throttler.d.ts.map +1 -0
  506. package/lib/{throttler.mjs → throttler.js} +1 -1
  507. package/lib/throttler.js.map +1 -0
  508. package/package.json +99 -88
  509. package/src/batchTracker.ts +1 -1
  510. package/src/blobManager.ts +1 -1
  511. package/src/{dataStores.ts → channelCollection.ts} +520 -84
  512. package/src/connectionTelemetry.ts +42 -3
  513. package/src/containerHandleContext.ts +1 -1
  514. package/src/containerRuntime.ts +661 -464
  515. package/src/dataStore.ts +13 -15
  516. package/src/dataStoreContext.ts +257 -184
  517. package/src/dataStoreContexts.ts +1 -1
  518. package/src/deltaManagerSummarizerProxy.ts +132 -7
  519. package/src/gc/garbageCollection.ts +121 -46
  520. package/src/gc/gcConfigs.ts +3 -3
  521. package/src/gc/gcDefinitions.ts +30 -7
  522. package/src/gc/gcHelpers.ts +2 -2
  523. package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
  524. package/src/gc/gcSummaryStateTracker.ts +19 -7
  525. package/src/gc/gcTelemetry.ts +10 -9
  526. package/src/gc/gcUnreferencedStateTracker.ts +12 -1
  527. package/src/gc/index.ts +10 -8
  528. package/src/index.ts +16 -27
  529. package/src/messageTypes.ts +4 -4
  530. package/src/opLifecycle/README.md +2 -4
  531. package/src/opLifecycle/batchManager.ts +2 -2
  532. package/src/opLifecycle/definitions.ts +2 -2
  533. package/src/opLifecycle/index.ts +8 -8
  534. package/src/opLifecycle/opCompressor.ts +3 -3
  535. package/src/opLifecycle/opDecompressor.ts +3 -3
  536. package/src/opLifecycle/opGroupingManager.ts +3 -12
  537. package/src/opLifecycle/opSplitter.ts +3 -3
  538. package/src/opLifecycle/outbox.ts +29 -9
  539. package/src/opLifecycle/remoteMessageProcessor.ts +4 -4
  540. package/src/packageVersion.ts +1 -1
  541. package/src/pendingStateManager.ts +19 -13
  542. package/src/scheduleManager.ts +4 -4
  543. package/src/summary/index.ts +13 -12
  544. package/src/summary/orderedClientElection.ts +1 -1
  545. package/src/summary/runWhileConnectedCoordinator.ts +1 -1
  546. package/src/summary/runningSummarizer.ts +141 -93
  547. package/src/summary/summarizer.ts +7 -7
  548. package/src/summary/summarizerClientElection.ts +2 -2
  549. package/src/summary/summarizerHeuristics.ts +3 -3
  550. package/src/summary/summarizerNode/index.ts +6 -3
  551. package/src/summary/summarizerNode/summarizerNode.ts +54 -69
  552. package/src/summary/summarizerNode/summarizerNodeUtils.ts +16 -34
  553. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +11 -17
  554. package/src/summary/summarizerTypes.ts +12 -24
  555. package/src/summary/summaryFormat.ts +16 -2
  556. package/src/summary/summaryGenerator.ts +16 -4
  557. package/src/summary/summaryManager.ts +6 -7
  558. package/tsconfig.cjs.json +7 -0
  559. package/tsconfig.json +2 -5
  560. package/dist/dataStores.d.ts +0 -149
  561. package/dist/dataStores.d.ts.map +0 -1
  562. package/dist/dataStores.js.map +0 -1
  563. package/dist/deltaManagerProxyBase.d.ts.map +0 -1
  564. package/dist/deltaManagerProxyBase.js +0 -77
  565. package/dist/deltaManagerProxyBase.js.map +0 -1
  566. package/lib/batchTracker.d.mts.map +0 -1
  567. package/lib/batchTracker.mjs.map +0 -1
  568. package/lib/blobManager.d.mts.map +0 -1
  569. package/lib/blobManager.mjs.map +0 -1
  570. package/lib/connectionTelemetry.d.mts.map +0 -1
  571. package/lib/connectionTelemetry.mjs.map +0 -1
  572. package/lib/containerHandleContext.d.mts.map +0 -1
  573. package/lib/containerHandleContext.mjs.map +0 -1
  574. package/lib/containerRuntime.d.mts.map +0 -1
  575. package/lib/containerRuntime.mjs.map +0 -1
  576. package/lib/dataStore.d.mts.map +0 -1
  577. package/lib/dataStore.mjs.map +0 -1
  578. package/lib/dataStoreContext.d.mts.map +0 -1
  579. package/lib/dataStoreContext.mjs.map +0 -1
  580. package/lib/dataStoreContexts.d.mts.map +0 -1
  581. package/lib/dataStoreContexts.mjs.map +0 -1
  582. package/lib/dataStoreRegistry.d.mts.map +0 -1
  583. package/lib/dataStoreRegistry.mjs.map +0 -1
  584. package/lib/dataStores.d.mts +0 -149
  585. package/lib/dataStores.d.mts.map +0 -1
  586. package/lib/dataStores.mjs.map +0 -1
  587. package/lib/deltaManagerProxyBase.d.mts +0 -35
  588. package/lib/deltaManagerProxyBase.d.mts.map +0 -1
  589. package/lib/deltaManagerProxyBase.mjs +0 -73
  590. package/lib/deltaManagerProxyBase.mjs.map +0 -1
  591. package/lib/deltaManagerSummarizerProxy.d.mts +0 -19
  592. package/lib/deltaManagerSummarizerProxy.d.mts.map +0 -1
  593. package/lib/deltaManagerSummarizerProxy.mjs +0 -38
  594. package/lib/deltaManagerSummarizerProxy.mjs.map +0 -1
  595. package/lib/deltaScheduler.d.mts.map +0 -1
  596. package/lib/deltaScheduler.mjs.map +0 -1
  597. package/lib/error.d.mts.map +0 -1
  598. package/lib/error.mjs.map +0 -1
  599. package/lib/gc/garbageCollection.d.mts.map +0 -1
  600. package/lib/gc/garbageCollection.mjs.map +0 -1
  601. package/lib/gc/gcConfigs.d.mts.map +0 -1
  602. package/lib/gc/gcConfigs.mjs.map +0 -1
  603. package/lib/gc/gcDefinitions.d.mts.map +0 -1
  604. package/lib/gc/gcDefinitions.mjs.map +0 -1
  605. package/lib/gc/gcHelpers.mjs.map +0 -1
  606. package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +0 -1
  607. package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +0 -1
  608. package/lib/gc/gcSummaryDefinitions.d.mts.map +0 -1
  609. package/lib/gc/gcSummaryDefinitions.mjs.map +0 -1
  610. package/lib/gc/gcSummaryStateTracker.d.mts.map +0 -1
  611. package/lib/gc/gcSummaryStateTracker.mjs.map +0 -1
  612. package/lib/gc/gcTelemetry.d.mts.map +0 -1
  613. package/lib/gc/gcTelemetry.mjs.map +0 -1
  614. package/lib/gc/gcUnreferencedStateTracker.d.mts.map +0 -1
  615. package/lib/gc/gcUnreferencedStateTracker.mjs.map +0 -1
  616. package/lib/gc/index.d.mts.map +0 -1
  617. package/lib/gc/index.mjs.map +0 -1
  618. package/lib/index.d.mts.map +0 -1
  619. package/lib/index.mjs +0 -24
  620. package/lib/index.mjs.map +0 -1
  621. package/lib/messageTypes.d.mts.map +0 -1
  622. package/lib/messageTypes.mjs.map +0 -1
  623. package/lib/metadata.d.mts.map +0 -1
  624. package/lib/metadata.mjs.map +0 -1
  625. package/lib/opLifecycle/batchManager.d.mts.map +0 -1
  626. package/lib/opLifecycle/batchManager.mjs.map +0 -1
  627. package/lib/opLifecycle/definitions.d.mts.map +0 -1
  628. package/lib/opLifecycle/definitions.mjs.map +0 -1
  629. package/lib/opLifecycle/index.d.mts +0 -13
  630. package/lib/opLifecycle/index.d.mts.map +0 -1
  631. package/lib/opLifecycle/index.mjs +0 -12
  632. package/lib/opLifecycle/index.mjs.map +0 -1
  633. package/lib/opLifecycle/opCompressor.d.mts.map +0 -1
  634. package/lib/opLifecycle/opCompressor.mjs.map +0 -1
  635. package/lib/opLifecycle/opDecompressor.d.mts.map +0 -1
  636. package/lib/opLifecycle/opDecompressor.mjs.map +0 -1
  637. package/lib/opLifecycle/opGroupingManager.d.mts.map +0 -1
  638. package/lib/opLifecycle/opGroupingManager.mjs.map +0 -1
  639. package/lib/opLifecycle/opSplitter.d.mts.map +0 -1
  640. package/lib/opLifecycle/opSplitter.mjs.map +0 -1
  641. package/lib/opLifecycle/outbox.d.mts.map +0 -1
  642. package/lib/opLifecycle/outbox.mjs.map +0 -1
  643. package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +0 -1
  644. package/lib/opLifecycle/remoteMessageProcessor.mjs.map +0 -1
  645. package/lib/opProperties.d.mts.map +0 -1
  646. package/lib/opProperties.mjs.map +0 -1
  647. package/lib/packageVersion.d.mts.map +0 -1
  648. package/lib/packageVersion.mjs.map +0 -1
  649. package/lib/pendingStateManager.d.mts.map +0 -1
  650. package/lib/pendingStateManager.mjs.map +0 -1
  651. package/lib/scheduleManager.d.mts.map +0 -1
  652. package/lib/scheduleManager.mjs.map +0 -1
  653. package/lib/storageServiceWithAttachBlobs.d.mts.map +0 -1
  654. package/lib/storageServiceWithAttachBlobs.mjs.map +0 -1
  655. package/lib/summary/index.d.mts.map +0 -1
  656. package/lib/summary/index.mjs.map +0 -1
  657. package/lib/summary/orderedClientElection.d.mts.map +0 -1
  658. package/lib/summary/orderedClientElection.mjs.map +0 -1
  659. package/lib/summary/runWhileConnectedCoordinator.d.mts.map +0 -1
  660. package/lib/summary/runWhileConnectedCoordinator.mjs.map +0 -1
  661. package/lib/summary/runningSummarizer.d.mts.map +0 -1
  662. package/lib/summary/runningSummarizer.mjs.map +0 -1
  663. package/lib/summary/summarizer.d.mts.map +0 -1
  664. package/lib/summary/summarizer.mjs.map +0 -1
  665. package/lib/summary/summarizerClientElection.d.mts.map +0 -1
  666. package/lib/summary/summarizerClientElection.mjs.map +0 -1
  667. package/lib/summary/summarizerHeuristics.d.mts.map +0 -1
  668. package/lib/summary/summarizerHeuristics.mjs.map +0 -1
  669. package/lib/summary/summarizerNode/index.d.mts.map +0 -1
  670. package/lib/summary/summarizerNode/index.mjs +0 -7
  671. package/lib/summary/summarizerNode/index.mjs.map +0 -1
  672. package/lib/summary/summarizerNode/summarizerNode.d.mts.map +0 -1
  673. package/lib/summary/summarizerNode/summarizerNode.mjs.map +0 -1
  674. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +0 -1
  675. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +0 -1
  676. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +0 -1
  677. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +0 -1
  678. package/lib/summary/summarizerTypes.d.mts.map +0 -1
  679. package/lib/summary/summarizerTypes.mjs.map +0 -1
  680. package/lib/summary/summaryCollection.d.mts.map +0 -1
  681. package/lib/summary/summaryCollection.mjs.map +0 -1
  682. package/lib/summary/summaryFormat.d.mts.map +0 -1
  683. package/lib/summary/summaryFormat.mjs.map +0 -1
  684. package/lib/summary/summaryGenerator.d.mts.map +0 -1
  685. package/lib/summary/summaryGenerator.mjs.map +0 -1
  686. package/lib/summary/summaryManager.d.mts.map +0 -1
  687. package/lib/summary/summaryManager.mjs.map +0 -1
  688. package/lib/throttler.d.mts.map +0 -1
  689. package/lib/throttler.mjs.map +0 -1
  690. package/src/deltaManagerProxyBase.ts +0 -111
@@ -1 +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KAAK,CAAC,qBAAqB,CAAC;IACpE,CAAC;CACD;AArQD,sDAqQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tgcTreeKey,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { mergeStats, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { IRefreshSummaryResult } from \"../summary\";\nimport { GCVersion, IGarbageCollectorConfigs, IGCStats } from \"./gcDefinitions\";\nimport { generateSortedGCState } from \"./gcHelpers\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions\";\n\nexport const gcStateBlobKey = `${gcBlobPrefix}_root`;\n\n/**\n * The GC data that is tracked for a summary.\n */\nexport interface IGCSummaryTrackingData {\n\tserializedGCState: string | undefined;\n\tserializedTombstones: string | undefined;\n\tserializedDeletedNodes: string | undefined;\n}\n\n/**\n * Encapsulates the garbage collection state that is tracked across summaries.\n * It maintains the GC state as per the latest summary in by the server. It updates state when a summary tracked by this\n * client is acked by the server or from a snapshot is downloaded from the server.\n * On summarize, it decides whether to write new state or re-use previous summary's state.\n */\nexport class GCSummaryStateTracker {\n\t// This is the version of GC data in the latest summary being tracked.\n\tprivate latestSummaryGCVersion: GCVersion;\n\n\t// Keeps track of the GC data from the latest summary successfully acked by the server.\n\tprivate latestSummaryData: IGCSummaryTrackingData | undefined;\n\t// Keeps track of the GC data from the last summary submitted to the server but not yet acked.\n\tprivate pendingSummaryData: IGCSummaryTrackingData | undefined;\n\n\t// Tracks whether there was GC was run in latest summary being tracked.\n\tprivate wasGCRunInLatestSummary: boolean;\n\n\t// Tracks the count of data stores whose state updated since the last summary, i.e., they went from referenced\n\t// to unreferenced or vice-versa.\n\tpublic updatedDSCountSinceLastSummary: number = 0;\n\n\tconstructor(\n\t\t// Tells whether GC should run or not.\n\t\tprivate readonly configs: Pick<\n\t\t\tIGarbageCollectorConfigs,\n\t\t\t\"shouldRunGC\" | \"tombstoneMode\" | \"gcVersionInBaseSnapshot\" | \"gcVersionInEffect\"\n\t\t>,\n\t\t// Tells whether GC was run in the base snapshot this container loaded from.\n\t\twasGCRunInBaseSnapshot: boolean,\n\t) {\n\t\tthis.wasGCRunInLatestSummary = wasGCRunInBaseSnapshot;\n\t\t// For existing document, the latest summary is the one that we loaded from. So, use its GC version as the\n\t\t// latest tracked GC version. For new documents, we will be writing the first summary with the current version.\n\t\tthis.latestSummaryGCVersion =\n\t\t\tthis.configs.gcVersionInBaseSnapshot ?? this.configs.gcVersionInEffect;\n\t}\n\n\t/**\n\t * Tells whether the GC state needs to be reset. This can happen under 3 conditions:\n\t *\n\t * 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after\n\t * it was enabled before. GC state needs to be removed from summary and all nodes should be marked referenced.\n\t *\n\t * 2. The base snapshot does not have GC state but GC is enabled. This will happen the very first time GC runs on\n\t * a document and the first time GC is enabled after is was disabled before.\n\t *\n\t * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n\t *\n\t * Note that the state will be reset only once for the first summary generated after this returns true. After that,\n\t * this will return false.\n\t */\n\tpublic get doesGCStateNeedReset(): boolean {\n\t\treturn this.wasGCRunInLatestSummary !== this.configs.shouldRunGC;\n\t}\n\n\t/**\n\t * Tells whether the GC state needs to be reset in the next summary. We need to do this if:\n\t *\n\t * 1. GC was enabled and is now disabled. The GC state needs to be removed and everything becomes referenced.\n\t *\n\t * 2. GC was disabled and is now enabled. The GC state needs to be regenerated and added to summary.\n\t *\n\t * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n\t *\n\t * 4. The GC version in the latest summary is different from the current GC version. This can happen if:\n\t *\n\t * 4.1. The summary this client loaded with has data from a different GC version.\n\t *\n\t * 4.2. This client's latest summary was updated from a snapshot that has a different GC version.\n\t */\n\tpublic get doesSummaryStateNeedReset(): boolean {\n\t\treturn (\n\t\t\tthis.doesGCStateNeedReset ||\n\t\t\t(this.configs.shouldRunGC &&\n\t\t\t\tthis.latestSummaryGCVersion !== this.configs.gcVersionInEffect)\n\t\t);\n\t}\n\n\t/**\n\t * Called during GC initialization. Initialize the latest summary data from the base snapshot data.\n\t */\n\tpublic initializeBaseState(baseSnapshotData: IGarbageCollectionSnapshotData | undefined) {\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If tracking state across summaries, update latest summary data from the snapshot's GC data.\n\t\tthis.latestSummaryData = {\n\t\t\tserializedGCState: baseSnapshotData.gcState\n\t\t\t\t? JSON.stringify(generateSortedGCState(baseSnapshotData.gcState))\n\t\t\t\t: undefined,\n\t\t\tserializedTombstones: JSON.stringify(baseSnapshotData.tombstones),\n\t\t\tserializedDeletedNodes: JSON.stringify(baseSnapshotData.deletedNodes),\n\t\t};\n\t}\n\n\t/**\n\t * Summarizes three component of the GC data - GC state, tombstones and deleted nodes.\n\t * It does incremental summary, i.e., it writes summary tree / summary blob only for the component that changed.\n\t * For components that did not change, a summary handle is returned that points to the previous successful summary.\n\t * If none of the components changed, it returns a summary handle for the entire GC data.\n\t */\n\tpublic summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\tgcState: IGarbageCollectionState,\n\t\tdeletedNodes: Set<string>,\n\t\ttombstones: string[],\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializedGCState = JSON.stringify(generateSortedGCState(gcState));\n\t\t// Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so\n\t\t// to identify deleted nodes' usage.\n\t\tconst serializedDeletedNodes =\n\t\t\tdeletedNodes.size > 0 ? JSON.stringify(Array.from(deletedNodes).sort()) : undefined;\n\t\t// If running in tombstone mode, serialize and write tombstones, if any.\n\t\tconst serializedTombstones = this.configs.tombstoneMode\n\t\t\t? tombstones.length > 0\n\t\t\t\t? JSON.stringify(tombstones.sort())\n\t\t\t\t: undefined\n\t\t\t: undefined;\n\n\t\t/**\n\t\t * Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,\n\t\t * write summary handle instead of summary tree for GC.\n\t\t * Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and\n\t\t * for each of these that did not change, write a summary handle.\n\t\t */\n\t\tthis.pendingSummaryData = {\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t};\n\n\t\tif (trackState && !fullTree && this.latestSummaryData !== undefined) {\n\t\t\t// If nothing changed since last summary, send a summary handle for the entire GC data.\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData.serializedGCState === serializedGCState &&\n\t\t\t\tthis.latestSummaryData.serializedTombstones === serializedTombstones &&\n\t\t\t\tthis.latestSummaryData.serializedDeletedNodes === serializedDeletedNodes\n\t\t\t) {\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: `/${gcTreeKey}`,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If some state changed, build a GC summary tree.\n\t\t\treturn this.buildGCSummaryTree(\n\t\t\t\tserializedGCState,\n\t\t\t\tserializedTombstones,\n\t\t\t\tserializedDeletedNodes,\n\t\t\t\ttrue /* trackState */,\n\t\t\t);\n\t\t}\n\t\t// If not tracking GC state, build a GC summary tree without any summary handles.\n\t\treturn this.buildGCSummaryTree(\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t}\n\n\t/**\n\t * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.\n\t * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.\n\t * If trackState is true, only states that changed are written. Rest are written as handles.\n\t * @param serializedGCState - The GC state serialized as string.\n\t * @param serializedTombstones - The tombstone state serialized as string.\n\t * @param serializedDeletedNodes - Deleted nodes serialized as string.\n\t * @param trackState - Whether we are tracking GC state across summaries.\n\t * @returns the GC summary tree.\n\t */\n\tprivate buildGCSummaryTree(\n\t\tserializedGCState: string,\n\t\tserializedTombstones: string | undefined,\n\t\tserializedDeletedNodes: string | undefined,\n\t\ttrackState: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// If the GC state hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (this.latestSummaryData?.serializedGCState === serializedGCState && trackState) {\n\t\t\tbuilder.addHandle(gcStateBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcStateBlobKey}`);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcStateBlobKey, serializedGCState);\n\t\t}\n\n\t\t// If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a\n\t\t// summary blob.\n\t\tif (serializedTombstones !== undefined) {\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData?.serializedTombstones === serializedTombstones &&\n\t\t\t\ttrackState\n\t\t\t) {\n\t\t\t\tbuilder.addHandle(\n\t\t\t\t\tgcTombstoneBlobKey,\n\t\t\t\t\tSummaryType.Blob,\n\t\t\t\t\t`/${gcTreeKey}/${gcTombstoneBlobKey}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbuilder.addBlob(gcTombstoneBlobKey, serializedTombstones);\n\t\t\t}\n\t\t}\n\n\t\t// If there are no deleted nodes, return the summary tree.\n\t\tif (serializedDeletedNodes === undefined) {\n\t\t\treturn builder.getSummaryTree();\n\t\t}\n\n\t\t// If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (\n\t\t\tthis.latestSummaryData?.serializedDeletedNodes === serializedDeletedNodes &&\n\t\t\ttrackState\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tgcDeletedBlobKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`/${gcTreeKey}/${gcDeletedBlobKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcDeletedBlobKey, serializedDeletedNodes);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when either a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tif (!result.isSummaryTracked) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the summary is tracked, this client is the one that generated it. So, update wasGCRunInLatestSummary.\n\t\t// Note that this has to be updated if GC did not run too. Otherwise, `gcStateNeedsReset` will always return\n\t\t// true in scenarios where GC is currently disabled but enabled in the snapshot we loaded from.\n\t\tthis.wasGCRunInLatestSummary = this.configs.shouldRunGC;\n\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestSummaryGCVersion = this.configs.gcVersionInEffect;\n\t\tthis.latestSummaryData = this.pendingSummaryData;\n\t\tthis.pendingSummaryData = undefined;\n\t\tthis.updatedDSCountSinceLastSummary = 0;\n\t\treturn;\n\t}\n\n\t/**\n\t * Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.\n\t */\n\tpublic updateStateFromGCRunStats(stats: IGCStats) {\n\t\tthis.updatedDSCountSinceLastSummary += stats.updatedDataStoreCount;\n\t}\n}\n"]}
1
+ {"version":3,"file":"gcSummaryStateTracker.js","sourceRoot":"","sources":["../../src/gc/gcSummaryStateTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAAmE;AACnE,6EAO6C;AAC7C,iEAA+E;AAG/E,iDAAuD;AAG1C,QAAA,cAAc,GAAG,GAAG,kCAAY,OAAO,CAAC;AAWrD;;;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AC,KAAe;QAC/C,IAAI,CAAC,8BAA8B,IAAI,KAAK,CAAC,qBAAqB,CAAC;IACpE,CAAC;CACD;AAjRD,sDAiRC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tgcTreeKey,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { mergeStats, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { IRefreshSummaryResult } from \"../summary/index.js\";\nimport { GCVersion, IGarbageCollectorConfigs, IGCStats } from \"./gcDefinitions.js\";\nimport { generateSortedGCState } from \"./gcHelpers.js\";\nimport { IGarbageCollectionSnapshotData, IGarbageCollectionState } from \"./gcSummaryDefinitions.js\";\n\nexport const gcStateBlobKey = `${gcBlobPrefix}_root`;\n\n/**\n * The GC data that is tracked for a summary.\n */\nexport interface IGCSummaryTrackingData {\n\tserializedGCState: string | undefined;\n\tserializedTombstones: string | undefined;\n\tserializedDeletedNodes: string | undefined;\n}\n\n/**\n * Encapsulates the garbage collection state that is tracked across summaries.\n * It maintains the GC state as per the latest summary in by the server. It updates state when a summary tracked by this\n * client is acked by the server or from a snapshot is downloaded from the server.\n * On summarize, it decides whether to write new state or re-use previous summary's state.\n */\nexport class GCSummaryStateTracker {\n\t// This is the version of GC data in the latest summary being tracked.\n\tprivate latestSummaryGCVersion: GCVersion;\n\n\t// Keeps track of the GC data from the latest summary successfully acked by the server.\n\tprivate latestSummaryData: IGCSummaryTrackingData | undefined;\n\t// Keeps track of the GC data from the last summary submitted to the server but not yet acked.\n\tprivate pendingSummaryData: IGCSummaryTrackingData | undefined;\n\n\t// Tracks whether there was GC was run in latest summary being tracked.\n\tprivate wasGCRunInLatestSummary: boolean;\n\n\t// Tracks the count of data stores whose state updated since the last summary, i.e., they went from referenced\n\t// to unreferenced or vice-versa.\n\tpublic updatedDSCountSinceLastSummary: number = 0;\n\n\t/** API for ensuring the correct auto-recovery mitigations */\n\tpublic autoRecovery = {\n\t\trequestFullGCOnNextRun: () => {\n\t\t\tthis.fullGCModeForAutoRecovery = true;\n\t\t},\n\t\tfullGCRequested: () => {\n\t\t\treturn this.fullGCModeForAutoRecovery;\n\t\t},\n\t};\n\t/** If true, the next GC run will do fullGC mode to regenerate the GC data for each node */\n\tprivate fullGCModeForAutoRecovery: boolean = false;\n\n\tconstructor(\n\t\t// Tells whether GC should run or not.\n\t\tprivate readonly configs: Pick<\n\t\t\tIGarbageCollectorConfigs,\n\t\t\t\"shouldRunGC\" | \"tombstoneMode\" | \"gcVersionInBaseSnapshot\" | \"gcVersionInEffect\"\n\t\t>,\n\t\t// Tells whether GC was run in the base snapshot this container loaded from.\n\t\twasGCRunInBaseSnapshot: boolean,\n\t) {\n\t\tthis.wasGCRunInLatestSummary = wasGCRunInBaseSnapshot;\n\t\t// For existing document, the latest summary is the one that we loaded from. So, use its GC version as the\n\t\t// latest tracked GC version. For new documents, we will be writing the first summary with the current version.\n\t\tthis.latestSummaryGCVersion =\n\t\t\tthis.configs.gcVersionInBaseSnapshot ?? this.configs.gcVersionInEffect;\n\t}\n\n\t/**\n\t * Tells whether the GC state needs to be reset. This can happen under 3 conditions:\n\t *\n\t * 1. The base snapshot contains GC state but GC is disabled. This will happen the first time GC is disabled after\n\t * it was enabled before. GC state needs to be removed from summary and all nodes should be marked referenced.\n\t *\n\t * 2. The base snapshot does not have GC state but GC is enabled. This will happen the very first time GC runs on\n\t * a document and the first time GC is enabled after is was disabled before.\n\t *\n\t * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n\t *\n\t * Note that the state will be reset only once for the first summary generated after this returns true. After that,\n\t * this will return false.\n\t */\n\tpublic get doesGCStateNeedReset(): boolean {\n\t\treturn this.wasGCRunInLatestSummary !== this.configs.shouldRunGC;\n\t}\n\n\t/**\n\t * Tells whether the GC state needs to be reset in the next summary. We need to do this if:\n\t *\n\t * 1. GC was enabled and is now disabled. The GC state needs to be removed and everything becomes referenced.\n\t *\n\t * 2. GC was disabled and is now enabled. The GC state needs to be regenerated and added to summary.\n\t *\n\t * 3. GC is enabled and the latest summary state is refreshed from a snapshot that had GC disabled and vice-versa.\n\t *\n\t * 4. The GC version in the latest summary is different from the current GC version. This can happen if:\n\t *\n\t * 4.1. The summary this client loaded with has data from a different GC version.\n\t *\n\t * 4.2. This client's latest summary was updated from a snapshot that has a different GC version.\n\t */\n\tpublic get doesSummaryStateNeedReset(): boolean {\n\t\treturn (\n\t\t\tthis.doesGCStateNeedReset ||\n\t\t\t(this.configs.shouldRunGC &&\n\t\t\t\tthis.latestSummaryGCVersion !== this.configs.gcVersionInEffect)\n\t\t);\n\t}\n\n\t/**\n\t * Called during GC initialization. Initialize the latest summary data from the base snapshot data.\n\t */\n\tpublic initializeBaseState(baseSnapshotData: IGarbageCollectionSnapshotData | undefined) {\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If tracking state across summaries, update latest summary data from the snapshot's GC data.\n\t\tthis.latestSummaryData = {\n\t\t\tserializedGCState: baseSnapshotData.gcState\n\t\t\t\t? JSON.stringify(generateSortedGCState(baseSnapshotData.gcState))\n\t\t\t\t: undefined,\n\t\t\tserializedTombstones: JSON.stringify(baseSnapshotData.tombstones),\n\t\t\tserializedDeletedNodes: JSON.stringify(baseSnapshotData.deletedNodes),\n\t\t};\n\t}\n\n\t/**\n\t * Summarizes three component of the GC data - GC state, tombstones and deleted nodes.\n\t * It does incremental summary, i.e., it writes summary tree / summary blob only for the component that changed.\n\t * For components that did not change, a summary handle is returned that points to the previous successful summary.\n\t * If none of the components changed, it returns a summary handle for the entire GC data.\n\t */\n\tpublic summarize(\n\t\ttrackState: boolean,\n\t\tgcState: IGarbageCollectionState,\n\t\tdeletedNodes: Set<string>,\n\t\ttombstones: string[],\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializedGCState = JSON.stringify(generateSortedGCState(gcState));\n\t\t// Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so\n\t\t// to identify deleted nodes' usage.\n\t\tconst serializedDeletedNodes =\n\t\t\tdeletedNodes.size > 0 ? JSON.stringify(Array.from(deletedNodes).sort()) : undefined;\n\t\t// If running in tombstone mode, serialize and write tombstones, if any.\n\t\tconst serializedTombstones = this.configs.tombstoneMode\n\t\t\t? tombstones.length > 0\n\t\t\t\t? JSON.stringify(tombstones.sort())\n\t\t\t\t: undefined\n\t\t\t: undefined;\n\n\t\t/**\n\t\t * Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,\n\t\t * write summary handle instead of summary tree for GC.\n\t\t * Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and\n\t\t * for each of these that did not change, write a summary handle.\n\t\t */\n\t\tthis.pendingSummaryData = {\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t};\n\n\t\tif (trackState && this.latestSummaryData !== undefined) {\n\t\t\t// If nothing changed since last summary, send a summary handle for the entire GC data.\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData.serializedGCState === serializedGCState &&\n\t\t\t\tthis.latestSummaryData.serializedTombstones === serializedTombstones &&\n\t\t\t\tthis.latestSummaryData.serializedDeletedNodes === serializedDeletedNodes\n\t\t\t) {\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: `/${gcTreeKey}`,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If some state changed, build a GC summary tree.\n\t\t\treturn this.buildGCSummaryTree(\n\t\t\t\tserializedGCState,\n\t\t\t\tserializedTombstones,\n\t\t\t\tserializedDeletedNodes,\n\t\t\t\ttrue /* trackState */,\n\t\t\t);\n\t\t}\n\t\t// If not tracking GC state, build a GC summary tree without any summary handles.\n\t\treturn this.buildGCSummaryTree(\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t}\n\n\t/**\n\t * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.\n\t * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.\n\t * If trackState is true, only states that changed are written. Rest are written as handles.\n\t * @param serializedGCState - The GC state serialized as string.\n\t * @param serializedTombstones - The tombstone state serialized as string.\n\t * @param serializedDeletedNodes - Deleted nodes serialized as string.\n\t * @param trackState - Whether we are tracking GC state across summaries.\n\t * @returns the GC summary tree.\n\t */\n\tprivate buildGCSummaryTree(\n\t\tserializedGCState: string,\n\t\tserializedTombstones: string | undefined,\n\t\tserializedDeletedNodes: string | undefined,\n\t\ttrackState: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// If the GC state hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (this.latestSummaryData?.serializedGCState === serializedGCState && trackState) {\n\t\t\tbuilder.addHandle(gcStateBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcStateBlobKey}`);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcStateBlobKey, serializedGCState);\n\t\t}\n\n\t\t// If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a\n\t\t// summary blob.\n\t\tif (serializedTombstones !== undefined) {\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData?.serializedTombstones === serializedTombstones &&\n\t\t\t\ttrackState\n\t\t\t) {\n\t\t\t\tbuilder.addHandle(\n\t\t\t\t\tgcTombstoneBlobKey,\n\t\t\t\t\tSummaryType.Blob,\n\t\t\t\t\t`/${gcTreeKey}/${gcTombstoneBlobKey}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbuilder.addBlob(gcTombstoneBlobKey, serializedTombstones);\n\t\t\t}\n\t\t}\n\n\t\t// If there are no deleted nodes, return the summary tree.\n\t\tif (serializedDeletedNodes === undefined) {\n\t\t\treturn builder.getSummaryTree();\n\t\t}\n\n\t\t// If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (\n\t\t\tthis.latestSummaryData?.serializedDeletedNodes === serializedDeletedNodes &&\n\t\t\ttrackState\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tgcDeletedBlobKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`/${gcTreeKey}/${gcDeletedBlobKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcDeletedBlobKey, serializedDeletedNodes);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tif (!result.isSummaryTracked) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the summary is tracked, this client is the one that generated it. So, update wasGCRunInLatestSummary.\n\t\t// Note that this has to be updated if GC did not run too. Otherwise, `gcStateNeedsReset` will always return\n\t\t// true in scenarios where GC is currently disabled but enabled in the snapshot we loaded from.\n\t\tthis.wasGCRunInLatestSummary = this.configs.shouldRunGC;\n\n\t\tif (!this.configs.shouldRunGC) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestSummaryGCVersion = this.configs.gcVersionInEffect;\n\t\tthis.latestSummaryData = this.pendingSummaryData;\n\t\tthis.pendingSummaryData = undefined;\n\t\tthis.updatedDSCountSinceLastSummary = 0;\n\t\tthis.fullGCModeForAutoRecovery = false;\n\t\treturn;\n\t}\n\n\t/**\n\t * Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.\n\t */\n\tpublic updateStateFromGCRunStats(stats: IGCStats) {\n\t\tthis.updatedDSCountSinceLastSummary += stats.updatedDataStoreCount;\n\t}\n}\n"]}
@@ -2,13 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryGenericEvent } from "@fluidframework/core-interfaces";
6
5
  import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
7
- import { ITelemetryLoggerExt, MonitoringContext } from "@fluidframework/telemetry-utils";
8
- import { RuntimeHeaderData } from "../containerRuntime";
9
- import { ICreateContainerMetadata } from "../summary";
10
- import { GCNodeType, IGarbageCollectorConfigs } from "./gcDefinitions";
11
- import { UnreferencedStateTracker } from "./gcUnreferencedStateTracker";
6
+ import { ITelemetryLoggerExt, MonitoringContext, type ITelemetryGenericEventExt } from "@fluidframework/telemetry-utils";
7
+ import { RuntimeHeaderData } from "../containerRuntime.js";
8
+ import { ICreateContainerMetadata } from "../summary/index.js";
9
+ import { GCNodeType, IGarbageCollectorConfigs } from "./gcDefinitions.js";
10
+ import { UnreferencedStateTracker } from "./gcUnreferencedStateTracker.js";
12
11
  type NodeUsageType = "Changed" | "Loaded" | "Revived";
13
12
  /** Properties that are common to IUnreferencedEventProps and INodeUsageProps */
14
13
  interface ICommonProps {
@@ -24,6 +23,7 @@ interface INodeUsageProps extends ICommonProps {
24
23
  currentReferenceTimestampMs: number | undefined;
25
24
  packagePath: readonly string[] | undefined;
26
25
  fromId?: string;
26
+ autorecovery?: true;
27
27
  }
28
28
  /**
29
29
  * Encapsulates the logic that tracks the various telemetry logged by the Garbage Collector.
@@ -91,7 +91,7 @@ export declare class GCTelemetryTracker {
91
91
  * Consolidates info / logic for logging when we encounter unexpected usage of GC'd objects. For example, when a
92
92
  * tombstoned or deleted object is loaded.
93
93
  */
94
- export declare function sendGCUnexpectedUsageEvent(mc: MonitoringContext, event: ITelemetryGenericEvent & {
94
+ export declare function sendGCUnexpectedUsageEvent(mc: MonitoringContext, event: ITelemetryGenericEventExt & {
95
95
  category: "error" | "generic";
96
96
  gcTombstoneEnforcementAllowed: boolean | undefined;
97
97
  }, packagePath: readonly string[] | undefined, error?: unknown): void;
@@ -1 +1 @@
1
- {"version":3,"file":"gcTelemetry.d.ts","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAEN,mBAAmB,EACnB,iBAAiB,EAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACN,UAAU,EAEV,wBAAwB,EAMxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD,gFAAgF;AAChF,UAAU,YAAY;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAuBD,kEAAkE;AAClE,UAAU,eAAgB,SAAQ,YAAY;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAkB;IAQ7B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,Q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@ -6,7 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.sendGCUnexpectedUsageEvent = exports.GCTelemetryTracker = void 0;
8
8
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
9
- const gcDefinitions_1 = require("./gcDefinitions");
9
+ const gcDefinitions_js_1 = require("./gcDefinitions.js");
10
10
  /**
11
11
  * Encapsulates the logic that tracks the various telemetry logged by the Garbage Collector.
12
12
  *
@@ -45,15 +45,15 @@ class GCTelemetryTracker {
45
45
  * 2. An event is logged only once per container instance per event per node.
46
46
  */
47
47
  shouldLogNonActiveEvent(nodeType, usageType, nodeStateTracker, uniqueEventId) {
48
- if (nodeStateTracker.state === gcDefinitions_1.UnreferencedState.Active) {
48
+ if (nodeStateTracker.state === gcDefinitions_js_1.UnreferencedState.Active) {
49
49
  return false;
50
50
  }
51
- if (nodeType === gcDefinitions_1.GCNodeType.Other) {
51
+ if (nodeType === gcDefinitions_js_1.GCNodeType.Other) {
52
52
  return false;
53
53
  }
54
54
  // For sub data store (DDS) nodes, if they are changed, its data store will also be changed,
55
55
  // so skip logging to make the telemetry less noisy.
56
- if (nodeType === gcDefinitions_1.GCNodeType.SubDataStore && usageType === "Changed") {
56
+ if (nodeType === gcDefinitions_js_1.GCNodeType.SubDataStore && usageType === "Changed") {
57
57
  return false;
58
58
  }
59
59
  // Non-tombstone events are logged once per event per node. A unique id is generated by joining
@@ -77,11 +77,11 @@ class GCTelemetryTracker {
77
77
  const nodeType = this.getNodeType(nodeUsageProps.id);
78
78
  const timeout = (() => {
79
79
  switch (nodeStateTracker?.state) {
80
- case gcDefinitions_1.UnreferencedState.Inactive:
80
+ case gcDefinitions_js_1.UnreferencedState.Inactive:
81
81
  return this.configs.inactiveTimeoutMs;
82
- case gcDefinitions_1.UnreferencedState.TombstoneReady:
82
+ case gcDefinitions_js_1.UnreferencedState.TombstoneReady:
83
83
  return this.configs.tombstoneTimeoutMs;
84
- case gcDefinitions_1.UnreferencedState.SweepReady:
84
+ case gcDefinitions_js_1.UnreferencedState.SweepReady:
85
85
  return (this.configs.tombstoneTimeoutMs &&
86
86
  this.configs.tombstoneTimeoutMs + this.configs.sweepGracePeriodMs);
87
87
  default:
@@ -104,8 +104,6 @@ class GCTelemetryTracker {
104
104
  gcConfigs: { ...configs, ...persistedGcFeatureMatrix },
105
105
  };
106
106
  // If the node that is used is tombstoned, log a tombstone telemetry.
107
- // Note that this is done before checking if "nodeStateTracker" is undefined below because unreferenced
108
- // tracking may not have yet been enabled. That happens only after the client transitions to write mode.
109
107
  if (nodeUsageProps.isTombstoned) {
110
108
  this.logTombstoneUsageTelemetry(nodeUsageProps, unrefEventProps, nodeType, usageType);
111
109
  }
@@ -176,12 +174,12 @@ class GCTelemetryTracker {
176
174
  details: detailedProps,
177
175
  gcConfigs,
178
176
  tombstoneFlags: {
179
- DisableTombstone: this.mc.config.getBoolean(gcDefinitions_1.disableTombstoneKey),
180
- ThrowOnTombstoneUsage: this.mc.config.getBoolean(gcDefinitions_1.throwOnTombstoneUsageKey),
181
- ThrowOnTombstoneLoad: this.mc.config.getBoolean(gcDefinitions_1.throwOnTombstoneLoadOverrideKey),
177
+ DisableTombstone: this.mc.config.getBoolean(gcDefinitions_js_1.disableTombstoneKey),
178
+ ThrowOnTombstoneUsage: this.mc.config.getBoolean(gcDefinitions_js_1.throwOnTombstoneUsageKey),
179
+ ThrowOnTombstoneLoad: this.mc.config.getBoolean(gcDefinitions_js_1.throwOnTombstoneLoadOverrideKey),
182
180
  },
183
181
  sweepFlags: {
184
- EnableSweepFlag: this.mc.config.getBoolean(gcDefinitions_1.runSweepKey),
182
+ EnableSweepFlag: this.mc.config.getBoolean(gcDefinitions_js_1.runSweepKey),
185
183
  },
186
184
  };
187
185
  if ((usageType === "Loaded" &&
@@ -221,7 +219,7 @@ class GCTelemetryTracker {
221
219
  const missingExplicitRoutes = [];
222
220
  for (const route of currentOutboundRoutes) {
223
221
  const nodeType = this.getNodeType(route);
224
- if ((nodeType === gcDefinitions_1.GCNodeType.DataStore || nodeType === gcDefinitions_1.GCNodeType.Blob) &&
222
+ if ((nodeType === gcDefinitions_js_1.GCNodeType.DataStore || nodeType === gcDefinitions_js_1.GCNodeType.Blob) &&
225
223
  !nodeId.startsWith(route) &&
226
224
  !previousRoutes.includes(route) &&
227
225
  !explicitRoutes.includes(route)) {
@@ -229,7 +227,9 @@ class GCTelemetryTracker {
229
227
  }
230
228
  }
231
229
  if (missingExplicitRoutes.length > 0) {
232
- logger.sendErrorEvent({
230
+ // Send as Generic not Error since there are known corner cases where this will fire.
231
+ // E.g. If an old client re-references a node via an attach op (that doesn't include GC Data)
232
+ logger.sendTelemetryEvent({
233
233
  eventName: "gcUnknownOutboundReferences",
234
234
  ...(0, telemetry_utils_1.tagCodeArtifacts)({
235
235
  id: nodeId,
@@ -260,7 +260,7 @@ class GCTelemetryTracker {
260
260
  */
261
261
  const nodeStateTracker = this.getNodeStateTracker(eventProps.id.value);
262
262
  const active = nodeStateTracker === undefined ||
263
- nodeStateTracker.state === gcDefinitions_1.UnreferencedState.Active;
263
+ nodeStateTracker.state === gcDefinitions_js_1.UnreferencedState.Active;
264
264
  if ((usageType === "Revived") === active) {
265
265
  const pkg = await this.getNodePackagePath(eventProps.id.value);
266
266
  const fromPkg = eventProps.fromId
@@ -294,12 +294,12 @@ exports.GCTelemetryTracker = GCTelemetryTracker;
294
294
  function sendGCUnexpectedUsageEvent(mc, event, packagePath, error) {
295
295
  event.pkg = (0, telemetry_utils_1.tagCodeArtifacts)({ pkg: packagePath?.join("/") })?.pkg;
296
296
  event.tombstoneFlags = JSON.stringify({
297
- DisableTombstone: mc.config.getBoolean(gcDefinitions_1.disableTombstoneKey),
298
- ThrowOnTombstoneUsage: mc.config.getBoolean(gcDefinitions_1.throwOnTombstoneUsageKey),
299
- ThrowOnTombstoneLoad: mc.config.getBoolean(gcDefinitions_1.throwOnTombstoneLoadOverrideKey),
297
+ DisableTombstone: mc.config.getBoolean(gcDefinitions_js_1.disableTombstoneKey),
298
+ ThrowOnTombstoneUsage: mc.config.getBoolean(gcDefinitions_js_1.throwOnTombstoneUsageKey),
299
+ ThrowOnTombstoneLoad: mc.config.getBoolean(gcDefinitions_js_1.throwOnTombstoneLoadOverrideKey),
300
300
  });
301
301
  event.sweepFlags = JSON.stringify({
302
- EnableSweepFlag: mc.config.getBoolean(gcDefinitions_1.runSweepKey),
302
+ EnableSweepFlag: mc.config.getBoolean(gcDefinitions_js_1.runSweepKey),
303
303
  });
304
304
  mc.logger.sendTelemetryEvent(event, error);
305
305
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gcTelemetry.js","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,qEAKyC;AAGzC,mDASyB;AA2CzB;;;;;;;;;;;;;;;GAeG;AACH,MAAa,kBAAkB;IAO9B,YACkB,EAAqB,EACrB,OAAiC,EACjC,kBAA2B,EAC3B,uBAAiD,EACjD,WAA2C,EAC3C,mBAEwB,EACxB,kBAE0B;QAV1B,OAAE,GAAF,EAAE,CAAmB;QACrB,YAAO,GAAP,OAAO,CAA0B;QACjC,uBAAkB,GAAlB,kBAAkB,CAAS;QAC3B,4BAAuB,GAAvB,uBAAuB,CAA0B;QACjD,gBAAW,GAAX,WAAW,CAAgC;QAC3C,wBAAmB,GAAnB,mBAAmB,CAEK;QACxB,uBAAkB,GAAlB,kBAAkB,CAEQ;QAjB5C,iHAAiH;QACjH,sBAAsB;QACL,6BAAwB,GAAgB,IAAI,GAAG,EAAE,CAAC;QACnE,6EAA6E;QACrE,uBAAkB,GAA8B,EAAE,CAAC;IAcxD,CAAC;IAEJ;;;;;OAKG;IACK,uBAAuB,CAC9B,QAAoB,EACpB,SAAwB,EACxB,gBAA0C,EAC1C,aAAqB;QAErB,IAAI,gBAAgB,CAAC,KAAK,KAAK,iCAAiB,CAAC,MAAM,EAAE;YACxD,OAAO,KAAK,CAAC;SACb;QAED,IAAI,QAAQ,KAAK,0BAA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,KAGC,EACD,WAA0C,EAC1C,KAAe;IAEf,KAAK,CAAC,GAAG,GAAG,IAAA,kCAAgB,EAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACnE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QACrC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,mCAAmB,CAAC;QAC3D,qBAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,wCAAwB,CAAC;QACrE,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,+CAA+B,CAAC;KAC3E,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,eAAe,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,2BAAW,CAAC;KAClD,CAAC,CAAC;IAEH,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AApBD,gEAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryGenericEvent } from \"@fluidframework/core-interfaces\";\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\nimport {\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { RuntimeHeaderData } from \"../containerRuntime\";\nimport { ICreateContainerMetadata } from \"../summary\";\nimport {\n\tGCNodeType,\n\tUnreferencedState,\n\tIGarbageCollectorConfigs,\n\tdisableTombstoneKey,\n\tthrowOnTombstoneUsageKey,\n\tthrowOnTombstoneLoadOverrideKey,\n\trunSweepKey,\n\tGCFeatureMatrix,\n} from \"./gcDefinitions\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\n\ntype NodeUsageType = \"Changed\" | \"Loaded\" | \"Revived\";\n\n/** Properties that are common to IUnreferencedEventProps and INodeUsageProps */\ninterface ICommonProps {\n\tusageType: NodeUsageType;\n\tcompletedGCRuns: number;\n\tisTombstoned: boolean;\n\tlastSummaryTime?: number;\n\theaders?: RuntimeHeaderData;\n}\n\n/** The event that is logged when unreferenced node is used after a certain time. */\ninterface IUnreferencedEventProps extends ICreateContainerMetadata, ICommonProps {\n\tstate: UnreferencedState;\n\tid: {\n\t\tvalue: string;\n\t\ttag: string;\n\t};\n\ttype: GCNodeType;\n\tunrefTime: number;\n\tage: number;\n\t// Expanding GC feature matrix. Without doing this, the configs cannot be logged in telemetry directly.\n\tgcConfigs: Omit<IGarbageCollectorConfigs, \"persistedGcFeatureMatrix\"> & {\n\t\t[K in keyof GCFeatureMatrix]: GCFeatureMatrix[K];\n\t};\n\ttimeout?: number;\n\tfromId?: {\n\t\tvalue: string;\n\t\ttag: string;\n\t};\n}\n\n/** Properties passed to nodeUsed function when a node is used. */\ninterface INodeUsageProps extends ICommonProps {\n\tid: string;\n\tcurrentReferenceTimestampMs: number | undefined;\n\tpackagePath: readonly string[] | undefined;\n\tfromId?: string;\n}\n\n/**\n * Encapsulates the logic that tracks the various telemetry logged by the Garbage Collector.\n *\n * These events are not logged as errors, just generic events, since there can be false positives:\n *\n * 1. inactiveObject telemetry - When an inactive node is used - A node that has been unreferenced for inactiveTimeoutMs.\n * 2. tombstoneReadyObject telemetry - When a tombstone-ready node is used - A node that has been unreferenced for tombstoneTimeoutMs.\n * 3. sweepReadyObject telemetry - When a sweep-ready node is used - A node that has been unreferenced for tombstoneTimeoutMs + sweepGracePeriodMs.\n *\n * These events are logged as errors since they are based on the core GC logic:\n *\n * 1. Tombstone telemetry - When a tombstoned node is used - A node that has been marked as tombstone.\n * 2. Unknown outbound reference telemetry - When a node is referenced but GC was not notified of it when the new reference appeared.\n *\n * Note: The telemetry for a Deleted node being used is logged elsewhere in this package.\n */\nexport class GCTelemetryTracker {\n\t// Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one\n\t// per event per node.\n\tprivate readonly loggedUnreferencedEvents: Set<string> = new Set();\n\t// Queue for unreferenced events that should be logged the next time GC runs.\n\tprivate pendingEventsQueue: IUnreferencedEventProps[] = [];\n\n\tconstructor(\n\t\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly configs: IGarbageCollectorConfigs,\n\t\tprivate readonly isSummarizerClient: boolean,\n\t\tprivate readonly createContainerMetadata: ICreateContainerMetadata,\n\t\tprivate readonly getNodeType: (nodeId: string) => GCNodeType,\n\t\tprivate readonly getNodeStateTracker: (\n\t\t\tnodeId: string,\n\t\t) => UnreferencedStateTracker | undefined,\n\t\tprivate readonly getNodePackagePath: (\n\t\t\tnodePath: string,\n\t\t) => Promise<readonly string[] | undefined>,\n\t) {}\n\n\t/**\n\t * Returns whether an event should be logged for a node that isn't active anymore. This does not apply to\n\t * tombstoned nodes for which an event is always logged. Some scenarios where we won't log:\n\t * 1. When a DDS is changed. The corresponding data store's event will be logged instead.\n\t * 2. An event is logged only once per container instance per event per node.\n\t */\n\tprivate shouldLogNonActiveEvent(\n\t\tnodeType: GCNodeType,\n\t\tusageType: NodeUsageType,\n\t\tnodeStateTracker: UnreferencedStateTracker,\n\t\tuniqueEventId: string,\n\t) {\n\t\tif (nodeStateTracker.state === UnreferencedState.Active) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodeType === GCNodeType.Other) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// For sub data store (DDS) nodes, if they are changed, its data store will also be changed,\n\t\t// so skip logging to make the telemetry less noisy.\n\t\tif (nodeType === GCNodeType.SubDataStore && usageType === \"Changed\") {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Non-tombstone events are logged once per event per node. A unique id is generated by joining\n\t\t// node state (inactive / sweep ready), node's id and usage (loaded / changed / revived).\n\t\tif (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called when a node is used. If the node is not active or tombstoned, log telemetry indicating object is used\n\t * when it should not have been.\n\t */\n\tpublic nodeUsed(nodeUsageProps: INodeUsageProps) {\n\t\t// If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n\t\t// logging as nothing interesting would have happened worth logging.\n\t\tif (nodeUsageProps.currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeStateTracker = this.getNodeStateTracker(nodeUsageProps.id);\n\t\tconst nodeType = this.getNodeType(nodeUsageProps.id);\n\t\tconst timeout = (() => {\n\t\t\tswitch (nodeStateTracker?.state) {\n\t\t\t\tcase UnreferencedState.Inactive:\n\t\t\t\t\treturn this.configs.inactiveTimeoutMs;\n\t\t\t\tcase UnreferencedState.TombstoneReady:\n\t\t\t\t\treturn this.configs.tombstoneTimeoutMs;\n\t\t\t\tcase UnreferencedState.SweepReady:\n\t\t\t\t\treturn (\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs &&\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs + this.configs.sweepGracePeriodMs\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn undefined;\n\t\t\t}\n\t\t})();\n\t\tconst {\n\t\t\tusageType,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tpackagePath,\n\t\t\tid: untaggedId,\n\t\t\tfromId: untaggedFromId,\n\t\t\t...propsToLog\n\t\t} = nodeUsageProps;\n\t\tconst { persistedGcFeatureMatrix, ...configs } = this.configs;\n\t\tconst unrefEventProps: Omit<IUnreferencedEventProps, \"state\" | \"usageType\"> = {\n\t\t\ttype: nodeType,\n\t\t\tunrefTime: nodeStateTracker?.unreferencedTimestampMs ?? -1,\n\t\t\tage:\n\t\t\t\tnodeStateTracker !== undefined\n\t\t\t\t\t? nodeUsageProps.currentReferenceTimestampMs -\n\t\t\t\t\t nodeStateTracker.unreferencedTimestampMs\n\t\t\t\t\t: -1,\n\t\t\ttimeout,\n\t\t\t...tagCodeArtifacts({ id: untaggedId, fromId: untaggedFromId }),\n\t\t\t...propsToLog,\n\t\t\t...this.createContainerMetadata,\n\t\t\tgcConfigs: { ...configs, ...persistedGcFeatureMatrix },\n\t\t};\n\n\t\t// If the node that is used is tombstoned, log a tombstone telemetry.\n\t\t// Note that this is done before checking if \"nodeStateTracker\" is undefined below because unreferenced\n\t\t// tracking may not have yet been enabled. That happens only after the client transitions to write mode.\n\t\tif (nodeUsageProps.isTombstoned) {\n\t\t\tthis.logTombstoneUsageTelemetry(nodeUsageProps, unrefEventProps, nodeType, usageType);\n\t\t}\n\n\t\t// After logging tombstone telemetry, if the node's unreferenced state is not tracked, there is nothing\n\t\t// else to log.\n\t\tif (nodeStateTracker === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst state = nodeStateTracker.state;\n\t\tconst uniqueEventId = `${state}-${nodeUsageProps.id}-${nodeUsageProps.usageType}`;\n\n\t\tif (\n\t\t\t!this.shouldLogNonActiveEvent(\n\t\t\t\tnodeType,\n\t\t\t\tnodeUsageProps.usageType,\n\t\t\t\tnodeStateTracker,\n\t\t\t\tuniqueEventId,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add the unique event id so that we don't generate a log for this event again in this session.\n\t\tthis.loggedUnreferencedEvents.add(uniqueEventId);\n\n\t\t// For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.\n\t\t// For non-summarizer client, log the event now since GC won't run on it. This may result in false positives\n\t\t// but it's a good signal nonetheless and we can consume it with a grain of salt.\n\t\t// Inactive errors are usages of Objects that are unreferenced for at least a period of 7 days.\n\t\t// SweepReady errors are usages of Objects that will be deleted by GC Sweep!\n\t\tif (this.isSummarizerClient) {\n\t\t\tthis.pendingEventsQueue.push({\n\t\t\t\t...unrefEventProps,\n\t\t\t\tusageType: nodeUsageProps.usageType,\n\t\t\t\tstate,\n\t\t\t});\n\t\t} else {\n\t\t\t// For non-summarizer clients, only log \"Loaded\" type events since these objects may not be loaded in the\n\t\t\t// summarizer clients if they are based off of user actions (such as scrolling to content for these objects)\n\t\t\t// Events generated:\n\t\t\t// InactiveObject_Loaded, SweepReadyObject_Loaded\n\t\t\tif (nodeUsageProps.usageType === \"Loaded\") {\n\t\t\t\tconst { id, fromId, headers, gcConfigs, ...detailedProps } = unrefEventProps;\n\t\t\t\tconst event = {\n\t\t\t\t\teventName: `${state}Object_${nodeUsageProps.usageType}`,\n\t\t\t\t\t...tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join(\"/\") }),\n\t\t\t\t\tstack: generateStack(),\n\t\t\t\t\tid,\n\t\t\t\t\tfromId,\n\t\t\t\t\theaders: { ...headers },\n\t\t\t\t\tdetails: detailedProps,\n\t\t\t\t\tgcConfigs,\n\t\t\t\t};\n\n\t\t\t\t// These are logged as generic events and not errors because there can be false positives. The Tombstone\n\t\t\t\t// and Delete errors are separately logged and are reliable.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Logs telemetry when a tombstoned object is changed, revived or loaded.\n\t */\n\tprivate logTombstoneUsageTelemetry(\n\t\tnodeUsageProps: INodeUsageProps,\n\t\tunrefEventProps: Omit<IUnreferencedEventProps, \"state\" | \"usageType\">,\n\t\tnodeType: GCNodeType,\n\t\tusageType: NodeUsageType,\n\t) {\n\t\t// This will log the following events:\n\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_DataStore_Changed, GC_Tombstone_DataStore_Revived\n\t\t// GC_Tombstone_SubDataStore_Requested, GC_Tombstone_SubDataStore_Changed, GC_Tombstone_SubDataStore_Revived\n\t\t// GC_Tombstone_Blob_Requested, GC_Tombstone_Blob_Changed, GC_Tombstone_Blob_Revived\n\t\tconst { id, fromId, headers, gcConfigs, ...detailedProps } = unrefEventProps;\n\t\tconst eventUsageName = usageType === \"Loaded\" ? \"Requested\" : usageType;\n\t\tconst event = {\n\t\t\teventName: `GC_Tombstone_${nodeType}_${eventUsageName}`,\n\t\t\tpkg: tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join(\"/\") }).pkg,\n\t\t\tstack: generateStack(),\n\t\t\tid,\n\t\t\tfromId,\n\t\t\theaders: { ...headers },\n\t\t\tdetails: detailedProps,\n\t\t\tgcConfigs,\n\t\t\ttombstoneFlags: {\n\t\t\t\tDisableTombstone: this.mc.config.getBoolean(disableTombstoneKey),\n\t\t\t\tThrowOnTombstoneUsage: this.mc.config.getBoolean(throwOnTombstoneUsageKey),\n\t\t\t\tThrowOnTombstoneLoad: this.mc.config.getBoolean(throwOnTombstoneLoadOverrideKey),\n\t\t\t},\n\t\t\tsweepFlags: {\n\t\t\t\tEnableSweepFlag: this.mc.config.getBoolean(runSweepKey),\n\t\t\t},\n\t\t};\n\n\t\tif (\n\t\t\t(usageType === \"Loaded\" &&\n\t\t\t\tthis.configs.throwOnTombstoneLoad &&\n\t\t\t\t!headers?.allowTombstone) ||\n\t\t\t(usageType === \"Changed\" && this.configs.throwOnTombstoneUsage)\n\t\t) {\n\t\t\tthis.mc.logger.sendErrorEvent(event);\n\t\t} else {\n\t\t\tthis.mc.logger.sendTelemetryEvent(event);\n\t\t}\n\t}\n\n\t/**\n\t * Log all new references or outbound routes in the current graph that haven't been explicitly notified to GC.\n\t * The principle is that every new reference or outbound route must be notified to GC via the\n\t * addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.\n\t *\n\t * In more simple terms:\n\t * Missing Explicit References = Current References - Previous References - Explicitly Added References;\n\t *\n\t * @param currentGCData - The GC data (reference graph) from the current GC run.\n\t * @param previousGCData - The GC data (reference graph) from the previous GC run.\n\t * @param explicitReferences - New references added explicity between the previous and the current run.\n\t */\n\tpublic logIfMissingExplicitReferences(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData,\n\t\texplicitReferences: Map<string, string[]>,\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tfor (const [nodeId, currentOutboundRoutes] of Object.entries(currentGCData.gcNodes)) {\n\t\t\tconst previousRoutes = previousGCData.gcNodes[nodeId] ?? [];\n\t\t\tconst explicitRoutes = explicitReferences.get(nodeId) ?? [];\n\n\t\t\t/**\n\t\t\t * 1. For routes in the current GC data, routes that were not present in previous GC data and did not have\n\t\t\t * explicit references should be added to missing explicit routes list.\n\t\t\t * 2. Only include data store and blob routes since GC only works for these two.\n\t\t\t * Note: Due to a bug with de-duped blobs, only adding data store routes for now.\n\t\t\t * 3. Ignore DDS routes to their parent datastores since those were added implicitly. So, there won't be\n\t\t\t * explicit routes to them.\n\t\t\t */\n\t\t\tconst missingExplicitRoutes: string[] = [];\n\t\t\tfor (const route of currentOutboundRoutes) {\n\t\t\t\tconst nodeType = this.getNodeType(route);\n\t\t\t\tif (\n\t\t\t\t\t(nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob) &&\n\t\t\t\t\t!nodeId.startsWith(route) &&\n\t\t\t\t\t!previousRoutes.includes(route) &&\n\t\t\t\t\t!explicitRoutes.includes(route)\n\t\t\t\t) {\n\t\t\t\t\tmissingExplicitRoutes.push(route);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (missingExplicitRoutes.length > 0) {\n\t\t\t\tlogger.sendErrorEvent({\n\t\t\t\t\teventName: \"gcUnknownOutboundReferences\",\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tid: nodeId,\n\t\t\t\t\t\troutes: JSON.stringify(missingExplicitRoutes),\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Log events that are pending in pendingEventsQueue. This is called after GC runs in the summarizer client\n\t * so that the state of an unreferenced node is updated.\n\t */\n\tpublic async logPendingEvents(logger: ITelemetryLoggerExt) {\n\t\t// Events sent come only from the summarizer client. In between summaries, events are pushed to a queue and at\n\t\t// summary time they are then logged.\n\t\t// Events generated:\n\t\t// InactiveObject_Loaded, InactiveObject_Changed, InactiveObject_Revived\n\t\t// SweepReadyObject_Loaded, SweepReadyObject_Changed, SweepReadyObject_Revived\n\t\tfor (const eventProps of this.pendingEventsQueue) {\n\t\t\t// const { usageType, state, id, fromId, ...propsToLog } = eventProps;\n\t\t\tconst { usageType, state, id, fromId, headers, gcConfigs, ...detailedProps } =\n\t\t\t\teventProps;\n\t\t\t/**\n\t\t\t * Revived event is logged only if the node is active. If the node is not active, the reference to it was\n\t\t\t * from another unreferenced node and this scenario is not interesting to log.\n\t\t\t * Loaded and Changed events are logged only if the node is not active. If the node is active, it was\n\t\t\t * revived and a Revived event will be logged for it.\n\t\t\t */\n\t\t\tconst nodeStateTracker = this.getNodeStateTracker(eventProps.id.value);\n\t\t\tconst active =\n\t\t\t\tnodeStateTracker === undefined ||\n\t\t\t\tnodeStateTracker.state === UnreferencedState.Active;\n\t\t\tif ((usageType === \"Revived\") === active) {\n\t\t\t\tconst pkg = await this.getNodePackagePath(eventProps.id.value);\n\t\t\t\tconst fromPkg = eventProps.fromId\n\t\t\t\t\t? await this.getNodePackagePath(eventProps.fromId.value)\n\t\t\t\t\t: undefined;\n\t\t\t\tconst event = {\n\t\t\t\t\teventName: `${state}Object_${usageType}`,\n\t\t\t\t\tid,\n\t\t\t\t\tfromId,\n\t\t\t\t\theaders: { ...headers },\n\t\t\t\t\tdetails: detailedProps,\n\t\t\t\t\tgcConfigs,\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tpkg: pkg?.join(\"/\"),\n\t\t\t\t\t\tfromPkg: fromPkg?.join(\"/\"),\n\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\t// These are logged as generic events and not errors because there can be false positives. The Tombstone\n\t\t\t\t// and Delete errors are separately logged and are reliable.\n\t\t\t\tlogger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t}\n\t\tthis.pendingEventsQueue = [];\n\t}\n}\n\n/**\n * Consolidates info / logic for logging when we encounter unexpected usage of GC'd objects. For example, when a\n * tombstoned or deleted object is loaded.\n */\nexport function sendGCUnexpectedUsageEvent(\n\tmc: MonitoringContext,\n\tevent: ITelemetryGenericEvent & {\n\t\tcategory: \"error\" | \"generic\";\n\t\tgcTombstoneEnforcementAllowed: boolean | undefined;\n\t},\n\tpackagePath: readonly string[] | undefined,\n\terror?: unknown,\n) {\n\tevent.pkg = tagCodeArtifacts({ pkg: packagePath?.join(\"/\") })?.pkg;\n\tevent.tombstoneFlags = JSON.stringify({\n\t\tDisableTombstone: mc.config.getBoolean(disableTombstoneKey),\n\t\tThrowOnTombstoneUsage: mc.config.getBoolean(throwOnTombstoneUsageKey),\n\t\tThrowOnTombstoneLoad: mc.config.getBoolean(throwOnTombstoneLoadOverrideKey),\n\t});\n\tevent.sweepFlags = JSON.stringify({\n\t\tEnableSweepFlag: mc.config.getBoolean(runSweepKey),\n\t});\n\n\tmc.logger.sendTelemetryEvent(event, error);\n}\n"]}
1
+ {"version":3,"file":"gcTelemetry.js","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAMyC;AAGzC,yDAS4B;AA4C5B;;;;;;;;;;;;;;;GAeG;AACH,MAAa,kBAAkB;IAO9B,YACkB,EAAqB,EACrB,OAAiC,EACjC,kBAA2B,EAC3B,uBAAiD,EACjD,WAA2C,EAC3C,mBAEwB,EACxB,kBAE0B;QAV1B,OAAE,GAAF,EAAE,CAAmB;QACrB,YAAO,GAAP,OAAO,CAA0B;QACjC,uBAAkB,GAAlB,kBAAkB,CAAS;QAC3B,4BAAuB,GAAvB,uBAAuB,CAA0B;QACjD,gBAAW,GAAX,WAAW,CAAgC;QAC3C,wBAAmB,GAAnB,mBAAmB,CAEK;QACxB,uBAAkB,GAAlB,kBAAkB,CAEQ;QAjB5C,iHAAiH;QACjH,sBAAsB;QACL,6BAAwB,GAAgB,IAAI,GAAG,EAAE,CAAC;QACnE,6EAA6E;QACrE,uBAAkB,GAA8B,EAAE,CAAC;IAcxD,CAAC;IAEJ;;;;;OAKG;IACK,uBAAu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5D,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;aACjC;SACD;QACD,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC9B,CAAC;CACD;AAnUD,gDAmUC;AAED;;;GAGG;AACH,SAAgB,0BAA0B,CACzC,EAAqB,EACrB,KAGC,EACD,WAA0C,EAC1C,KAAe;IAEf,KAAK,CAAC,GAAG,GAAG,IAAA,kCAAgB,EAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACnE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QACrC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,sCAAmB,CAAC;QAC3D,qBAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,2CAAwB,CAAC;QACrE,oBAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,kDAA+B,CAAC;KAC3E,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,eAAe,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,8BAAW,CAAC;KAClD,CAAC,CAAC;IAEH,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AApBD,gEAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\nimport {\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n\ttype ITelemetryGenericEventExt,\n} from \"@fluidframework/telemetry-utils\";\nimport { RuntimeHeaderData } from \"../containerRuntime.js\";\nimport { ICreateContainerMetadata } from \"../summary/index.js\";\nimport {\n\tGCNodeType,\n\tUnreferencedState,\n\tIGarbageCollectorConfigs,\n\tdisableTombstoneKey,\n\tthrowOnTombstoneUsageKey,\n\tthrowOnTombstoneLoadOverrideKey,\n\trunSweepKey,\n\tGCFeatureMatrix,\n} from \"./gcDefinitions.js\";\nimport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker.js\";\n\ntype NodeUsageType = \"Changed\" | \"Loaded\" | \"Revived\";\n\n/** Properties that are common to IUnreferencedEventProps and INodeUsageProps */\ninterface ICommonProps {\n\tusageType: NodeUsageType;\n\tcompletedGCRuns: number;\n\tisTombstoned: boolean;\n\tlastSummaryTime?: number;\n\theaders?: RuntimeHeaderData;\n}\n\n/** The event that is logged when unreferenced node is used after a certain time. */\ninterface IUnreferencedEventProps extends ICreateContainerMetadata, ICommonProps {\n\tstate: UnreferencedState;\n\tid: {\n\t\tvalue: string;\n\t\ttag: string;\n\t};\n\ttype: GCNodeType;\n\tunrefTime: number;\n\tage: number;\n\t// Expanding GC feature matrix. Without doing this, the configs cannot be logged in telemetry directly.\n\tgcConfigs: Omit<IGarbageCollectorConfigs, \"persistedGcFeatureMatrix\"> & {\n\t\t[K in keyof GCFeatureMatrix]: GCFeatureMatrix[K];\n\t};\n\ttimeout?: number;\n\tfromId?: {\n\t\tvalue: string;\n\t\ttag: string;\n\t};\n}\n\n/** Properties passed to nodeUsed function when a node is used. */\ninterface INodeUsageProps extends ICommonProps {\n\tid: string;\n\tcurrentReferenceTimestampMs: number | undefined;\n\tpackagePath: readonly string[] | undefined;\n\tfromId?: string;\n\tautorecovery?: true;\n}\n\n/**\n * Encapsulates the logic that tracks the various telemetry logged by the Garbage Collector.\n *\n * These events are not logged as errors, just generic events, since there can be false positives:\n *\n * 1. inactiveObject telemetry - When an inactive node is used - A node that has been unreferenced for inactiveTimeoutMs.\n * 2. tombstoneReadyObject telemetry - When a tombstone-ready node is used - A node that has been unreferenced for tombstoneTimeoutMs.\n * 3. sweepReadyObject telemetry - When a sweep-ready node is used - A node that has been unreferenced for tombstoneTimeoutMs + sweepGracePeriodMs.\n *\n * These events are logged as errors since they are based on the core GC logic:\n *\n * 1. Tombstone telemetry - When a tombstoned node is used - A node that has been marked as tombstone.\n * 2. Unknown outbound reference telemetry - When a node is referenced but GC was not notified of it when the new reference appeared.\n *\n * Note: The telemetry for a Deleted node being used is logged elsewhere in this package.\n */\nexport class GCTelemetryTracker {\n\t// Keeps track of unreferenced events that are logged for a node. This is used to limit the log generation to one\n\t// per event per node.\n\tprivate readonly loggedUnreferencedEvents: Set<string> = new Set();\n\t// Queue for unreferenced events that should be logged the next time GC runs.\n\tprivate pendingEventsQueue: IUnreferencedEventProps[] = [];\n\n\tconstructor(\n\t\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly configs: IGarbageCollectorConfigs,\n\t\tprivate readonly isSummarizerClient: boolean,\n\t\tprivate readonly createContainerMetadata: ICreateContainerMetadata,\n\t\tprivate readonly getNodeType: (nodeId: string) => GCNodeType,\n\t\tprivate readonly getNodeStateTracker: (\n\t\t\tnodeId: string,\n\t\t) => UnreferencedStateTracker | undefined,\n\t\tprivate readonly getNodePackagePath: (\n\t\t\tnodePath: string,\n\t\t) => Promise<readonly string[] | undefined>,\n\t) {}\n\n\t/**\n\t * Returns whether an event should be logged for a node that isn't active anymore. This does not apply to\n\t * tombstoned nodes for which an event is always logged. Some scenarios where we won't log:\n\t * 1. When a DDS is changed. The corresponding data store's event will be logged instead.\n\t * 2. An event is logged only once per container instance per event per node.\n\t */\n\tprivate shouldLogNonActiveEvent(\n\t\tnodeType: GCNodeType,\n\t\tusageType: NodeUsageType,\n\t\tnodeStateTracker: UnreferencedStateTracker,\n\t\tuniqueEventId: string,\n\t) {\n\t\tif (nodeStateTracker.state === UnreferencedState.Active) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodeType === GCNodeType.Other) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// For sub data store (DDS) nodes, if they are changed, its data store will also be changed,\n\t\t// so skip logging to make the telemetry less noisy.\n\t\tif (nodeType === GCNodeType.SubDataStore && usageType === \"Changed\") {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Non-tombstone events are logged once per event per node. A unique id is generated by joining\n\t\t// node state (inactive / sweep ready), node's id and usage (loaded / changed / revived).\n\t\tif (this.loggedUnreferencedEvents.has(uniqueEventId)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called when a node is used. If the node is not active or tombstoned, log telemetry indicating object is used\n\t * when it should not have been.\n\t */\n\tpublic nodeUsed(nodeUsageProps: INodeUsageProps) {\n\t\t// If there is no reference timestamp to work with, no ops have been processed after creation. If so, skip\n\t\t// logging as nothing interesting would have happened worth logging.\n\t\tif (nodeUsageProps.currentReferenceTimestampMs === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeStateTracker = this.getNodeStateTracker(nodeUsageProps.id);\n\t\tconst nodeType = this.getNodeType(nodeUsageProps.id);\n\t\tconst timeout = (() => {\n\t\t\tswitch (nodeStateTracker?.state) {\n\t\t\t\tcase UnreferencedState.Inactive:\n\t\t\t\t\treturn this.configs.inactiveTimeoutMs;\n\t\t\t\tcase UnreferencedState.TombstoneReady:\n\t\t\t\t\treturn this.configs.tombstoneTimeoutMs;\n\t\t\t\tcase UnreferencedState.SweepReady:\n\t\t\t\t\treturn (\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs &&\n\t\t\t\t\t\tthis.configs.tombstoneTimeoutMs + this.configs.sweepGracePeriodMs\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\treturn undefined;\n\t\t\t}\n\t\t})();\n\t\tconst {\n\t\t\tusageType,\n\t\t\tcurrentReferenceTimestampMs,\n\t\t\tpackagePath,\n\t\t\tid: untaggedId,\n\t\t\tfromId: untaggedFromId,\n\t\t\t...propsToLog\n\t\t} = nodeUsageProps;\n\t\tconst { persistedGcFeatureMatrix, ...configs } = this.configs;\n\t\tconst unrefEventProps: Omit<IUnreferencedEventProps, \"state\" | \"usageType\"> = {\n\t\t\ttype: nodeType,\n\t\t\tunrefTime: nodeStateTracker?.unreferencedTimestampMs ?? -1,\n\t\t\tage:\n\t\t\t\tnodeStateTracker !== undefined\n\t\t\t\t\t? nodeUsageProps.currentReferenceTimestampMs -\n\t\t\t\t\t nodeStateTracker.unreferencedTimestampMs\n\t\t\t\t\t: -1,\n\t\t\ttimeout,\n\t\t\t...tagCodeArtifacts({ id: untaggedId, fromId: untaggedFromId }),\n\t\t\t...propsToLog,\n\t\t\t...this.createContainerMetadata,\n\t\t\tgcConfigs: { ...configs, ...persistedGcFeatureMatrix },\n\t\t};\n\n\t\t// If the node that is used is tombstoned, log a tombstone telemetry.\n\t\tif (nodeUsageProps.isTombstoned) {\n\t\t\tthis.logTombstoneUsageTelemetry(nodeUsageProps, unrefEventProps, nodeType, usageType);\n\t\t}\n\n\t\t// After logging tombstone telemetry, if the node's unreferenced state is not tracked, there is nothing\n\t\t// else to log.\n\t\tif (nodeStateTracker === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst state = nodeStateTracker.state;\n\t\tconst uniqueEventId = `${state}-${nodeUsageProps.id}-${nodeUsageProps.usageType}`;\n\n\t\tif (\n\t\t\t!this.shouldLogNonActiveEvent(\n\t\t\t\tnodeType,\n\t\t\t\tnodeUsageProps.usageType,\n\t\t\t\tnodeStateTracker,\n\t\t\t\tuniqueEventId,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Add the unique event id so that we don't generate a log for this event again in this session.\n\t\tthis.loggedUnreferencedEvents.add(uniqueEventId);\n\n\t\t// For summarizer client, queue the event so it is logged the next time GC runs if the event is still valid.\n\t\t// For non-summarizer client, log the event now since GC won't run on it. This may result in false positives\n\t\t// but it's a good signal nonetheless and we can consume it with a grain of salt.\n\t\t// Inactive errors are usages of Objects that are unreferenced for at least a period of 7 days.\n\t\t// SweepReady errors are usages of Objects that will be deleted by GC Sweep!\n\t\tif (this.isSummarizerClient) {\n\t\t\tthis.pendingEventsQueue.push({\n\t\t\t\t...unrefEventProps,\n\t\t\t\tusageType: nodeUsageProps.usageType,\n\t\t\t\tstate,\n\t\t\t});\n\t\t} else {\n\t\t\t// For non-summarizer clients, only log \"Loaded\" type events since these objects may not be loaded in the\n\t\t\t// summarizer clients if they are based off of user actions (such as scrolling to content for these objects)\n\t\t\t// Events generated:\n\t\t\t// InactiveObject_Loaded, SweepReadyObject_Loaded\n\t\t\tif (nodeUsageProps.usageType === \"Loaded\") {\n\t\t\t\tconst { id, fromId, headers, gcConfigs, ...detailedProps } = unrefEventProps;\n\t\t\t\tconst event = {\n\t\t\t\t\teventName: `${state}Object_${nodeUsageProps.usageType}`,\n\t\t\t\t\t...tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join(\"/\") }),\n\t\t\t\t\tstack: generateStack(),\n\t\t\t\t\tid,\n\t\t\t\t\tfromId,\n\t\t\t\t\theaders: { ...headers },\n\t\t\t\t\tdetails: detailedProps,\n\t\t\t\t\tgcConfigs,\n\t\t\t\t};\n\n\t\t\t\t// These are logged as generic events and not errors because there can be false positives. The Tombstone\n\t\t\t\t// and Delete errors are separately logged and are reliable.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Logs telemetry when a tombstoned object is changed, revived or loaded.\n\t */\n\tprivate logTombstoneUsageTelemetry(\n\t\tnodeUsageProps: INodeUsageProps,\n\t\tunrefEventProps: Omit<IUnreferencedEventProps, \"state\" | \"usageType\">,\n\t\tnodeType: GCNodeType,\n\t\tusageType: NodeUsageType,\n\t) {\n\t\t// This will log the following events:\n\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_DataStore_Changed, GC_Tombstone_DataStore_Revived\n\t\t// GC_Tombstone_SubDataStore_Requested, GC_Tombstone_SubDataStore_Changed, GC_Tombstone_SubDataStore_Revived\n\t\t// GC_Tombstone_Blob_Requested, GC_Tombstone_Blob_Changed, GC_Tombstone_Blob_Revived\n\t\tconst { id, fromId, headers, gcConfigs, ...detailedProps } = unrefEventProps;\n\t\tconst eventUsageName = usageType === \"Loaded\" ? \"Requested\" : usageType;\n\t\tconst event = {\n\t\t\teventName: `GC_Tombstone_${nodeType}_${eventUsageName}`,\n\t\t\tpkg: tagCodeArtifacts({ pkg: nodeUsageProps.packagePath?.join(\"/\") }).pkg,\n\t\t\tstack: generateStack(),\n\t\t\tid,\n\t\t\tfromId,\n\t\t\theaders: { ...headers },\n\t\t\tdetails: detailedProps,\n\t\t\tgcConfigs,\n\t\t\ttombstoneFlags: {\n\t\t\t\tDisableTombstone: this.mc.config.getBoolean(disableTombstoneKey),\n\t\t\t\tThrowOnTombstoneUsage: this.mc.config.getBoolean(throwOnTombstoneUsageKey),\n\t\t\t\tThrowOnTombstoneLoad: this.mc.config.getBoolean(throwOnTombstoneLoadOverrideKey),\n\t\t\t},\n\t\t\tsweepFlags: {\n\t\t\t\tEnableSweepFlag: this.mc.config.getBoolean(runSweepKey),\n\t\t\t},\n\t\t};\n\n\t\tif (\n\t\t\t(usageType === \"Loaded\" &&\n\t\t\t\tthis.configs.throwOnTombstoneLoad &&\n\t\t\t\t!headers?.allowTombstone) ||\n\t\t\t(usageType === \"Changed\" && this.configs.throwOnTombstoneUsage)\n\t\t) {\n\t\t\tthis.mc.logger.sendErrorEvent(event);\n\t\t} else {\n\t\t\tthis.mc.logger.sendTelemetryEvent(event);\n\t\t}\n\t}\n\n\t/**\n\t * Log all new references or outbound routes in the current graph that haven't been explicitly notified to GC.\n\t * The principle is that every new reference or outbound route must be notified to GC via the\n\t * addedOutboundReference method. It it hasn't, its a bug and we want to identify these scenarios.\n\t *\n\t * In more simple terms:\n\t * Missing Explicit References = Current References - Previous References - Explicitly Added References;\n\t *\n\t * @param currentGCData - The GC data (reference graph) from the current GC run.\n\t * @param previousGCData - The GC data (reference graph) from the previous GC run.\n\t * @param explicitReferences - New references added explicity between the previous and the current run.\n\t */\n\tpublic logIfMissingExplicitReferences(\n\t\tcurrentGCData: IGarbageCollectionData,\n\t\tpreviousGCData: IGarbageCollectionData,\n\t\texplicitReferences: Map<string, string[]>,\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\tfor (const [nodeId, currentOutboundRoutes] of Object.entries(currentGCData.gcNodes)) {\n\t\t\tconst previousRoutes = previousGCData.gcNodes[nodeId] ?? [];\n\t\t\tconst explicitRoutes = explicitReferences.get(nodeId) ?? [];\n\n\t\t\t/**\n\t\t\t * 1. For routes in the current GC data, routes that were not present in previous GC data and did not have\n\t\t\t * explicit references should be added to missing explicit routes list.\n\t\t\t * 2. Only include data store and blob routes since GC only works for these two.\n\t\t\t * Note: Due to a bug with de-duped blobs, only adding data store routes for now.\n\t\t\t * 3. Ignore DDS routes to their parent datastores since those were added implicitly. So, there won't be\n\t\t\t * explicit routes to them.\n\t\t\t */\n\t\t\tconst missingExplicitRoutes: string[] = [];\n\t\t\tfor (const route of currentOutboundRoutes) {\n\t\t\t\tconst nodeType = this.getNodeType(route);\n\t\t\t\tif (\n\t\t\t\t\t(nodeType === GCNodeType.DataStore || nodeType === GCNodeType.Blob) &&\n\t\t\t\t\t!nodeId.startsWith(route) &&\n\t\t\t\t\t!previousRoutes.includes(route) &&\n\t\t\t\t\t!explicitRoutes.includes(route)\n\t\t\t\t) {\n\t\t\t\t\tmissingExplicitRoutes.push(route);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (missingExplicitRoutes.length > 0) {\n\t\t\t\t// Send as Generic not Error since there are known corner cases where this will fire.\n\t\t\t\t// E.g. If an old client re-references a node via an attach op (that doesn't include GC Data)\n\t\t\t\tlogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"gcUnknownOutboundReferences\",\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tid: nodeId,\n\t\t\t\t\t\troutes: JSON.stringify(missingExplicitRoutes),\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Log events that are pending in pendingEventsQueue. This is called after GC runs in the summarizer client\n\t * so that the state of an unreferenced node is updated.\n\t */\n\tpublic async logPendingEvents(logger: ITelemetryLoggerExt) {\n\t\t// Events sent come only from the summarizer client. In between summaries, events are pushed to a queue and at\n\t\t// summary time they are then logged.\n\t\t// Events generated:\n\t\t// InactiveObject_Loaded, InactiveObject_Changed, InactiveObject_Revived\n\t\t// SweepReadyObject_Loaded, SweepReadyObject_Changed, SweepReadyObject_Revived\n\t\tfor (const eventProps of this.pendingEventsQueue) {\n\t\t\t// const { usageType, state, id, fromId, ...propsToLog } = eventProps;\n\t\t\tconst { usageType, state, id, fromId, headers, gcConfigs, ...detailedProps } =\n\t\t\t\teventProps;\n\t\t\t/**\n\t\t\t * Revived event is logged only if the node is active. If the node is not active, the reference to it was\n\t\t\t * from another unreferenced node and this scenario is not interesting to log.\n\t\t\t * Loaded and Changed events are logged only if the node is not active. If the node is active, it was\n\t\t\t * revived and a Revived event will be logged for it.\n\t\t\t */\n\t\t\tconst nodeStateTracker = this.getNodeStateTracker(eventProps.id.value);\n\t\t\tconst active =\n\t\t\t\tnodeStateTracker === undefined ||\n\t\t\t\tnodeStateTracker.state === UnreferencedState.Active;\n\t\t\tif ((usageType === \"Revived\") === active) {\n\t\t\t\tconst pkg = await this.getNodePackagePath(eventProps.id.value);\n\t\t\t\tconst fromPkg = eventProps.fromId\n\t\t\t\t\t? await this.getNodePackagePath(eventProps.fromId.value)\n\t\t\t\t\t: undefined;\n\t\t\t\tconst event = {\n\t\t\t\t\teventName: `${state}Object_${usageType}`,\n\t\t\t\t\tid,\n\t\t\t\t\tfromId,\n\t\t\t\t\theaders: { ...headers },\n\t\t\t\t\tdetails: detailedProps,\n\t\t\t\t\tgcConfigs,\n\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\tpkg: pkg?.join(\"/\"),\n\t\t\t\t\t\tfromPkg: fromPkg?.join(\"/\"),\n\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\t// These are logged as generic events and not errors because there can be false positives. The Tombstone\n\t\t\t\t// and Delete errors are separately logged and are reliable.\n\t\t\t\tlogger.sendTelemetryEvent(event);\n\t\t\t}\n\t\t}\n\t\tthis.pendingEventsQueue = [];\n\t}\n}\n\n/**\n * Consolidates info / logic for logging when we encounter unexpected usage of GC'd objects. For example, when a\n * tombstoned or deleted object is loaded.\n */\nexport function sendGCUnexpectedUsageEvent(\n\tmc: MonitoringContext,\n\tevent: ITelemetryGenericEventExt & {\n\t\tcategory: \"error\" | \"generic\";\n\t\tgcTombstoneEnforcementAllowed: boolean | undefined;\n\t},\n\tpackagePath: readonly string[] | undefined,\n\terror?: unknown,\n) {\n\tevent.pkg = tagCodeArtifacts({ pkg: packagePath?.join(\"/\") })?.pkg;\n\tevent.tombstoneFlags = JSON.stringify({\n\t\tDisableTombstone: mc.config.getBoolean(disableTombstoneKey),\n\t\tThrowOnTombstoneUsage: mc.config.getBoolean(throwOnTombstoneUsageKey),\n\t\tThrowOnTombstoneLoad: mc.config.getBoolean(throwOnTombstoneLoadOverrideKey),\n\t});\n\tevent.sweepFlags = JSON.stringify({\n\t\tEnableSweepFlag: mc.config.getBoolean(runSweepKey),\n\t});\n\n\tmc.logger.sendTelemetryEvent(event, error);\n}\n"]}
@@ -2,7 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { UnreferencedState } from "./gcDefinitions";
5
+ import { UnreferencedState } from "./gcDefinitions.js";
6
+ /** The collection of UnreferencedStateTrackers for all unreferenced nodes. Ensures stopTracking is called when deleting */
7
+ export declare class UnreferencedStateTrackerMap extends Map<string, UnreferencedStateTracker> {
8
+ /** Delete the given key, and stop tracking if that node was actually unreferenced */
9
+ delete(key: string): boolean;
10
+ }
6
11
  /**
7
12
  * Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can
8
13
  * be tombstoned or deleted by the sweep phase.
@@ -1 +1 @@
1
- {"version":3,"file":"gcUnreferencedStateTracker.d.ts","sourceRoot":"","sources":["../../src/gc/gcUnreferencedStateTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAoBpD;;;GAGG;AACH,qBAAa,wBAAwB;aAcnB,uBAAuB,EAAE,MAAM;IAC/C,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,8GAA8G;IAC9G,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,kGAAkG;IAClG,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IArBpC,OAAO,CAAC,MAAM,CAA+C;IAC7D,IAAW,KAAK,IAAI,iBAAiB,CAEpC;IAED,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4B;gBAGtC,uBAAuB,EAAE,MAAM;IAC/C,+DAA+D;IAC9C,iBAAiB,EAAE,MAAM;IAC1C,kGAAkG;IAClG,2BAA2B,EAAE,MAAM;IACnC,8GAA8G;IAC7F,kBAAkB,EAAE,MAAM,GAAG,SAAS;IACvD,kGAAkG;IACjF,kBAAkB,EAAE,MAAM;IA4CrC,cAAc,CAAC,2BAA2B,EAAE,MAAM;IA4CzD,OAAO,CAAC,WAAW;IAMnB,gFAAgF;IACzE,YAAY;CAInB"}
1
+ {"version":3,"file":"gcUnreferencedStateTracker.d.ts","sourceRoot":"","sources":["../../src/gc/gcUnreferencedStateTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAoBvD,2HAA2H;AAC3H,qBAAa,2BAA4B,SAAQ,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC;IACrF,qFAAqF;IACrF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAM5B;AAED;;;GAGG;AACH,qBAAa,wBAAwB;aAcnB,uBAAuB,EAAE,MAAM;IAC/C,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,8GAA8G;IAC9G,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,kGAAkG;IAClG,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IArBpC,OAAO,CAAC,MAAM,CAA+C;IAC7D,IAAW,KAAK,IAAI,iBAAiB,CAEpC;IAED,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4B;gBAGtC,uBAAuB,EAAE,MAAM;IAC/C,+DAA+D;IAC9C,iBAAiB,EAAE,MAAM;IAC1C,kGAAkG;IAClG,2BAA2B,EAAE,MAAM;IACnC,8GAA8G;IAC7F,kBAAkB,EAAE,MAAM,GAAG,SAAS;IACvD,kGAAkG;IACjF,kBAAkB,EAAE,MAAM;IA4CrC,cAAc,CAAC,2BAA2B,EAAE,MAAM;IA4CzD,OAAO,CAAC,WAAW;IAMnB,gFAAgF;IACzE,YAAY;CAInB"}
@@ -4,10 +4,10 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.UnreferencedStateTracker = void 0;
7
+ exports.UnreferencedStateTracker = exports.UnreferencedStateTrackerMap = void 0;
8
8
  const core_utils_1 = require("@fluidframework/core-utils");
9
9
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
- const gcDefinitions_1 = require("./gcDefinitions");
10
+ const gcDefinitions_js_1 = require("./gcDefinitions.js");
11
11
  /** A wrapper around common-utils Timer that requires the timeout when calling start/restart */
12
12
  class TimerWithNoDefaultTimeout extends core_utils_1.Timer {
13
13
  constructor(callback) {
@@ -24,6 +24,17 @@ class TimerWithNoDefaultTimeout extends core_utils_1.Timer {
24
24
  super.restart(timeoutMs, this.callback);
25
25
  }
26
26
  }
27
+ /** The collection of UnreferencedStateTrackers for all unreferenced nodes. Ensures stopTracking is called when deleting */
28
+ class UnreferencedStateTrackerMap extends Map {
29
+ /** Delete the given key, and stop tracking if that node was actually unreferenced */
30
+ delete(key) {
31
+ // Stop tracking so as to clear out any running timers.
32
+ this.get(key)?.stopTracking();
33
+ // Delete the node as we don't need to track it any more.
34
+ return super.delete(key);
35
+ }
36
+ }
37
+ exports.UnreferencedStateTrackerMap = UnreferencedStateTrackerMap;
27
38
  /**
28
39
  * Helper class that tracks the state of an unreferenced node such as the time it was unreferenced and if it can
29
40
  * be tombstoned or deleted by the sweep phase.
@@ -45,26 +56,26 @@ class UnreferencedStateTracker {
45
56
  this.inactiveTimeoutMs = inactiveTimeoutMs;
46
57
  this.tombstoneTimeoutMs = tombstoneTimeoutMs;
47
58
  this.sweepGracePeriodMs = sweepGracePeriodMs;
48
- this._state = gcDefinitions_1.UnreferencedState.Active;
59
+ this._state = gcDefinitions_js_1.UnreferencedState.Active;
49
60
  (0, telemetry_utils_1.validatePrecondition)(this.tombstoneTimeoutMs === undefined ||
50
61
  this.tombstoneTimeoutMs >= this.inactiveTimeoutMs, "inactiveTimeoutMs must not be greater than the tombstoneTimeoutMs");
51
62
  this.sweepTimer = new TimerWithNoDefaultTimeout(() => {
52
- this._state = gcDefinitions_1.UnreferencedState.SweepReady;
63
+ this._state = gcDefinitions_js_1.UnreferencedState.SweepReady;
53
64
  (0, core_utils_1.assert)(!this.inactiveTimer.hasTimer && !this.tombstoneTimer.hasTimer, 0x863 /* inactiveTimer or tombstoneTimer still running after sweepTimer fired! */);
54
65
  });
55
66
  this.tombstoneTimer = new TimerWithNoDefaultTimeout(() => {
56
- this._state = gcDefinitions_1.UnreferencedState.TombstoneReady;
67
+ this._state = gcDefinitions_js_1.UnreferencedState.TombstoneReady;
57
68
  (0, core_utils_1.assert)(!this.inactiveTimer.hasTimer, 0x864 /* inactiveTimer still running after tombstoneTimer fired! */); // aka 0x3b1
58
69
  if (this.sweepGracePeriodMs > 0) {
59
70
  // After the node becomes tombstone ready, start the sweep timer after which the node will be ready for sweep.
60
71
  this.sweepTimer.restart(this.sweepGracePeriodMs);
61
72
  }
62
73
  else {
63
- this._state = gcDefinitions_1.UnreferencedState.SweepReady;
74
+ this._state = gcDefinitions_js_1.UnreferencedState.SweepReady;
64
75
  }
65
76
  });
66
77
  this.inactiveTimer = new TimerWithNoDefaultTimeout(() => {
67
- this._state = gcDefinitions_1.UnreferencedState.Inactive;
78
+ this._state = gcDefinitions_js_1.UnreferencedState.Inactive;
68
79
  // After the node becomes inactive, start the tombstone timer after which the node will be ready for tombstone.
69
80
  if (this.tombstoneTimeoutMs !== undefined) {
70
81
  this.tombstoneTimer.restart(this.tombstoneTimeoutMs - this.inactiveTimeoutMs);
@@ -80,21 +91,21 @@ class UnreferencedStateTracker {
80
91
  // If the node has been unreferenced long enough, update the state to SweepReady.
81
92
  if (this.tombstoneTimeoutMs !== undefined &&
82
93
  unreferencedDurationMs >= this.tombstoneTimeoutMs + this.sweepGracePeriodMs) {
83
- this._state = gcDefinitions_1.UnreferencedState.SweepReady;
94
+ this._state = gcDefinitions_js_1.UnreferencedState.SweepReady;
84
95
  return;
85
96
  }
86
97
  // If the node has been unreferenced long enough, update the state to TombstoneReady.
87
98
  // Also, start a timer for the remainder of the sweep delay.
88
99
  if (this.tombstoneTimeoutMs !== undefined &&
89
100
  unreferencedDurationMs >= this.tombstoneTimeoutMs) {
90
- this._state = gcDefinitions_1.UnreferencedState.TombstoneReady;
101
+ this._state = gcDefinitions_js_1.UnreferencedState.TombstoneReady;
91
102
  this.sweepTimer.restart(this.tombstoneTimeoutMs + this.sweepGracePeriodMs - unreferencedDurationMs);
92
103
  return;
93
104
  }
94
105
  // If the node has been unreferenced for long enough, update the state to inactive.
95
106
  // Also, start a timer for the remainder of the tombstone timeout.
96
107
  if (unreferencedDurationMs >= this.inactiveTimeoutMs) {
97
- this._state = gcDefinitions_1.UnreferencedState.Inactive;
108
+ this._state = gcDefinitions_js_1.UnreferencedState.Inactive;
98
109
  if (this.tombstoneTimeoutMs !== undefined) {
99
110
  this.tombstoneTimer.restart(this.tombstoneTimeoutMs - unreferencedDurationMs);
100
111
  }
@@ -111,7 +122,7 @@ class UnreferencedStateTracker {
111
122
  /** Stop tracking this node. Reset the unreferenced timers and state, if any. */
112
123
  stopTracking() {
113
124
  this.clearTimers();
114
- this._state = gcDefinitions_1.UnreferencedState.Active;
125
+ this._state = gcDefinitions_js_1.UnreferencedState.Active;
115
126
  }
116
127
  }
117
128
  exports.UnreferencedStateTracker = UnreferencedStateTracker;
@@ -1 +1 @@
1
- {"version":3,"file":"gcUnreferencedStateTracker.js","sourceRoot":"","sources":["../../src/gc/gcUnreferencedStateTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAA2D;AAC3D,qEAAuE;AACvE,mDAAoD;AAEpD,+FAA+F;AAC/F,MAAM,yBAA0B,SAAQ,kBAAK;IAC5C,YAA6B,QAAoB;QAChD,2FAA2F;QAC3F,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAJyB,aAAQ,GAAR,QAAQ,CAAY;IAKjD,CAAC;IAED,KAAK,CAAC,SAAiB;QACtB,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,SAAiB;QACxB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACD;AAED;;;GAGG;AACH,MAAa,wBAAwB;IAEpC,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IASD,YACiB,uBAA+B;IAC/C,+DAA+D;IAC9C,iBAAyB;IAC1C,kGAAk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OAAO,CAAC,IAAI,CAAC,kBAAkB,GAAG,sBAAsB,CAAC,CAAC;aAC9E;YACD,OAAO;SACP;QAED,qGAAqG;QACrG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,CAAC;IAC7E,CAAC;IAEO,WAAW;QAClB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,gFAAgF;IACzE,YAAY;QAClB,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,iCAAiB,CAAC,MAAM,CAAC;IACxC,CAAC;CACD;AAzHD,4DAyHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Timer } from \"@fluidframework/core-utils\";\nimport { validatePrecondition } from \"@fluidframework/telemetry-utils\";\nimport { UnreferencedState } from \"./gcDefinitions\";\n\n/** A wrapper around common-utils Timer that requires the timeout when calling start/restart */\nclass TimerWithNoDefaultTimeout extends Timer {\n\tconstructor(private readonly callback: () => void) {\n\t\t// The default timeout/handlers will never be used since start/restart pass overrides below\n\t\tsuper(0, () => {\n\t\t\tthrow new Error(\"DefaultHandler should not be used\");\n\t\t});\n\t}\n\n\tstart(timeoutMs: number) {\n\t\tsuper.start(timeoutMs, this.callback);\n\t}\n\n\trestart(timeoutMs: number): void {\n\t\tsuper.restart(timeoutMs, this.callback);\n\t}\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 tombstoned or deleted by the sweep phase.\n */\nexport class UnreferencedStateTracker {\n\tprivate _state: UnreferencedState = UnreferencedState.Active;\n\tpublic get state(): UnreferencedState {\n\t\treturn this._state;\n\t}\n\n\t/** Timer to indicate when an unreferenced object is considered Inactive */\n\tprivate readonly inactiveTimer: TimerWithNoDefaultTimeout;\n\t/** Timer to indicate when an unreferenced object is Tombstone-Ready */\n\tprivate readonly tombstoneTimer: TimerWithNoDefaultTimeout;\n\t/** Timer to indicate when an unreferenced object is Sweep-Ready */\n\tprivate readonly sweepTimer: TimerWithNoDefaultTimeout;\n\n\tconstructor(\n\t\tpublic readonly unreferencedTimestampMs: number,\n\t\t/** The time after which node transitions to Inactive state. */\n\t\tprivate readonly inactiveTimeoutMs: number,\n\t\t/** The current reference timestamp used to track how long this node has been unreferenced for. */\n\t\tcurrentReferenceTimestampMs: number,\n\t\t/** The time after which node transitions to TombstoneReady state; undefined if session expiry is disabled. */\n\t\tprivate readonly tombstoneTimeoutMs: number | undefined,\n\t\t/** The delay from TombstoneReady to SweepReady (only applies if tombstoneTimeoutMs is defined) */\n\t\tprivate readonly sweepGracePeriodMs: number,\n\t) {\n\t\tvalidatePrecondition(\n\t\t\tthis.tombstoneTimeoutMs === undefined ||\n\t\t\t\tthis.tombstoneTimeoutMs >= this.inactiveTimeoutMs,\n\t\t\t\"inactiveTimeoutMs must not be greater than the tombstoneTimeoutMs\",\n\t\t);\n\n\t\tthis.sweepTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\tassert(\n\t\t\t\t!this.inactiveTimer.hasTimer && !this.tombstoneTimer.hasTimer,\n\t\t\t\t0x863 /* inactiveTimer or tombstoneTimer still running after sweepTimer fired! */,\n\t\t\t);\n\t\t});\n\n\t\tthis.tombstoneTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.TombstoneReady;\n\t\t\tassert(\n\t\t\t\t!this.inactiveTimer.hasTimer,\n\t\t\t\t0x864 /* inactiveTimer still running after tombstoneTimer fired! */,\n\t\t\t); // aka 0x3b1\n\n\t\t\tif (this.sweepGracePeriodMs > 0) {\n\t\t\t\t// After the node becomes tombstone ready, start the sweep timer after which the node will be ready for sweep.\n\t\t\t\tthis.sweepTimer.restart(this.sweepGracePeriodMs);\n\t\t\t} else {\n\t\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\t}\n\t\t});\n\n\t\tthis.inactiveTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.Inactive;\n\n\t\t\t// After the node becomes inactive, start the tombstone timer after which the node will be ready for tombstone.\n\t\t\tif (this.tombstoneTimeoutMs !== undefined) {\n\t\t\t\tthis.tombstoneTimer.restart(this.tombstoneTimeoutMs - this.inactiveTimeoutMs);\n\t\t\t}\n\t\t});\n\n\t\tthis.updateTracking(currentReferenceTimestampMs);\n\t}\n\n\t/* Updates the unreferenced state based on the provided timestamp. */\n\tpublic updateTracking(currentReferenceTimestampMs: number) {\n\t\tconst unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;\n\n\t\t// Below we will set the appropriate timer (or none). Any running timers are superceded by the new currentReferenceTimestampMs\n\t\tthis.clearTimers();\n\n\t\t// If the node has been unreferenced long enough, update the state to SweepReady.\n\t\tif (\n\t\t\tthis.tombstoneTimeoutMs !== undefined &&\n\t\t\tunreferencedDurationMs >= this.tombstoneTimeoutMs + this.sweepGracePeriodMs\n\t\t) {\n\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\treturn;\n\t\t}\n\n\t\t// If the node has been unreferenced long enough, update the state to TombstoneReady.\n\t\t// Also, start a timer for the remainder of the sweep delay.\n\t\tif (\n\t\t\tthis.tombstoneTimeoutMs !== undefined &&\n\t\t\tunreferencedDurationMs >= this.tombstoneTimeoutMs\n\t\t) {\n\t\t\tthis._state = UnreferencedState.TombstoneReady;\n\n\t\t\tthis.sweepTimer.restart(\n\t\t\t\tthis.tombstoneTimeoutMs + this.sweepGracePeriodMs - unreferencedDurationMs,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// If the node has been unreferenced for long enough, update the state to inactive.\n\t\t// Also, start a timer for the remainder of the tombstone timeout.\n\t\tif (unreferencedDurationMs >= this.inactiveTimeoutMs) {\n\t\t\tthis._state = UnreferencedState.Inactive;\n\n\t\t\tif (this.tombstoneTimeoutMs !== undefined) {\n\t\t\t\tthis.tombstoneTimer.restart(this.tombstoneTimeoutMs - unreferencedDurationMs);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// The node is still active. Ensure the inactive timer is running with the proper remaining duration.\n\t\tthis.inactiveTimer.restart(this.inactiveTimeoutMs - unreferencedDurationMs);\n\t}\n\n\tprivate clearTimers() {\n\t\tthis.inactiveTimer.clear();\n\t\tthis.tombstoneTimer.clear();\n\t\tthis.sweepTimer.clear();\n\t}\n\n\t/** Stop tracking this node. Reset the unreferenced timers and state, if any. */\n\tpublic stopTracking() {\n\t\tthis.clearTimers();\n\t\tthis._state = UnreferencedState.Active;\n\t}\n}\n"]}
1
+ {"version":3,"file":"gcUnreferencedStateTracker.js","sourceRoot":"","sources":["../../src/gc/gcUnreferencedStateTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAA2D;AAC3D,qEAAuE;AACvE,yDAAuD;AAEvD,+FAA+F;AAC/F,MAAM,yBAA0B,SAAQ,kBAAK;IAC5C,YAA6B,QAAoB;QAChD,2FAA2F;QAC3F,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAJyB,aAAQ,GAAR,QAAQ,CAAY;IAKjD,CAAC;IAED,KAAK,CAAC,SAAiB;QACtB,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,SAAiB;QACxB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACD;AAED,2HAA2H;AAC3H,MAAa,2BAA4B,SAAQ,GAAqC;IACrF,qFAAqF;IACrF,MAAM,CAAC,GAAW;QACjB,uDA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U,CAAC,OAAO,CACtB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,GAAG,sBAAsB,CAC1E,CAAC;YACF,OAAO;SACP;QAED,mFAAmF;QACnF,kEAAkE;QAClE,IAAI,sBAAsB,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACrD,IAAI,CAAC,MAAM,GAAG,oCAAiB,CAAC,QAAQ,CAAC;YAEzC,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE;gBAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,GAAG,sBAAsB,CAAC,CAAC;aAC9E;YACD,OAAO;SACP;QAED,qGAAqG;QACrG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,CAAC;IAC7E,CAAC;IAEO,WAAW;QAClB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,gFAAgF;IACzE,YAAY;QAClB,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,oCAAiB,CAAC,MAAM,CAAC;IACxC,CAAC;CACD;AAzHD,4DAyHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Timer } from \"@fluidframework/core-utils\";\nimport { validatePrecondition } from \"@fluidframework/telemetry-utils\";\nimport { UnreferencedState } from \"./gcDefinitions.js\";\n\n/** A wrapper around common-utils Timer that requires the timeout when calling start/restart */\nclass TimerWithNoDefaultTimeout extends Timer {\n\tconstructor(private readonly callback: () => void) {\n\t\t// The default timeout/handlers will never be used since start/restart pass overrides below\n\t\tsuper(0, () => {\n\t\t\tthrow new Error(\"DefaultHandler should not be used\");\n\t\t});\n\t}\n\n\tstart(timeoutMs: number) {\n\t\tsuper.start(timeoutMs, this.callback);\n\t}\n\n\trestart(timeoutMs: number): void {\n\t\tsuper.restart(timeoutMs, this.callback);\n\t}\n}\n\n/** The collection of UnreferencedStateTrackers for all unreferenced nodes. Ensures stopTracking is called when deleting */\nexport class UnreferencedStateTrackerMap extends Map<string, UnreferencedStateTracker> {\n\t/** Delete the given key, and stop tracking if that node was actually unreferenced */\n\tdelete(key: string): boolean {\n\t\t// Stop tracking so as to clear out any running timers.\n\t\tthis.get(key)?.stopTracking();\n\t\t// Delete the node as we don't need to track it any more.\n\t\treturn super.delete(key);\n\t}\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 tombstoned or deleted by the sweep phase.\n */\nexport class UnreferencedStateTracker {\n\tprivate _state: UnreferencedState = UnreferencedState.Active;\n\tpublic get state(): UnreferencedState {\n\t\treturn this._state;\n\t}\n\n\t/** Timer to indicate when an unreferenced object is considered Inactive */\n\tprivate readonly inactiveTimer: TimerWithNoDefaultTimeout;\n\t/** Timer to indicate when an unreferenced object is Tombstone-Ready */\n\tprivate readonly tombstoneTimer: TimerWithNoDefaultTimeout;\n\t/** Timer to indicate when an unreferenced object is Sweep-Ready */\n\tprivate readonly sweepTimer: TimerWithNoDefaultTimeout;\n\n\tconstructor(\n\t\tpublic readonly unreferencedTimestampMs: number,\n\t\t/** The time after which node transitions to Inactive state. */\n\t\tprivate readonly inactiveTimeoutMs: number,\n\t\t/** The current reference timestamp used to track how long this node has been unreferenced for. */\n\t\tcurrentReferenceTimestampMs: number,\n\t\t/** The time after which node transitions to TombstoneReady state; undefined if session expiry is disabled. */\n\t\tprivate readonly tombstoneTimeoutMs: number | undefined,\n\t\t/** The delay from TombstoneReady to SweepReady (only applies if tombstoneTimeoutMs is defined) */\n\t\tprivate readonly sweepGracePeriodMs: number,\n\t) {\n\t\tvalidatePrecondition(\n\t\t\tthis.tombstoneTimeoutMs === undefined ||\n\t\t\t\tthis.tombstoneTimeoutMs >= this.inactiveTimeoutMs,\n\t\t\t\"inactiveTimeoutMs must not be greater than the tombstoneTimeoutMs\",\n\t\t);\n\n\t\tthis.sweepTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\tassert(\n\t\t\t\t!this.inactiveTimer.hasTimer && !this.tombstoneTimer.hasTimer,\n\t\t\t\t0x863 /* inactiveTimer or tombstoneTimer still running after sweepTimer fired! */,\n\t\t\t);\n\t\t});\n\n\t\tthis.tombstoneTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.TombstoneReady;\n\t\t\tassert(\n\t\t\t\t!this.inactiveTimer.hasTimer,\n\t\t\t\t0x864 /* inactiveTimer still running after tombstoneTimer fired! */,\n\t\t\t); // aka 0x3b1\n\n\t\t\tif (this.sweepGracePeriodMs > 0) {\n\t\t\t\t// After the node becomes tombstone ready, start the sweep timer after which the node will be ready for sweep.\n\t\t\t\tthis.sweepTimer.restart(this.sweepGracePeriodMs);\n\t\t\t} else {\n\t\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\t}\n\t\t});\n\n\t\tthis.inactiveTimer = new TimerWithNoDefaultTimeout(() => {\n\t\t\tthis._state = UnreferencedState.Inactive;\n\n\t\t\t// After the node becomes inactive, start the tombstone timer after which the node will be ready for tombstone.\n\t\t\tif (this.tombstoneTimeoutMs !== undefined) {\n\t\t\t\tthis.tombstoneTimer.restart(this.tombstoneTimeoutMs - this.inactiveTimeoutMs);\n\t\t\t}\n\t\t});\n\n\t\tthis.updateTracking(currentReferenceTimestampMs);\n\t}\n\n\t/* Updates the unreferenced state based on the provided timestamp. */\n\tpublic updateTracking(currentReferenceTimestampMs: number) {\n\t\tconst unreferencedDurationMs = currentReferenceTimestampMs - this.unreferencedTimestampMs;\n\n\t\t// Below we will set the appropriate timer (or none). Any running timers are superceded by the new currentReferenceTimestampMs\n\t\tthis.clearTimers();\n\n\t\t// If the node has been unreferenced long enough, update the state to SweepReady.\n\t\tif (\n\t\t\tthis.tombstoneTimeoutMs !== undefined &&\n\t\t\tunreferencedDurationMs >= this.tombstoneTimeoutMs + this.sweepGracePeriodMs\n\t\t) {\n\t\t\tthis._state = UnreferencedState.SweepReady;\n\t\t\treturn;\n\t\t}\n\n\t\t// If the node has been unreferenced long enough, update the state to TombstoneReady.\n\t\t// Also, start a timer for the remainder of the sweep delay.\n\t\tif (\n\t\t\tthis.tombstoneTimeoutMs !== undefined &&\n\t\t\tunreferencedDurationMs >= this.tombstoneTimeoutMs\n\t\t) {\n\t\t\tthis._state = UnreferencedState.TombstoneReady;\n\n\t\t\tthis.sweepTimer.restart(\n\t\t\t\tthis.tombstoneTimeoutMs + this.sweepGracePeriodMs - unreferencedDurationMs,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// If the node has been unreferenced for long enough, update the state to inactive.\n\t\t// Also, start a timer for the remainder of the tombstone timeout.\n\t\tif (unreferencedDurationMs >= this.inactiveTimeoutMs) {\n\t\t\tthis._state = UnreferencedState.Inactive;\n\n\t\t\tif (this.tombstoneTimeoutMs !== undefined) {\n\t\t\t\tthis.tombstoneTimer.restart(this.tombstoneTimeoutMs - unreferencedDurationMs);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// The node is still active. Ensure the inactive timer is running with the proper remaining duration.\n\t\tthis.inactiveTimer.restart(this.inactiveTimeoutMs - unreferencedDurationMs);\n\t}\n\n\tprivate clearTimers() {\n\t\tthis.inactiveTimer.clear();\n\t\tthis.tombstoneTimer.clear();\n\t\tthis.sweepTimer.clear();\n\t}\n\n\t/** Stop tracking this node. Reset the unreferenced timers and state, if any. */\n\tpublic stopTracking() {\n\t\tthis.clearTimers();\n\t\tthis._state = UnreferencedState.Active;\n\t}\n}\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { GarbageCollector } from "./garbageCollection";
6
- export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableDataStoreSweepOptionName, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, GCFeatureMatrix, GCVersion, gcVersionUpgradeToV4Key, IGarbageCollectionRuntime, IGarbageCollector, IGarbageCollectorConfigs, IGarbageCollectorCreateParams, IGCMetadata, IGCMetadata_Deprecated, IGCResult, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCStats, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, disableDatastoreSweepKey, detectOutboundRoutesViaDDSKey, UnreferencedState, throwOnTombstoneLoadOverrideKey, GarbageCollectionMessage, ISweepMessage, } from "./gcDefinitions";
7
- export { cloneGCData, concatGarbageCollectionStates, trimLeadingAndTrailingSlashes, unpackChildNodesGCDetails, } from "./gcHelpers";
8
- export { runGarbageCollection } from "./gcReferenceGraphAlgorithm";
9
- export { IGarbageCollectionNodeData, IGarbageCollectionSnapshotData, IGarbageCollectionState, IGarbageCollectionSummaryDetailsLegacy, } from "./gcSummaryDefinitions";
10
- export { gcStateBlobKey, GCSummaryStateTracker, IGCSummaryTrackingData, } from "./gcSummaryStateTracker";
11
- export { GCTelemetryTracker, sendGCUnexpectedUsageEvent } from "./gcTelemetry";
12
- export { UnreferencedStateTracker } from "./gcUnreferencedStateTracker";
5
+ export { GarbageCollector } from "./garbageCollection.js";
6
+ export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableDataStoreSweepOptionName, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, GCFeatureMatrix, GCVersion, gcVersionUpgradeToV4Key, IGarbageCollectionRuntime, IGarbageCollector, IGarbageCollectorConfigs, IGarbageCollectorCreateParams, IGCMetadata, IGCMetadata_Deprecated, IGCResult, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCStats, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, disableAutoRecoveryKey, disableDatastoreSweepKey, detectOutboundRoutesViaDDSKey, UnreferencedState, throwOnTombstoneLoadOverrideKey, GarbageCollectionMessage, GarbageCollectionMessageType, ISweepMessage, } from "./gcDefinitions.js";
7
+ export { cloneGCData, concatGarbageCollectionStates, trimLeadingAndTrailingSlashes, unpackChildNodesGCDetails, } from "./gcHelpers.js";
8
+ export { runGarbageCollection } from "./gcReferenceGraphAlgorithm.js";
9
+ export { IGarbageCollectionNodeData, IGarbageCollectionSnapshotData, IGarbageCollectionState, IGarbageCollectionSummaryDetailsLegacy, } from "./gcSummaryDefinitions.js";
10
+ export { gcStateBlobKey, GCSummaryStateTracker, IGCSummaryTrackingData, } from "./gcSummaryStateTracker.js";
11
+ export { GCTelemetryTracker, sendGCUnexpectedUsageEvent } from "./gcTelemetry.js";
12
+ export { UnreferencedStateTracker } from "./gcUnreferencedStateTracker.js";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,aAAa,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,uBAAuB,EACvB,sCAAsC,GACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,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