@fluidframework/container-runtime 2.31.1 → 2.33.0-333010

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 (301) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/container-runtime.test-files.tar +0 -0
  3. package/dist/channelCollection.d.ts +0 -14
  4. package/dist/channelCollection.d.ts.map +1 -1
  5. package/dist/channelCollection.js +10 -25
  6. package/dist/channelCollection.js.map +1 -1
  7. package/dist/containerRuntime.d.ts +16 -9
  8. package/dist/containerRuntime.d.ts.map +1 -1
  9. package/dist/containerRuntime.js +137 -103
  10. package/dist/containerRuntime.js.map +1 -1
  11. package/dist/dataStoreContext.d.ts +1 -5
  12. package/dist/dataStoreContext.d.ts.map +1 -1
  13. package/dist/dataStoreContext.js +0 -8
  14. package/dist/dataStoreContext.js.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/messageTypes.d.ts +3 -7
  20. package/dist/messageTypes.d.ts.map +1 -1
  21. package/dist/messageTypes.js.map +1 -1
  22. package/dist/opLifecycle/batchManager.d.ts +3 -15
  23. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  24. package/dist/opLifecycle/batchManager.js +3 -40
  25. package/dist/opLifecycle/batchManager.js.map +1 -1
  26. package/dist/opLifecycle/definitions.d.ts +42 -6
  27. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  28. package/dist/opLifecycle/definitions.js.map +1 -1
  29. package/dist/opLifecycle/index.d.ts +5 -4
  30. package/dist/opLifecycle/index.d.ts.map +1 -1
  31. package/dist/opLifecycle/index.js +6 -4
  32. package/dist/opLifecycle/index.js.map +1 -1
  33. package/dist/opLifecycle/opCompressor.d.ts +10 -11
  34. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  35. package/dist/opLifecycle/opCompressor.js +21 -20
  36. package/dist/opLifecycle/opCompressor.js.map +1 -1
  37. package/dist/opLifecycle/opGroupingManager.d.ts +9 -5
  38. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  39. package/dist/opLifecycle/opGroupingManager.js +18 -22
  40. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  41. package/dist/opLifecycle/opSerialization.d.ts +20 -0
  42. package/dist/opLifecycle/opSerialization.d.ts.map +1 -0
  43. package/dist/opLifecycle/opSerialization.js +40 -0
  44. package/dist/opLifecycle/opSerialization.js.map +1 -0
  45. package/dist/opLifecycle/opSplitter.d.ts +12 -13
  46. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  47. package/dist/opLifecycle/opSplitter.js +15 -15
  48. package/dist/opLifecycle/opSplitter.js.map +1 -1
  49. package/dist/opLifecycle/outbox.d.ts +35 -18
  50. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  51. package/dist/opLifecycle/outbox.js +111 -72
  52. package/dist/opLifecycle/outbox.js.map +1 -1
  53. package/dist/opLifecycle/remoteMessageProcessor.d.ts +0 -7
  54. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  55. package/dist/opLifecycle/remoteMessageProcessor.js +1 -15
  56. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  57. package/dist/packageVersion.d.ts +1 -1
  58. package/dist/packageVersion.d.ts.map +1 -1
  59. package/dist/packageVersion.js +1 -1
  60. package/dist/packageVersion.js.map +1 -1
  61. package/dist/pendingStateManager.d.ts +2 -2
  62. package/dist/pendingStateManager.d.ts.map +1 -1
  63. package/dist/pendingStateManager.js +1 -1
  64. package/dist/pendingStateManager.js.map +1 -1
  65. package/dist/runtimeLayerCompatState.d.ts.map +1 -1
  66. package/dist/runtimeLayerCompatState.js +6 -5
  67. package/dist/runtimeLayerCompatState.js.map +1 -1
  68. package/dist/summary/index.d.ts +5 -8
  69. package/dist/summary/index.d.ts.map +1 -1
  70. package/dist/summary/index.js +20 -21
  71. package/dist/summary/index.js.map +1 -1
  72. package/dist/summary/orderedClientElection.js +9 -9
  73. package/dist/summary/orderedClientElection.js.map +1 -1
  74. package/dist/summary/summarizerClientElection.d.ts +0 -1
  75. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  76. package/dist/summary/summarizerClientElection.js +3 -3
  77. package/dist/summary/summarizerClientElection.js.map +1 -1
  78. package/dist/summary/summarizerTypes.d.ts +3 -75
  79. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  80. package/dist/summary/summarizerTypes.js +2 -0
  81. package/dist/summary/summarizerTypes.js.map +1 -1
  82. package/{lib/summary/summaryGenerator.d.ts → dist/summary/summarizerUtils.d.ts} +12 -43
  83. package/dist/summary/summarizerUtils.d.ts.map +1 -0
  84. package/dist/summary/summarizerUtils.js +71 -0
  85. package/dist/summary/summarizerUtils.js.map +1 -0
  86. package/dist/summary/summaryDelayLoadedModule/index.d.ts +10 -0
  87. package/dist/summary/summaryDelayLoadedModule/index.d.ts.map +1 -0
  88. package/dist/summary/summaryDelayLoadedModule/index.js +20 -0
  89. package/dist/summary/summaryDelayLoadedModule/index.js.map +1 -0
  90. package/dist/summary/{runWhileConnectedCoordinator.d.ts → summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts} +1 -1
  91. package/dist/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts.map +1 -0
  92. package/dist/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.js.map +1 -0
  93. package/dist/summary/{runningSummarizer.d.ts → summaryDelayLoadedModule/runningSummarizer.d.ts} +4 -13
  94. package/dist/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -0
  95. package/dist/summary/{runningSummarizer.js → summaryDelayLoadedModule/runningSummarizer.js} +17 -24
  96. package/dist/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -0
  97. package/dist/summary/{summarizer.d.ts → summaryDelayLoadedModule/summarizer.d.ts} +13 -2
  98. package/dist/summary/summaryDelayLoadedModule/summarizer.d.ts.map +1 -0
  99. package/dist/summary/{summarizer.js → summaryDelayLoadedModule/summarizer.js} +13 -3
  100. package/dist/summary/summaryDelayLoadedModule/summarizer.js.map +1 -0
  101. package/{lib/summary → dist/summary/summaryDelayLoadedModule}/summarizerHeuristics.d.ts +3 -3
  102. package/dist/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts.map +1 -0
  103. package/dist/summary/summaryDelayLoadedModule/summarizerHeuristics.js.map +1 -0
  104. package/dist/summary/summaryDelayLoadedModule/summaryGenerator.d.ts +36 -0
  105. package/dist/summary/summaryDelayLoadedModule/summaryGenerator.d.ts.map +1 -0
  106. package/dist/summary/{summaryGenerator.js → summaryDelayLoadedModule/summaryGenerator.js} +14 -99
  107. package/dist/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -0
  108. package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts +21 -0
  109. package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts.map +1 -0
  110. package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.js +44 -0
  111. package/dist/summary/summaryDelayLoadedModule/summaryResultBuilder.js.map +1 -0
  112. package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts +80 -0
  113. package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts.map +1 -0
  114. package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.js +7 -0
  115. package/dist/summary/summaryDelayLoadedModule/summaryResultTypes.js.map +1 -0
  116. package/dist/summary/summaryHelpers.d.ts +1 -1
  117. package/dist/summary/summaryHelpers.d.ts.map +1 -1
  118. package/dist/summary/summaryHelpers.js +2 -2
  119. package/dist/summary/summaryHelpers.js.map +1 -1
  120. package/dist/summary/summaryManager.d.ts +4 -3
  121. package/dist/summary/summaryManager.d.ts.map +1 -1
  122. package/dist/summary/summaryManager.js +2 -2
  123. package/dist/summary/summaryManager.js.map +1 -1
  124. package/lib/channelCollection.d.ts +0 -14
  125. package/lib/channelCollection.d.ts.map +1 -1
  126. package/lib/channelCollection.js +6 -21
  127. package/lib/channelCollection.js.map +1 -1
  128. package/lib/containerRuntime.d.ts +16 -9
  129. package/lib/containerRuntime.d.ts.map +1 -1
  130. package/lib/containerRuntime.js +140 -106
  131. package/lib/containerRuntime.js.map +1 -1
  132. package/lib/dataStoreContext.d.ts +1 -5
  133. package/lib/dataStoreContext.d.ts.map +1 -1
  134. package/lib/dataStoreContext.js +0 -8
  135. package/lib/dataStoreContext.js.map +1 -1
  136. package/lib/index.d.ts +1 -1
  137. package/lib/index.d.ts.map +1 -1
  138. package/lib/index.js +1 -1
  139. package/lib/index.js.map +1 -1
  140. package/lib/messageTypes.d.ts +3 -7
  141. package/lib/messageTypes.d.ts.map +1 -1
  142. package/lib/messageTypes.js.map +1 -1
  143. package/lib/opLifecycle/batchManager.d.ts +3 -15
  144. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  145. package/lib/opLifecycle/batchManager.js +2 -38
  146. package/lib/opLifecycle/batchManager.js.map +1 -1
  147. package/lib/opLifecycle/definitions.d.ts +42 -6
  148. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  149. package/lib/opLifecycle/definitions.js.map +1 -1
  150. package/lib/opLifecycle/index.d.ts +5 -4
  151. package/lib/opLifecycle/index.d.ts.map +1 -1
  152. package/lib/opLifecycle/index.js +4 -3
  153. package/lib/opLifecycle/index.js.map +1 -1
  154. package/lib/opLifecycle/opCompressor.d.ts +10 -11
  155. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  156. package/lib/opLifecycle/opCompressor.js +21 -20
  157. package/lib/opLifecycle/opCompressor.js.map +1 -1
  158. package/lib/opLifecycle/opGroupingManager.d.ts +9 -5
  159. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  160. package/lib/opLifecycle/opGroupingManager.js +18 -22
  161. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  162. package/lib/opLifecycle/opSerialization.d.ts +20 -0
  163. package/lib/opLifecycle/opSerialization.d.ts.map +1 -0
  164. package/lib/opLifecycle/opSerialization.js +35 -0
  165. package/lib/opLifecycle/opSerialization.js.map +1 -0
  166. package/lib/opLifecycle/opSplitter.d.ts +12 -13
  167. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  168. package/lib/opLifecycle/opSplitter.js +14 -14
  169. package/lib/opLifecycle/opSplitter.js.map +1 -1
  170. package/lib/opLifecycle/outbox.d.ts +35 -18
  171. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  172. package/lib/opLifecycle/outbox.js +109 -71
  173. package/lib/opLifecycle/outbox.js.map +1 -1
  174. package/lib/opLifecycle/remoteMessageProcessor.d.ts +0 -7
  175. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  176. package/lib/opLifecycle/remoteMessageProcessor.js +0 -13
  177. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  178. package/lib/packageVersion.d.ts +1 -1
  179. package/lib/packageVersion.d.ts.map +1 -1
  180. package/lib/packageVersion.js +1 -1
  181. package/lib/packageVersion.js.map +1 -1
  182. package/lib/pendingStateManager.d.ts +2 -2
  183. package/lib/pendingStateManager.d.ts.map +1 -1
  184. package/lib/pendingStateManager.js +1 -1
  185. package/lib/pendingStateManager.js.map +1 -1
  186. package/lib/runtimeLayerCompatState.d.ts.map +1 -1
  187. package/lib/runtimeLayerCompatState.js +3 -2
  188. package/lib/runtimeLayerCompatState.js.map +1 -1
  189. package/lib/summary/index.d.ts +5 -8
  190. package/lib/summary/index.d.ts.map +1 -1
  191. package/lib/summary/index.js +5 -7
  192. package/lib/summary/index.js.map +1 -1
  193. package/lib/summary/orderedClientElection.js +1 -1
  194. package/lib/summary/orderedClientElection.js.map +1 -1
  195. package/lib/summary/summarizerClientElection.d.ts +0 -1
  196. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  197. package/lib/summary/summarizerClientElection.js +1 -1
  198. package/lib/summary/summarizerClientElection.js.map +1 -1
  199. package/lib/summary/summarizerTypes.d.ts +3 -75
  200. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  201. package/lib/summary/summarizerTypes.js +1 -1
  202. package/lib/summary/summarizerTypes.js.map +1 -1
  203. package/{dist/summary/summaryGenerator.d.ts → lib/summary/summarizerUtils.d.ts} +12 -43
  204. package/lib/summary/summarizerUtils.d.ts.map +1 -0
  205. package/lib/summary/summarizerUtils.js +64 -0
  206. package/lib/summary/summarizerUtils.js.map +1 -0
  207. package/lib/summary/summaryDelayLoadedModule/index.d.ts +10 -0
  208. package/lib/summary/summaryDelayLoadedModule/index.d.ts.map +1 -0
  209. package/lib/summary/summaryDelayLoadedModule/index.js +9 -0
  210. package/lib/summary/summaryDelayLoadedModule/index.js.map +1 -0
  211. package/lib/summary/{runWhileConnectedCoordinator.d.ts → summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts} +1 -1
  212. package/lib/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.d.ts.map +1 -0
  213. package/lib/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.js.map +1 -0
  214. package/lib/summary/{runningSummarizer.d.ts → summaryDelayLoadedModule/runningSummarizer.d.ts} +4 -13
  215. package/lib/summary/summaryDelayLoadedModule/runningSummarizer.d.ts.map +1 -0
  216. package/lib/summary/{runningSummarizer.js → summaryDelayLoadedModule/runningSummarizer.js} +5 -12
  217. package/lib/summary/summaryDelayLoadedModule/runningSummarizer.js.map +1 -0
  218. package/lib/summary/{summarizer.d.ts → summaryDelayLoadedModule/summarizer.d.ts} +13 -2
  219. package/lib/summary/summaryDelayLoadedModule/summarizer.d.ts.map +1 -0
  220. package/lib/summary/{summarizer.js → summaryDelayLoadedModule/summarizer.js} +11 -1
  221. package/lib/summary/summaryDelayLoadedModule/summarizer.js.map +1 -0
  222. package/{dist/summary → lib/summary/summaryDelayLoadedModule}/summarizerHeuristics.d.ts +3 -3
  223. package/lib/summary/summaryDelayLoadedModule/summarizerHeuristics.d.ts.map +1 -0
  224. package/lib/summary/summaryDelayLoadedModule/summarizerHeuristics.js.map +1 -0
  225. package/lib/summary/summaryDelayLoadedModule/summaryGenerator.d.ts +36 -0
  226. package/lib/summary/summaryDelayLoadedModule/summaryGenerator.d.ts.map +1 -0
  227. package/lib/summary/{summaryGenerator.js → summaryDelayLoadedModule/summaryGenerator.js} +4 -85
  228. package/lib/summary/summaryDelayLoadedModule/summaryGenerator.js.map +1 -0
  229. package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts +21 -0
  230. package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.d.ts.map +1 -0
  231. package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.js +40 -0
  232. package/lib/summary/summaryDelayLoadedModule/summaryResultBuilder.js.map +1 -0
  233. package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts +80 -0
  234. package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.d.ts.map +1 -0
  235. package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.js +6 -0
  236. package/lib/summary/summaryDelayLoadedModule/summaryResultTypes.js.map +1 -0
  237. package/lib/summary/summaryHelpers.d.ts +1 -1
  238. package/lib/summary/summaryHelpers.d.ts.map +1 -1
  239. package/lib/summary/summaryHelpers.js +1 -1
  240. package/lib/summary/summaryHelpers.js.map +1 -1
  241. package/lib/summary/summaryManager.d.ts +4 -3
  242. package/lib/summary/summaryManager.d.ts.map +1 -1
  243. package/lib/summary/summaryManager.js +2 -2
  244. package/lib/summary/summaryManager.js.map +1 -1
  245. package/package.json +20 -19
  246. package/src/channelCollection.ts +5 -20
  247. package/src/containerRuntime.ts +220 -178
  248. package/src/dataStoreContext.ts +0 -11
  249. package/src/index.ts +0 -1
  250. package/src/messageTypes.ts +5 -19
  251. package/src/opLifecycle/batchManager.ts +12 -51
  252. package/src/opLifecycle/definitions.ts +49 -6
  253. package/src/opLifecycle/index.ts +19 -4
  254. package/src/opLifecycle/opCompressor.ts +26 -25
  255. package/src/opLifecycle/opGroupingManager.ts +27 -26
  256. package/src/opLifecycle/opSerialization.ts +46 -0
  257. package/src/opLifecycle/opSplitter.ts +21 -17
  258. package/src/opLifecycle/outbox.ts +168 -99
  259. package/src/opLifecycle/remoteMessageProcessor.ts +0 -17
  260. package/src/packageVersion.ts +1 -1
  261. package/src/pendingStateManager.ts +3 -3
  262. package/src/runtimeLayerCompatState.ts +3 -2
  263. package/src/summary/index.ts +35 -31
  264. package/src/summary/orderedClientElection.ts +1 -1
  265. package/src/summary/summarizerClientElection.ts +1 -2
  266. package/src/summary/summarizerTypes.ts +7 -91
  267. package/src/summary/summarizerUtils.ts +132 -0
  268. package/src/summary/summaryDelayLoadedModule/index.ts +28 -0
  269. package/src/summary/{runWhileConnectedCoordinator.ts → summaryDelayLoadedModule/runWhileConnectedCoordinator.ts} +1 -1
  270. package/src/summary/{runningSummarizer.ts → summaryDelayLoadedModule/runningSummarizer.ts} +13 -28
  271. package/src/summary/{summarizer.ts → summaryDelayLoadedModule/summarizer.ts} +19 -8
  272. package/src/summary/{summarizerHeuristics.ts → summaryDelayLoadedModule/summarizerHeuristics.ts} +3 -3
  273. package/src/summary/{summaryGenerator.ts → summaryDelayLoadedModule/summaryGenerator.ts} +13 -179
  274. package/src/summary/summaryDelayLoadedModule/summaryResultBuilder.ts +70 -0
  275. package/src/summary/summaryDelayLoadedModule/summaryResultTypes.ts +100 -0
  276. package/src/summary/summaryHelpers.ts +6 -6
  277. package/src/summary/summaryManager.ts +8 -6
  278. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +0 -1
  279. package/dist/summary/runWhileConnectedCoordinator.js.map +0 -1
  280. package/dist/summary/runningSummarizer.d.ts.map +0 -1
  281. package/dist/summary/runningSummarizer.js.map +0 -1
  282. package/dist/summary/summarizer.d.ts.map +0 -1
  283. package/dist/summary/summarizer.js.map +0 -1
  284. package/dist/summary/summarizerHeuristics.d.ts.map +0 -1
  285. package/dist/summary/summarizerHeuristics.js.map +0 -1
  286. package/dist/summary/summaryGenerator.d.ts.map +0 -1
  287. package/dist/summary/summaryGenerator.js.map +0 -1
  288. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +0 -1
  289. package/lib/summary/runWhileConnectedCoordinator.js.map +0 -1
  290. package/lib/summary/runningSummarizer.d.ts.map +0 -1
  291. package/lib/summary/runningSummarizer.js.map +0 -1
  292. package/lib/summary/summarizer.d.ts.map +0 -1
  293. package/lib/summary/summarizer.js.map +0 -1
  294. package/lib/summary/summarizerHeuristics.d.ts.map +0 -1
  295. package/lib/summary/summarizerHeuristics.js.map +0 -1
  296. package/lib/summary/summaryGenerator.d.ts.map +0 -1
  297. package/lib/summary/summaryGenerator.js.map +0 -1
  298. /package/dist/summary/{runWhileConnectedCoordinator.js → summaryDelayLoadedModule/runWhileConnectedCoordinator.js} +0 -0
  299. /package/dist/summary/{summarizerHeuristics.js → summaryDelayLoadedModule/summarizerHeuristics.js} +0 -0
  300. /package/lib/summary/{runWhileConnectedCoordinator.js → summaryDelayLoadedModule/runWhileConnectedCoordinator.js} +0 -0
  301. /package/lib/summary/{summarizerHeuristics.js → summaryDelayLoadedModule/summarizerHeuristics.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDeltaManager,\n\tContainerWarning,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tISummarizerEvents,\n\tSummarizerStopReason,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport {\n\tIEventProvider,\n\tITelemetryBaseProperties,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tISummaryAckMessage,\n\tISummaryNackMessage,\n\tISummaryOpMessage,\n} from \"./summaryCollection.js\";\nimport { SummarizeReason } from \"./summaryGenerator.js\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @internal\n */\nexport interface ICancellationToken<T> {\n\t/**\n\t * Tells if this cancellable token is cancelled\n\t */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @internal\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @internal\n */\nexport interface IRefreshSummaryAckOptions {\n\t/**\n\t * Handle from the ack's summary op.\n\t */\n\treadonly proposalHandle: string | undefined;\n\t/**\n\t * Handle from the summary ack just received\n\t */\n\treadonly ackHandle: string;\n\t/**\n\t * Reference sequence number from the ack's summary op\n\t */\n\treadonly summaryRefSeq: number;\n\t/**\n\t * Telemetry logger to which telemetry events will be forwarded.\n\t */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizerInternalsProvider {\n\t/**\n\t * Encapsulates the work to walk the internals of the running container to generate a summary\n\t */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/**\n\t * Callback whenever a new SummaryAck is received, to update internal tracking state\n\t */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly baseLogger: ITelemetryBaseLogger;\n\t/**\n\t * clientId of parent (non-summarizing) container that owns summarizer container\n\t */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @legacy\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/**\n\t * True to generate the full tree with no handle reuse optimizations; defaults to false\n\t */\n\treadonly fullTree?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/**\n\t * Logger to use for correlated summary events\n\t */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/**\n\t * Tells when summary process should be cancelled\n\t */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/**\n\t * Summarization may be attempted multiple times. This tells whether this is the final summarization attempt.\n\t */\n\treadonly finalAttempt?: boolean;\n\t/**\n\t * The sequence number of the latest summary used to validate if summary state is correct before summarizing\n\t */\n\treadonly latestSummaryRefSeqNum: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/**\n\t * Reason for generating summary.\n\t */\n\treadonly reason: string;\n\t/**\n\t * In case of a failure, will attempt to retry based on if the failure is retriable.\n\t */\n\treadonly retryOnFailure?: boolean;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @legacy\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/**\n\t * If specified, The summarize attempt will not occur until after this sequence number.\n\t */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @legacy\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/**\n\t * The total number of data stores in the container.\n\t */\n\treadonly dataStoreCount: number;\n\t/**\n\t * The number of data stores that were summarized in this summary.\n\t */\n\treadonly summarizedDataStoreCount: number;\n\t/**\n\t * The number of data stores whose GC reference state was updated in this summary.\n\t */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/**\n\t * The size of the gc blobs in this summary.\n\t */\n\treadonly gcTotalBlobsSize?: number;\n\t/**\n\t * The number of gc blobs in this summary.\n\t */\n\treadonly gcBlobNodeCount?: number;\n\t/**\n\t * The summary number for a container's summary. Incremented on summaries throughout its lifetime.\n\t */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Type for summarization failures that are retriable.\n * @legacy\n * @alpha\n */\nexport interface IRetriableFailureError extends Error {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @legacy\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/**\n\t * Retriable error object related to failed summarize attempt.\n\t */\n\treadonly error: IRetriableFailureError | undefined;\n\t/**\n\t * Reference sequence number as of the generate summary attempt.\n\t */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @legacy\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/**\n\t * Generated summary tree.\n\t */\n\treadonly summaryTree: ISummaryTree;\n\t/**\n\t * Stats for generated summary tree.\n\t */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/**\n\t * Time it took to generate the summary tree and stats.\n\t */\n\treadonly generateDuration: number;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @legacy\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/**\n\t * The handle returned by storage pointing to the uploaded summary tree.\n\t */\n\treadonly handle: string;\n\t/**\n\t * Time it took to upload the summary tree to storage.\n\t */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @legacy\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/**\n\t * The client sequence number of the summarize op submitted for the summary.\n\t */\n\treadonly clientSequenceNumber: number;\n\t/**\n\t * Time it took to submit the summarize op to the broadcasting service.\n\t */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @legacy\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @legacy\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @legacy\n * @alpha\n */\nexport interface SubmitSummaryFailureData {\n\tstage: SummaryStage;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IBroadcastSummaryResult {\n\treadonly summarizeOp: ISummaryOpMessage;\n\treadonly broadcastDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAckSummaryResult {\n\treadonly summaryAckOp: ISummaryAckMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface INackSummaryResult {\n\treadonly summaryNackOp: ISummaryNackMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: IRetriableFailureError;\n\t };\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizeResults {\n\t/**\n\t * Resolves when we generate, upload, and submit the summary.\n\t */\n\treadonly summarySubmitted: Promise<\n\t\tSummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>\n\t>;\n\t/**\n\t * Resolves when we observe our summarize op broadcast.\n\t */\n\treadonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n\t/**\n\t * Resolves when we receive a summaryAck or summaryNack.\n\t */\n\treadonly receivedSummaryAckOrNack: Promise<\n\t\tSummarizeResultPart<IAckSummaryResult, INackSummaryResult>\n\t>;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type EnqueueSummarizeResult =\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt is not already enqueued,\n\t\t\t * and this attempt has been enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued?: undefined;\n\t })\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt was already enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt was abandoned,\n\t\t\t * and this attempt has been enqueued enqueued.\n\t\t\t */\n\t\t\treadonly overridden: true;\n\t })\n\t| {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt was already enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt remains enqueued,\n\t\t\t * and this attempt has not been enqueued.\n\t\t\t */\n\t\t\treadonly overridden?: undefined;\n\t };\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/**\n * Data about an attempt to summarize used for heuristics.\n */\nexport interface ISummarizeAttempt {\n\t/**\n\t * Reference sequence number when summary was generated or attempted\n\t */\n\treadonly refSequenceNumber: number;\n\n\t/**\n\t * Time of summary attempt after it was sent or attempted\n\t */\n\treadonly summaryTime: number;\n\n\t/**\n\t * Sequence number of summary op\n\t */\n\tsummarySequenceNumber?: number;\n}\n\n/**\n * Data relevant for summary heuristics.\n */\nexport interface ISummarizeHeuristicData {\n\t/**\n\t * Latest received op sequence number\n\t */\n\tlastOpSequenceNumber: number;\n\n\t/**\n\t * Most recent summary attempt from this client\n\t */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/**\n\t * Most recent summary that received an ack\n\t */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/**\n\t * Number of runtime ops since last summary\n\t */\n\tnumRuntimeOps: number;\n\n\t/**\n\t * Number of non-runtime ops since last summary\n\t */\n\tnumNonRuntimeOps: number;\n\n\t/**\n\t * Cumulative size in bytes of all the ops since the last summary\n\t */\n\ttotalOpsSize: number;\n\n\t/**\n\t * Wether or not this instance contains adjusted metrics due to missing op data\n\t */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/**\n\t * Mark that the last sent summary attempt has received an ack\n\t */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/**\n * Responsible for running heuristics determining when to summarize.\n */\nexport interface ISummarizeHeuristicRunner {\n\t/**\n\t * Start specific heuristic trackers (ex: idle timer)\n\t */\n\tstart(): void;\n\n\t/**\n\t * Runs the heuristics to determine if it should try to summarize\n\t */\n\trun(): void;\n\n\t/**\n\t * Runs a different heuristic to check if it should summarize before closing\n\t */\n\tshouldRunLastSummary(): boolean;\n\n\t/**\n\t * Disposes of resources\n\t */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/**\n\t * Reason code for attempting to summarize\n\t */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/**\n\t * Number of attempts within the last time window, used for calculating the throttle delay.\n\t */\n\t| \"summaryAttempts\"\n\t/**\n\t * Summarization may be attempted multiple times. This tells whether this is the final summarization attempt\n\t */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryBaseProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/**\n * Strategy used to heuristically determine when we should run a summary\n */\nexport interface ISummaryHeuristicStrategy {\n\t/**\n\t * Summarize reason for this summarize heuristic strategy (ex: \"maxTime\")\n\t */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/**\n\t * True to generate the full tree with no handle reuse optimizations\n\t */\n\t| \"fullTree\"\n\t/**\n\t * Time since we last attempted to generate a summary\n\t */\n\t| \"timeSinceLastAttempt\"\n\t/**\n\t * Time since we last successfully generated a summary\n\t */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/**\n\t * Reference sequence number as of the generate summary attempt.\n\t */\n\t| \"referenceSequenceNumber\"\n\t/**\n\t * minimum sequence number (at the reference sequence number)\n\t */\n\t| \"minimumSequenceNumber\"\n\t/**\n\t * Delta between the current reference sequence number and the reference sequence number of the last attempt\n\t */\n\t| \"opsSinceLastAttempt\"\n\t/**\n\t * Delta between the current reference sequence number and the reference sequence number of the last summary\n\t */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/**\n\t * Delta between the number of non-runtime ops since the last summary\n\t */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/**\n\t * Delta between the number of runtime ops since the last summary\n\t */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/**\n\t * Wether or not this instance contains adjusted metrics due to missing op data\n\t */\n\t| \"hasMissingOpData\"\n\t/**\n\t * Time it took to generate the summary tree and stats.\n\t */\n\t| \"generateDuration\"\n\t/**\n\t * The handle returned by storage pointing to the uploaded summary tree.\n\t */\n\t| \"handle\"\n\t/**\n\t * Time it took to upload the summary tree to storage.\n\t */\n\t| \"uploadDuration\"\n\t/**\n\t * The client sequence number of the summarize op submitted for the summary.\n\t */\n\t| \"clientSequenceNumber\"\n\t/**\n\t * Time it took for this summary to be acked after it was generated\n\t */\n\t| \"ackWaitDuration\"\n\t/**\n\t * Reference sequence number of the ack/nack message\n\t */\n\t| \"ackNackSequenceNumber\"\n\t/**\n\t * Actual sequence number of the summary op proposal.\n\t */\n\t| \"summarySequenceNumber\"\n\t/**\n\t * Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying.\n\t */\n\t| \"nackRetryAfter\"\n\t/**\n\t * The stage at which the submit summary method failed at. This can help determine what type of failure we have\n\t */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryBaseProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/**\n\t * Number of times the summarizer run.\n\t */\n\tsummarizeCount: () => number;\n\t/**\n\t * Number of successful attempts to summarize.\n\t */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryBaseConfiguration {\n\t/**\n\t * Delay before first attempt to spawn summarizing container.\n\t */\n\tinitialSummarizerDelayMs: number;\n\n\t/**\n\t * Defines the maximum allowed time to wait for a pending summary ack.\n\t * The maximum amount of time client will wait for a summarize is the minimum of\n\t * maxSummarizeAckWaitTime (currently 3 * 60 * 1000) and maxAckWaitTime.\n\t */\n\tmaxAckWaitTime: number;\n\t/**\n\t * Defines the maximum number of Ops in between Summaries that can be\n\t * allowed before forcibly electing a new summarizer client.\n\t */\n\tmaxOpsSinceLastSummary: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {\n\tstate: \"enabled\";\n\t/**\n\t * Defines the maximum allowed time, since the last received Ack, before running the summary\n\t * with reason maxTime.\n\t * For example, say we receive ops one by one just before the idle time is triggered.\n\t * In this case, we still want to run a summary since it's been a while since the last summary.\n\t */\n\tmaxTime: number;\n\t/**\n\t * Defines the maximum number of Ops, since the last received Ack, that can be allowed\n\t * before running the summary with reason maxOps.\n\t */\n\tmaxOps: number;\n\t/**\n\t * Defines the minimum number of Ops, since the last received Ack, that can be allowed\n\t * before running the last summary.\n\t */\n\tminOpsForLastSummaryAttempt: number;\n\t/**\n\t * Defines the lower boundary for the allowed time in between summarizations.\n\t * Pairs with maxIdleTime to form a range.\n\t * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.\n\t * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change\n\t * linearly depending on the number of ops we receive.\n\t */\n\tminIdleTime: number;\n\t/**\n\t * Defines the upper boundary for the allowed time in between summarizations.\n\t * Pairs with minIdleTime to form a range.\n\t * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.\n\t * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change\n\t * linearly depending on the number of ops we receive.\n\t */\n\tmaxIdleTime: number;\n\t/**\n\t * Runtime op weight to use in heuristic summarizing.\n\t * This number is a multiplier on the number of runtime ops we process when running summarize heuristics.\n\t * For example: (multiplier) * (number of runtime ops) = weighted number of runtime ops\n\t */\n\truntimeOpWeight: number;\n\t/**\n\t * Non-runtime op weight to use in heuristic summarizing\n\t * This number is a multiplier on the number of non-runtime ops we process when running summarize heuristics.\n\t * For example: (multiplier) * (number of non-runtime ops) = weighted number of non-runtime ops\n\t */\n\tnonRuntimeOpWeight: number;\n\n\t/**\n\t * Number of ops since last summary needed before a non-runtime op can trigger running summary heuristics.\n\t *\n\t * Note: Any runtime ops sent before the threshold is reached will trigger heuristics normally.\n\t * This threshold ONLY applies to non-runtime ops triggering summaries.\n\t *\n\t * For example: Say the threshold is 20. Sending 19 non-runtime ops will not trigger any heuristic checks.\n\t * Sending the 20th non-runtime op will trigger the heuristic checks for summarizing.\n\t */\n\tnonRuntimeHeuristicThreshold?: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationDisableSummarizer {\n\tstate: \"disabled\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConfiguration {\n\tstate: \"disableHeuristics\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type ISummaryConfiguration =\n\t| ISummaryConfigurationDisableSummarizer\n\t| ISummaryConfigurationDisableHeuristics\n\t| ISummaryConfigurationHeuristics;\n"]}
