@fluidframework/container-runtime 2.23.0 → 2.31.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 (317) hide show
  1. package/CHANGELOG.md +593 -537
  2. package/api-report/container-runtime.legacy.alpha.api.md +0 -246
  3. package/dist/blobManager/blobManager.d.ts +11 -9
  4. package/dist/blobManager/blobManager.d.ts.map +1 -1
  5. package/dist/blobManager/blobManager.js +38 -39
  6. package/dist/blobManager/blobManager.js.map +1 -1
  7. package/dist/blobManager/blobManagerSnapSum.d.ts +2 -4
  8. package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  9. package/dist/blobManager/blobManagerSnapSum.js +6 -6
  10. package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
  11. package/dist/channelCollection.d.ts +1 -7
  12. package/dist/channelCollection.d.ts.map +1 -1
  13. package/dist/channelCollection.js +2 -27
  14. package/dist/channelCollection.js.map +1 -1
  15. package/dist/connectionTelemetry.d.ts +0 -43
  16. package/dist/connectionTelemetry.d.ts.map +1 -1
  17. package/dist/connectionTelemetry.js.map +1 -1
  18. package/dist/containerRuntime.d.ts +40 -145
  19. package/dist/containerRuntime.d.ts.map +1 -1
  20. package/dist/containerRuntime.js +149 -364
  21. package/dist/containerRuntime.js.map +1 -1
  22. package/dist/dataStoreContext.d.ts +6 -14
  23. package/dist/dataStoreContext.d.ts.map +1 -1
  24. package/dist/dataStoreContext.js +14 -26
  25. package/dist/dataStoreContext.js.map +1 -1
  26. package/dist/gc/garbageCollection.d.ts.map +1 -1
  27. package/dist/gc/garbageCollection.js +2 -20
  28. package/dist/gc/garbageCollection.js.map +1 -1
  29. package/dist/gc/gcConfigs.d.ts.map +1 -1
  30. package/dist/gc/gcConfigs.js +0 -2
  31. package/dist/gc/gcConfigs.js.map +1 -1
  32. package/dist/gc/gcDefinitions.d.ts +8 -24
  33. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  34. package/dist/gc/gcDefinitions.js +1 -3
  35. package/dist/gc/gcDefinitions.js.map +1 -1
  36. package/dist/gc/gcHelpers.d.ts.map +1 -1
  37. package/dist/gc/gcHelpers.js +1 -4
  38. package/dist/gc/gcHelpers.js.map +1 -1
  39. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  40. package/dist/gc/gcSummaryStateTracker.js +0 -1
  41. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  42. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  43. package/dist/gc/gcTelemetry.js +6 -18
  44. package/dist/gc/gcTelemetry.js.map +1 -1
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +2 -2
  48. package/dist/index.js.map +1 -1
  49. package/dist/legacy.d.ts +0 -29
  50. package/dist/messageTypes.d.ts.map +1 -1
  51. package/dist/messageTypes.js.map +1 -1
  52. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  53. package/dist/opLifecycle/batchManager.js +16 -5
  54. package/dist/opLifecycle/batchManager.js.map +1 -1
  55. package/dist/opLifecycle/outbox.d.ts +12 -3
  56. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  57. package/dist/opLifecycle/outbox.js +41 -21
  58. package/dist/opLifecycle/outbox.js.map +1 -1
  59. package/dist/packageVersion.d.ts +1 -1
  60. package/dist/packageVersion.js +1 -1
  61. package/dist/packageVersion.js.map +1 -1
  62. package/dist/pendingStateManager.d.ts +1 -0
  63. package/dist/pendingStateManager.d.ts.map +1 -1
  64. package/dist/pendingStateManager.js +12 -2
  65. package/dist/pendingStateManager.js.map +1 -1
  66. package/dist/runCounter.d.ts +11 -0
  67. package/dist/runCounter.d.ts.map +1 -0
  68. package/dist/runCounter.js +43 -0
  69. package/dist/runCounter.js.map +1 -0
  70. package/dist/runtimeLayerCompatState.d.ts +51 -0
  71. package/dist/runtimeLayerCompatState.d.ts.map +1 -0
  72. package/dist/runtimeLayerCompatState.js +123 -0
  73. package/dist/runtimeLayerCompatState.js.map +1 -0
  74. package/dist/signalTelemetryProcessing.d.ts +33 -0
  75. package/dist/signalTelemetryProcessing.d.ts.map +1 -0
  76. package/dist/signalTelemetryProcessing.js +149 -0
  77. package/dist/signalTelemetryProcessing.js.map +1 -0
  78. package/dist/summary/documentSchema.d.ts +7 -31
  79. package/dist/summary/documentSchema.d.ts.map +1 -1
  80. package/dist/summary/documentSchema.js +2 -18
  81. package/dist/summary/documentSchema.js.map +1 -1
  82. package/dist/summary/index.d.ts +2 -1
  83. package/dist/summary/index.d.ts.map +1 -1
  84. package/dist/summary/index.js +7 -1
  85. package/dist/summary/index.js.map +1 -1
  86. package/dist/summary/orderedClientElection.d.ts +1 -3
  87. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  88. package/dist/summary/orderedClientElection.js.map +1 -1
  89. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -3
  90. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  91. package/dist/summary/runWhileConnectedCoordinator.js +2 -7
  92. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  93. package/dist/summary/runningSummarizer.d.ts +1 -2
  94. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  95. package/dist/summary/runningSummarizer.js +4 -23
  96. package/dist/summary/runningSummarizer.js.map +1 -1
  97. package/dist/summary/summarizer.d.ts +2 -5
  98. package/dist/summary/summarizer.d.ts.map +1 -1
  99. package/dist/summary/summarizer.js +3 -11
  100. package/dist/summary/summarizer.js.map +1 -1
  101. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  102. package/dist/summary/summarizerClientElection.js +0 -1
  103. package/dist/summary/summarizerClientElection.js.map +1 -1
  104. package/dist/summary/summarizerHeuristics.d.ts +1 -1
  105. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  106. package/dist/summary/summarizerHeuristics.js.map +1 -1
  107. package/dist/summary/summarizerNode/summarizerNode.d.ts +2 -2
  108. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  109. package/dist/summary/summarizerNode/summarizerNode.js +4 -4
  110. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  111. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -18
  112. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  113. package/dist/summary/summarizerNode/summarizerNodeUtils.js +0 -27
  114. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  115. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
  116. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  117. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +1 -2
  118. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  119. package/dist/summary/summarizerTypes.d.ts +109 -22
  120. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  121. package/dist/summary/summarizerTypes.js.map +1 -1
  122. package/dist/summary/summaryFormat.d.ts +3 -9
  123. package/dist/summary/summaryFormat.d.ts.map +1 -1
  124. package/dist/summary/summaryFormat.js.map +1 -1
  125. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  126. package/dist/summary/summaryGenerator.js +3 -9
  127. package/dist/summary/summaryGenerator.js.map +1 -1
  128. package/dist/summary/summaryHelpers.d.ts +19 -0
  129. package/dist/summary/summaryHelpers.d.ts.map +1 -0
  130. package/dist/summary/summaryHelpers.js +90 -0
  131. package/dist/summary/summaryHelpers.js.map +1 -0
  132. package/dist/summary/summaryManager.d.ts.map +1 -1
  133. package/dist/summary/summaryManager.js +0 -2
  134. package/dist/summary/summaryManager.js.map +1 -1
  135. package/lib/blobManager/blobManager.d.ts +11 -9
  136. package/lib/blobManager/blobManager.d.ts.map +1 -1
  137. package/lib/blobManager/blobManager.js +37 -37
  138. package/lib/blobManager/blobManager.js.map +1 -1
  139. package/lib/blobManager/blobManagerSnapSum.d.ts +2 -4
  140. package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
  141. package/lib/blobManager/blobManagerSnapSum.js +6 -6
  142. package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
  143. package/lib/channelCollection.d.ts +1 -7
  144. package/lib/channelCollection.d.ts.map +1 -1
  145. package/lib/channelCollection.js +3 -30
  146. package/lib/channelCollection.js.map +1 -1
  147. package/lib/connectionTelemetry.d.ts +0 -43
  148. package/lib/connectionTelemetry.d.ts.map +1 -1
  149. package/lib/connectionTelemetry.js.map +1 -1
  150. package/lib/containerRuntime.d.ts +40 -145
  151. package/lib/containerRuntime.d.ts.map +1 -1
  152. package/lib/containerRuntime.js +151 -372
  153. package/lib/containerRuntime.js.map +1 -1
  154. package/lib/dataStoreContext.d.ts +6 -14
  155. package/lib/dataStoreContext.d.ts.map +1 -1
  156. package/lib/dataStoreContext.js +14 -26
  157. package/lib/dataStoreContext.js.map +1 -1
  158. package/lib/gc/garbageCollection.d.ts.map +1 -1
  159. package/lib/gc/garbageCollection.js +3 -23
  160. package/lib/gc/garbageCollection.js.map +1 -1
  161. package/lib/gc/gcConfigs.d.ts.map +1 -1
  162. package/lib/gc/gcConfigs.js +0 -2
  163. package/lib/gc/gcConfigs.js.map +1 -1
  164. package/lib/gc/gcDefinitions.d.ts +8 -24
  165. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  166. package/lib/gc/gcDefinitions.js +1 -3
  167. package/lib/gc/gcDefinitions.js.map +1 -1
  168. package/lib/gc/gcHelpers.d.ts.map +1 -1
  169. package/lib/gc/gcHelpers.js +1 -4
  170. package/lib/gc/gcHelpers.js.map +1 -1
  171. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  172. package/lib/gc/gcSummaryStateTracker.js +0 -1
  173. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  174. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  175. package/lib/gc/gcTelemetry.js +7 -21
  176. package/lib/gc/gcTelemetry.js.map +1 -1
  177. package/lib/index.d.ts +2 -2
  178. package/lib/index.d.ts.map +1 -1
  179. package/lib/index.js +2 -2
  180. package/lib/index.js.map +1 -1
  181. package/lib/legacy.d.ts +0 -29
  182. package/lib/messageTypes.d.ts.map +1 -1
  183. package/lib/messageTypes.js.map +1 -1
  184. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  185. package/lib/opLifecycle/batchManager.js +16 -5
  186. package/lib/opLifecycle/batchManager.js.map +1 -1
  187. package/lib/opLifecycle/outbox.d.ts +12 -3
  188. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  189. package/lib/opLifecycle/outbox.js +43 -23
  190. package/lib/opLifecycle/outbox.js.map +1 -1
  191. package/lib/packageVersion.d.ts +1 -1
  192. package/lib/packageVersion.js +1 -1
  193. package/lib/packageVersion.js.map +1 -1
  194. package/lib/pendingStateManager.d.ts +1 -0
  195. package/lib/pendingStateManager.d.ts.map +1 -1
  196. package/lib/pendingStateManager.js +12 -2
  197. package/lib/pendingStateManager.js.map +1 -1
  198. package/lib/runCounter.d.ts +11 -0
  199. package/lib/runCounter.d.ts.map +1 -0
  200. package/lib/runCounter.js +39 -0
  201. package/lib/runCounter.js.map +1 -0
  202. package/lib/runtimeLayerCompatState.d.ts +51 -0
  203. package/lib/runtimeLayerCompatState.d.ts.map +1 -0
  204. package/lib/runtimeLayerCompatState.js +118 -0
  205. package/lib/runtimeLayerCompatState.js.map +1 -0
  206. package/lib/signalTelemetryProcessing.d.ts +33 -0
  207. package/lib/signalTelemetryProcessing.d.ts.map +1 -0
  208. package/lib/signalTelemetryProcessing.js +145 -0
  209. package/lib/signalTelemetryProcessing.js.map +1 -0
  210. package/lib/summary/documentSchema.d.ts +7 -31
  211. package/lib/summary/documentSchema.d.ts.map +1 -1
  212. package/lib/summary/documentSchema.js +2 -18
  213. package/lib/summary/documentSchema.js.map +1 -1
  214. package/lib/summary/index.d.ts +2 -1
  215. package/lib/summary/index.d.ts.map +1 -1
  216. package/lib/summary/index.js +1 -0
  217. package/lib/summary/index.js.map +1 -1
  218. package/lib/summary/orderedClientElection.d.ts +1 -3
  219. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  220. package/lib/summary/orderedClientElection.js.map +1 -1
  221. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -3
  222. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  223. package/lib/summary/runWhileConnectedCoordinator.js +2 -7
  224. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  225. package/lib/summary/runningSummarizer.d.ts +1 -2
  226. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  227. package/lib/summary/runningSummarizer.js +4 -23
  228. package/lib/summary/runningSummarizer.js.map +1 -1
  229. package/lib/summary/summarizer.d.ts +2 -5
  230. package/lib/summary/summarizer.d.ts.map +1 -1
  231. package/lib/summary/summarizer.js +3 -11
  232. package/lib/summary/summarizer.js.map +1 -1
  233. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  234. package/lib/summary/summarizerClientElection.js +0 -1
  235. package/lib/summary/summarizerClientElection.js.map +1 -1
  236. package/lib/summary/summarizerHeuristics.d.ts +1 -1
  237. package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
  238. package/lib/summary/summarizerHeuristics.js.map +1 -1
  239. package/lib/summary/summarizerNode/summarizerNode.d.ts +2 -2
  240. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  241. package/lib/summary/summarizerNode/summarizerNode.js +5 -5
  242. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  243. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +1 -18
  244. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  245. package/lib/summary/summarizerNode/summarizerNodeUtils.js +1 -25
  246. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  247. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -2
  248. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  249. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +1 -2
  250. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  251. package/lib/summary/summarizerTypes.d.ts +109 -22
  252. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  253. package/lib/summary/summarizerTypes.js.map +1 -1
  254. package/lib/summary/summaryFormat.d.ts +3 -9
  255. package/lib/summary/summaryFormat.d.ts.map +1 -1
  256. package/lib/summary/summaryFormat.js.map +1 -1
  257. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  258. package/lib/summary/summaryGenerator.js +3 -9
  259. package/lib/summary/summaryGenerator.js.map +1 -1
  260. package/lib/summary/summaryHelpers.d.ts +19 -0
  261. package/lib/summary/summaryHelpers.d.ts.map +1 -0
  262. package/lib/summary/summaryHelpers.js +84 -0
  263. package/lib/summary/summaryHelpers.js.map +1 -0
  264. package/lib/summary/summaryManager.d.ts.map +1 -1
  265. package/lib/summary/summaryManager.js +0 -2
  266. package/lib/summary/summaryManager.js.map +1 -1
  267. package/lib/tsdoc-metadata.json +1 -1
  268. package/package.json +20 -23
  269. package/src/blobManager/blobManager.ts +70 -62
  270. package/src/blobManager/blobManagerSnapSum.ts +7 -9
  271. package/src/channelCollection.ts +4 -32
  272. package/src/connectionTelemetry.ts +0 -51
  273. package/src/containerRuntime.ts +259 -622
  274. package/src/dataStoreContext.ts +24 -33
  275. package/src/gc/{garbageCollection.md → README.md} +17 -19
  276. package/src/gc/garbageCollection.ts +9 -26
  277. package/src/gc/gcConfigs.ts +3 -6
  278. package/src/gc/gcDefinitions.ts +10 -28
  279. package/src/gc/gcHelpers.ts +0 -5
  280. package/src/gc/gcSummaryStateTracker.ts +1 -2
  281. package/src/gc/gcTelemetry.ts +8 -15
  282. package/src/index.ts +6 -6
  283. package/src/messageTypes.ts +0 -2
  284. package/src/opLifecycle/batchManager.ts +20 -6
  285. package/src/opLifecycle/outbox.ts +64 -24
  286. package/src/packageVersion.ts +1 -1
  287. package/src/pendingStateManager.ts +18 -2
  288. package/src/runCounter.ts +25 -0
  289. package/src/runtimeLayerCompatState.ts +143 -0
  290. package/src/signalTelemetryProcessing.ts +233 -0
  291. package/src/summary/documentSchema.ts +7 -38
  292. package/src/summary/index.ts +12 -0
  293. package/src/summary/orderedClientElection.ts +1 -3
  294. package/src/summary/runWhileConnectedCoordinator.ts +3 -8
  295. package/src/summary/runningSummarizer.ts +12 -20
  296. package/src/summary/summarizer.ts +6 -18
  297. package/src/summary/summarizerClientElection.ts +0 -2
  298. package/src/summary/summarizerHeuristics.ts +1 -2
  299. package/src/summary/summarizerNode/summarizerNode.ts +6 -5
  300. package/src/summary/summarizerNode/summarizerNodeUtils.ts +1 -27
  301. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +2 -3
  302. package/src/summary/summarizerTypes.ts +119 -23
  303. package/src/summary/summaryFormat.ts +4 -13
  304. package/src/summary/summaryGenerator.ts +1 -8
  305. package/src/summary/summaryHelpers.ts +118 -0
  306. package/src/summary/summaryManager.ts +0 -2
  307. package/tsconfig.json +1 -0
  308. package/dist/layerCompatState.d.ts +0 -19
  309. package/dist/layerCompatState.d.ts.map +0 -1
  310. package/dist/layerCompatState.js +0 -64
  311. package/dist/layerCompatState.js.map +0 -1
  312. package/lib/layerCompatState.d.ts +0 -19
  313. package/lib/layerCompatState.d.ts.map +0 -1
  314. package/lib/layerCompatState.js +0 -60
  315. package/lib/layerCompatState.js.map +0 -1
  316. package/prettier.config.cjs +0 -8
  317. package/src/layerCompatState.ts +0 -75
@@ -1 +1 @@
1
- {"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAMjE,kEAA+D;AAC/D,uEAOkD;AAMlD,iEAA2D;AAC3D,uEAAmE;AAkBnE,+DAA+D;AAE/D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAa,kBACZ,SAAQ,uBAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,c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CAAC;IAIO,oBAAoB;QAC3B,KAAK,MAAM,KAAK,IAAI,CAAC,WAAW,EAAE,4BAA4B,CAAC,EAAE,CAAC;YACjE,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAe,EAAQ,EAAE;gBAC7C,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;YAC3B,CAAC,CAAC;YACF,2BAA2B;YAC3B,qGAAqG;YACrG,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,KAAY,EAAE,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAEO,sBAAsB;QAC7B,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC;YAChE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AAhVD,gCAgVC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tISummarizerEvents,\n\tSummarizerStopReason,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tUsageError,\n\tcreateChildLogger,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfiguration } from \"../containerRuntime.js\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator.js\";\nimport { RunningSummarizer } from \"./runningSummarizer.js\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics.js\";\nimport {\n\tEnqueueSummarizeResult,\n\t// eslint-disable-next-line import/no-deprecated\n\tIConnectableRuntime,\n\tIEnqueueSummarizeOptions,\n\tIOnDemandSummarizeOptions,\n\tISummarizeHeuristicData,\n\tISummarizeResults,\n\tISummarizer,\n\t// eslint-disable-next-line import/no-deprecated\n\tISummarizerInternalsProvider,\n\t// eslint-disable-next-line import/no-deprecated\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\ttype IRetriableFailureError,\n} from \"./summarizerTypes.js\";\nimport { SummaryCollection } from \"./summaryCollection.js\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator.js\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(\n\t\terror: unknown,\n\t\tlogged: boolean = false,\n\t\tlogger: ITelemetryLoggerExt,\n\t): SummarizingWarning {\n\t\tconst newErrorFn = (errMsg: string): SummarizingWarning =>\n\t\t\tnew SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (\n\terrorMessage: string,\n\tlogged: boolean,\n): SummarizingWarning => new SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer(): this {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/**\n\t\t * Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/**\n\t\t * Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\truntime: IConnectableRuntime,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"Summarizer\",\n\t\t});\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\tconst stopReason = await this.runCore(onBehalfOf);\n\t\t\tthis.emit(\"summarizerStop\", {\n\t\t\t\tstopReason,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\treturn stopReason;\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthis.emit(\"summarizerStop\", {\n\t\t\t\tstopReason: \"summarizerException\",\n\t\t\t\terror,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason): void {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close(): void {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\t// eslint-disable-next-line no-void\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\tthis.emit(\"summarizerStartupFailed\", {\n\t\t\t\treason: await runCoordinator.waitCancelled,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tthis.emit(\"summarizerStart\", {\n\t\t\tonBehalfOf,\n\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t});\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * summary attempt baseline for heuristics\n\t\t\t\t */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryAckCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.setupForwardedEvents();\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose(): void {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.cleanupForwardedEvents();\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error: IRetriableFailureError) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", error);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((error: IRetriableFailureError) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", error);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number): void {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n\n\tprivate readonly forwardedEvents = new Map<string, () => void>();\n\n\tprivate setupForwardedEvents(): void {\n\t\tfor (const event of [\"summarize\", \"summarizeAllAttemptsFailed\"]) {\n\t\t\tconst listener = (...args: unknown[]): void => {\n\t\t\t\tthis.emit(event, ...args);\n\t\t\t};\n\t\t\t// TODO: better typing here\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument\n\t\t\tthis.runningSummarizer?.on(event as any, listener);\n\t\t\tthis.forwardedEvents.set(event, listener);\n\t\t}\n\t}\n\n\tprivate cleanupForwardedEvents(): void {\n\t\tfor (const [event, listener] of this.forwardedEvents.entries()) {\n\t\t\tthis.runningSummarizer?.off(event, listener);\n\t\t}\n\t\tthis.forwardedEvents.clear();\n\t}\n}\n"]}
1
+ {"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAMjE,kEAA+D;AAC/D,uEAOkD;AAGlD,iEAA2D;AAC3D,uEAAmE;AAgBnE,+DAA+D;AAE/D,MAAa,kBACZ,SAAQ,uBAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,cAAS,GAAG,kBAAkB,CAAC;QAC/B,a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;YACjE,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAe,EAAQ,EAAE;gBAC7C,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;YAC3B,CAAC,CAAC;YACF,2BAA2B;YAC3B,qGAAqG;YACrG,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,KAAY,EAAE,QAAQ,CAAC,CAAC;YACnD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAEO,sBAAsB;QAC7B,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC;YAChE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AA7UD,gCA6UC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type {\n\tISummarizerEvents,\n\tSummarizerStopReason,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tUsageError,\n\tcreateChildLogger,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator.js\";\nimport { RunningSummarizer } from \"./runningSummarizer.js\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics.js\";\nimport {\n\tEnqueueSummarizeResult,\n\tIConnectableRuntime,\n\tIEnqueueSummarizeOptions,\n\tIOnDemandSummarizeOptions,\n\tISummarizeHeuristicData,\n\tISummarizeResults,\n\tISummarizer,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\ttype IRetriableFailureError,\n\ttype ISummaryConfiguration,\n} from \"./summarizerTypes.js\";\nimport { SummaryCollection } from \"./summaryCollection.js\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator.js\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = \"summarizingError\";\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(\n\t\terror: unknown,\n\t\tlogged: boolean = false,\n\t\tlogger: ITelemetryLoggerExt,\n\t): SummarizingWarning {\n\t\tconst newErrorFn = (errMsg: string): SummarizingWarning =>\n\t\t\tnew SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (\n\terrorMessage: string,\n\tlogged: boolean,\n): SummarizingWarning => new SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @internal\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer(): this {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/**\n\t\t * Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/**\n\t\t * Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"Summarizer\",\n\t\t});\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\tconst stopReason = await this.runCore(onBehalfOf);\n\t\t\tthis.emit(\"summarizerStop\", {\n\t\t\t\tstopReason,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\treturn stopReason;\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthis.emit(\"summarizerStop\", {\n\t\t\t\tstopReason: \"summarizerException\",\n\t\t\t\terror,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason): void {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close(): void {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\t// eslint-disable-next-line no-void\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\tthis.emit(\"summarizerStartupFailed\", {\n\t\t\t\treason: await runCoordinator.waitCancelled,\n\t\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t\t});\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tthis.emit(\"summarizerStart\", {\n\t\t\tonBehalfOf,\n\t\t\tnumUnsummarizedRuntimeOps: this._heuristicData?.numRuntimeOps,\n\t\t\tnumUnsummarizedNonRuntimeOps: this._heuristicData?.numNonRuntimeOps,\n\t\t});\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * summary attempt baseline for heuristics\n\t\t\t\t */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryAckCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.setupForwardedEvents();\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose(): void {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.cleanupForwardedEvents();\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error: IRetriableFailureError) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", error);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((error: IRetriableFailureError) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", error);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number): void {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n\n\tprivate readonly forwardedEvents = new Map<string, () => void>();\n\n\tprivate setupForwardedEvents(): void {\n\t\tfor (const event of [\"summarize\", \"summarizeAllAttemptsFailed\"]) {\n\t\t\tconst listener = (...args: unknown[]): void => {\n\t\t\t\tthis.emit(event, ...args);\n\t\t\t};\n\t\t\t// TODO: better typing here\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument\n\t\t\tthis.runningSummarizer?.on(event as any, listener);\n\t\t\tthis.forwardedEvents.set(event, listener);\n\t\t}\n\t}\n\n\tprivate cleanupForwardedEvents(): void {\n\t\tfor (const [event, listener] of this.forwardedEvents.entries()) {\n\t\t\tthis.runningSummarizer?.off(event, listener);\n\t\t}\n\t\tthis.forwardedEvents.clear();\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerClientElection.d.ts","sourceRoot":"","sources":["../../src/summary/summarizerClientElection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EACN,sBAAsB,EAEtB,mBAAmB,EACnB,cAAc,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,MAAM,WAAW,+BAAgC,SAAQ,MAAM;IAC9D,CAAC,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,yBAChB,SAAQ,cAAc,CAAC,+BAA+B,CAAC;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,qBAAa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,0BAA0B,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,yBAChB,SAAQ,cAAc,CAAC,+BAA+B,CAAC;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,qBAAa,wBACZ,SAAQ,iBAAiB,CAAC,+BAA+B,CACzD,YAAW,yBAAyB;IAwBnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;aAClB,cAAc,EAAE,sBAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAzBxC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B,CAAqB;IACvD;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAK;IAE5B,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAE/C;IACD,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAE/C;gBAGiB,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,EAAE,cAAc,CAAC,0BAA0B,CAAC,EAC9D,cAAc,EAAE,sBAAsB,EACrC,sBAAsB,EAAE,MAAM;IAyDzC,SAAS,IAAI,mBAAmB;WAUzB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAS/D,gBAAuB,2BAA2B,YAAa,cAAc,KAAG,OAAO,CACZ;CAC3E"}
@@ -82,7 +82,6 @@ class SummarizerClientElection extends client_utils_1.TypedEventEmitter {
82
82
  this.emit("electedSummarizerChanged");
83
83
  });
84
84
  }