1
+ {"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgCU,QAAA,oBAAoB,GAAG,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDeltaManager,\n\tContainerWarning,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tISummarizerEvents,\n\tSummarizerStopReason,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport {\n\tIEventProvider,\n\tITelemetryBaseProperties,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { SummarizeReason } from \"./summarizerUtils.js\";\nimport type {\n\tEnqueueSummarizeResult,\n\tISummarizeResults,\n} from \"./summaryDelayLoadedModule/index.js\";\n\nexport const summarizerClientType = \"summarizer\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @internal\n */\nexport interface ICancellationToken<T> {\n\t/**\n\t * Tells if this cancellable token is cancelled\n\t */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @internal\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @internal\n */\nexport interface IRefreshSummaryAckOptions {\n\t/**\n\t * Handle from the ack's summary op.\n\t */\n\treadonly proposalHandle: string | undefined;\n\t/**\n\t * Handle from the summary ack just received\n\t */\n\treadonly ackHandle: string;\n\t/**\n\t * Reference sequence number from the ack's summary op\n\t */\n\treadonly summaryRefSeq: number;\n\t/**\n\t * Telemetry logger to which telemetry events will be forwarded.\n\t */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizerInternalsProvider {\n\t/**\n\t * Encapsulates the work to walk the internals of the running container to generate a summary\n\t */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/**\n\t * Callback whenever a new SummaryAck is received, to update internal tracking state\n\t */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly baseLogger: ITelemetryBaseLogger;\n\t/**\n\t * clientId of parent (non-summarizing) container that owns summarizer container\n\t */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @legacy\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/**\n\t * True to generate the full tree with no handle reuse optimizations; defaults to false\n\t */\n\treadonly fullTree?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/**\n\t * Logger to use for correlated summary events\n\t */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/**\n\t * Tells when summary process should be cancelled\n\t */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/**\n\t * Summarization may be attempted multiple times. This tells whether this is the final summarization attempt.\n\t */\n\treadonly finalAttempt?: boolean;\n\t/**\n\t * The sequence number of the latest summary used to validate if summary state is correct before summarizing\n\t */\n\treadonly latestSummaryRefSeqNum: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/**\n\t * Reason for generating summary.\n\t */\n\treadonly reason: string;\n\t/**\n\t * In case of a failure, will attempt to retry based on if the failure is retriable.\n\t */\n\treadonly retryOnFailure?: boolean;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @legacy\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/**\n\t * If specified, The summarize attempt will not occur until after this sequence number.\n\t */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @legacy\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/**\n\t * The total number of data stores in the container.\n\t */\n\treadonly dataStoreCount: number;\n\t/**\n\t * The number of data stores that were summarized in this summary.\n\t */\n\treadonly summarizedDataStoreCount: number;\n\t/**\n\t * The number of data stores whose GC reference state was updated in this summary.\n\t */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/**\n\t * The size of the gc blobs in this summary.\n\t */\n\treadonly gcTotalBlobsSize?: number;\n\t/**\n\t * The number of gc blobs in this summary.\n\t */\n\treadonly gcBlobNodeCount?: number;\n\t/**\n\t * The summary number for a container's summary. Incremented on summaries throughout its lifetime.\n\t */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Type for summarization failures that are retriable.\n * @legacy\n * @alpha\n */\nexport interface IRetriableFailureError extends Error {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @legacy\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/**\n\t * Retriable error object related to failed summarize attempt.\n\t */\n\treadonly error: IRetriableFailureError | undefined;\n\t/**\n\t * Reference sequence number as of the generate summary attempt.\n\t */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @legacy\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/**\n\t * Generated summary tree.\n\t */\n\treadonly summaryTree: ISummaryTree;\n\t/**\n\t * Stats for generated summary tree.\n\t */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/**\n\t * Time it took to generate the summary tree and stats.\n\t */\n\treadonly generateDuration: number;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @legacy\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/**\n\t * The handle returned by storage pointing to the uploaded summary tree.\n\t */\n\treadonly handle: string;\n\t/**\n\t * Time it took to upload the summary tree to storage.\n\t */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @legacy\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/**\n\t * The client sequence number of the summarize op submitted for the summary.\n\t */\n\treadonly clientSequenceNumber: number;\n\t/**\n\t * Time it took to submit the summarize op to the broadcasting service.\n\t */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @legacy\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @legacy\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @legacy\n * @alpha\n */\nexport interface SubmitSummaryFailureData {\n\tstage: SummaryStage;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: IRetriableFailureError;\n\t };\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/**\n * Data about an attempt to summarize used for heuristics.\n */\nexport interface ISummarizeAttempt {\n\t/**\n\t * Reference sequence number when summary was generated or attempted\n\t */\n\treadonly refSequenceNumber: number;\n\n\t/**\n\t * Time of summary attempt after it was sent or attempted\n\t */\n\treadonly summaryTime: number;\n\n\t/**\n\t * Sequence number of summary op\n\t */\n\tsummarySequenceNumber?: number;\n}\n\n/**\n * Data relevant for summary heuristics.\n */\nexport interface ISummarizeHeuristicData {\n\t/**\n\t * Latest received op sequence number\n\t */\n\tlastOpSequenceNumber: number;\n\n\t/**\n\t * Most recent summary attempt from this client\n\t */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/**\n\t * Most recent summary that received an ack\n\t */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/**\n\t * Number of runtime ops since last summary\n\t */\n\tnumRuntimeOps: number;\n\n\t/**\n\t * Number of non-runtime ops since last summary\n\t */\n\tnumNonRuntimeOps: number;\n\n\t/**\n\t * Cumulative size in bytes of all the ops since the last summary\n\t */\n\ttotalOpsSize: number;\n\n\t/**\n\t * Wether or not this instance contains adjusted metrics due to missing op data\n\t */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/**\n\t * Mark that the last sent summary attempt has received an ack\n\t */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/**\n * Responsible for running heuristics determining when to summarize.\n */\nexport interface ISummarizeHeuristicRunner {\n\t/**\n\t * Start specific heuristic trackers (ex: idle timer)\n\t */\n\tstart(): void;\n\n\t/**\n\t * Runs the heuristics to determine if it should try to summarize\n\t */\n\trun(): void;\n\n\t/**\n\t * Runs a different heuristic to check if it should summarize before closing\n\t */\n\tshouldRunLastSummary(): boolean;\n\n\t/**\n\t * Disposes of resources\n\t */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/**\n\t * Reason code for attempting to summarize\n\t */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/**\n\t * Number of attempts within the last time window, used for calculating the throttle delay.\n\t */\n\t| \"summaryAttempts\"\n\t/**\n\t * Summarization may be attempted multiple times. This tells whether this is the final summarization attempt\n\t */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryBaseProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/**\n * Strategy used to heuristically determine when we should run a summary\n */\nexport interface ISummaryHeuristicStrategy {\n\t/**\n\t * Summarize reason for this summarize heuristic strategy (ex: \"maxTime\")\n\t */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/**\n\t * True to generate the full tree with no handle reuse optimizations\n\t */\n\t| \"fullTree\"\n\t/**\n\t * Time since we last attempted to generate a summary\n\t */\n\t| \"timeSinceLastAttempt\"\n\t/**\n\t * Time since we last successfully generated a summary\n\t */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/**\n\t * Reference sequence number as of the generate summary attempt.\n\t */\n\t| \"referenceSequenceNumber\"\n\t/**\n\t * minimum sequence number (at the reference sequence number)\n\t */\n\t| \"minimumSequenceNumber\"\n\t/**\n\t * Delta between the current reference sequence number and the reference sequence number of the last attempt\n\t */\n\t| \"opsSinceLastAttempt\"\n\t/**\n\t * Delta between the current reference sequence number and the reference sequence number of the last summary\n\t */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/**\n\t * Delta between the number of non-runtime ops since the last summary\n\t */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/**\n\t * Delta between the number of runtime ops since the last summary\n\t */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/**\n\t * Wether or not this instance contains adjusted metrics due to missing op data\n\t */\n\t| \"hasMissingOpData\"\n\t/**\n\t * Time it took to generate the summary tree and stats.\n\t */\n\t| \"generateDuration\"\n\t/**\n\t * The handle returned by storage pointing to the uploaded summary tree.\n\t */\n\t| \"handle\"\n\t/**\n\t * Time it took to upload the summary tree to storage.\n\t */\n\t| \"uploadDuration\"\n\t/**\n\t * The client sequence number of the summarize op submitted for the summary.\n\t */\n\t| \"clientSequenceNumber\"\n\t/**\n\t * Time it took for this summary to be acked after it was generated\n\t */\n\t| \"ackWaitDuration\"\n\t/**\n\t * Reference sequence number of the ack/nack message\n\t */\n\t| \"ackNackSequenceNumber\"\n\t/**\n\t * Actual sequence number of the summary op proposal.\n\t */\n\t| \"summarySequenceNumber\"\n\t/**\n\t * Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying.\n\t */\n\t| \"nackRetryAfter\"\n\t/**\n\t * The stage at which the submit summary method failed at. This can help determine what type of failure we have\n\t */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryBaseProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/**\n\t * Number of times the summarizer run.\n\t */\n\tsummarizeCount: () => number;\n\t/**\n\t * Number of successful attempts to summarize.\n\t */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryBaseConfiguration {\n\t/**\n\t * Delay before first attempt to spawn summarizing container.\n\t */\n\tinitialSummarizerDelayMs: number;\n\n\t/**\n\t * Defines the maximum allowed time to wait for a pending summary ack.\n\t * The maximum amount of time client will wait for a summarize is the minimum of\n\t * maxSummarizeAckWaitTime (currently 3 * 60 * 1000) and maxAckWaitTime.\n\t */\n\tmaxAckWaitTime: number;\n\t/**\n\t * Defines the maximum number of Ops in between Summaries that can be\n\t * allowed before forcibly electing a new summarizer client.\n\t */\n\tmaxOpsSinceLastSummary: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {\n\tstate: \"enabled\";\n\t/**\n\t * Defines the maximum allowed time, since the last received Ack, before running the summary\n\t * with reason maxTime.\n\t * For example, say we receive ops one by one just before the idle time is triggered.\n\t * In this case, we still want to run a summary since it's been a while since the last summary.\n\t */\n\tmaxTime: number;\n\t/**\n\t * Defines the maximum number of Ops, since the last received Ack, that can be allowed\n\t * before running the summary with reason maxOps.\n\t */\n\tmaxOps: number;\n\t/**\n\t * Defines the minimum number of Ops, since the last received Ack, that can be allowed\n\t * before running the last summary.\n\t */\n\tminOpsForLastSummaryAttempt: number;\n\t/**\n\t * Defines the lower boundary for the allowed time in between summarizations.\n\t * Pairs with maxIdleTime to form a range.\n\t * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.\n\t * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change\n\t * linearly depending on the number of ops we receive.\n\t */\n\tminIdleTime: number;\n\t/**\n\t * Defines the upper boundary for the allowed time in between summarizations.\n\t * Pairs with minIdleTime to form a range.\n\t * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.\n\t * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change\n\t * linearly depending on the number of ops we receive.\n\t */\n\tmaxIdleTime: number;\n\t/**\n\t * Runtime op weight to use in heuristic summarizing.\n\t * This number is a multiplier on the number of runtime ops we process when running summarize heuristics.\n\t * For example: (multiplier) * (number of runtime ops) = weighted number of runtime ops\n\t */\n\truntimeOpWeight: number;\n\t/**\n\t * Non-runtime op weight to use in heuristic summarizing\n\t * This number is a multiplier on the number of non-runtime ops we process when running summarize heuristics.\n\t * For example: (multiplier) * (number of non-runtime ops) = weighted number of non-runtime ops\n\t */\n\tnonRuntimeOpWeight: number;\n\n\t/**\n\t * Number of ops since last summary needed before a non-runtime op can trigger running summary heuristics.\n\t *\n\t * Note: Any runtime ops sent before the threshold is reached will trigger heuristics normally.\n\t * This threshold ONLY applies to non-runtime ops triggering summaries.\n\t *\n\t * For example: Say the threshold is 20. Sending 19 non-runtime ops will not trigger any heuristic checks.\n\t * Sending the 20th non-runtime op will trigger the heuristic checks for summarizing.\n\t */\n\tnonRuntimeHeuristicThreshold?: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationDisableSummarizer {\n\tstate: \"disabled\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConfiguration {\n\tstate: \"disableHeuristics\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type ISummaryConfiguration =\n\t| ISummaryConfigurationDisableSummarizer\n\t| ISummaryConfigurationDisableHeuristics\n\t| ISummaryConfigurationHeuristics;\n"]}
@@ -2,11 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { SummarizerStopReason } from "@fluidframework/container-runtime-definitions/internal";
5
6
  import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
6
- import { Deferred, IPromiseTimer, IPromiseTimerResult } from "@fluidframework/core-utils/internal";
7
- import { ITelemetryLoggerExt, LoggingError } from "@fluidframework/telemetry-utils/internal";
8
- import { IAckSummaryResult, IBroadcastSummaryResult, INackSummaryResult, IRefreshSummaryAckOptions, ISubmitSummaryOptions, ISummarizeHeuristicData, ISummarizeResults, ISummaryCancellationToken, SubmitSummaryFailureData, SubmitSummaryResult, SummarizeResultPart, type IRetriableFailureError } from "./summarizerTypes.js";
9
- import { IClientSummaryWatcher } from "./summaryCollection.js";
7
+ import { IPromiseTimerResult } from "@fluidframework/core-utils/internal";
8
+ import { LoggingError } from "@fluidframework/telemetry-utils/internal";
9
+ import { ISummaryCancellationToken, type IRetriableFailureError } from "./summarizerTypes.js";
10
10
  export type raceTimerResult<T> = {
11
11
  result: "done";
12
12
  value: T;
@@ -19,6 +19,13 @@ export type raceTimerResult<T> = {
19
19
  * Wait for a promise or PromiseTimer to elapse.
20
20
  */
21
21
  export declare function raceTimer<T>(promise: Promise<T>, timer: Promise<IPromiseTimerResult>, cancellationToken?: ISummaryCancellationToken): Promise<raceTimerResult<T>>;
22
+ /**
23
+ * Should we try to run a last summary for the given stop reason?
24
+ * Currently only allows "parentNotConnected"
25
+ * @param stopReason - SummarizerStopReason
26
+ * @returns `true` if the stop reason can run a last summary, otherwise `false`.
27
+ */
28
+ export declare function stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean;
22
29
  export type SummarizeReason =
23
30
  /**
24
31
  * Attempt to summarize after idle timeout has elapsed.
@@ -84,19 +91,6 @@ declare const summarizeErrors: {
84
91
  };
85
92
  export type SummarizeErrorCode = keyof typeof summarizeErrors;
86
93
  export declare const getFailMessage: (errorCode: SummarizeErrorCode) => string;
87
- export declare class SummarizeResultBuilder {
88
- readonly summarySubmitted: Deferred<SummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>>;
89
- readonly summaryOpBroadcasted: Deferred<SummarizeResultPart<IBroadcastSummaryResult>>;
90
- readonly receivedSummaryAckOrNack: Deferred<SummarizeResultPart<IAckSummaryResult, INackSummaryResult>>;
91
- /**
92
- * Fails one or more of the three results as per the passed params.
93
- * If submit fails, all three results fail.
94
- * If op broadcast fails, only op broadcast result and ack nack result fails.
95
- * If ack nack fails, only ack nack result fails.
96
- */
97
- fail(message: string, error: IRetriableFailureError, submitFailureResult?: SubmitSummaryFailureData, nackSummaryResult?: INackSummaryResult): void;
98
- build(): ISummarizeResults;
99
- }
100
94
  /**
101
95
  * Errors type for errors hit during summary that may be retriable.
102
96
  */
@@ -104,30 +98,5 @@ export declare class RetriableSummaryError extends LoggingError implements IRetr
104
98
  readonly retryAfterSeconds?: number | undefined;
105
99
  constructor(message: string, retryAfterSeconds?: number | undefined, props?: ITelemetryBaseProperties);
106
100
  }