85
- // eslint-disable-next-line import/no-deprecated
86
85
  serialize() {
87
86
  const { electedClientId, electedParentId, electionSequenceNumber } = this.clientElection.serialize();
88
87
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerClientElection.js","sourceRoot":"","sources":["../../src/summary/summarizerClientElection.ts"],"names":[],"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AE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,GACjE,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO;YACN,eAAe;YACf,eAAe;YACf,sBAAsB,EAAE,IAAI,CAAC,0BAA0B,IAAI,sBAAsB;SACjF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,MAAsB;QACpD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,+BAA+B;YAC/B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,wBAAwB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;;AAxGF,4DA4GC;AAFuB,oDAA2B,GAAG,CAAC,OAAuB,EAAW,EAAE,CACzF,OAAO,CAAC,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,4BAAoB,AADxB,CACyB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tIOrderedClientElection,\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializedElection,\n\tITrackedClient,\n} from \"./orderedClientElection.js\";\nimport { ISummaryCollectionOpEvents } from \"./summaryCollection.js\";\n\nexport const summarizerClientType = \"summarizer\";\n\nexport interface ISummarizerClientElectionEvents extends IEvent {\n\t(event: \"electedSummarizerChanged\", handler: () => void): void;\n}\n\nexport interface ISummarizerClientElection\n\textends IEventProvider<ISummarizerClientElectionEvents> {\n\treadonly electedClientId: string | undefined;\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * This class encapsulates logic around tracking the elected summarizer client.\n * It will handle updating the elected client when a summary ack hasn't been seen\n * for some configured number of ops.\n */\nexport class SummarizerClientElection\n\textends TypedEventEmitter<ISummarizerClientElectionEvents>\n\timplements ISummarizerClientElection\n{\n\t/**\n\t * Used to calculate number of ops since last summary ack for the current elected client.\n\t * This will be undefined if there is no elected summarizer, or no summary ack has been\n\t * observed since this client was elected.\n\t * When a summary ack comes in, this will be set to the sequence number of the summary ack.\n\t */\n\tprivate lastSummaryAckSeqForClient: number | undefined;\n\t/**\n\t * Used to prevent excess logging by recording the sequence number that we last reported at,\n\t * and making sure we don't report another event to telemetry. If things work as intended,\n\t * this is not needed, otherwise it could report an event on every op in worst case scenario.\n\t */\n\tprivate lastReportedSeq = 0;\n\n\tpublic get electedClientId(): string | undefined {\n\t\treturn this.clientElection.electedClient?.clientId;\n\t}\n\tpublic get electedParentId(): string | undefined {\n\t\treturn this.clientElection.electedParent?.clientId;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summaryCollection: IEventProvider<ISummaryCollectionOpEvents>,\n\t\tpublic readonly clientElection: IOrderedClientElection,\n\t\tprivate readonly maxOpsSinceLastSummary: number,\n\t) {\n\t\tsuper();\n\t\t// On every inbound op, if enough ops pass without seeing a summary ack (per elected client),\n\t\t// elect a new client and log to telemetry.\n\t\tthis.summaryCollection.on(\"default\", ({ sequenceNumber }) => {\n\t\t\tconst electedClientId = this.electedClientId;\n\t\t\tif (electedClientId === undefined) {\n\t\t\t\t// Reset election if no elected client, but eligible clients are connected.\n\t\t\t\t// This should be uncommon, but is possible if the initial state of the\n\t\t\t\t// ordered client election contains an undefined client id or one not found\n\t\t\t\t// in the quorum (the latter would already log an error).\n\t\t\t\tif (this.clientElection.eligibleCount > 0) {\n\t\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst electionSequenceNumber = this.clientElection.electionSequenceNumber;\n\t\t\tconst opsWithoutSummary =\n\t\t\t\tsequenceNumber - (this.lastSummaryAckSeqForClient ?? electionSequenceNumber);\n\t\t\tif (opsWithoutSummary > this.maxOpsSinceLastSummary) {\n\t\t\t\t// Log and elect a new summarizer client.\n\t\t\t\tconst opsSinceLastReport = sequenceNumber - this.lastReportedSeq;\n\t\t\t\tif (opsSinceLastReport > this.maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ElectedClientNotSummarizing\",\n\t\t\t\t\t\telectedClientId,\n\t\t\t\t\t\tlastSummaryAckSeqForClient: this.lastSummaryAckSeqForClient,\n\t\t\t\t\t\telectionSequenceNumber,\n\t\t\t\t\t\tnextElectedClientId: this.clientElection.peekNextElectedClient()?.clientId,\n\t\t\t\t\t});\n\t\t\t\t\tthis.lastReportedSeq = sequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// When a summary ack comes in, reset our op seq counter.\n\t\tthis.summaryCollection.on(MessageType.SummaryAck, (op) => {\n\t\t\tthis.lastSummaryAckSeqForClient = op.sequenceNumber;\n\t\t});\n\n\t\t// Use oldest client election for unanimously and deterministically deciding\n\t\t// which client should summarize.\n\t\tthis.clientElection.on(\"election\", (client, sequenceNumber) => {\n\t\t\tthis.lastSummaryAckSeqForClient = undefined;\n\t\t\tif (client === undefined && this.clientElection.eligibleCount > 0) {\n\t\t\t\t// If no client is valid for election, reset to the oldest again.\n\t\t\t\t// Also make extra sure not to get stuck in an infinite loop here:\n\t\t\t\t// If there are no eligible clients, just wait until a client joins\n\t\t\t\t// and will be auto-elected.\n\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t}\n\t\t\t// Election can trigger a change in SummaryManager state.\n\t\t\tthis.emit(\"electedSummarizerChanged\");\n\t\t});\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic serialize(): ISerializedElection {\n\t\tconst { electedClientId, electedParentId, electionSequenceNumber } =\n\t\t\tthis.clientElection.serialize();\n\t\treturn {\n\t\t\telectedClientId,\n\t\t\telectedParentId,\n\t\t\telectionSequenceNumber: this.lastSummaryAckSeqForClient ?? electionSequenceNumber,\n\t\t};\n\t}\n\n\tpublic static isClientEligible(client: ITrackedClient): boolean {\n\t\tconst details = client.client.details;\n\t\tif (details === undefined) {\n\t\t\t// Very old clients back-compat\n\t\t\treturn true;\n\t\t}\n\t\treturn SummarizerClientElection.clientDetailsPermitElection(details);\n\t}\n\n\tpublic static readonly clientDetailsPermitElection = (details: IClientDetails): boolean =>\n\t\tdetails.capabilities.interactive || details.type === summarizerClientType;\n}\n"]}
1
+ {"version":3,"file":"summarizerClientElection.js","sourceRoot":"","sources":["../../src/summary/summarizerClientElection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,0EAA0E;AAU7D,QAAA,oBAAoB,GAAG,YAAY,CAAC;AAYjD;;;;GAIG;AACH,MAAa,wBACZ,SAAQ,gCAAkD;IAiB1D,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC;IACpD,CAAC;IACD,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC;IACpD,CAAC;IAED,YACkB,MAA2B,EAC3B,iBAA6D,EAC9D,cAAsC,EACrC,sBAA8B;QAE/C,KAAK,EAAE,CAAC;QALS,WAAM,GAAN,MAAM,CAAqB;QAC3B,sBAAiB,GAAjB,iBAAiB,CAA4C;QAC9D,mBAAc,GAAd,cAAc,CAAwB;QACrC,2BAAsB,GAAtB,sBAAsB,CAAQ;QAlBhD;;;;WAIG;QACK,oBAAe,GAAG,CAAC,CAAC;QAgB3B,6FAA6F;QAC7F,2CAA2C;QAC3C,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,EAA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QACjC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE;YAC7D,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;YAC5C,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;gBACnE,iEAAiE;gBACjE,kEAAkE;gBAClE,mEAAmE;gBACnE,4BAA4B;gBAC5B,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACxD,CAAC;YACD,yDAAyD;YACzD,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,SAAS;QACf,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,GACjE,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO;YACN,eAAe;YACf,eAAe;YACf,sBAAsB,EAAE,IAAI,CAAC,0BAA0B,IAAI,sBAAsB;SACjF,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,MAAsB;QACpD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,+BAA+B;YAC/B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,wBAAwB,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC;;AAvGF,4DA2GC;AAFuB,oDAA2B,GAAG,CAAC,OAAuB,EAAW,EAAE,CACzF,OAAO,CAAC,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,4BAAoB,AADxB,CACyB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tIOrderedClientElection,\n\tISerializedElection,\n\tITrackedClient,\n} from \"./orderedClientElection.js\";\nimport { ISummaryCollectionOpEvents } from \"./summaryCollection.js\";\n\nexport const summarizerClientType = \"summarizer\";\n\nexport interface ISummarizerClientElectionEvents extends IEvent {\n\t(event: \"electedSummarizerChanged\", handler: () => void): void;\n}\n\nexport interface ISummarizerClientElection\n\textends IEventProvider<ISummarizerClientElectionEvents> {\n\treadonly electedClientId: string | undefined;\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * This class encapsulates logic around tracking the elected summarizer client.\n * It will handle updating the elected client when a summary ack hasn't been seen\n * for some configured number of ops.\n */\nexport class SummarizerClientElection\n\textends TypedEventEmitter<ISummarizerClientElectionEvents>\n\timplements ISummarizerClientElection\n{\n\t/**\n\t * Used to calculate number of ops since last summary ack for the current elected client.\n\t * This will be undefined if there is no elected summarizer, or no summary ack has been\n\t * observed since this client was elected.\n\t * When a summary ack comes in, this will be set to the sequence number of the summary ack.\n\t */\n\tprivate lastSummaryAckSeqForClient: number | undefined;\n\t/**\n\t * Used to prevent excess logging by recording the sequence number that we last reported at,\n\t * and making sure we don't report another event to telemetry. If things work as intended,\n\t * this is not needed, otherwise it could report an event on every op in worst case scenario.\n\t */\n\tprivate lastReportedSeq = 0;\n\n\tpublic get electedClientId(): string | undefined {\n\t\treturn this.clientElection.electedClient?.clientId;\n\t}\n\tpublic get electedParentId(): string | undefined {\n\t\treturn this.clientElection.electedParent?.clientId;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summaryCollection: IEventProvider<ISummaryCollectionOpEvents>,\n\t\tpublic readonly clientElection: IOrderedClientElection,\n\t\tprivate readonly maxOpsSinceLastSummary: number,\n\t) {\n\t\tsuper();\n\t\t// On every inbound op, if enough ops pass without seeing a summary ack (per elected client),\n\t\t// elect a new client and log to telemetry.\n\t\tthis.summaryCollection.on(\"default\", ({ sequenceNumber }) => {\n\t\t\tconst electedClientId = this.electedClientId;\n\t\t\tif (electedClientId === undefined) {\n\t\t\t\t// Reset election if no elected client, but eligible clients are connected.\n\t\t\t\t// This should be uncommon, but is possible if the initial state of the\n\t\t\t\t// ordered client election contains an undefined client id or one not found\n\t\t\t\t// in the quorum (the latter would already log an error).\n\t\t\t\tif (this.clientElection.eligibleCount > 0) {\n\t\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst electionSequenceNumber = this.clientElection.electionSequenceNumber;\n\t\t\tconst opsWithoutSummary =\n\t\t\t\tsequenceNumber - (this.lastSummaryAckSeqForClient ?? electionSequenceNumber);\n\t\t\tif (opsWithoutSummary > this.maxOpsSinceLastSummary) {\n\t\t\t\t// Log and elect a new summarizer client.\n\t\t\t\tconst opsSinceLastReport = sequenceNumber - this.lastReportedSeq;\n\t\t\t\tif (opsSinceLastReport > this.maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ElectedClientNotSummarizing\",\n\t\t\t\t\t\telectedClientId,\n\t\t\t\t\t\tlastSummaryAckSeqForClient: this.lastSummaryAckSeqForClient,\n\t\t\t\t\t\telectionSequenceNumber,\n\t\t\t\t\t\tnextElectedClientId: this.clientElection.peekNextElectedClient()?.clientId,\n\t\t\t\t\t});\n\t\t\t\t\tthis.lastReportedSeq = sequenceNumber;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// When a summary ack comes in, reset our op seq counter.\n\t\tthis.summaryCollection.on(MessageType.SummaryAck, (op) => {\n\t\t\tthis.lastSummaryAckSeqForClient = op.sequenceNumber;\n\t\t});\n\n\t\t// Use oldest client election for unanimously and deterministically deciding\n\t\t// which client should summarize.\n\t\tthis.clientElection.on(\"election\", (client, sequenceNumber) => {\n\t\t\tthis.lastSummaryAckSeqForClient = undefined;\n\t\t\tif (client === undefined && this.clientElection.eligibleCount > 0) {\n\t\t\t\t// If no client is valid for election, reset to the oldest again.\n\t\t\t\t// Also make extra sure not to get stuck in an infinite loop here:\n\t\t\t\t// If there are no eligible clients, just wait until a client joins\n\t\t\t\t// and will be auto-elected.\n\t\t\t\tthis.clientElection.resetElectedClient(sequenceNumber);\n\t\t\t}\n\t\t\t// Election can trigger a change in SummaryManager state.\n\t\t\tthis.emit(\"electedSummarizerChanged\");\n\t\t});\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\tconst { electedClientId, electedParentId, electionSequenceNumber } =\n\t\t\tthis.clientElection.serialize();\n\t\treturn {\n\t\t\telectedClientId,\n\t\t\telectedParentId,\n\t\t\telectionSequenceNumber: this.lastSummaryAckSeqForClient ?? electionSequenceNumber,\n\t\t};\n\t}\n\n\tpublic static isClientEligible(client: ITrackedClient): boolean {\n\t\tconst details = client.client.details;\n\t\tif (details === undefined) {\n\t\t\t// Very old clients back-compat\n\t\t\treturn true;\n\t\t}\n\t\treturn SummarizerClientElection.clientDetailsPermitElection(details);\n\t}\n\n\tpublic static readonly clientDetailsPermitElection = (details: IClientDetails): boolean =>\n\t\tdetails.capabilities.interactive || details.type === summarizerClientType;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
6
- import { ISummaryConfigurationHeuristics } from "../containerRuntime.js";
6
+ import type { ISummaryConfigurationHeuristics } from "./summarizerTypes.js";
7
7
  import { ISummarizeAttempt, ISummarizeHeuristicData, ISummarizeHeuristicRunner, ISummaryHeuristicStrategy } from "./summarizerTypes.js";
8
8
  import { SummarizeReason } from "./summaryGenerator.js";
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerHeuristics.d.ts","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ACF,OAAO,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC;IAChD,CAAC;CACD;AAED,SAAS,oCAAoC;IAI5C,OAAO,CAAC,IAAI,+BAA+B,EAAE,EAAE,IAAI,mCAAmC,EAAE,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Timer } from \"@fluidframework/core-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime.js\";\n\nimport {\n\tISummarizeAttempt,\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tISummaryHeuristicStrategy,\n} from \"./summarizerTypes.js\";\nimport { SummarizeReason } from \"./summaryGenerator.js\";\n\n/**\n * Simple implementation of class for tracking summarize heuristic data.\n */\nexport class SummarizeHeuristicData implements ISummarizeHeuristicData {\n\tprotected _lastAttempt: ISummarizeAttempt;\n\tpublic get lastAttempt(): ISummarizeAttempt {\n\t\treturn this._lastAttempt;\n\t}\n\n\tprotected _lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\tpublic get lastSuccessfulSummary(): Readonly<ISummarizeAttempt> {\n\t\treturn this._lastSuccessfulSummary;\n\t}\n\n\tpublic get opsSinceLastSummary(): number {\n\t\treturn this.numNonRuntimeOpsBefore + this.numRuntimeOpsBefore;\n\t}\n\n\tpublic hasMissingOpData: boolean = false;\n\n\tpublic totalOpsSize: number = 0;\n\t/**\n\t * Cumulative size in bytes of all the ops at the beginning of the summarization attempt.\n\t * Is used to adjust totalOpsSize appropriately after successful summarization.\n\t */\n\tprivate totalOpsSizeBefore: number = 0;\n\n\tpublic numNonRuntimeOps: number = 0;\n\t/**\n\t * Number of non-runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numNonRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numNonRuntimeOpsBefore: number = 0;\n\n\tpublic numRuntimeOps: number = 0;\n\t/**\n\t * Number of runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numRuntimeOpsBefore: number = 0;\n\n\tconstructor(\n\t\tpublic lastOpSequenceNumber: number,\n\t\t/**\n\t\t * Baseline attempt data used for comparisons with subsequent attempts/calculations.\n\t\t */\n\t\tattemptBaseline: ISummarizeAttempt,\n\t) {\n\t\tthis._lastAttempt = attemptBaseline;\n\t\tthis._lastSuccessfulSummary = { ...attemptBaseline };\n\t}\n\n\tpublic updateWithLastSummaryAckInfo(lastSummary: Readonly<ISummarizeAttempt>): void {\n\t\tthis._lastAttempt = lastSummary;\n\t\tthis._lastSuccessfulSummary = { ...lastSummary };\n\t}\n\n\tpublic recordAttempt(refSequenceNumber?: number): void {\n\t\tthis._lastAttempt = {\n\t\t\trefSequenceNumber: refSequenceNumber ?? this.lastOpSequenceNumber,\n\t\t\tsummaryTime: Date.now(),\n\t\t};\n\n\t\tthis.numNonRuntimeOpsBefore = this.numNonRuntimeOps;\n\t\tthis.numRuntimeOpsBefore = this.numRuntimeOps;\n\t\tthis.totalOpsSizeBefore = this.totalOpsSize;\n\t}\n\n\tpublic markLastAttemptAsSuccessful(): void {\n\t\tthis._lastSuccessfulSummary = { ...this.lastAttempt };\n\n\t\tthis.numNonRuntimeOps -= this.numNonRuntimeOpsBefore;\n\t\tthis.numNonRuntimeOpsBefore = 0;\n\n\t\tthis.numRuntimeOps -= this.numRuntimeOpsBefore;\n\t\tthis.numRuntimeOpsBefore = 0;\n\n\t\tthis.totalOpsSize -= this.totalOpsSizeBefore;\n\t\tthis.totalOpsSizeBefore = 0;\n\t}\n}\n\n/**\n * This class contains the heuristics for when to summarize.\n */\nexport class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {\n\tprivate readonly idleTimer: Timer | undefined;\n\tprivate readonly runSummarize: (reason: SummarizeReason) => void;\n\n\tpublic constructor(\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly configuration: ISummaryConfigurationHeuristics,\n\t\ttrySummarize: (reason: SummarizeReason) => void,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summarizeStrategies: ISummaryHeuristicStrategy[] = getDefaultSummaryHeuristicStrategies(),\n\t) {\n\t\tthis.idleTimer = new Timer(this.idleTime, () => this.runSummarize(\"idle\"));\n\n\t\tthis.runSummarize = (reason: SummarizeReason) => {\n\t\t\tthis.idleTimer?.clear();\n\n\t\t\t// We shouldn't attempt a summary if there are no new processed ops\n\t\t\tconst opsSinceLastAck = this.opsSinceLastAck;\n\t\t\tif (opsSinceLastAck > 0) {\n\t\t\t\ttrySummarize(reason);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic get idleTime(): number {\n\t\tconst maxIdleTime = this.configuration.maxIdleTime;\n\t\tconst minIdleTime = this.configuration.minIdleTime;\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst pToMaxOps = (weightedNumOfOps * 1) / this.configuration.maxOps;\n\n\t\tif (pToMaxOps >= 1) {\n\t\t\treturn minIdleTime;\n\t\t}\n\n\t\t// Return a ratioed idle time based on the percentage of ops\n\t\treturn maxIdleTime - (maxIdleTime - minIdleTime) * pToMaxOps;\n\t}\n\n\tpublic get opsSinceLastAck(): number {\n\t\treturn (\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber\n\t\t);\n\t}\n\n\tpublic start(): void {\n\t\tthis.idleTimer?.start(this.idleTime);\n\t}\n\n\tpublic run(): void {\n\t\tfor (const strategy of this.summarizeStrategies) {\n\t\t\tif (strategy.shouldRunSummary(this.configuration, this.heuristicData)) {\n\t\t\t\treturn this.runSummarize(strategy.summarizeReason);\n\t\t\t}\n\t\t}\n\n\t\tthis.idleTimer?.restart(this.idleTime);\n\t}\n\n\tpublic shouldRunLastSummary(): boolean {\n\t\tconst weightedOpsSinceLastAck = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ShouldRunLastSummary\",\n\t\t\tweightedOpsSinceLastAck,\n\t\t\tminOpsForLastSummaryAttempt,\n\t\t});\n\n\t\treturn weightedOpsSinceLastAck >= minOpsForLastSummaryAttempt;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.idleTimer?.clear();\n\t}\n}\n\n/**\n * Strategy used to run a summary when it's been a while since our last successful summary\n */\nclass MaxTimeSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxTime\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst timeSinceLastSummary = Date.now() - heuristicData.lastSuccessfulSummary.summaryTime;\n\t\treturn timeSinceLastSummary > configuration.maxTime;\n\t}\n}\n\nfunction getWeightedNumberOfOps(\n\truntimeOpCount: number,\n\tnonRuntimeOpCount: number,\n\truntimeOpWeight: number,\n\tnonRuntimeOpWeight: number,\n): number {\n\treturn runtimeOpWeight * runtimeOpCount + nonRuntimeOpWeight * nonRuntimeOpCount;\n}\n\n/**\n * Strategy used to do a weighted analysis on the ops we've processed since the last successful summary\n */\nclass WeightedOpsSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxOps\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\theuristicData.numRuntimeOps,\n\t\t\theuristicData.numNonRuntimeOps,\n\t\t\tconfiguration.runtimeOpWeight,\n\t\t\tconfiguration.nonRuntimeOpWeight,\n\t\t);\n\t\treturn weightedNumOfOps > configuration.maxOps;\n\t}\n}\n\nfunction getDefaultSummaryHeuristicStrategies(): (\n\t| MaxTimeSummaryHeuristicStrategy\n\t| WeightedOpsSummaryHeuristicStrategy\n)[] {\n\treturn [new MaxTimeSummaryHeuristicStrategy(), new WeightedOpsSummaryHeuristicStrategy()];\n}\n"]}
1
+ {"version":3,"file":"summarizerHeuristics.js","sourceRoot":"","sources":["../../src/summary/summarizerHeuristics.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4D;AAY5D;;GAEG;AACH,MAAa,sBAAsB;IAElC,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAGD,IAAW,qBAAqB;QAC/B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IAED,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,CAAC;IAC/D,CAAC;IAyBD,YACQ,oBAA4B;IACnC;;OAEG;IACH,eAAkC;QAJ3B,yBAAoB,GAApB,oBAAoB,CAAQ;QAxB7B,qBAAgB,GAAY,KAAK,CAAC;QAElC,iBAAY,GAAW,CAAC,CAAC;QAChC;;;WAGG;QACK,uBAAkB,GAAW,CAAC,CAAC;QAEhC,qBAAgB,GAAW,CAAC,CAAC;QACpC;;;WAGG;QACK,2BAAsB,GAAW,CAAC,CAAC;QAEpC,kBAAa,GAAW,CAAC,CAAC;QACjC;;;WAGG;QACK,wBAAmB,GAAW,CAAC,CAAC;QASvC,IAAI,CAAC,YAAY,GAAG,eAA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G,aAAa,CAAC,OAAO,CAAC;IACrD,CAAC;CACD;AAED,SAAS,sBAAsB,CAC9B,cAAsB,EACtB,iBAAyB,EACzB,eAAuB,EACvB,kBAA0B;IAE1B,OAAO,eAAe,GAAG,cAAc,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAClF,CAAC;AAED;;GAEG;AACH,MAAM,mCAAmC;IAAzC;QACiB,oBAAe,GAA8B,QAAQ,CAAC;IAcvE,CAAC;IAZO,gBAAgB,CACtB,aAA8C,EAC9C,aAAsC;QAEtC,MAAM,gBAAgB,GAAG,sBAAsB,CAC9C,aAAa,CAAC,aAAa,EAC3B,aAAa,CAAC,gBAAgB,EAC9B,aAAa,CAAC,eAAe,EAC7B,aAAa,CAAC,kBAAkB,CAChC,CAAC;QACF,OAAO,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC;IAChD,CAAC;CACD;AAED,SAAS,oCAAoC;IAI5C,OAAO,CAAC,IAAI,+BAA+B,EAAE,EAAE,IAAI,mCAAmC,EAAE,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Timer } from \"@fluidframework/core-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ISummaryConfigurationHeuristics } from \"./summarizerTypes.js\";\nimport {\n\tISummarizeAttempt,\n\tISummarizeHeuristicData,\n\tISummarizeHeuristicRunner,\n\tISummaryHeuristicStrategy,\n} from \"./summarizerTypes.js\";\nimport { SummarizeReason } from \"./summaryGenerator.js\";\n\n/**\n * Simple implementation of class for tracking summarize heuristic data.\n */\nexport class SummarizeHeuristicData implements ISummarizeHeuristicData {\n\tprotected _lastAttempt: ISummarizeAttempt;\n\tpublic get lastAttempt(): ISummarizeAttempt {\n\t\treturn this._lastAttempt;\n\t}\n\n\tprotected _lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\tpublic get lastSuccessfulSummary(): Readonly<ISummarizeAttempt> {\n\t\treturn this._lastSuccessfulSummary;\n\t}\n\n\tpublic get opsSinceLastSummary(): number {\n\t\treturn this.numNonRuntimeOpsBefore + this.numRuntimeOpsBefore;\n\t}\n\n\tpublic hasMissingOpData: boolean = false;\n\n\tpublic totalOpsSize: number = 0;\n\t/**\n\t * Cumulative size in bytes of all the ops at the beginning of the summarization attempt.\n\t * Is used to adjust totalOpsSize appropriately after successful summarization.\n\t */\n\tprivate totalOpsSizeBefore: number = 0;\n\n\tpublic numNonRuntimeOps: number = 0;\n\t/**\n\t * Number of non-runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numNonRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numNonRuntimeOpsBefore: number = 0;\n\n\tpublic numRuntimeOps: number = 0;\n\t/**\n\t * Number of runtime ops at beginning of attempting to summarize.\n\t * Is used to adjust numRuntimeOps appropriately after successful summarization.\n\t */\n\tprivate numRuntimeOpsBefore: number = 0;\n\n\tconstructor(\n\t\tpublic lastOpSequenceNumber: number,\n\t\t/**\n\t\t * Baseline attempt data used for comparisons with subsequent attempts/calculations.\n\t\t */\n\t\tattemptBaseline: ISummarizeAttempt,\n\t) {\n\t\tthis._lastAttempt = attemptBaseline;\n\t\tthis._lastSuccessfulSummary = { ...attemptBaseline };\n\t}\n\n\tpublic updateWithLastSummaryAckInfo(lastSummary: Readonly<ISummarizeAttempt>): void {\n\t\tthis._lastAttempt = lastSummary;\n\t\tthis._lastSuccessfulSummary = { ...lastSummary };\n\t}\n\n\tpublic recordAttempt(refSequenceNumber?: number): void {\n\t\tthis._lastAttempt = {\n\t\t\trefSequenceNumber: refSequenceNumber ?? this.lastOpSequenceNumber,\n\t\t\tsummaryTime: Date.now(),\n\t\t};\n\n\t\tthis.numNonRuntimeOpsBefore = this.numNonRuntimeOps;\n\t\tthis.numRuntimeOpsBefore = this.numRuntimeOps;\n\t\tthis.totalOpsSizeBefore = this.totalOpsSize;\n\t}\n\n\tpublic markLastAttemptAsSuccessful(): void {\n\t\tthis._lastSuccessfulSummary = { ...this.lastAttempt };\n\n\t\tthis.numNonRuntimeOps -= this.numNonRuntimeOpsBefore;\n\t\tthis.numNonRuntimeOpsBefore = 0;\n\n\t\tthis.numRuntimeOps -= this.numRuntimeOpsBefore;\n\t\tthis.numRuntimeOpsBefore = 0;\n\n\t\tthis.totalOpsSize -= this.totalOpsSizeBefore;\n\t\tthis.totalOpsSizeBefore = 0;\n\t}\n}\n\n/**\n * This class contains the heuristics for when to summarize.\n */\nexport class SummarizeHeuristicRunner implements ISummarizeHeuristicRunner {\n\tprivate readonly idleTimer: Timer | undefined;\n\tprivate readonly runSummarize: (reason: SummarizeReason) => void;\n\n\tpublic constructor(\n\t\tprivate readonly heuristicData: ISummarizeHeuristicData,\n\t\tprivate readonly configuration: ISummaryConfigurationHeuristics,\n\t\ttrySummarize: (reason: SummarizeReason) => void,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly summarizeStrategies: ISummaryHeuristicStrategy[] = getDefaultSummaryHeuristicStrategies(),\n\t) {\n\t\tthis.idleTimer = new Timer(this.idleTime, () => this.runSummarize(\"idle\"));\n\n\t\tthis.runSummarize = (reason: SummarizeReason) => {\n\t\t\tthis.idleTimer?.clear();\n\n\t\t\t// We shouldn't attempt a summary if there are no new processed ops\n\t\t\tconst opsSinceLastAck = this.opsSinceLastAck;\n\t\t\tif (opsSinceLastAck > 0) {\n\t\t\t\ttrySummarize(reason);\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic get idleTime(): number {\n\t\tconst maxIdleTime = this.configuration.maxIdleTime;\n\t\tconst minIdleTime = this.configuration.minIdleTime;\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst pToMaxOps = (weightedNumOfOps * 1) / this.configuration.maxOps;\n\n\t\tif (pToMaxOps >= 1) {\n\t\t\treturn minIdleTime;\n\t\t}\n\n\t\t// Return a ratioed idle time based on the percentage of ops\n\t\treturn maxIdleTime - (maxIdleTime - minIdleTime) * pToMaxOps;\n\t}\n\n\tpublic get opsSinceLastAck(): number {\n\t\treturn (\n\t\t\tthis.heuristicData.lastOpSequenceNumber -\n\t\t\tthis.heuristicData.lastSuccessfulSummary.refSequenceNumber\n\t\t);\n\t}\n\n\tpublic start(): void {\n\t\tthis.idleTimer?.start(this.idleTime);\n\t}\n\n\tpublic run(): void {\n\t\tfor (const strategy of this.summarizeStrategies) {\n\t\t\tif (strategy.shouldRunSummary(this.configuration, this.heuristicData)) {\n\t\t\t\treturn this.runSummarize(strategy.summarizeReason);\n\t\t\t}\n\t\t}\n\n\t\tthis.idleTimer?.restart(this.idleTime);\n\t}\n\n\tpublic shouldRunLastSummary(): boolean {\n\t\tconst weightedOpsSinceLastAck = getWeightedNumberOfOps(\n\t\t\tthis.heuristicData.numRuntimeOps,\n\t\t\tthis.heuristicData.numNonRuntimeOps,\n\t\t\tthis.configuration.runtimeOpWeight,\n\t\t\tthis.configuration.nonRuntimeOpWeight,\n\t\t);\n\t\tconst minOpsForLastSummaryAttempt = this.configuration.minOpsForLastSummaryAttempt;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ShouldRunLastSummary\",\n\t\t\tweightedOpsSinceLastAck,\n\t\t\tminOpsForLastSummaryAttempt,\n\t\t});\n\n\t\treturn weightedOpsSinceLastAck >= minOpsForLastSummaryAttempt;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.idleTimer?.clear();\n\t}\n}\n\n/**\n * Strategy used to run a summary when it's been a while since our last successful summary\n */\nclass MaxTimeSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxTime\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst timeSinceLastSummary = Date.now() - heuristicData.lastSuccessfulSummary.summaryTime;\n\t\treturn timeSinceLastSummary > configuration.maxTime;\n\t}\n}\n\nfunction getWeightedNumberOfOps(\n\truntimeOpCount: number,\n\tnonRuntimeOpCount: number,\n\truntimeOpWeight: number,\n\tnonRuntimeOpWeight: number,\n): number {\n\treturn runtimeOpWeight * runtimeOpCount + nonRuntimeOpWeight * nonRuntimeOpCount;\n}\n\n/**\n * Strategy used to do a weighted analysis on the ops we've processed since the last successful summary\n */\nclass WeightedOpsSummaryHeuristicStrategy implements ISummaryHeuristicStrategy {\n\tpublic readonly summarizeReason: Readonly<SummarizeReason> = \"maxOps\";\n\n\tpublic shouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean {\n\t\tconst weightedNumOfOps = getWeightedNumberOfOps(\n\t\t\theuristicData.numRuntimeOps,\n\t\t\theuristicData.numNonRuntimeOps,\n\t\t\tconfiguration.runtimeOpWeight,\n\t\t\tconfiguration.nonRuntimeOpWeight,\n\t\t);\n\t\treturn weightedNumOfOps > configuration.maxOps;\n\t}\n}\n\nfunction getDefaultSummaryHeuristicStrategies(): (\n\t| MaxTimeSummaryHeuristicStrategy\n\t| WeightedOpsSummaryHeuristicStrategy\n)[] {\n\treturn [new MaxTimeSummaryHeuristicStrategy(), new WeightedOpsSummaryHeuristicStrategy()];\n}\n"]}
@@ -7,7 +7,7 @@ import { ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver
7
7
  import { ITelemetryContext, CreateChildSummarizerNodeParam, ISummarizeResult, ISummarizerNode, ISummarizerNodeConfig, SummarizeInternalFn } from "@fluidframework/runtime-definitions/internal";
8
8
  import { type ITelemetryErrorEventExt } from "@fluidframework/telemetry-utils/internal";
9
9
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
- import { EscapedPath, ICreateChildDetails, IRefreshSummaryResult, IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, PendingSummaryInfo } from "./summarizerNodeUtils.js";
10
+ import { ICreateChildDetails, IRefreshSummaryResult, IStartSummaryResult, ISummarizerNodeRootContract, ValidateSummaryResult, PendingSummaryInfo } from "./summarizerNodeUtils.js";
11
11
  export interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {
12
12
  }
13
13
  /**
@@ -72,7 +72,7 @@ export declare class SummarizerNode implements IRootSummarizerNode {
72
72
  /**
73
73
  * Encoded handle or path to the node
74
74
  */
75
- _summaryHandleId: EscapedPath, _changeSequenceNumber: number,
75
+ _summaryHandleId: string, _changeSequenceNumber: number,
76
76
  /**
77
77
  * Summary reference sequence number, i.e. last sequence number seen when last successful summary was created
78
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EACN,aAAa,EACb,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,iBAAiB,EACjB,8BAA8B,EAE9B,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EACN,mBAAmB,EAMnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,mBAAoB,SAAQ,eAAe,EAAE,2BAA2B;CAAG;AAE5F;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,YAAW,mBAAmB;IA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MAAM,GAAG,IAAI;IAcxE,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,IAAI;IAItF;;OAEG;IACI,mBAAmB,IAAI,OAAO;IAIrC;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,uBAAuB,GAAG,KAAK;CAW1E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WAC5B,mBAAmB,uBACN,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC3B,mBAUD,CAAC"}
1
+ {"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EACN,aAAa,EACb,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGN,iBAAiB,EACjB,8BAA8B,EAE9B,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EACN,mBAAmB,EAMnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,mBAAoB,SAAQ,eAAe,EAAE,2BAA2B;CAAG;AAE5F;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,YAAW,mBAAmB;IAwCxD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAEpC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,qBAAqB;IAC7B;;OAEG;IACH,OAAO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OAAO;IAIrC;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,uBAAuB,GAAG,KAAK;CAW1E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WAC5B,mBAAmB,uBACN,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC3B,mBAUD,CAAC"}
@@ -10,7 +10,6 @@ const driver_definitions_1 = require("@fluidframework/driver-definitions");
10
10
  const internal_2 = require("@fluidframework/runtime-definitions/internal");
11
11
  const internal_3 = require("@fluidframework/runtime-utils/internal");
12
12
  const internal_4 = require("@fluidframework/telemetry-utils/internal");
13
- const summarizerNodeUtils_js_1 = require("./summarizerNodeUtils.js");
14
13
  /**
15
14
  * Encapsulates the summarizing work and state of an individual tree node in the
16
15
  * summary tree. It tracks changes and allows for optimizations when unchanged, or
@@ -37,7 +36,7 @@ class SummarizerNode {
37
36
  * (this getter is primarily only used in the test code)
38
37
  */
39
38
  get summaryHandleId() {
40
- return this._summaryHandleId.toString();
39
+ return this._summaryHandleId;
41
40
  }
42
41
  /**
43
42
  * Do not call constructor directly.
@@ -434,7 +433,8 @@ class SummarizerNode {
434
433
  }
435
434
  }
436
435
  const childTelemetryNodeId = `${this.telemetryNodeId ?? ""}/${id}`;
437
- const childSummaryHandleId = this._summaryHandleId.createChildPath(summarizerNodeUtils_js_1.EscapedPath.create(id));
436
+ // parentHandleId/.channels/childId
437
+ const childSummaryHandleId = `${this._summaryHandleId}/${internal_2.channelsTreeName}/${id}`;
438
438
  return {
439
439
  changeSequenceNumber,
440
440
  telemetryNodeId: childTelemetryNodeId,
@@ -498,6 +498,6 @@ exports.SummarizerNode = SummarizerNode;
498
498
  * or undefined if not loaded from summary
499
499
  * @param config - Configure behavior of summarizer node
500
500
  */
501
- const createRootSummarizerNode = (logger, summarizeInternalFn, changeSequenceNumber, referenceSequenceNumber, config = {}) => new SummarizerNode(logger, summarizeInternalFn, config, summarizerNodeUtils_js_1.EscapedPath.create("") /* summaryHandleId */, changeSequenceNumber, referenceSequenceNumber, undefined /* wipSummaryLogger */, "" /* telemetryNodeId */);
501
+ const createRootSummarizerNode = (logger, summarizeInternalFn, changeSequenceNumber, referenceSequenceNumber, config = {}) => new SummarizerNode(logger, summarizeInternalFn, config, "" /* summaryHandleId */, changeSequenceNumber, referenceSequenceNumber, undefined /* wipSummaryLogger */, "" /* telemetryNodeId */);
502
502
  exports.createRootSummarizerNode = createRootSummarizerNode;
503
503
  //# sourceMappingURL=summarizerNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA8E;AAC9E,2EAAiE;AAKjE,2EASsD;AACtD,qEAAoE;AAEpE,uEAOkD;AAElD,qEAQkC;AAIlC;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAC1B;;;OAGG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,mCAAmC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IACzC,CAAC;IAmBD;;;OAGG;IACH,YACC,UAAgC,EACf,mBAAwC,EACzD,MAA6B;IAC7B;;OAEG;IACc,gBAA6B,EACtC,qBAA6B;IACrC;;OAEG;IACK,mCAA4C,EAC1C,gBAAuC;IACjD;;OAEG;IACO,eAAwB;QAfjB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAKxC,qBAAgB,GAAhB,gBAAgB,CAAa;QACtC,0BAAqB,GAArB,qBAAqB,CAAQ;QAI7B,wCAAmC,GAAnC,mCAAmC,CAAS;QAC1C,qBAAgB,GAAhB,gBAAgB,CAAuB;QAIvC,oBAAe,GAAf,eAAe,CAAS;QAtChB,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAChE;;;WAGG;QAC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oBAAoB,CAAC,UAAmC;QACjE,MAAM,KAAK,GAAG,IAAI,uBAAY,CAAC,UAAU,CAAC,SAAS,EAAE;YACpD,GAAG,UAAU;YACb,uBAAuB,EAAE,IAAI,CAAC,0BAA0B;YACxD,GAAG,IAAA,2BAAgB,EAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,eAAe;aACxB,CAAC;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC;IACb,CAAC;CACD;AAjlBD,wCAilBC;AAED;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACvC,MAA2B,EAC3B,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAgC,EAAE,EACZ,EAAE,CACxB,IAAI,cAAc,CACjB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oCAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,qBAAqB,EAC5C,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,CAAC,sBAAsB,EAChC,EAAE,CAAC,qBAAqB,CACxB,CAAC;AAhBU,QAAA,wBAAwB,4BAgBlC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tISummarizeResult,\n\tISummarizerNode,\n\tISummarizerNodeConfig,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { mergeStats } from \"@fluidframework/runtime-utils/internal\";\nimport { type ITelemetryErrorEventExt } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEscapedPath,\n\tICreateChildDetails,\n\tIRefreshSummaryResult,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n\tPendingSummaryInfo,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {}\n\n/**\n * Encapsulates the summarizing work and state of an individual tree node in the\n * summary tree. It tracks changes and allows for optimizations when unchanged, or\n * can allow for fallback summaries to be generated when an error is encountered.\n * Usage is for the root node to call startSummary first to begin tracking a WIP\n * (work in progress) summary. Then all nodes will call summarize to summaries their\n * individual parts. Once completed and uploaded to storage, the root node will call\n * completeSummary or clearSummary to clear the WIP summary tracking state if something\n * went wrong. The SummarizerNodes will track all pending summaries that have been\n * recorded by the completeSummary call. When one of them is acked, the root node should\n * call refreshLatestSummary to inform the tree of SummarizerNodes of the new baseline\n * latest successful summary.\n */\nexport class SummarizerNode implements IRootSummarizerNode {\n\t/**\n\t * The reference sequence number of the most recent acked summary.\n\t * Returns 0 if there is not yet an acked summary.\n\t */\n\tpublic get referenceSequenceNumber(): number {\n\t\treturn this._lastSummaryReferenceSequenceNumber ?? 0;\n\t}\n\n\t/**\n\t * returns the handle of the last successful summary of this summarizerNode in string format\n\t * (this getter is primarily only used in the test code)\n\t */\n\tpublic get summaryHandleId(): string {\n\t\treturn this._summaryHandleId.toString();\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\t/**\n\t * Key value pair of summaries submitted by this client which are not yet acked.\n\t * Key is the proposalHandle and value is the summary op's referece sequence number.\n\t */\n\tprotected readonly pendingSummaries = new Map<string, PendingSummaryInfo>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\t/**\n\t * True if the current node was summarized during the current summary process\n\t * This flag is used to identify scenarios where summarize was not called on a node.\n\t * For example, this node was created after its parent was already summarized due to out-of-order realization via application code.\n\t */\n\tprivate wipSummarizeCalled: boolean = false;\n\tprivate wipSkipRecursion = false;\n\n\tprotected readonly logger: ITelemetryLoggerExt;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfig,\n\t\t/**\n\t\t * Encoded handle or path to the node\n\t\t */\n\t\tprivate readonly _summaryHandleId: EscapedPath,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when last successful summary was created\n\t\t */\n\t\tprivate _lastSummaryReferenceSequenceNumber?: number,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\n\t\tprotected telemetryNodeId?: string,\n\t) {\n\t\tthis.canReuseHandle = config.canReuseHandle ?? true;\n\t\t// All logs posted by the summarizer node should include the telemetryNodeId.\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: baseLogger,\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({ id: this.telemetryNodeId }),\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * In order to produce a summary with a summarizer node, the summarizer node system must be notified a summary has\n\t * started. This is done by calling startSummary. This will track the reference sequence number of the summary and\n\t * run some validation checks to ensure the summary is correct.\n\t * @param referenceSequenceNumber - the number of ops processed up to this point\n\t * @param summaryLogger - the logger to use for the summary\n\t * @param latestSummaryRefSeqNum - the reference sequence number of the latest summary. Another way to think about\n\t * it is the reference sequence number of the previous summary.\n\t * @returns the number of nodes in the tree, the number of nodes that are invalid, and the different types of\n\t * sequence number mismatches\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger === undefined,\n\t\t\t0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber === undefined,\n\t\t\t0x1a0 /* \"Already tracking a summary\" */,\n\t\t);\n\n\t\tlet nodes = 1; // number of summarizerNodes at the start of the summary\n\t\tlet invalidNodes = 0;\n\t\tconst sequenceNumberMismatchKeySet = new Set<string>();\n\t\tconst nodeLatestSummaryRefSeqNum = this._lastSummaryReferenceSequenceNumber;\n\t\tif (\n\t\t\tnodeLatestSummaryRefSeqNum !== undefined &&\n\t\t\tlatestSummaryRefSeqNum !== nodeLatestSummaryRefSeqNum\n\t\t) {\n\t\t\tinvalidNodes++;\n\t\t\tsequenceNumberMismatchKeySet.add(\n\t\t\t\t`${latestSummaryRefSeqNum}-${nodeLatestSummaryRefSeqNum}`,\n\t\t\t);\n\t\t}\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst childStartSummaryResult = child.startSummary(\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tthis.wipSummaryLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\t\t\tnodes += childStartSummaryResult.nodes;\n\t\t\tinvalidNodes += childStartSummaryResult.invalidNodes;\n\t\t\tfor (const invalidSequenceNumber of childStartSummaryResult.mismatchNumbers) {\n\t\t\t\tsequenceNumberMismatchKeySet.add(invalidSequenceNumber);\n\t\t\t}\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t\treturn {\n\t\t\tnodes,\n\t\t\tinvalidNodes,\n\t\t\tmismatchNumbers: sequenceNumberMismatchKeySet,\n\t\t};\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\t// If trackState is false, call summarize internal directly and don't track any state.\n\t\tif (!trackState) {\n\t\t\treturn this.summarizeInternalFn(fullTree, trackState, telemetryContext);\n\t\t}\n\n\t\t// Set to wipSummarizeCalled true to represent that current node was included in the summary process.\n\t\tthis.wipSummarizeCalled = true;\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullTree &&\n\t\t\t!this.hasChanged() &&\n\t\t\tthis._lastSummaryReferenceSequenceNumber !== undefined\n\t\t) {\n\t\t\tthis.wipSkipRecursion = true;\n\t\t\tconst stats = mergeStats();\n\t\t\tstats.handleNodeCount++;\n\t\t\treturn {\n\t\t\t\tsummary: {\n\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\thandle: this.summaryHandleId,\n\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t},\n\t\t\t\tstats,\n\t\t\t};\n\t\t}\n\n\t\tlet incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined;\n\t\tif (!fullTree) {\n\t\t\tassert(\n\t\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t\t);\n\t\t\tincrementalSummaryContext =\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\t\tlatestSummarySequenceNumber: this._lastSummaryReferenceSequenceNumber,\n\t\t\t\t\t\t\t// TODO: remove summaryPath.\n\t\t\t\t\t\t\tsummaryPath: this.summaryHandleId,\n\t\t\t\t\t\t};\n\t\t}\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\n\t\treturn { summary: result.summary, stats: result.stats };\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct, i.e., summarize should have run for all non-skipped\n\t * nodes. This will only be called for the root summarizer node and is called by it recursively on all child nodes.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tpublic validateSummary(): ValidateSummaryResult {\n\t\treturn this.validateSummaryCore(false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., summarize should have run for all\n\t * non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotSummarize\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\tif (parentSkipRecursion) {\n\t\t\treturn { success: true };\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst result = child.validateSummaryCore(this.wipSkipRecursion || parentSkipRecursion);\n\t\t\t// If any child fails, return the failure.\n\t\t\tif (!result.success) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn { success: true };\n\t}\n\n\tprivate wasSummarizeMissed(parentSkipRecursion: boolean): boolean {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x6fc /* wipSummaryLogger should have been set in startSummary or ctor */,\n\t\t);\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x6fd /* Not tracking a summary */);\n\n\t\t// If the parent node skipped recursion, it did not call summarize on this node. So, summarize was not missed\n\t\t// but was intentionally not called.\n\t\t// Otherwise, summarize should have been called on this node and wipSummarizeCalled must be set.\n\t\tif (parentSkipRecursion || this.wipSummarizeCalled) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * The absence of wip local path indicates that summarize was not called for this node. Return failure.\n\t\t * This can happen if:\n\t\t * 1. A child node was created after summarize was already called on the parent. For example, a data store\n\t\t * is realized (loaded) after summarize was called on it creating summarizer nodes for its DDSes. In this case,\n\t\t * parentSkipRecursion will be true and the if block above would handle it.\n\t\t * 2. A new node was created but summarize was never called on it. This can mean that the summary that is\n\t\t * generated may not have the data from this node. We should not continue, log and throw an error. This\n\t\t * will help us identify these cases and take appropriate action.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending summary\n\t * queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t */\n\tpublic completeSummary(proposalHandle: string): void {\n\t\tthis.completeSummaryCore(proposalHandle, false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Recursive implementation for completeSummary, with additional internal-only parameters.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t * @param validate - true to validate that the in-progress summary is correct for all nodes.\n\t */\n\tprotected completeSummaryCore(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x1a4 /* \"Not tracking a summary\" */,\n\t\t);\n\t\tif (parentSkipRecursion && this._lastSummaryReferenceSequenceNumber === undefined) {\n\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t// This node and all children should consider themselves as still not\n\t\t\t// having a successful summary yet.\n\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\tthis.clearSummary();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(proposalHandle, this.wipSkipRecursion || parentSkipRecursion);\n\t\t}\n\t\t// Note that this overwrites existing pending summary with\n\t\t// the same proposalHandle. If proposalHandle is something like\n\t\t// a hash or unique identifier, this should be fine. If storage\n\t\t// can return the same proposalHandle for a different summary,\n\t\t// this should still be okay, because we should be proposing the\n\t\t// newer one later which would have to overwrite the previous one.\n\t\tthis.pendingSummaries.set(proposalHandle, {\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t});\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary(): void {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipSummarizeCalled = false;\n\t\tthis.wipSkipRecursion = false;\n\t\tthis.wipSummaryLogger = undefined;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.clearSummary();\n\t\t}\n\t}\n\n\t/**\n\t * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n\t * it becomes the latest summary. If the current summary is already ahead, we skip the update.\n\t * If the current summary is behind, then we do not refresh.\n\t * @param proposalHandle - Handle of the generated / uploaded summary.\n\t * @param summaryRefSeq - Reference sequence of the acked summary\n\t * @returns true if the summary is tracked by this node, false otherwise.\n\t */\n\tpublic async refreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult> {\n\t\tconst eventProps: {\n\t\t\tproposalHandle: string | undefined;\n\t\t\tsummaryRefSeq: number;\n\t\t\treferenceSequenceNumber: number;\n\t\t\tisSummaryTracked?: boolean;\n\t\t\tpendingSummaryFound?: boolean;\n\t\t} = {\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t};\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"refreshLatestSummary\",\n\t\t\t\t...eventProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// Refresh latest summary should not happen while a summary is in progress. If it does, it can result\n\t\t\t\t// in inconsistent state, so, we should not continue;\n\t\t\t\tif (this.isSummaryInProgress()) {\n\t\t\t\t\tthrow new LoggingError(\"UnexpectedRefreshDuringSummarize\", {\n\t\t\t\t\t\tinProgressSummaryRefSeq: this.wipReferenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tlet isSummaryTracked = false;\n\t\t\t\tlet isSummaryNewer = false;\n\n\t\t\t\tif (summaryRefSeq > this.referenceSequenceNumber) {\n\t\t\t\t\tisSummaryNewer = true;\n\t\t\t\t}\n\n\t\t\t\t// If the acked summary is found in the pendingSummaries, it means the summary was created and tracked by the current client\n\t\t\t\t// so set the isSummaryTracked to true.\n\t\t\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\t\t\tif (pendingSummary?.referenceSequenceNumber !== undefined) {\n\t\t\t\t\tisSummaryTracked = true;\n\t\t\t\t\t// update the pendingSummariesMap for the root and all child summarizerNodes\n\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\tpendingSummary.referenceSequenceNumber,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({ ...eventProps, isSummaryNewer, pendingSummaryFound: isSummaryTracked });\n\t\t\t\treturn { isSummaryTracked, isSummaryNewer };\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"error\" },\n\t\t);\n\t}\n\t/**\n\t * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n\t * from the state in the pending summary queue.\n\t * @param proposalHandle - Handle for the current proposal.\n\t * @param referenceSequenceNumber - Reference sequence number of sent summary.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\tif (pendingSummary === undefined) {\n\t\t\t// This should only happen if parent skipped recursion AND no prior summary existed.\n\t\t\tassert(\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined,\n\t\t\t\t0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\treferenceSequenceNumber === pendingSummary.referenceSequenceNumber,\n\t\t\t\t0x1a7 /* Pending summary reference sequence number should be consistent */,\n\t\t\t);\n\n\t\t\t// Clear earlier pending summaries\n\t\t\tthis.pendingSummaries.delete(proposalHandle);\n\t\t}\n\n\t\t// Delete all summaries whose reference sequence number is smaller than the one just acked.\n\t\tfor (const [key, summary] of this.pendingSummaries) {\n\t\t\tif (summary.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t\t// Update the latest successful summary reference number\n\t\tthis._lastSummaryReferenceSequenceNumber = pendingSummary.referenceSequenceNumber;\n\t\t// Propagate update to all child nodes\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t\t}\n\t}\n\n\tpublic updateBaseSummaryState(snapshot: ISnapshotTree): void {\n\t\t// Function deprecated. Empty declaration is kept around to compat failures.\n\t}\n\n\tpublic recordChange(op: ISequencedDocumentMessage): void {\n\t\tthis.invalidate(op.sequenceNumber);\n\t}\n\n\tpublic invalidate(sequenceNumber: number): void {\n\t\tif (sequenceNumber > this._changeSequenceNumber) {\n\t\t\tthis._changeSequenceNumber = sequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * True if a change has been recorded with sequence number exceeding\n\t * the latest successfully acked summary reference sequence number.\n\t * False implies that the previous summary can be reused.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this._changeSequenceNumber > this.referenceSequenceNumber;\n\t}\n\n\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfig = {},\n\t): ISummarizerNode {\n\t\tassert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNode(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\tcreateDetails.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n\t\t// have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\tpublic getChild(id: string): ISummarizerNode | undefined {\n\t\treturn this.children.get(id);\n\t}\n\n\t/**\n\t * Returns the details needed to create a child node.\n\t * @param id - Initial id or path part of the child node.\n\t * @param createParam - Information needed to create the node.\n\t * @returns the details needed to create the child node.\n\t */\n\tprotected getCreateDetailsForChild(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): ICreateChildDetails {\n\t\tlet childLastSummaryReferenceSequenceNumber: number | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLastSummaryReferenceSequenceNumber = this._lastSummaryReferenceSequenceNumber;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLastSummaryReferenceSequenceNumber !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLastSummaryReferenceSequenceNumber\n\t\t\t\t) {\n\t\t\t\t\t// Prioritize latest summary if it was after this node was attached.\n\t\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\t}\n\t\t\t\tchangeSequenceNumber = createParam.sequenceNumber;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.FromSummary:\n\t\t\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\tchangeSequenceNumber = parentLastSummaryReferenceSequenceNumber ?? -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n\t\t\t\tunreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst childTelemetryNodeId = `${this.telemetryNodeId ?? \"\"}/${id}`;\n\t\tconst childSummaryHandleId = this._summaryHandleId.createChildPath(EscapedPath.create(id));\n\n\t\treturn {\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childTelemetryNodeId,\n\t\t\tsummaryHandleId: childSummaryHandleId,\n\t\t\tlastSummaryReferenceSequenceNumber: childLastSummaryReferenceSequenceNumber,\n\t\t};\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t *\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNode, id: string): void {\n\t\t// If a summary is in progress, this child was created after the summary started. So, we need to update the\n\t\t// child's summary state as well.\n\t\tif (this.isSummaryInProgress()) {\n\t\t\tchild.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n\t\t}\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child._lastSummaryReferenceSequenceNumber !== undefined) {\n\t\t\tfor (const [proposedHandle, pendingSummaryInfo] of this.pendingSummaries.entries()) {\n\t\t\t\tchild.addPendingSummary(proposedHandle, pendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, pendingSummaryInfo: PendingSummaryInfo): void {\n\t\tthis.pendingSummaries.set(key, pendingSummaryInfo);\n\t}\n\n\t/**\n\t * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n\t */\n\tpublic isSummaryInProgress(): boolean {\n\t\treturn this.wipReferenceSequenceNumber !== undefined;\n\t}\n\n\t/**\n\t * Creates and throws an error due to unexpected conditions.\n\t */\n\tprotected throwUnexpectedError(eventProps: ITelemetryErrorEventExt): never {\n\t\tconst error = new LoggingError(eventProps.eventName, {\n\t\t\t...eventProps,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tid: this.telemetryNodeId,\n\t\t\t}),\n\t\t});\n\t\tthis.logger.sendErrorEvent(eventProps, error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Creates a root summarizer node.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n */\nexport const createRootSummarizerNode = (\n\tlogger: ITelemetryLoggerExt,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfig = {},\n): IRootSummarizerNode =>\n\tnew SummarizerNode(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\tEscapedPath.create(\"\") /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\n\t\tundefined /* wipSummaryLogger */,\n\t\t\"\" /* telemetryNodeId */,\n\t);\n"]}
1
+ {"version":3,"file":"summarizerNode.js","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA8E;AAC9E,2EAAiE;AAKjE,2EAUsD;AACtD,qEAAoE;AAEpE,uEAOkD;AAalD;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IAC1B;;;OAGG;IACH,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,mCAAmC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAmBD;;;OAGG;IACH,YACC,UAAgC,EACf,mBAAwC,EACzD,MAA6B;IAC7B;;OAEG;IACc,gBAAwB,EACjC,qBAA6B;IACrC;;OAEG;IACK,mCAA4C,EAC1C,gBAAuC;IACjD;;OAEG;IACO,eAAwB;QAfjB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAKxC,qBAAgB,GAAhB,gBAAgB,CAAQ;QACjC,0BAAqB,GAArB,qBAAqB,CAAQ;QAI7B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CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,mBAAmB;QACzB,OAAO,IAAI,CAAC,0BAA0B,KAAK,SAAS,CAAC;IACtD,CAAC;IAED;;OAEG;IACO,oBAAoB,CAAC,UAAmC;QACjE,MAAM,KAAK,GAAG,IAAI,uBAAY,CAAC,UAAU,CAAC,SAAS,EAAE;YACpD,GAAG,UAAU;YACb,uBAAuB,EAAE,IAAI,CAAC,0BAA0B;YACxD,GAAG,IAAA,2BAAgB,EAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,eAAe;aACxB,CAAC;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC;IACb,CAAC;CACD;AAllBD,wCAklBC;AAED;;;;;;;;GAQG;AACI,MAAM,wBAAwB,GAAG,CACvC,MAA2B,EAC3B,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAgC,EAAE,EACZ,EAAE,CACxB,IAAI,cAAc,CACjB,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,EAAE,CAAC,qBAAqB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,CAAC,sBAAsB,EAChC,EAAE,CAAC,qBAAqB,CACxB,CAAC;AAhBU,QAAA,wBAAwB,4BAgBlC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tchannelsTreeName,\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tISummarizeResult,\n\tISummarizerNode,\n\tISummarizerNodeConfig,\n\tSummarizeInternalFn,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { mergeStats } from \"@fluidframework/runtime-utils/internal\";\nimport { type ITelemetryErrorEventExt } from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tICreateChildDetails,\n\tIRefreshSummaryResult,\n\tIStartSummaryResult,\n\tISummarizerNodeRootContract,\n\tValidateSummaryResult,\n\tPendingSummaryInfo,\n} from \"./summarizerNodeUtils.js\";\n\nexport interface IRootSummarizerNode extends ISummarizerNode, ISummarizerNodeRootContract {}\n\n/**\n * Encapsulates the summarizing work and state of an individual tree node in the\n * summary tree. It tracks changes and allows for optimizations when unchanged, or\n * can allow for fallback summaries to be generated when an error is encountered.\n * Usage is for the root node to call startSummary first to begin tracking a WIP\n * (work in progress) summary. Then all nodes will call summarize to summaries their\n * individual parts. Once completed and uploaded to storage, the root node will call\n * completeSummary or clearSummary to clear the WIP summary tracking state if something\n * went wrong. The SummarizerNodes will track all pending summaries that have been\n * recorded by the completeSummary call. When one of them is acked, the root node should\n * call refreshLatestSummary to inform the tree of SummarizerNodes of the new baseline\n * latest successful summary.\n */\nexport class SummarizerNode implements IRootSummarizerNode {\n\t/**\n\t * The reference sequence number of the most recent acked summary.\n\t * Returns 0 if there is not yet an acked summary.\n\t */\n\tpublic get referenceSequenceNumber(): number {\n\t\treturn this._lastSummaryReferenceSequenceNumber ?? 0;\n\t}\n\n\t/**\n\t * returns the handle of the last successful summary of this summarizerNode in string format\n\t * (this getter is primarily only used in the test code)\n\t */\n\tpublic get summaryHandleId(): string {\n\t\treturn this._summaryHandleId;\n\t}\n\n\tprotected readonly children = new Map<string, SummarizerNode>();\n\t/**\n\t * Key value pair of summaries submitted by this client which are not yet acked.\n\t * Key is the proposalHandle and value is the summary op's referece sequence number.\n\t */\n\tprotected readonly pendingSummaries = new Map<string, PendingSummaryInfo>();\n\tprotected wipReferenceSequenceNumber: number | undefined;\n\t/**\n\t * True if the current node was summarized during the current summary process\n\t * This flag is used to identify scenarios where summarize was not called on a node.\n\t * For example, this node was created after its parent was already summarized due to out-of-order realization via application code.\n\t */\n\tprivate wipSummarizeCalled: boolean = false;\n\tprivate wipSkipRecursion = false;\n\n\tprotected readonly logger: ITelemetryLoggerExt;\n\n\t/**\n\t * Do not call constructor directly.\n\t * Use createRootSummarizerNode to create root node, or createChild to create child nodes.\n\t */\n\tpublic constructor(\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly summarizeInternalFn: SummarizeInternalFn,\n\t\tconfig: ISummarizerNodeConfig,\n\t\t/**\n\t\t * Encoded handle or path to the node\n\t\t */\n\t\tprivate readonly _summaryHandleId: string,\n\t\tprivate _changeSequenceNumber: number,\n\t\t/**\n\t\t * Summary reference sequence number, i.e. last sequence number seen when last successful summary was created\n\t\t */\n\t\tprivate _lastSummaryReferenceSequenceNumber?: number,\n\t\tprotected wipSummaryLogger?: ITelemetryBaseLogger,\n\t\t/**\n\t\t * A unique id of this node to be logged when sending telemetry.\n\t\t */\n\t\tprotected telemetryNodeId?: string,\n\t) {\n\t\tthis.canReuseHandle = config.canReuseHandle ?? true;\n\t\t// All logs posted by the summarizer node should include the telemetryNodeId.\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: baseLogger,\n\t\t\tproperties: {\n\t\t\t\tall: tagCodeArtifacts({ id: this.telemetryNodeId }),\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * In order to produce a summary with a summarizer node, the summarizer node system must be notified a summary has\n\t * started. This is done by calling startSummary. This will track the reference sequence number of the summary and\n\t * run some validation checks to ensure the summary is correct.\n\t * @param referenceSequenceNumber - the number of ops processed up to this point\n\t * @param summaryLogger - the logger to use for the summary\n\t * @param latestSummaryRefSeqNum - the reference sequence number of the latest summary. Another way to think about\n\t * it is the reference sequence number of the previous summary.\n\t * @returns the number of nodes in the tree, the number of nodes that are invalid, and the different types of\n\t * sequence number mismatches\n\t */\n\tpublic startSummary(\n\t\treferenceSequenceNumber: number,\n\t\tsummaryLogger: ITelemetryBaseLogger,\n\t\tlatestSummaryRefSeqNum: number,\n\t): IStartSummaryResult {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger === undefined,\n\t\t\t0x19f /* \"wipSummaryLogger should not be set yet in startSummary\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber === undefined,\n\t\t\t0x1a0 /* \"Already tracking a summary\" */,\n\t\t);\n\n\t\tlet nodes = 1; // number of summarizerNodes at the start of the summary\n\t\tlet invalidNodes = 0;\n\t\tconst sequenceNumberMismatchKeySet = new Set<string>();\n\t\tconst nodeLatestSummaryRefSeqNum = this._lastSummaryReferenceSequenceNumber;\n\t\tif (\n\t\t\tnodeLatestSummaryRefSeqNum !== undefined &&\n\t\t\tlatestSummaryRefSeqNum !== nodeLatestSummaryRefSeqNum\n\t\t) {\n\t\t\tinvalidNodes++;\n\t\t\tsequenceNumberMismatchKeySet.add(\n\t\t\t\t`${latestSummaryRefSeqNum}-${nodeLatestSummaryRefSeqNum}`,\n\t\t\t);\n\t\t}\n\n\t\tthis.wipSummaryLogger = summaryLogger;\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst childStartSummaryResult = child.startSummary(\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tthis.wipSummaryLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\t\t\tnodes += childStartSummaryResult.nodes;\n\t\t\tinvalidNodes += childStartSummaryResult.invalidNodes;\n\t\t\tfor (const invalidSequenceNumber of childStartSummaryResult.mismatchNumbers) {\n\t\t\t\tsequenceNumberMismatchKeySet.add(invalidSequenceNumber);\n\t\t\t}\n\t\t}\n\t\tthis.wipReferenceSequenceNumber = referenceSequenceNumber;\n\t\treturn {\n\t\t\tnodes,\n\t\t\tinvalidNodes,\n\t\t\tmismatchNumbers: sequenceNumberMismatchKeySet,\n\t\t};\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\t// If trackState is false, call summarize internal directly and don't track any state.\n\t\tif (!trackState) {\n\t\t\treturn this.summarizeInternalFn(fullTree, trackState, telemetryContext);\n\t\t}\n\n\t\t// Set to wipSummarizeCalled true to represent that current node was included in the summary process.\n\t\tthis.wipSummarizeCalled = true;\n\n\t\t// Try to reuse the tree if unchanged\n\t\tif (\n\t\t\tthis.canReuseHandle &&\n\t\t\t!fullTree &&\n\t\t\t!this.hasChanged() &&\n\t\t\tthis._lastSummaryReferenceSequenceNumber !== undefined\n\t\t) {\n\t\t\tthis.wipSkipRecursion = true;\n\t\t\tconst stats = mergeStats();\n\t\t\tstats.handleNodeCount++;\n\t\t\treturn {\n\t\t\t\tsummary: {\n\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\thandle: this.summaryHandleId,\n\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t},\n\t\t\t\tstats,\n\t\t\t};\n\t\t}\n\n\t\tlet incrementalSummaryContext: IExperimentalIncrementalSummaryContext | undefined;\n\t\tif (!fullTree) {\n\t\t\tassert(\n\t\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t\t0x5df /* Summarize should not be called when not tracking the summary */,\n\t\t\t);\n\t\t\tincrementalSummaryContext =\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tsummarySequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t\t\t\t\tlatestSummarySequenceNumber: this._lastSummaryReferenceSequenceNumber,\n\t\t\t\t\t\t\t// TODO: remove summaryPath.\n\t\t\t\t\t\t\tsummaryPath: this.summaryHandleId,\n\t\t\t\t\t\t};\n\t\t}\n\n\t\tconst result = await this.summarizeInternalFn(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\n\t\treturn { summary: result.summary, stats: result.stats };\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct, i.e., summarize should have run for all non-skipped\n\t * nodes. This will only be called for the root summarizer node and is called by it recursively on all child nodes.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tpublic validateSummary(): ValidateSummaryResult {\n\t\treturn this.validateSummaryCore(false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Validates that the in-progress summary is correct for all nodes, i.e., summarize should have run for all\n\t * non-skipped nodes.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t *\n\t * @returns ValidateSummaryResult which contains a boolean success indicating whether the validation was successful.\n\t * In case of failure, additional information is returned indicating type of failure and where it was.\n\t */\n\tprotected validateSummaryCore(parentSkipRecursion: boolean): ValidateSummaryResult {\n\t\tif (this.wasSummarizeMissed(parentSkipRecursion)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\treason: \"NodeDidNotSummarize\",\n\t\t\t\tid: {\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\tvalue: this.telemetryNodeId,\n\t\t\t\t},\n\t\t\t\t// These errors are usually transient and should go away when summarize is retried.\n\t\t\t\tretryAfterSeconds: 1,\n\t\t\t};\n\t\t}\n\t\tif (parentSkipRecursion) {\n\t\t\treturn { success: true };\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tconst result = child.validateSummaryCore(this.wipSkipRecursion || parentSkipRecursion);\n\t\t\t// If any child fails, return the failure.\n\t\t\tif (!result.success) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn { success: true };\n\t}\n\n\tprivate wasSummarizeMissed(parentSkipRecursion: boolean): boolean {\n\t\tassert(\n\t\t\tthis.wipSummaryLogger !== undefined,\n\t\t\t0x6fc /* wipSummaryLogger should have been set in startSummary or ctor */,\n\t\t);\n\t\tassert(this.wipReferenceSequenceNumber !== undefined, 0x6fd /* Not tracking a summary */);\n\n\t\t// If the parent node skipped recursion, it did not call summarize on this node. So, summarize was not missed\n\t\t// but was intentionally not called.\n\t\t// Otherwise, summarize should have been called on this node and wipSummarizeCalled must be set.\n\t\tif (parentSkipRecursion || this.wipSummarizeCalled) {\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * The absence of wip local path indicates that summarize was not called for this node. Return failure.\n\t\t * This can happen if:\n\t\t * 1. A child node was created after summarize was already called on the parent. For example, a data store\n\t\t * is realized (loaded) after summarize was called on it creating summarizer nodes for its DDSes. In this case,\n\t\t * parentSkipRecursion will be true and the if block above would handle it.\n\t\t * 2. A new node was created but summarize was never called on it. This can mean that the summary that is\n\t\t * generated may not have the data from this node. We should not continue, log and throw an error. This\n\t\t * will help us identify these cases and take appropriate action.\n\t\t *\n\t\t * This happens due to scenarios such as data store created during summarize. Such errors should go away when\n\t\t * summarize is attempted again.\n\t\t */\n\t\treturn true;\n\t}\n\n\t/**\n\t * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending summary\n\t * queue. We track this until we get an ack from the server for this summary.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t */\n\tpublic completeSummary(proposalHandle: string): void {\n\t\tthis.completeSummaryCore(proposalHandle, false /* parentSkipRecursion */);\n\t}\n\n\t/**\n\t * Recursive implementation for completeSummary, with additional internal-only parameters.\n\t * @param proposalHandle - The handle of the summary that was uploaded to the server.\n\t * @param parentPath - The path of the parent node which is used to build the path of this node.\n\t * @param parentSkipRecursion - true if the parent of this node skipped recursing the child nodes when summarizing.\n\t * In that case, the children will not have work-in-progress state.\n\t * @param validate - true to validate that the in-progress summary is correct for all nodes.\n\t */\n\tprotected completeSummaryCore(proposalHandle: string, parentSkipRecursion: boolean): void {\n\t\tassert(\n\t\t\tthis.wipReferenceSequenceNumber !== undefined,\n\t\t\t0x1a4 /* \"Not tracking a summary\" */,\n\t\t);\n\t\tif (parentSkipRecursion && this._lastSummaryReferenceSequenceNumber === undefined) {\n\t\t\t// This case the child is added after the latest non-failure summary.\n\t\t\t// This node and all children should consider themselves as still not\n\t\t\t// having a successful summary yet.\n\t\t\t// We cannot \"reuse\" this node if unchanged since that summary, because\n\t\t\t// handles will be unable to point to that node. It never made it to the\n\t\t\t// tree itself, and only exists as an attach op in the _outstandingOps.\n\t\t\tthis.clearSummary();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.completeSummaryCore(proposalHandle, this.wipSkipRecursion || parentSkipRecursion);\n\t\t}\n\t\t// Note that this overwrites existing pending summary with\n\t\t// the same proposalHandle. If proposalHandle is something like\n\t\t// a hash or unique identifier, this should be fine. If storage\n\t\t// can return the same proposalHandle for a different summary,\n\t\t// this should still be okay, because we should be proposing the\n\t\t// newer one later which would have to overwrite the previous one.\n\t\tthis.pendingSummaries.set(proposalHandle, {\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t});\n\t\tthis.clearSummary();\n\t}\n\n\tpublic clearSummary(): void {\n\t\tthis.wipReferenceSequenceNumber = undefined;\n\t\tthis.wipSummarizeCalled = false;\n\t\tthis.wipSkipRecursion = false;\n\t\tthis.wipSummaryLogger = undefined;\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.clearSummary();\n\t\t}\n\t}\n\n\t/**\n\t * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,\n\t * it becomes the latest summary. If the current summary is already ahead, we skip the update.\n\t * If the current summary is behind, then we do not refresh.\n\t * @param proposalHandle - Handle of the generated / uploaded summary.\n\t * @param summaryRefSeq - Reference sequence of the acked summary\n\t * @returns true if the summary is tracked by this node, false otherwise.\n\t */\n\tpublic async refreshLatestSummary(\n\t\tproposalHandle: string,\n\t\tsummaryRefSeq: number,\n\t): Promise<IRefreshSummaryResult> {\n\t\tconst eventProps: {\n\t\t\tproposalHandle: string | undefined;\n\t\t\tsummaryRefSeq: number;\n\t\t\treferenceSequenceNumber: number;\n\t\t\tisSummaryTracked?: boolean;\n\t\t\tpendingSummaryFound?: boolean;\n\t\t} = {\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t\treferenceSequenceNumber: this.referenceSequenceNumber,\n\t\t};\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"refreshLatestSummary\",\n\t\t\t\t...eventProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\t// Refresh latest summary should not happen while a summary is in progress. If it does, it can result\n\t\t\t\t// in inconsistent state, so, we should not continue;\n\t\t\t\tif (this.isSummaryInProgress()) {\n\t\t\t\t\tthrow new LoggingError(\"UnexpectedRefreshDuringSummarize\", {\n\t\t\t\t\t\tinProgressSummaryRefSeq: this.wipReferenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tlet isSummaryTracked = false;\n\t\t\t\tlet isSummaryNewer = false;\n\n\t\t\t\tif (summaryRefSeq > this.referenceSequenceNumber) {\n\t\t\t\t\tisSummaryNewer = true;\n\t\t\t\t}\n\n\t\t\t\t// If the acked summary is found in the pendingSummaries, it means the summary was created and tracked by the current client\n\t\t\t\t// so set the isSummaryTracked to true.\n\t\t\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\t\t\tif (pendingSummary?.referenceSequenceNumber !== undefined) {\n\t\t\t\t\tisSummaryTracked = true;\n\t\t\t\t\t// update the pendingSummariesMap for the root and all child summarizerNodes\n\t\t\t\t\tthis.refreshLatestSummaryFromPending(\n\t\t\t\t\t\tproposalHandle,\n\t\t\t\t\t\tpendingSummary.referenceSequenceNumber,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({ ...eventProps, isSummaryNewer, pendingSummaryFound: isSummaryTracked });\n\t\t\t\treturn { isSummaryTracked, isSummaryNewer };\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"error\" },\n\t\t);\n\t}\n\t/**\n\t * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node\n\t * from the state in the pending summary queue.\n\t * @param proposalHandle - Handle for the current proposal.\n\t * @param referenceSequenceNumber - Reference sequence number of sent summary.\n\t */\n\tprotected refreshLatestSummaryFromPending(\n\t\tproposalHandle: string,\n\t\treferenceSequenceNumber: number,\n\t): void {\n\t\tconst pendingSummary = this.pendingSummaries.get(proposalHandle);\n\t\tif (pendingSummary === undefined) {\n\t\t\t// This should only happen if parent skipped recursion AND no prior summary existed.\n\t\t\tassert(\n\t\t\t\tthis._lastSummaryReferenceSequenceNumber === undefined,\n\t\t\t\t0x1a6 /* \"Not found pending summary, but this node has previously completed a summary\" */,\n\t\t\t);\n\t\t\treturn;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\treferenceSequenceNumber === pendingSummary.referenceSequenceNumber,\n\t\t\t\t0x1a7 /* Pending summary reference sequence number should be consistent */,\n\t\t\t);\n\n\t\t\t// Clear earlier pending summaries\n\t\t\tthis.pendingSummaries.delete(proposalHandle);\n\t\t}\n\n\t\t// Delete all summaries whose reference sequence number is smaller than the one just acked.\n\t\tfor (const [key, summary] of this.pendingSummaries) {\n\t\t\tif (summary.referenceSequenceNumber < referenceSequenceNumber) {\n\t\t\t\tthis.pendingSummaries.delete(key);\n\t\t\t}\n\t\t}\n\t\t// Update the latest successful summary reference number\n\t\tthis._lastSummaryReferenceSequenceNumber = pendingSummary.referenceSequenceNumber;\n\t\t// Propagate update to all child nodes\n\t\tfor (const child of this.children.values()) {\n\t\t\tchild.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n\t\t}\n\t}\n\n\tpublic updateBaseSummaryState(snapshot: ISnapshotTree): void {\n\t\t// Function deprecated. Empty declaration is kept around to compat failures.\n\t}\n\n\tpublic recordChange(op: ISequencedDocumentMessage): void {\n\t\tthis.invalidate(op.sequenceNumber);\n\t}\n\n\tpublic invalidate(sequenceNumber: number): void {\n\t\tif (sequenceNumber > this._changeSequenceNumber) {\n\t\t\tthis._changeSequenceNumber = sequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * True if a change has been recorded with sequence number exceeding\n\t * the latest successfully acked summary reference sequence number.\n\t * False implies that the previous summary can be reused.\n\t */\n\tprotected hasChanged(): boolean {\n\t\treturn this._changeSequenceNumber > this.referenceSequenceNumber;\n\t}\n\n\tprotected readonly canReuseHandle: boolean;\n\n\tpublic createChild(\n\t\t/**\n\t\t * Summarize function\n\t\t */\n\t\tsummarizeInternalFn: SummarizeInternalFn,\n\t\t/**\n\t\t * Initial id or path part of this node\n\t\t */\n\t\tid: string,\n\t\t/**\n\t\t * Information needed to create the node.\n\t\t * If it is from a base summary, it will assert that a summary has been seen.\n\t\t * Attach information if it is created from an attach op.\n\t\t */\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\tconfig: ISummarizerNodeConfig = {},\n\t): ISummarizerNode {\n\t\tassert(!this.children.has(id), 0x1ab /* \"Create SummarizerNode child already exists\" */);\n\n\t\tconst createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n\t\tconst child = new SummarizerNode(\n\t\t\tthis.logger,\n\t\t\tsummarizeInternalFn,\n\t\t\tconfig,\n\t\t\tcreateDetails.summaryHandleId,\n\t\t\tcreateDetails.changeSequenceNumber,\n\t\t\tcreateDetails.lastSummaryReferenceSequenceNumber,\n\t\t\tthis.wipSummaryLogger,\n\t\t\tcreateDetails.telemetryNodeId,\n\t\t);\n\n\t\t// There may be additional state that has to be updated in this child. For example, if a summary is being\n\t\t// tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might\n\t\t// have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.\n\t\tthis.maybeUpdateChildState(child, id);\n\n\t\tthis.children.set(id, child);\n\t\treturn child;\n\t}\n\n\tpublic getChild(id: string): ISummarizerNode | undefined {\n\t\treturn this.children.get(id);\n\t}\n\n\t/**\n\t * Returns the details needed to create a child node.\n\t * @param id - Initial id or path part of the child node.\n\t * @param createParam - Information needed to create the node.\n\t * @returns the details needed to create the child node.\n\t */\n\tprotected getCreateDetailsForChild(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): ICreateChildDetails {\n\t\tlet childLastSummaryReferenceSequenceNumber: number | undefined;\n\t\tlet changeSequenceNumber: number;\n\n\t\tconst parentLastSummaryReferenceSequenceNumber = this._lastSummaryReferenceSequenceNumber;\n\t\tswitch (createParam.type) {\n\t\t\tcase CreateSummarizerNodeSource.FromAttach: {\n\t\t\t\tif (\n\t\t\t\t\tparentLastSummaryReferenceSequenceNumber !== undefined &&\n\t\t\t\t\tcreateParam.sequenceNumber <= parentLastSummaryReferenceSequenceNumber\n\t\t\t\t) {\n\t\t\t\t\t// Prioritize latest summary if it was after this node was attached.\n\t\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\t}\n\t\t\t\tchangeSequenceNumber = createParam.sequenceNumber;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase CreateSummarizerNodeSource.FromSummary:\n\t\t\tcase CreateSummarizerNodeSource.Local: {\n\t\t\t\tchildLastSummaryReferenceSequenceNumber = parentLastSummaryReferenceSequenceNumber;\n\t\t\t\tchangeSequenceNumber = parentLastSummaryReferenceSequenceNumber ?? -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst type = (createParam as unknown as CreateChildSummarizerNodeParam).type;\n\t\t\t\tunreachableCase(createParam, `Unexpected CreateSummarizerNodeSource: ${type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst childTelemetryNodeId = `${this.telemetryNodeId ?? \"\"}/${id}`;\n\t\t// parentHandleId/.channels/childId\n\t\tconst childSummaryHandleId = `${this._summaryHandleId}/${channelsTreeName}/${id}`;\n\n\t\treturn {\n\t\t\tchangeSequenceNumber,\n\t\t\ttelemetryNodeId: childTelemetryNodeId,\n\t\t\tsummaryHandleId: childSummaryHandleId,\n\t\t\tlastSummaryReferenceSequenceNumber: childLastSummaryReferenceSequenceNumber,\n\t\t};\n\t}\n\n\t/**\n\t * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's\n\t * summary tracking state needs to be updated too.\n\t * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's\n\t * pending summary as well.\n\t * @param child - The child node whose state is to be updated.\n\t * @param id - Initial id or path part of this node\n\t *\n\t */\n\tprotected maybeUpdateChildState(child: SummarizerNode, id: string): void {\n\t\t// If a summary is in progress, this child was created after the summary started. So, we need to update the\n\t\t// child's summary state as well.\n\t\tif (this.isSummaryInProgress()) {\n\t\t\tchild.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;\n\t\t}\n\t\t// In case we have pending summaries on the parent, let's initialize it on the child.\n\t\tif (child._lastSummaryReferenceSequenceNumber !== undefined) {\n\t\t\tfor (const [proposedHandle, pendingSummaryInfo] of this.pendingSummaries.entries()) {\n\t\t\t\tchild.addPendingSummary(proposedHandle, pendingSummaryInfo);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addPendingSummary(key: string, pendingSummaryInfo: PendingSummaryInfo): void {\n\t\tthis.pendingSummaries.set(key, pendingSummaryInfo);\n\t}\n\n\t/**\n\t * Tells whether summary tracking is in progress. True if \"startSummary\" API is called before summarize.\n\t */\n\tpublic isSummaryInProgress(): boolean {\n\t\treturn this.wipReferenceSequenceNumber !== undefined;\n\t}\n\n\t/**\n\t * Creates and throws an error due to unexpected conditions.\n\t */\n\tprotected throwUnexpectedError(eventProps: ITelemetryErrorEventExt): never {\n\t\tconst error = new LoggingError(eventProps.eventName, {\n\t\t\t...eventProps,\n\t\t\treferenceSequenceNumber: this.wipReferenceSequenceNumber,\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tid: this.telemetryNodeId,\n\t\t\t}),\n\t\t});\n\t\tthis.logger.sendErrorEvent(eventProps, error);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Creates a root summarizer node.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n */\nexport const createRootSummarizerNode = (\n\tlogger: ITelemetryLoggerExt,\n\tsummarizeInternalFn: SummarizeInternalFn,\n\tchangeSequenceNumber: number,\n\treferenceSequenceNumber: number | undefined,\n\tconfig: ISummarizerNodeConfig = {},\n): IRootSummarizerNode =>\n\tnew SummarizerNode(\n\t\tlogger,\n\t\tsummarizeInternalFn,\n\t\tconfig,\n\t\t\"\" /* summaryHandleId */,\n\t\tchangeSequenceNumber,\n\t\treferenceSequenceNumber,\n\t\tundefined /* wipSummaryLogger */,\n\t\t\"\" /* telemetryNodeId */,\n\t);\n"]}
@@ -61,23 +61,6 @@ export interface ISummarizerNodeRootContract {
61
61
  clearSummary(): void;
62
62
  refreshLatestSummary(proposalHandle: string, summaryRefSeq: number): Promise<IRefreshSummaryResult>;
63
63
  }