107
- /**
108
- * This class generates and tracks a summary attempt.
109
- */
110
- export declare class SummaryGenerator {
111
- private readonly pendingAckTimer;
112
- private readonly heuristicData;
113
- private readonly submitSummaryCallback;
114
- private readonly successfulSummaryCallback;
115
- private readonly refreshLatestSummaryCallback;
116
- private readonly summaryWatcher;
117
- private readonly logger;
118
- private readonly summarizeTimer;
119
- constructor(pendingAckTimer: IPromiseTimer, heuristicData: ISummarizeHeuristicData, submitSummaryCallback: (options: ISubmitSummaryOptions) => Promise<SubmitSummaryResult>, successfulSummaryCallback: () => void, refreshLatestSummaryCallback: (options: IRefreshSummaryAckOptions) => Promise<void>, summaryWatcher: Pick<IClientSummaryWatcher, "watchSummary">, logger: ITelemetryLoggerExt);
120
- /**
121
- * Generates summary and listens for broadcast and ack/nack.
122
- * Returns true for ack, false for nack, and undefined for failure or timeout.
123
- * @param summaryOptions - options controlling how the summary is generated or submitted.
124
- * @param resultsBuilder - optional, result builder to use to build pass or fail result.
125
- */
126
- summarize(summaryOptions: ISubmitSummaryOptions, resultsBuilder?: SummarizeResultBuilder): ISummarizeResults;
127
- private summarizeCore;
128
- private addSummaryDataToTelemetryProps;
129
- private summarizeTimerHandler;
130
- dispose(): void;
131
- }
132
101
  export {};