64
- /**
65
- * Class to build paths for nodes in a tree with escaped special characters
66
- */
67
- export declare class EscapedPath {
68
- readonly path: string;
69
- private constructor();
70
- /**
71
- * Creates and returns a new instance of this class.
72
- * @param path - Id or path part of a node
73
- */
74
- static create(path: string): EscapedPath;
75
- toString(): string;
76
- /**
77
- * Creates and returns a new instance of this class for child of the current node.
78
- */
79
- createChildPath(childNodePath: EscapedPath): EscapedPath;
80
- }
81
64
  export interface PendingSummaryInfo {
82
65
  /**
83
66
  * The sequence number at which the summary was created.
@@ -99,7 +82,7 @@ export interface ICreateChildDetails {
99
82
  /**
100
83
  * Summary handle for child node
101
84
  */
102
- summaryHandleId: EscapedPath;
85
+ summaryHandleId: string;
103
86
  /**
104
87
  * the reference sequence number of the last successful summary.
105
88
  */
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC9B;IACA,OAAO,EAAE,IAAI,CAAC;CACb,GACD;IACA,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,EAAE;QACH,GAAG,EAAE,gBAAgB,CAAC,YAAY,CAAC;QACnC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEL,MAAM,WAAW,2BAA2B;IAC3C,YAAY,CACX,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,mBAAmB,EAClC,sBAAsB,EAAE,MAAM,GAC5B,mBAAmB,CAAC;IACvB,eAAe,IAAI,qBAAqB,CAAC;IACzC,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,YAAY,IAAI,IAAI,CAAC;IACrB,oBAAoB,CACnB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,WAAW;aACa,IAAI,EAAE,MAAM;IAAhD,OAAO;IAEP;;;OAGG;WACW,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAGxC,QAAQ,IAAI,MAAM;IAGzB;;OAEG;IACI,eAAe,CAAC,aAAa,EAAE,WAAW,GAAG,WAAW;CAK/D;AACD,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,EAAE,WAAW,CAAC;IAC7B;;OAEG;IACH,kCAAkC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACpE;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC;IAChB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC"}
1
+ {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../../src/summary/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,W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