133
- //# sourceMappingURL=summaryGenerator.d.ts.map
102
+ //# sourceMappingURL=summarizerUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarizerUtils.d.ts","sourceRoot":"","sources":["../../src/summary/summarizerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,MAAM,MAAM,eAAe,CAAC,CAAC,IAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAC5B;IAAE,MAAM,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;CAAE,GAC9C;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC;AAE3B;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAEnC,iBAAiB,CAAC,EAAE,yBAAyB,GAC3C,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAW7B;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAErF;AAED,MAAM,MAAM,eAAe;AAC1B;;;;;GAKG;AACD,MAAM;AACR;;;;GAIG;GACD,SAAS;AACX;;;;;;GAMG;GACD,QAAQ;AACV;;;;;;GAMG;GACD,aAAa;AACf;;GAEG;GACD,YAAY,MAAM,EAAE;AACtB;;GAEG;GACD,WAAW,MAAM,EAAE,CAAC;AAEvB,QAAA,MAAM,eAAe;IACpB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;;CAIM,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,eAAe,CAAC;AAG9D,eAAO,MAAM,cAAc,cAAe,kBAAkB,KAAG,MACjB,CAAC;AAE/C;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAa,YAAW,sBAAsB;aAGvE,iBAAiB,CAAC;gBADlC,OAAO,EAAE,MAAM,EACC,iBAAiB,CAAC,oBAAQ,EAC1C,KAAK,CAAC,EAAE,wBAAwB;CAIjC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RetriableSummaryError = exports.getFailMessage = exports.stopReasonCanRunLastSummary = exports.raceTimer = void 0;
8
+ const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
+ /**
10
+ * Wait for a promise or PromiseTimer to elapse.
11
+ */
12
+ async function raceTimer(promise, timer, cancellationToken) {
13
+ const promises = [
14
+ promise.then((value) => ({ result: "done", value })),
15
+ timer.then(({ timerResult: result }) => ({ result })),
16
+ ];
17
+ if (cancellationToken !== undefined) {
18
+ promises.push(cancellationToken.waitCancelled.then(() => ({ result: "cancelled" })));
19
+ }
20
+ return Promise.race(promises);
21
+ }
22
+ exports.raceTimer = raceTimer;
23
+ /**
24
+ * Should we try to run a last summary for the given stop reason?
25
+ * Currently only allows "parentNotConnected"
26
+ * @param stopReason - SummarizerStopReason
27
+ * @returns `true` if the stop reason can run a last summary, otherwise `false`.
28
+ */
29
+ function stopReasonCanRunLastSummary(stopReason) {
30
+ return stopReason === "parentNotConnected";
31
+ }
32
+ exports.stopReasonCanRunLastSummary = stopReasonCanRunLastSummary;
33
+ const summarizeErrors = {
34
+ /**
35
+ * Error encountered while generating the summary tree, uploading
36
+ * it to storage, or submitting the op. It could be a result of
37
+ * the client becoming disconnected while generating or an actual error.
38
+ */
39
+ submitSummaryFailure: "Error while generating, uploading, or submitting summary",
40
+ /**
41
+ * The summaryAckWaitTimeout time has elapsed before receiving the summarize op
42
+ * sent by this summarize attempt. It is expected to be broadcast quickly.
43
+ */
44
+ summaryOpWaitTimeout: "Timeout while waiting for summarize op broadcast",
45
+ /**
46
+ * The summaryAckWaitTimeout time has elapsed before receiving either a
47
+ * summaryAck or summaryNack op from the server in response to this
48
+ * summarize attempt. It is expected that the server should respond.
49
+ */
50
+ summaryAckWaitTimeout: "Timeout while waiting for summaryAck/summaryNack op",
51
+ /**
52
+ * The server responded with a summaryNack op, thus rejecting this
53
+ * summarize attempt.
54
+ */
55
+ summaryNack: "Server rejected summary via summaryNack op",
56
+ disconnect: "Summary cancelled due to summarizer or main client disconnect",
57
+ };
58
+ // Helper functions to report failures and return.
59
+ const getFailMessage = (errorCode) => `${errorCode}: ${summarizeErrors[errorCode]}`;
60
+ exports.getFailMessage = getFailMessage;
61
+ /**
62
+ * Errors type for errors hit during summary that may be retriable.
63
+ */
64
+ class RetriableSummaryError extends internal_1.LoggingError {
65
+ constructor(message, retryAfterSeconds, props) {
66
+ super(message, props);
67
+ this.retryAfterSeconds = retryAfterSeconds;
68
+ }
69
+ }
70
+ exports.RetriableSummaryError = RetriableSummaryError;
71
+ //# sourceMappingURL=summarizerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarizerUtils.js","sourceRoot":"","sources":["../../src/summary/summarizerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,uEAAwE;AASxE;;GAEG;AACI,KAAK,UAAU,SAAS,CAC9B,OAAmB,EACnB,KAAmC,EAEnC,iBAA6C;IAE7C,MAAM,QAAQ,GAAkC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAU,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAU,CAAC;KAC9D,CAAC;IACF,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACrC,QAAQ,CAAC,IAAI,CACZ,iBAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAU,CAAC,CAC9E,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAhBD,8BAgBC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,UAAgC;IAC3E,OAAO,UAAU,KAAK,oBAAoB,CAAC;AAC5C,CAAC;AAFD,kEAEC;AAyCD,MAAM,eAAe,GAAG;IACvB;;;;OAIG;IACH,oBAAoB,EAAE,0DAA0D;IAChF;;;OAGG;IACH,oBAAoB,EAAE,kDAAkD;IACxE;;;;OAIG;IACH,qBAAqB,EAAE,qDAAqD;IAC5E;;;OAGG;IACH,WAAW,EAAE,4CAA4C;IAEzD,UAAU,EAAE,+DAA+D;CAClE,CAAC;AAIX,kDAAkD;AAC3C,MAAM,cAAc,GAAG,CAAC,SAA6B,EAAU,EAAE,CACvE,GAAG,SAAS,KAAK,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AADlC,QAAA,cAAc,kBACoB;AAE/C;;GAEG;AACH,MAAa,qBAAsB,SAAQ,uBAAY;IACtD,YACC,OAAe,EACC,iBAA0B,EAC1C,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHN,sBAAiB,GAAjB,iBAAiB,CAAS;IAI3C,CAAC;CACD;AARD,sDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SummarizerStopReason } from \"@fluidframework/container-runtime-definitions/internal\";\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { IPromiseTimerResult } from \"@fluidframework/core-utils/internal\";\nimport { LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryCancellationToken, type IRetriableFailureError } from \"./summarizerTypes.js\";\n\nexport type raceTimerResult<T> =\n\t| { result: \"done\"; value: T }\n\t| { result: IPromiseTimerResult[\"timerResult\"] }\n\t| { result: \"cancelled\" };\n\n/**\n * Wait for a promise or PromiseTimer to elapse.\n */\nexport async function raceTimer<T>(\n\tpromise: Promise<T>,\n\ttimer: Promise<IPromiseTimerResult>,\n\n\tcancellationToken?: ISummaryCancellationToken,\n): Promise<raceTimerResult<T>> {\n\tconst promises: Promise<raceTimerResult<T>>[] = [\n\t\tpromise.then((value) => ({ result: \"done\", value }) as const),\n\t\ttimer.then(({ timerResult: result }) => ({ result }) as const),\n\t];\n\tif (cancellationToken !== undefined) {\n\t\tpromises.push(\n\t\t\tcancellationToken.waitCancelled.then(() => ({ result: \"cancelled\" }) as const),\n\t\t);\n\t}\n\treturn Promise.race(promises);\n}\n\n/**\n * Should we try to run a last summary for the given stop reason?\n * Currently only allows \"parentNotConnected\"\n * @param stopReason - SummarizerStopReason\n * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n */\nexport function stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\treturn stopReason === \"parentNotConnected\";\n}\n\nexport type SummarizeReason =\n\t/**\n\t * Attempt to summarize after idle timeout has elapsed.\n\t * Idle timer restarts whenever an op is received. So this\n\t * triggers only after some amount of time has passed with\n\t * no ops being received.\n\t */\n\t| \"idle\"\n\t/**\n\t * Attempt to summarize after a maximum time since last\n\t * successful summary has passed. This measures time since\n\t * last summary ack op was processed.\n\t */\n\t| \"maxTime\"\n\t/**\n\t * Attempt to summarize after a maximum number of ops have\n\t * passed since the last successful summary. This compares\n\t * op sequence numbers with the reference sequence number\n\t * of the summarize op corresponding to the last summary\n\t * ack op.\n\t */\n\t| \"maxOps\"\n\t/**\n\t * Special case to attempt to summarize one last time before the\n\t * summarizer client closes itself. This is to prevent cases where\n\t * the summarizer client never gets a chance to summarize, because\n\t * there are too many outstanding ops and/or parent client cannot\n\t * stay connected long enough for summarizer client to catch up.\n\t */\n\t| \"lastSummary\"\n\t/**\n\t * On-demand summary requested with specified reason.\n\t */\n\t| `onDemand;${string}`\n\t/**\n\t * Enqueue summarize attempt with specified reason.\n\t */\n\t| `enqueue;${string}`;\n\nconst summarizeErrors = {\n\t/**\n\t * Error encountered while generating the summary tree, uploading\n\t * it to storage, or submitting the op. It could be a result of\n\t * the client becoming disconnected while generating or an actual error.\n\t */\n\tsubmitSummaryFailure: \"Error while generating, uploading, or submitting summary\",\n\t/**\n\t * The summaryAckWaitTimeout time has elapsed before receiving the summarize op\n\t * sent by this summarize attempt. It is expected to be broadcast quickly.\n\t */\n\tsummaryOpWaitTimeout: \"Timeout while waiting for summarize op broadcast\",\n\t/**\n\t * The summaryAckWaitTimeout time has elapsed before receiving either a\n\t * summaryAck or summaryNack op from the server in response to this\n\t * summarize attempt. It is expected that the server should respond.\n\t */\n\tsummaryAckWaitTimeout: \"Timeout while waiting for summaryAck/summaryNack op\",\n\t/**\n\t * The server responded with a summaryNack op, thus rejecting this\n\t * summarize attempt.\n\t */\n\tsummaryNack: \"Server rejected summary via summaryNack op\",\n\n\tdisconnect: \"Summary cancelled due to summarizer or main client disconnect\",\n} as const;\n\nexport type SummarizeErrorCode = keyof typeof summarizeErrors;\n\n// Helper functions to report failures and return.\nexport const getFailMessage = (errorCode: SummarizeErrorCode): string =>\n\t`${errorCode}: ${summarizeErrors[errorCode]}`;\n\n/**\n * Errors type for errors hit during summary that may be retriable.\n */\nexport class RetriableSummaryError extends LoggingError implements IRetriableFailureError {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly retryAfterSeconds?: number,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { defaultMaxAttempts, defaultMaxAttemptsForSubmitFailures, Summarizer, } from "./summarizer.js";
6
+ export { ICancellableSummarizerController, neverCancelledSummaryToken, RunWhileConnectedCoordinator, } from "./runWhileConnectedCoordinator.js";
7
+ export { EnqueueSummarizeResult, IAckSummaryResult, INackSummaryResult, IBroadcastSummaryResult, ISummarizeResults, } from "./summaryResultTypes.js";
8
+ export { RunningSummarizer } from "./runningSummarizer.js";
9
+ export { SummarizeHeuristicData, SummarizeHeuristicRunner, } from "./summarizerHeuristics.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/summary/summaryDelayLoadedModule/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,mCAAmC,EACnC,UAAU,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACN,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SummarizeHeuristicRunner = exports.SummarizeHeuristicData = exports.RunningSummarizer = exports.RunWhileConnectedCoordinator = exports.neverCancelledSummaryToken = exports.Summarizer = exports.defaultMaxAttemptsForSubmitFailures = exports.defaultMaxAttempts = void 0;
8
+ var summarizer_js_1 = require("./summarizer.js");
9
+ Object.defineProperty(exports, "defaultMaxAttempts", { enumerable: true, get: function () { return summarizer_js_1.defaultMaxAttempts; } });
10
+ Object.defineProperty(exports, "defaultMaxAttemptsForSubmitFailures", { enumerable: true, get: function () { return summarizer_js_1.defaultMaxAttemptsForSubmitFailures; } });
11
+ Object.defineProperty(exports, "Summarizer", { enumerable: true, get: function () { return summarizer_js_1.Summarizer; } });
12
+ var runWhileConnectedCoordinator_js_1 = require("./runWhileConnectedCoordinator.js");
13
+ Object.defineProperty(exports, "neverCancelledSummaryToken", { enumerable: true, get: function () { return runWhileConnectedCoordinator_js_1.neverCancelledSummaryToken; } });
14
+ Object.defineProperty(exports, "RunWhileConnectedCoordinator", { enumerable: true, get: function () { return runWhileConnectedCoordinator_js_1.RunWhileConnectedCoordinator; } });
15
+ var runningSummarizer_js_1 = require("./runningSummarizer.js");
16
+ Object.defineProperty(exports, "RunningSummarizer", { enumerable: true, get: function () { return runningSummarizer_js_1.RunningSummarizer; } });
17
+ var summarizerHeuristics_js_1 = require("./summarizerHeuristics.js");
18
+ Object.defineProperty(exports, "SummarizeHeuristicData", { enumerable: true, get: function () { return summarizerHeuristics_js_1.SummarizeHeuristicData; } });
19
+ Object.defineProperty(exports, "SummarizeHeuristicRunner", { enumerable: true, get: function () { return summarizerHeuristics_js_1.SummarizeHeuristicRunner; } });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/summary/summaryDelayLoadedModule/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAIyB;AAHxB,mHAAA,kBAAkB,OAAA;AAClB,oIAAA,mCAAmC,OAAA;AACnC,2GAAA,UAAU,OAAA;AAEX,qFAI2C;AAF1C,6IAAA,0BAA0B,OAAA;AAC1B,+IAAA,4BAA4B,OAAA;AAU7B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,qEAGmC;AAFlC,iIAAA,sBAAsB,OAAA;AACtB,mIAAA,wBAAwB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tdefaultMaxAttempts,\n\tdefaultMaxAttemptsForSubmitFailures,\n\tSummarizer,\n} from \"./summarizer.js\";\nexport {\n\tICancellableSummarizerController,\n\tneverCancelledSummaryToken,\n\tRunWhileConnectedCoordinator,\n} from \"./runWhileConnectedCoordinator.js\";\n\nexport {\n\tEnqueueSummarizeResult,\n\tIAckSummaryResult,\n\tINackSummaryResult,\n\tIBroadcastSummaryResult,\n\tISummarizeResults,\n} from \"./summaryResultTypes.js\";\nexport { RunningSummarizer } from \"./runningSummarizer.js\";\nexport {\n\tSummarizeHeuristicData,\n\tSummarizeHeuristicRunner,\n} from \"./summarizerHeuristics.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { SummarizerStopReason } from "@fluidframework/container-runtime-definitions/internal";
6
- import { IConnectableRuntime, ISummaryCancellationToken } from "./summarizerTypes.js";
6
+ import { IConnectableRuntime, ISummaryCancellationToken } from "../summarizerTypes.js";
7
7
  /**
8
8
  * Similar to AbortController, but using promise instead of events
9
9
  * @internal
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWhileConnectedCoordinator.d.ts","sourceRoot":"","sources":["../../../src/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAGnG,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvF;;;GAGG;AAEH,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;IAClF,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACzC;AAED;;;;GAIG;AAEH,eAAO,MAAM,0BAA0B,EAAE,yBAGxC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,4BAA6B,YAAW,gCAAgC;IAyCnF,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAzCxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwC;IAErE,IAAW,SAAS,IAAI,OAAO,CAkB9B;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAExD;WAEmB,MAAM,CACzB,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,OAAO,GACnB,OAAO,CAAC,4BAA4B,CAAC;IAMxC,SAAS,aACS,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,OAAO;IAGvC;;;;;;;;;;;;OAYG;cACa,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1C;;OAEG;IACI,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;CAM/C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runWhileConnectedCoordinator.js","sourceRoot":"","sources":["../../../src/summary/summaryDelayLoadedModule/runWhileConnectedCoordinator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAuE;AAavE;;;;GAIG;AAEU,QAAA,0BAA0B,GAA8B;IACpE,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAa,4BAA4B;IAIxC,IAAW,SAAS;QACnB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtB,IAAA,iBAAM,EAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAEvE,+EAA+E;YAC/E,iFAAiF;YACjF,4EAA4E;YAC5E,oCAAoC;YACpC,6CAA6C;YAC7C,mGAAmG;YACnG,yBAAyB;YACzB,oFAAoF;YACpF,EAAE;YACF,wEAAwE;YACxE,uFAAuF;QACxF,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAM,CACzB,OAA4B,EAC5B,MAAqB;QAErB,MAAM,GAAG,GAAG,IAAI,4BAA4B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,YACkB,OAA4B,EAC5B,MAAqB;QADrB,YAAO,GAAP,OAAO,CAAqB;QAC5B,WAAM,GAAN,MAAM,CAAe;QAzC/B,eAAU,GAAG,KAAK,CAAC;QACV,iBAAY,GAAG,IAAI,mBAAQ,EAAwB,CAAC;IAyClE,CAAC;IAEJ;;;;;;;;;;;;OAYG;IACO,KAAK,CAAC,SAAS;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;YAC1C,OAAO;QACR,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAE9E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC7B,MAAM,aAAa,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CACnD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CACvC,CAAC;YACF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,MAA4B;QACvC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;CACD;AApFD,oEAoFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SummarizerStopReason } from \"@fluidframework/container-runtime-definitions/internal\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\n\nimport { IConnectableRuntime, ISummaryCancellationToken } from \"../summarizerTypes.js\";\n\n/**\n * Similar to AbortController, but using promise instead of events\n * @internal\n */\n\nexport interface ICancellableSummarizerController extends ISummaryCancellationToken {\n\tstop(reason: SummarizerStopReason): void;\n}\n\n/**\n * Can be useful in testing as well as in places where caller does not use cancellation.\n * This object implements ISummaryCancellationToken interface but cancellation is never leveraged.\n * @internal\n */\n\nexport const neverCancelledSummaryToken: ISummaryCancellationToken = {\n\tcancelled: false,\n\twaitCancelled: new Promise(() => {}),\n};\n\n/**\n * Helper class to coordinate something that needs to run only while connected.\n * This provides promises that resolve as it starts or stops. Stopping happens\n * when disconnected or if stop() is called.\n */\nexport class RunWhileConnectedCoordinator implements ICancellableSummarizerController {\n\tprivate _cancelled = false;\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tpublic get cancelled(): boolean {\n\t\tif (!this._cancelled) {\n\t\t\tassert(this.active(), 0x25d /* \"We should never connect as 'read'\" */);\n\n\t\t\t// This check can't be enabled in current design due to lastSummary flow, where\n\t\t\t// summarizer for closed container stays around and can produce one more summary.\n\t\t\t// Currently we solve the problem of overlapping summarizer by doing wait in\n\t\t\t// SummaryManager.createSummarizer()\n\t\t\t// Better solution would involve these steps:\n\t\t\t// 1. Summarizer selection logic should chose summarizing client (with clientType === \"summarizer\")\n\t\t\t// if such client exists.\n\t\t\t// 2. Summarizer should be updated about such changes (to update onBehalfOfClientId)\n\t\t\t//\n\t\t\t// assert(this.runtime.summarizerClientId === this.onBehalfOfClientId ||\n\t\t\t// this.runtime.summarizerClientId === this.runtime.clientId, \"onBehalfOfClientId\");\n\t\t}\n\n\t\treturn this._cancelled;\n\t}\n\n\t/**\n\t * Returns a promise that resolves once stopped either externally or by disconnect.\n\t */\n\tpublic get waitCancelled(): Promise<SummarizerStopReason> {\n\t\treturn this.stopDeferred.promise;\n\t}\n\n\tpublic static async create(\n\t\truntime: IConnectableRuntime,\n\t\tactive: () => boolean,\n\t): Promise<RunWhileConnectedCoordinator> {\n\t\tconst obj = new RunWhileConnectedCoordinator(runtime, active);\n\t\tawait obj.waitStart();\n\t\treturn obj;\n\t}\n\n\tprotected constructor(\n\t\tprivate readonly runtime: IConnectableRuntime,\n\t\tprivate readonly active: () => boolean,\n\t) {}\n\n\t/**\n\t * Starts and waits for a promise which resolves when connected.\n\t * The promise will also resolve if stopped either externally or by disconnect.\n\t *\n\t * We only listen on disconnected event for clientType === \"summarizer\" container!\n\t * And only do it here - no other place should check it! That way we have only one place\n\t * that controls policy and it's easy to change policy in the future if we want to!\n\t * We do not listen for \"main\" (aka interactive) container disconnect here, as it's\n\t * responsibility of SummaryManager to decide if that's material or not. There are cases\n\t * like \"lastSummary\", or main client experiencing nacks / disconnects due to hitting limit\n\t * of non-summarized ops, where can make determination to continue with summary even if main\n\t * client is disconnected.\n\t */\n\tprotected async waitStart(): Promise<void> {\n\t\tif (this.runtime.disposed) {\n\t\t\tthis.stop(\"summarizerClientDisconnected\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.runtime.once(\"dispose\", () => this.stop(\"summarizerClientDisconnected\"));\n\n\t\tif (!this.runtime.connected) {\n\t\t\tconst waitConnected = new Promise<void>((resolve) =>\n\t\t\t\tthis.runtime.once(\"connected\", resolve),\n\t\t\t);\n\t\t\tawait Promise.race([waitConnected, this.waitCancelled]);\n\t\t}\n\t\tthis.runtime.once(\"disconnected\", () => this.stop(\"summarizerClientDisconnected\"));\n\t}\n\n\t/**\n\t * Stops running.\n\t */\n\tpublic stop(reason: SummarizerStopReason): void {\n\t\tif (!this._cancelled) {\n\t\t\tthis._cancelled = true;\n\t\t\tthis.stopDeferred.resolve(reason);\n\t\t}\n\t}\n}\n"]}
@@ -7,19 +7,10 @@ import type { ISummarizerEvents, SummarizerStopReason } from "@fluidframework/co
7
7
  import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
8
8
  import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
9
9
  import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
- import type { ISummaryConfiguration, EnqueueSummarizeResult, IEnqueueSummarizeOptions, IOnDemandSummarizeOptions, IRefreshSummaryAckOptions, ISubmitSummaryOptions, ISummarizeHeuristicData, ISummarizeResults, ISummarizerRuntime, ISummaryCancellationToken, SubmitSummaryResult } from "./summarizerTypes.js";
11
- import { IClientSummaryWatcher, SummaryCollection } from "./summaryCollection.js";
12
- import { SummarizeResultBuilder } from "./summaryGenerator.js";
13
- /**
14
- * The maximum number of summarization attempts that will be done by default in case of failures
15
- * that can be retried.
16
- */
17
- export declare const defaultMaxAttempts = 2;
18
- /**
19
- * The default value for maximum number of summarization attempts that will be done for summarization failures where
20
- * submit fails and the failure can be retried.
21
- */
22
- export declare const defaultMaxAttemptsForSubmitFailures = 5;
10
+ import type { IEnqueueSummarizeOptions, IOnDemandSummarizeOptions, IRefreshSummaryAckOptions, ISubmitSummaryOptions, ISummarizeHeuristicData, ISummarizerRuntime, ISummaryCancellationToken, ISummaryConfiguration, SubmitSummaryResult } from "../summarizerTypes.js";
11
+ import { IClientSummaryWatcher, SummaryCollection } from "../summaryCollection.js";
12
+ import { SummarizeResultBuilder } from "./summaryResultBuilder.js";
13
+ import type { EnqueueSummarizeResult, ISummarizeResults } from "./summaryResultTypes.js";
23
14
  /**
24
15
  * An instance of RunningSummarizer manages the heuristics for summarizing.
25
16
  * Until disposed, the instance of RunningSummarizer can assume that it is
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runningSummarizer.d.ts","sourceRoot":"","sources":["../../../src/summary/summaryDelayLoadedModule/runningSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAEX,iBAAiB,EAEjB,oBAAoB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEpF,OAAO,EAGN,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAMN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACX,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EAEzB,qBAAqB,EACrB,uBAAuB,EAGvB,kBAAkB,EAGlB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEN,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIzF;;;;;;GAMG;AACH,qBAAa,iBACZ,SAAQ,iBAAiB,CAAC,iBAAiB,CAC3C,YAAW,WAAW;IAiIrB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAGtC,OAAO,CAAC,QAAQ,CAAC,+BAA+B;IAGhD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAElC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAEvC,OAAO,CAAC,QAAQ,CAAC,OAAO;WA7IL,KAAK,CACxB,MAAM,EAAE,oBAAoB,EAC5B,cAAc,EAAE,qBAAqB,EACrC,aAAa,EAAE,qBAAqB,EAEpC,qBAAqB,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,mBAAmB,CAAC,EAEvF,+BAA+B,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,IAAI,CAAC,EACtF,aAAa,EAAE,uBAAuB,EACtC,iBAAiB,EAAE,iBAAiB,EAEpC,iBAAiB,EAAE,yBAAyB,EAC5C,sBAAsB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,EAE9D,OAAO,EAAE,kBAAkB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAqE7B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAe;IAC/C,OAAO,CAAC,eAAe,CAAC,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IAEvC,OAAO,CAAC,eAAe,CAOV;IACb,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAGtB;IAEV;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAS;IAEtD;;;OAGG;IACH,OAAO,CAAC,8BAA8B,CAC3B;IAEX,OAAO;YAyHO,gBAAgB;IAiC9B,OAAO,CAAC,QAAQ,CAAC,qCAAqC,CA2BpD;IAEF;;;;;;;OAOG;YACW,0BAA0B;IAYjC,OAAO,IAAI,IAAI;IAYtB;;;;;OAKG;IACI,sBAAsB,oBACX,MAAM,KACrB,mBAAmB,GAAG,SAAS,CAGpB;IAEd;;OAEG;IACH,OAAO,CAAC,8BAA8B,CAAS;IAExC,QAAQ,CAAC,EAAE,EAAE,yBAAyB,EAAE,cAAc,EAAE,OAAO,GAAG,IAAI;IA8B7E;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,6BAA6B;IAWxB,QAAQ,CAAC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YAyCjD,SAAS;IAuBvB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,kBAAkB;IAW1B;;;;;;;;OAQG;YACW,mBAAmB;IAsBjC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IA8ExB;;OAEG;IACH,OAAO,CAAC,YAAY;IAuBpB;;;OAGG;YACW,uBAAuB;IA0KrC;;;OAGG;YACW,4BAA4B;IAqB1C;;OAEG;IACI,iBAAiB,CACvB,OAAO,EAAE,yBAAyB,EAClC,cAAc,GAAE,sBAAqD,GACnE,iBAAiB;IAgCpB;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB;IAmClF,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,sBAAsB;CAS9B"}
@@ -4,25 +4,18 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RunningSummarizer = exports.defaultMaxAttemptsForSubmitFailures = exports.defaultMaxAttempts = void 0;
7
+ exports.RunningSummarizer = void 0;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const internal_2 = require("@fluidframework/driver-definitions/internal");
11
11
  const internal_3 = require("@fluidframework/telemetry-utils/internal");
12
- const opProperties_js_1 = require("../opProperties.js");
12
+ const opProperties_js_1 = require("../../opProperties.js");
13
+ const summarizerUtils_js_1 = require("../summarizerUtils.js");
14
+ const summarizer_js_1 = require("./summarizer.js");
13
15
  const summarizerHeuristics_js_1 = require("./summarizerHeuristics.js");
14
16
  const summaryGenerator_js_1 = require("./summaryGenerator.js");
17
+ const summaryResultBuilder_js_1 = require("./summaryResultBuilder.js");
15
18
  const maxSummarizeAckWaitTime = 10 * 60 * 1000; // 10 minutes
16
- /**
17
- * The maximum number of summarization attempts that will be done by default in case of failures
18
- * that can be retried.
19
- */
20
- exports.defaultMaxAttempts = 2;
21
- /**
22
- * The default value for maximum number of summarization attempts that will be done for summarization failures where
23
- * submit fails and the failure can be retried.
24
- */
25
- exports.defaultMaxAttemptsForSubmitFailures = 5;
26
19
  /**
27
20
  * An instance of RunningSummarizer manages the heuristics for summarizing.
28
21
  * Until disposed, the instance of RunningSummarizer can assume that it is
@@ -194,9 +187,9 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
194
187
  // If its set to a number higher than `defaultMaxAttemptsForSubmitFailures`, it will be ignored.
195
188
  const overrideMaxAttempts = this.mc.config.getNumber("Fluid.Summarizer.AttemptsForSubmitFailures");
196
189
  this.maxAttemptsForSubmitFailures =
197
- overrideMaxAttempts && overrideMaxAttempts < exports.defaultMaxAttemptsForSubmitFailures
190
+ overrideMaxAttempts && overrideMaxAttempts < summarizer_js_1.defaultMaxAttemptsForSubmitFailures
198
191
  ? overrideMaxAttempts
199
- : exports.defaultMaxAttemptsForSubmitFailures;
192
+ : summarizer_js_1.defaultMaxAttemptsForSubmitFailures;
200
193
  }
201
194
  async handleSummaryAck(ack) {
202
195
  const refSequenceNumber = ack.summaryOp.referenceSequenceNumber;
@@ -334,7 +327,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
334
327
  }
335
328
  async waitStart() {
336
329
  // Wait no longer than ack timeout for all pending
337
- const waitStartResult = await (0, summaryGenerator_js_1.raceTimer)(this.summaryWatcher.waitFlushed(), this.pendingAckTimer.start());
330
+ const waitStartResult = await (0, summarizerUtils_js_1.raceTimer)(this.summaryWatcher.waitFlushed(), this.pendingAckTimer.start());
338
331
  this.pendingAckTimer.clear();
339
332
  // Remove pending ack wait timeout by op timestamp comparison, because
340
333
  // it has race conditions with summaries submitted by this same client.
@@ -390,7 +383,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
390
383
  * @param isLastSummary - optional, is the call to this method for a last summary when shutting down the summarizer?
391
384
  * @returns ISummarizeResult - result of running a summary.
392
385
  */
393
- trySummarizeOnce(summarizeProps, options, resultsBuilder = new summaryGenerator_js_1.SummarizeResultBuilder(), isLastSummary = false) {
386
+ trySummarizeOnce(summarizeProps, options, resultsBuilder = new summaryResultBuilder_js_1.SummarizeResultBuilder(), isLastSummary = false) {
394
387
  this.lockedSummaryAction(() => {
395
388
  this.beforeSummaryAction();
396
389
  }, async () => {
@@ -512,7 +505,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
512
505
  // such scenarios are very unlikely and even if it happens, it would resolve when a new summarizer starts over.
513
506
  // For example - When failure switches from one the submit failures to nack failure, only one more retry will
514
507
  // happen irrespective of the value of `defaultMaxAttempts`.
515
- let maxAttempts = exports.defaultMaxAttempts;
508
+ let maxAttempts = summarizer_js_1.defaultMaxAttempts;
516
509
  let currentAttempt = 0;
517
510
  let retryAfterSeconds;
518
511
  let done = false;
@@ -541,7 +534,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
541
534
  // Note: Check "summarySubmitted" result first because if it fails, ack nack would fail as well.
542
535
  const submitSummaryResult = await results.summarySubmitted;
543
536
  maxAttempts = submitSummaryResult.success
544
- ? exports.defaultMaxAttempts
537
+ ? summarizer_js_1.defaultMaxAttempts
545
538
  : this.maxAttemptsForSubmitFailures;
546
539
  // Emit "summarize" event for this failed attempt.
547
540
  status = "failure";
@@ -631,7 +624,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
631
624
  async summarizeOnDemandWithRetries(reason, resultsBuilder) {
632
625
  const results = await this.trySummarizeWithRetries(reason);
633
626
  if (results === undefined) {
634
- resultsBuilder.fail("Summarization was canceled", new summaryGenerator_js_1.RetriableSummaryError("Summarization was canceled"));
627
+ resultsBuilder.fail("Summarization was canceled", new summarizerUtils_js_1.RetriableSummaryError("Summarization was canceled"));
635
628
  return resultsBuilder.build();
636
629
  }
637
630
  const submitResult = await results.summarySubmitted;
@@ -645,9 +638,9 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
645
638
  /**
646
639
  *{@inheritdoc (ISummarizer:interface).summarizeOnDemand}
647
640
  */
648
- summarizeOnDemand(options, resultsBuilder = new summaryGenerator_js_1.SummarizeResultBuilder()) {
641
+ summarizeOnDemand(options, resultsBuilder = new summaryResultBuilder_js_1.SummarizeResultBuilder()) {
649
642
  if (this.stopping) {
650
- resultsBuilder.fail("RunningSummarizer stopped or disposed", new summaryGenerator_js_1.RetriableSummaryError("RunningSummarizer stopped or disposed"));
643
+ resultsBuilder.fail("RunningSummarizer stopped or disposed", new summarizerUtils_js_1.RetriableSummaryError("RunningSummarizer stopped or disposed"));
651
644
  return resultsBuilder.build();
652
645
  }
653
646
  // Check for concurrent summary attempts. If one is found,
@@ -678,7 +671,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
678
671
  return { alreadyEnqueued: true };
679
672
  }
680
673
  // Override existing enqueued summarize attempt.
681
- this.enqueuedSummary.resultsBuilder.fail("Aborted; overridden by another enqueue summarize attempt", new summaryGenerator_js_1.RetriableSummaryError("Summary was overridden by another enqueue summarize attempt"));
674
+ this.enqueuedSummary.resultsBuilder.fail("Aborted; overridden by another enqueue summarize attempt", new summarizerUtils_js_1.RetriableSummaryError("Summary was overridden by another enqueue summarize attempt"));
682
675
  this.enqueuedSummary = undefined;
683
676
  overridden = true;
684
677
  }
@@ -686,7 +679,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
686
679
  reason: `enqueue;${reason}`,
687
680
  afterSequenceNumber,
688
681
  summarizeOptions,
689
- resultsBuilder: new summaryGenerator_js_1.SummarizeResultBuilder(),
682
+ resultsBuilder: new summaryResultBuilder_js_1.SummarizeResultBuilder(),
690
683
  };
691
684
  const results = this.enqueuedSummary.resultsBuilder.build();
692
685
  this.tryRunEnqueuedSummary();
@@ -717,7 +710,7 @@ class RunningSummarizer extends client_utils_1.TypedEventEmitter {
717
710
  }
718
711
  disposeEnqueuedSummary() {
719
712
  if (this.enqueuedSummary !== undefined) {
720
- this.enqueuedSummary.resultsBuilder.fail("RunningSummarizer stopped or disposed", new summaryGenerator_js_1.RetriableSummaryError("RunningSummarizer stopped or disposed"));
713
+ this.enqueuedSummary.resultsBuilder.fail("RunningSummarizer stopped or disposed", new summarizerUtils_js_1.RetriableSummaryError("RunningSummarizer stopped or disposed"));
721
714
  this.enqueuedSummary = undefined;
722
715
  }
723
716
  }