@fluidframework/tree 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/api-report/tree.alpha.api.md +29 -4
  4. package/api-report/tree.beta.api.md +29 -4
  5. package/api-report/tree.legacy.alpha.api.md +29 -4
  6. package/api-report/tree.legacy.public.api.md +29 -4
  7. package/api-report/tree.public.api.md +29 -4
  8. package/dist/alpha.d.ts +1 -0
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/core/forest/editableForest.js +1 -1
  11. package/dist/core/forest/editableForest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/tree/anchorSet.d.ts +2 -5
  16. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  17. package/dist/core/tree/anchorSet.js +1 -151
  18. package/dist/core/tree/anchorSet.js.map +1 -1
  19. package/dist/core/tree/index.d.ts +1 -2
  20. package/dist/core/tree/index.d.ts.map +1 -1
  21. package/dist/core/tree/index.js.map +1 -1
  22. package/dist/core/tree/pathTree.d.ts +0 -11
  23. package/dist/core/tree/pathTree.d.ts.map +1 -1
  24. package/dist/core/tree/pathTree.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  27. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  28. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  29. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  30. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  31. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  32. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  34. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  36. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  40. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  41. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  42. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  43. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  44. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  45. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  46. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  50. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  51. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  52. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  53. package/dist/feature-libraries/optional-field/optionalField.js +7 -3
  54. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  55. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  56. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  57. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  61. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  62. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  63. package/dist/index.d.ts +3 -3
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +4 -4
  66. package/dist/index.js.map +1 -1
  67. package/dist/legacy.d.ts +1 -0
  68. package/dist/packageVersion.d.ts +1 -1
  69. package/dist/packageVersion.js +1 -1
  70. package/dist/packageVersion.js.map +1 -1
  71. package/dist/public.d.ts +1 -0
  72. package/dist/shared-tree/index.d.ts +1 -3
  73. package/dist/shared-tree/index.d.ts.map +1 -1
  74. package/dist/shared-tree/index.js +1 -7
  75. package/dist/shared-tree/index.js.map +1 -1
  76. package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
  77. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  78. package/dist/shared-tree/schematizingTreeView.js +9 -10
  79. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  80. package/dist/shared-tree/sharedTree.d.ts +39 -39
  81. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  82. package/dist/shared-tree/sharedTree.js +81 -52
  83. package/dist/shared-tree/sharedTree.js.map +1 -1
  84. package/dist/shared-tree/treeApi.d.ts +2 -2
  85. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  86. package/dist/shared-tree/treeApi.js +9 -3
  87. package/dist/shared-tree/treeApi.js.map +1 -1
  88. package/dist/shared-tree/treeCheckout.d.ts +3 -3
  89. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  90. package/dist/shared-tree/treeCheckout.js +3 -2
  91. package/dist/shared-tree/treeCheckout.js.map +1 -1
  92. package/dist/shared-tree-core/editManager.js +1 -1
  93. package/dist/shared-tree-core/editManager.js.map +1 -1
  94. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  95. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  96. package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
  97. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  98. package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  99. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  100. package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
  101. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  102. package/dist/shared-tree-core/sharedTreeCore.d.ts +25 -30
  103. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  104. package/dist/shared-tree-core/sharedTreeCore.js +20 -49
  105. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  106. package/dist/simple-tree/api/index.d.ts +3 -2
  107. package/dist/simple-tree/api/index.d.ts.map +1 -1
  108. package/dist/simple-tree/api/index.js +3 -1
  109. package/dist/simple-tree/api/index.js.map +1 -1
  110. package/dist/simple-tree/api/schemaFactory.d.ts +156 -63
  111. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  112. package/dist/simple-tree/api/schemaFactory.js +179 -86
  113. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  114. package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  115. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
  116. package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  117. package/dist/simple-tree/api/tree.d.ts +23 -2
  118. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  119. package/dist/simple-tree/api/tree.js.map +1 -1
  120. package/dist/simple-tree/index.d.ts +1 -1
  121. package/dist/simple-tree/index.d.ts.map +1 -1
  122. package/dist/simple-tree/index.js +3 -2
  123. package/dist/simple-tree/index.js.map +1 -1
  124. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  125. package/dist/simple-tree/schemaTypes.js +1 -1
  126. package/dist/simple-tree/schemaTypes.js.map +1 -1
  127. package/dist/simple-tree/treeNodeValid.js +1 -2
  128. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  129. package/dist/treeFactory.d.ts +16 -5
  130. package/dist/treeFactory.d.ts.map +1 -1
  131. package/dist/treeFactory.js +21 -12
  132. package/dist/treeFactory.js.map +1 -1
  133. package/dist/util/breakable.d.ts +1 -1
  134. package/dist/util/breakable.d.ts.map +1 -1
  135. package/dist/util/breakable.js.map +1 -1
  136. package/dist/util/rangeMap.d.ts +1 -1
  137. package/dist/util/rangeMap.js +1 -1
  138. package/dist/util/rangeMap.js.map +1 -1
  139. package/lib/alpha.d.ts +1 -0
  140. package/lib/beta.d.ts +1 -0
  141. package/lib/core/forest/editableForest.js +1 -1
  142. package/lib/core/forest/editableForest.js.map +1 -1
  143. package/lib/core/index.d.ts +1 -1
  144. package/lib/core/index.d.ts.map +1 -1
  145. package/lib/core/index.js.map +1 -1
  146. package/lib/core/tree/anchorSet.d.ts +2 -5
  147. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  148. package/lib/core/tree/anchorSet.js +1 -151
  149. package/lib/core/tree/anchorSet.js.map +1 -1
  150. package/lib/core/tree/index.d.ts +1 -2
  151. package/lib/core/tree/index.d.ts.map +1 -1
  152. package/lib/core/tree/index.js.map +1 -1
  153. package/lib/core/tree/pathTree.d.ts +0 -11
  154. package/lib/core/tree/pathTree.d.ts.map +1 -1
  155. package/lib/core/tree/pathTree.js.map +1 -1
  156. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  157. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  158. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  159. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  160. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  161. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  162. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  163. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  164. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  165. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  166. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  167. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  168. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  169. package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  170. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  171. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  172. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  173. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  174. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  175. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  176. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  177. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  178. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  179. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  180. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  181. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  182. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  183. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  184. package/lib/feature-libraries/optional-field/optionalField.js +7 -3
  185. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  186. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  187. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  188. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  189. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  190. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  191. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  192. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  193. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  194. package/lib/index.d.ts +3 -3
  195. package/lib/index.d.ts.map +1 -1
  196. package/lib/index.js +3 -3
  197. package/lib/index.js.map +1 -1
  198. package/lib/legacy.d.ts +1 -0
  199. package/lib/packageVersion.d.ts +1 -1
  200. package/lib/packageVersion.js +1 -1
  201. package/lib/packageVersion.js.map +1 -1
  202. package/lib/public.d.ts +1 -0
  203. package/lib/shared-tree/index.d.ts +1 -3
  204. package/lib/shared-tree/index.d.ts.map +1 -1
  205. package/lib/shared-tree/index.js +1 -3
  206. package/lib/shared-tree/index.js.map +1 -1
  207. package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
  208. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  209. package/lib/shared-tree/schematizingTreeView.js +4 -5
  210. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  211. package/lib/shared-tree/sharedTree.d.ts +39 -39
  212. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  213. package/lib/shared-tree/sharedTree.js +79 -50
  214. package/lib/shared-tree/sharedTree.js.map +1 -1
  215. package/lib/shared-tree/treeApi.d.ts +2 -2
  216. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  217. package/lib/shared-tree/treeApi.js +8 -2
  218. package/lib/shared-tree/treeApi.js.map +1 -1
  219. package/lib/shared-tree/treeCheckout.d.ts +3 -3
  220. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  221. package/lib/shared-tree/treeCheckout.js +4 -3
  222. package/lib/shared-tree/treeCheckout.js.map +1 -1
  223. package/lib/shared-tree-core/editManager.js +2 -2
  224. package/lib/shared-tree-core/editManager.js.map +1 -1
  225. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  226. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  227. package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
  228. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  229. package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  230. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  231. package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
  232. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  233. package/lib/shared-tree-core/sharedTreeCore.d.ts +25 -30
  234. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  235. package/lib/shared-tree-core/sharedTreeCore.js +19 -48
  236. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  237. package/lib/simple-tree/api/index.d.ts +3 -2
  238. package/lib/simple-tree/api/index.d.ts.map +1 -1
  239. package/lib/simple-tree/api/index.js +1 -0
  240. package/lib/simple-tree/api/index.js.map +1 -1
  241. package/lib/simple-tree/api/schemaFactory.d.ts +156 -63
  242. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  243. package/lib/simple-tree/api/schemaFactory.js +178 -85
  244. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  245. package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  246. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
  247. package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  248. package/lib/simple-tree/api/tree.d.ts +23 -2
  249. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  250. package/lib/simple-tree/api/tree.js.map +1 -1
  251. package/lib/simple-tree/index.d.ts +1 -1
  252. package/lib/simple-tree/index.d.ts.map +1 -1
  253. package/lib/simple-tree/index.js +1 -1
  254. package/lib/simple-tree/index.js.map +1 -1
  255. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  256. package/lib/simple-tree/schemaTypes.js +1 -1
  257. package/lib/simple-tree/schemaTypes.js.map +1 -1
  258. package/lib/simple-tree/treeNodeValid.js +1 -2
  259. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  260. package/lib/treeFactory.d.ts +16 -5
  261. package/lib/treeFactory.d.ts.map +1 -1
  262. package/lib/treeFactory.js +20 -11
  263. package/lib/treeFactory.js.map +1 -1
  264. package/lib/util/breakable.d.ts +1 -1
  265. package/lib/util/breakable.d.ts.map +1 -1
  266. package/lib/util/breakable.js.map +1 -1
  267. package/lib/util/rangeMap.d.ts +1 -1
  268. package/lib/util/rangeMap.js +1 -1
  269. package/lib/util/rangeMap.js.map +1 -1
  270. package/package.json +21 -21
  271. package/src/core/forest/editableForest.ts +1 -1
  272. package/src/core/index.ts +0 -3
  273. package/src/core/tree/anchorSet.ts +4 -197
  274. package/src/core/tree/index.ts +0 -3
  275. package/src/core/tree/pathTree.ts +0 -13
  276. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  277. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
  278. package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
  279. package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
  280. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
  281. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
  282. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -42
  283. package/src/feature-libraries/optional-field/optionalField.ts +10 -3
  284. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
  285. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
  286. package/src/index.ts +15 -12
  287. package/src/packageVersion.ts +1 -1
  288. package/src/shared-tree/index.ts +3 -19
  289. package/src/shared-tree/schematizingTreeView.ts +18 -16
  290. package/src/shared-tree/sharedTree.ts +203 -100
  291. package/src/shared-tree/treeApi.ts +10 -1
  292. package/src/shared-tree/treeCheckout.ts +11 -8
  293. package/src/shared-tree-core/editManager.ts +2 -2
  294. package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
  295. package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
  296. package/src/shared-tree-core/sharedTreeCore.ts +30 -87
  297. package/src/simple-tree/api/index.ts +15 -0
  298. package/src/simple-tree/api/schemaFactory.ts +203 -89
  299. package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
  300. package/src/simple-tree/api/tree.ts +31 -6
  301. package/src/simple-tree/index.ts +12 -0
  302. package/src/simple-tree/schemaTypes.ts +2 -2
  303. package/src/treeFactory.ts +29 -11
  304. package/src/util/breakable.ts +1 -1
  305. package/src/util/rangeMap.ts +1 -1
  306. package/dist/core/tree/visitPath.d.ts +0 -101
  307. package/dist/core/tree/visitPath.d.ts.map +0 -1
  308. package/dist/core/tree/visitPath.js +0 -7
  309. package/dist/core/tree/visitPath.js.map +0 -1
  310. package/dist/shared-tree/publicContracts.d.ts +0 -18
  311. package/dist/shared-tree/publicContracts.d.ts.map +0 -1
  312. package/dist/shared-tree/publicContracts.js +0 -24
  313. package/dist/shared-tree/publicContracts.js.map +0 -1
  314. package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
  315. package/lib/core/tree/visitPath.d.ts +0 -101
  316. package/lib/core/tree/visitPath.d.ts.map +0 -1
  317. package/lib/core/tree/visitPath.js +0 -6
  318. package/lib/core/tree/visitPath.js.map +0 -1
  319. package/lib/shared-tree/publicContracts.d.ts +0 -18
  320. package/lib/shared-tree/publicContracts.d.ts.map +0 -1
  321. package/lib/shared-tree/publicContracts.js +0 -21
  322. package/lib/shared-tree/publicContracts.js.map +0 -1
  323. package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
  324. package/src/core/tree/visitPath.ts +0 -124
  325. package/src/shared-tree/publicContracts.ts +0 -24
  326. /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
  327. /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"editManager.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,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AAU,GACf,OAAO,QAAQ,KAAK,QAAQ;YAC3B,CAAC,CAAC;gBACA,gFAAgF;gBAChF,mDAAmD;gBACnD,+GAA+G;gBAC/G,cAAc,EAAE,QAAQ;gBACxB,YAAY,EAAE,MAAM,CAAC,iBAAiB;aACtC;YACF,CAAC,CAAC,QAAQ,CAAC;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,QAAQ,CAAC,cAAyB;QACzC,MAAM,eAAe,GAAe;YACnC,cAAc;SACd,CAAC;QACF,MAAM,aAAa,GAAe;YACjC,cAAc,EAAE,KAAK,CAAE,cAAyB,GAAG,CAAC,CAAC;SACrD,CAAC;QAEF,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;CACD;AAUD;;GAEG;AACH,SAAS,eAAe,CACvB,UAAmB,EACnB,cAAuB;IAEvB,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,MAAM,CACL,kBAAkB,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,KAAK,SAAS,EACpE,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseChange,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n} from \"../core/index.js\";\nimport { type Mutable, brand, fail, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport { SharedTreeBranch, type BranchTrimmingEvents, onForkTransitive } from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormat.js\";\nimport {\n\tdecrementSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\tmeasure,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\t/** The \"trunk\" branch. The trunk represents the list of received sequenced changes. */\n\tprivate readonly trunk: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Records extra data associated with commits in the {@link trunk}.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly trunkMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\t/**\n\t * A map from a sequence id to the commit in the {@link trunk} which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tprivate readonly sequenceMap = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Tracks where on the trunk all registered branches are based. Each key is the sequence id of a commit on\n\t * the trunk, and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\t\tthis.sequenceMap.set(minimumPossibleSequenceId, this.trunkBase);\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tthis.trunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(this.localBranch, (fork) => this.registerBranch(fork));\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimTrunk();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimTrunk();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(this.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(\"Expected branch to be related to trunk\");\n\t\tconst sequenceId = this.getCommitSequenceId(trunkCommit);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(this.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(\"Expected branch to be related to trunk\");\n\t\tconst sequenceId = this.getCommitSequenceId(trunkCommit);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(\"Expected branch to be tracked\");\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate fastForwardNextLocalCommit(sequenceId: SequenceId): void {\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here, but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst previousSequenceId = this.getCommitSequenceId(this.trunk.getHead());\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, this.localSessionId);\n\n\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t// Intuitively, this makes sense because:\n\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\tif (currentBranches !== undefined) {\n\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\tfor (const branch of currentBranches) {\n\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\tif (findAncestor(branch.getHead(), (c) => c === firstLocalCommit) !== undefined) {\n\t\t\t\t\tnewBranches.add(branch);\n\t\t\t\t\tcurrentBranches.delete(branch);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\tif (currentBranches.size === 0) {\n\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t}\n\t\t\tif (newBranches.size === 0) {\n\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequence number at which the given commit was sequenced on the trunk, or undefined if the commit is not part of the trunk.\n\t */\n\tpublic getSequenceNumber(trunkCommit: GraphCommit<TChangeset>): SeqNumber | undefined {\n\t\treturn this.trunkMetadata.get(trunkCommit.revision)?.sequenceId.sequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimTrunk = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimTrunk) {\n\t\t\tthis.trimTrunk();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimTrunk(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = decrementSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst [sequenceId, latestEvicted] = this.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tthis.sequenceMap.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted !== this.trunkBase) {\n\t\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\t\tbranch.rebaseOnto(this.trunk, latestEvicted);\n\t\t\t}\n\n\t\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\t\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\t\tthis.trunkMetadata.delete(newTrunkBase.revision);\n\t\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\t\tconst trimmedRevisions: RevisionTag[] = getPathFromBase(\n\t\t\t\tnewTrunkBase,\n\t\t\t\tthis.trunkBase,\n\t\t\t).map((c) => c.revision);\n\t\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\t\tdelete newTrunkBase.parent;\n\t\t\tthis.trunkBase = newTrunkBase;\n\n\t\t\t// Update any state that is derived from trunk commits\n\t\t\tthis.sequenceMap.editRange(minimumPossibleSequenceId, sequenceId, true, (s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.trunkMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newTrunkBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa5e /* Should not access 'change' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa60 /* Should not access 'parent' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), this.trunkBase).length;\n\t\t\tassert(\n\t\t\t\tthis.sequenceMap.size === trunkSize + 1,\n\t\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tthis.trunkMetadata.size === trunkSize,\n\t\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t\t);\n\n\t\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t\t}\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === this.trunkBase &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead() &&\n\t\t\tthis.minimumSequenceNumber === minimumPossibleSequenceNumber\n\t\t);\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChange` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0x428 /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimTrunk();\n\n\t\tlet oldestCommitInCollabWindow = this.getClosestTrunkCommit(this.minimumSequenceNumber)[1];\n\t\tassert(\n\t\t\toldestCommitInCollabWindow.parent !== undefined ||\n\t\t\t\toldestCommitInCollabWindow === this.trunkBase,\n\t\t\t0x8c7 /* Expected oldest commit in collab window to have a parent or be the trunk base */,\n\t\t);\n\n\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\toldestCommitInCollabWindow =\n\t\t\toldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\n\t\tconst trunk = getPathFromBase(this.trunk.getHead(), oldestCommitInCollabWindow).map(\n\t\t\t(c) => {\n\t\t\t\tassert(\n\t\t\t\t\tc !== this.trunkBase,\n\t\t\t\t\t0xa61 /* Serialized trunk should not include the trunk base */,\n\t\t\t\t);\n\t\t\t\tconst metadata =\n\t\t\t\t\tthis.trunkMetadata.get(c.revision) ?? fail(\"Expected metadata for trunk commit\");\n\t\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\t\tchange: c.change,\n\t\t\t\t\trevision: c.revision,\n\t\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t\t};\n\t\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t\t}\n\t\t\t\treturn commit;\n\t\t\t},\n\t\t);\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(\"Expected branch to be based on trunk\");\n\n\t\t\t\tconst base = ancestor === this.trunkBase ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tc !== this.trunkBase,\n\t\t\t\t\t\t\t\t0xa62 /* Serialized branch should not include the trunk base */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\treturn { trunk, peerLocalBranches };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceMap.set(sequenceId, commit);\n\t\t\t\tthis.trunkMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, this.trunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(\"Expected summary branch to be based off of a revision in the trunk\");\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate getCommitSequenceId(trunkCommitOrTrunkBase: GraphCommit<TChangeset>): SequenceId {\n\t\tconst id = this.trunkMetadata.get(trunkCommitOrTrunkBase.revision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\tassert(\n\t\t\t\ttrunkCommitOrTrunkBase === this.trunkBase,\n\t\t\t\t0xa63 /* Commit must be either be on the trunk or be the trunk base */,\n\t\t\t);\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\tpublic getTrunkChanges(): readonly TChangeset[] {\n\t\treturn this.getTrunkCommits().map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.trunk.getHead(), this.trunkBase);\n\t}\n\n\tpublic getTrunkHead(): GraphCommit<TChangeset> {\n\t\treturn this.trunk.getHead();\n\t}\n\n\tpublic getLocalChanges(): readonly TChangeset[] {\n\t\treturn this.getLocalCommits().map((c) => c.change);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * @returns The length of the longest branch maintained by this EditManager.\n\t * This may be the length of a peer branch or the local branch.\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic addSequencedChange(\n\t\tnewCommit: Commit<TChangeset>,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst commitsSequenceNumber = this.getBatch(sequenceNumber);\n\t\tconst sequenceId: SequenceId =\n\t\t\tcommitsSequenceNumber.length === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: commitsSequenceNumber.length,\n\t\t\t\t\t};\n\n\t\tif (newCommit.sessionId === this.localSessionId) {\n\t\t\treturn this.fastForwardNextLocalCommit(sequenceId);\n\t\t}\n\n\t\t// Get the revision that the remote change is based on\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\t// Rebase that branch over the part of the trunk up to the base revision\n\t\t// This will be a no-op if the sending client has not advanced since the last time we received an edit from it\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tnewCommit.sessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the branch is fully caught up and empty after being rebased, then push to the trunk directly\n\t\t\tthis.pushCommitToTrunk(sequenceId, newCommit);\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.\n\t\t\tconst { duration, output: newChangeFullyRebased } = measure(() =>\n\t\t\t\trebaseChange(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tnewCommit,\n\t\t\t\t\tpeerLocalBranch.getHead(),\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tthis.telemetryEventBatcher?.accumulateAndLog({\n\t\t\t\tduration,\n\t\t\t\t...newChangeFullyRebased.telemetryProperties,\n\t\t\t});\n\n\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\tthis.pushCommitToTrunk(sequenceId, {\n\t\t\t\t...newCommit,\n\t\t\t\tchange: newChangeFullyRebased.change,\n\t\t\t});\n\t\t}\n\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic findLocalCommit(\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tthis.sequenceMap.set(sequenceId, trunkHead);\n\t\tthis.trunkMetadata.set(trunkHead.revision, { sequenceId, sessionId });\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tprivate getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tprivate getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tprivate getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceMap.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate getBatch(sequenceNumber: SeqNumber): [SequenceId, GraphCommit<TChangeset>][] {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceMap.getRange(startSequenceId, endSequenceId, false);\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * @returns the path from the base of a branch to its head\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n"]}
1
+ {"version":3,"file":"editManager.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAKN,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,YAAY,EAEZ,SAAS,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAA6B,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ5F,OAAO,EACN,iCAAiC,EACjC,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,oBAAoB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,qBAAqB,EACrB,OAAO,GAEP,MAAM,0CAA0C,CAAC;AAElD,MAAM,CAAC,MAAM,6BAA6B,GAAc,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACvF,MAAM,yBAAyB,GAAe;IAC7C,cAAc,EAAE,6BAA6B;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,MAAqC,CAAC;AAE3D;;GAEG;AACH,MAAM,8BAA8B,GAAG,IAAI,CAAC;AA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AAE,cAAc,CAAC,KAAK,SAAS,EACpE,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { BTree } from \"@tylerbu/sorted-btree-es6\";\n\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseChange,\n\ttype RebaseStatsWithDuration,\n\ttagChange,\n} from \"../core/index.js\";\nimport { type Mutable, brand, fail, getOrCreate, mapIterable } from \"../util/index.js\";\n\nimport { SharedTreeBranch, type BranchTrimmingEvents, onForkTransitive } from \"./branch.js\";\nimport type {\n\tCommit,\n\tSeqNumber,\n\tSequenceId,\n\tSequencedCommit,\n\tSummarySessionBranch,\n} from \"./editManagerFormat.js\";\nimport {\n\tgetUpperBoundOfPreviousSequenceId,\n\tequalSequenceIds,\n\tmaxSequenceId,\n\tminSequenceId,\n\tsequenceIdComparator,\n} from \"./sequenceIdUtils.js\";\nimport {\n\tTelemetryEventBatcher,\n\tmeasure,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport const minimumPossibleSequenceNumber: SeqNumber = brand(Number.MIN_SAFE_INTEGER);\nconst minimumPossibleSequenceId: SequenceId = {\n\tsequenceNumber: minimumPossibleSequenceNumber,\n};\n\n/**\n * A special revision tag for the initial {@link EditManager.trunkBase} commit.\n * @remarks This tag is used to supply the _initial_ trunk base with a known revision.\n * The trunk base may advance over time, after which point the trunk base will have a different revision.\n * When {@link EditManager.getSummaryData | serializing} and deserializing, peer branches that include the trunk base commit in their history will always use this tag.\n */\nconst rootRevision = \"root\" as const satisfies RevisionTag;\n\n/**\n * Max number of telemetry log call that may be aggregated before being sent.\n */\nconst maxRebaseStatsAggregationCount = 1000;\n\n/**\n * Represents a local branch of a document and interprets the effect on the document of adding sequenced changes,\n * which were based on a given session's branch, to the document history\n */\n// TODO: Try to reduce this to a single type parameter\nexport class EditManager<\n\tTEditor extends ChangeFamilyEditor,\n\tTChangeset,\n\tTChangeFamily extends ChangeFamily<TEditor, TChangeset>,\n> {\n\tprivate readonly _events = createEmitter<BranchTrimmingEvents>();\n\n\t/** The \"trunk\" branch. The trunk represents the list of received sequenced changes. */\n\tprivate readonly trunk: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Records extra data associated with commits in the {@link trunk}.\n\t * This does not include an entry for the {@link trunkBase}.\n\t */\n\tprivate readonly trunkMetadata = new Map<\n\t\tRevisionTag,\n\t\t{ sequenceId: SequenceId; sessionId: SessionId }\n\t>();\n\t/**\n\t * A map from a sequence id to the commit in the {@link trunk} which has that sequence id.\n\t * This also includes an entry for the {@link trunkBase} which always has the lowest key in the map.\n\t */\n\tprivate readonly sequenceMap = new BTree<SequenceId, GraphCommit<TChangeset>>(\n\t\tundefined,\n\t\tsequenceIdComparator,\n\t);\n\n\t/**\n\t * Branches are maintained to represent the local change list that the issuing client had\n\t * at the time of submitting the latest known edit on the branch.\n\t * This means the head commit of each branch is always in its original (non-rebased) form.\n\t */\n\tprivate readonly peerLocalBranches: Map<SessionId, SharedTreeBranch<TEditor, TChangeset>> =\n\t\tnew Map();\n\n\t/**\n\t * This branch holds the changes made by this client which have not yet been confirmed as sequenced changes.\n\t */\n\tpublic readonly localBranch: SharedTreeBranch<TEditor, TChangeset>;\n\n\t/**\n\t * Tracks where on the trunk all registered branches are based. Each key is the sequence id of a commit on\n\t * the trunk, and the value is the set of all branches who have that commit as their common ancestor with the trunk.\n\t *\n\t * @remarks\n\t * This does not include the local branch.\n\t */\n\tprivate readonly trunkBranches = new BTree<\n\t\tSequenceId,\n\t\tSet<SharedTreeBranch<TEditor, TChangeset>>\n\t>(undefined, sequenceIdComparator);\n\n\t/**\n\t * The sequence number of the newest commit on the trunk that has been received by all peers.\n\t * Defaults to {@link minimumPossibleSequenceNumber} if no commits have been received.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tprivate minimumSequenceNumber = minimumPossibleSequenceNumber;\n\n\t/**\n\t * A special commit that is a \"base\" (tail) of the trunk, though not part of the trunk itself.\n\t * This makes it possible to model the trunk in the same way as any other branch (it branches off of a base commit)\n\t * which allows it to use branching APIs to interact with the other branches.\n\t * Each time trunk eviction occurs, the most recent evicted commit becomes the new `trunkBase`.\n\t */\n\tprivate trunkBase: GraphCommit<TChangeset>;\n\n\t/**\n\t * The list of commits (from oldest to most recent) that are on the local branch but not on the trunk.\n\t * When a local commit is sequenced, the first commit in this list shifted onto the tip of the trunk.\n\t */\n\tprivate readonly localCommits: GraphCommit<TChangeset>[] = [];\n\n\tprivate readonly telemetryEventBatcher:\n\t\t| TelemetryEventBatcher<keyof RebaseStatsWithDuration>\n\t\t| undefined;\n\n\t/**\n\t * @param changeFamily - the change family of changes on the trunk and local branch\n\t * @param localSessionId - the id of the local session that will be used for local commits\n\t */\n\tpublic constructor(\n\t\tpublic readonly changeFamily: TChangeFamily,\n\t\tpublic readonly localSessionId: SessionId,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tlogger?: ITelemetryLoggerExt,\n\t) {\n\t\tthis.trunkBase = {\n\t\t\trevision: rootRevision,\n\t\t\tchange: changeFamily.rebaser.compose([]),\n\t\t};\n\t\tthis.sequenceMap.set(minimumPossibleSequenceId, this.trunkBase);\n\n\t\tif (logger !== undefined) {\n\t\t\tthis.telemetryEventBatcher = new TelemetryEventBatcher(\n\t\t\t\t{\n\t\t\t\t\teventName: \"rebaseProcessing\",\n\t\t\t\t\tcategory: \"performance\",\n\t\t\t\t},\n\t\t\t\tlogger,\n\t\t\t\tmaxRebaseStatsAggregationCount,\n\t\t\t);\n\t\t}\n\n\t\tthis.trunk = new SharedTreeBranch(\n\t\t\tthis.trunkBase,\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\t\tthis.localBranch = new SharedTreeBranch(\n\t\t\tthis.trunk.getHead(),\n\t\t\tchangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis._events,\n\t\t\tthis.telemetryEventBatcher,\n\t\t);\n\n\t\tthis.localBranch.events.on(\"afterChange\", (event) => {\n\t\t\tif (event.type === \"append\") {\n\t\t\t\tfor (const commit of event.newCommits) {\n\t\t\t\t\tthis.localCommits.push(commit);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.localCommits.length = 0;\n\t\t\t\tfindCommonAncestor(\n\t\t\t\t\t[this.localBranch.getHead(), this.localCommits],\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\t// Track all forks of the local branch for purposes of trunk eviction. Unlike the local branch, they have\n\t\t// an unknown lifetime and rebase frequency, so we can not make any assumptions about which trunk commits\n\t\t// they require and therefore we monitor them explicitly.\n\t\tonForkTransitive(this.localBranch, (fork) => this.registerBranch(fork));\n\t}\n\n\t/**\n\t * Make the given branch known to the `EditManager`. The `EditManager` will ensure that all registered\n\t * branches remain usable even as the minimum sequence number advances.\n\t *\n\t * TODO#AB6926: Refactor local branch management into a separate class that encapsulates `trunkBranches` and everything\n\t * that touches it.\n\t * TODO#AB6925: Maintain the divergence point between each branch and the trunk so that we don't have to recompute\n\t * it so often.\n\t */\n\tprivate registerBranch(branch: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tthis.trackBranch(branch);\n\t\t// Whenever the branch is rebased, update our record of its base trunk commit\n\t\tconst offBeforeRebase = branch.events.on(\"beforeChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.untrackBranch(branch);\n\t\t\t}\n\t\t});\n\t\tconst offAfterRebase = branch.events.on(\"afterChange\", (args) => {\n\t\t\tif (args.type === \"rebase\") {\n\t\t\t\tthis.trackBranch(branch);\n\t\t\t\tthis.trimTrunk();\n\t\t\t}\n\t\t});\n\t\t// When the branch is disposed, update our branch set and trim the trunk\n\t\tconst offDispose = branch.events.on(\"dispose\", () => {\n\t\t\tthis.untrackBranch(branch);\n\t\t\tthis.trimTrunk();\n\t\t\toffBeforeRebase();\n\t\t\toffAfterRebase();\n\t\t\toffDispose();\n\t\t});\n\t}\n\n\tprivate trackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(this.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(\"Expected branch to be related to trunk\");\n\t\tconst sequenceId = this.getCommitSequenceId(trunkCommit);\n\t\tconst branches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\n\t\tassert(!branches.has(b), 0x670 /* Branch was registered more than once */);\n\t\tbranches.add(b);\n\t}\n\n\tprivate untrackBranch(b: SharedTreeBranch<TEditor, TChangeset>): void {\n\t\tconst trunkCommit =\n\t\t\tfindCommonAncestor(this.trunk.getHead(), b.getHead()) ??\n\t\t\tfail(\"Expected branch to be related to trunk\");\n\t\tconst sequenceId = this.getCommitSequenceId(trunkCommit);\n\t\tconst branches =\n\t\t\tthis.trunkBranches.get(sequenceId) ?? fail(\"Expected branch to be tracked\");\n\n\t\tassert(branches.delete(b), 0x671 /* Expected branch to be tracked */);\n\t\tif (branches.size === 0) {\n\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t}\n\t}\n\n\t/**\n\t * Promote the oldest un-sequenced commit on the local branch to the head of the trunk.\n\t * @param sequenceId - The sequence id of the new trunk commit\n\t * @remarks This method is a performance optimization for the scenario where this client receives its own change back after sequencing.\n\t * The normal (not optimized) process in this case would be to apply the new sequenced commit to the trunk and then rebase the local branch over the trunk.\n\t * The first commit will be \"the same\" (as in, it will have the same revision) as the commit that was just sequenced, so the rebase will be a no-op.\n\t * Because the rebase is a no-op, we can skip it entirely and simply remove the commit from the local branch and append it to the trunk.\n\t * Avoiding the overhead of the rebase process, even when it's a no-op, has real measured performance benefits and is worth the added complexity here.\n\t */\n\tprivate fastForwardNextLocalCommit(sequenceId: SequenceId): void {\n\t\t// First, push the local commit to the trunk.\n\t\t// We are mutating our `localCommits` cache here, but there is no need to actually change the `localBranch` itself because it will simply catch up later if/when it next rebases.\n\t\tconst firstLocalCommit = this.localCommits.shift();\n\t\tassert(\n\t\t\tfirstLocalCommit !== undefined,\n\t\t\t0x6b5 /* Received a sequenced change from the local session despite having no local changes */,\n\t\t);\n\n\t\tconst previousSequenceId = this.getCommitSequenceId(this.trunk.getHead());\n\t\tthis.pushGraphCommitToTrunk(sequenceId, firstLocalCommit, this.localSessionId);\n\n\t\t// Next, we need to update the sequence IDs that our local branches (user's branches, not peer branches) are associated with.\n\t\t// In particular, if a local branch is based on the previous trunk head (the branch's first ancestor in the trunk is the commit that was the head before we pushed the new commit)\n\t\t// and also branches off of the local branch (it has an ancestor that is part of the local branch), it needs to have its sequence number advanced to be that of the new trunk head.\n\t\t// Intuitively, this makes sense because:\n\t\t// 1. The trunk's head just advanced forward by some (sequence) amount.\n\t\t// 2. The local branch is always rebased to be branching off of the head of the trunk (not literally in this case, because of the optimization, but in effect).\n\t\t// 3. Therefore, the entire local branch just advanced forward by some (sequence) amount, and any commits downstream of it which track the sequence numbers of their base commits on the trunk should also advance.\n\t\t// This update is not necessarily required for all local branches, since some may have fallen behind the local branch and are based on older trunk commits (such branches do not need updating).\n\t\tconst currentBranches = this.trunkBranches.get(previousSequenceId);\n\t\tif (currentBranches !== undefined) {\n\t\t\tconst newBranches = getOrCreate(this.trunkBranches, sequenceId, () => new Set());\n\t\t\tfor (const branch of currentBranches) {\n\t\t\t\t// Check every branch associated with the old sequence ID and advance it if it is based on the local branch (specifically, on the local branch as it was before we pushed its first commit to the trunk).\n\t\t\t\t// We validate this by checking if the branch's head is a descendant of the local commit that we just pushed.\n\t\t\t\tif (findAncestor(branch.getHead(), (c) => c === firstLocalCommit) !== undefined) {\n\t\t\t\t\tnewBranches.add(branch);\n\t\t\t\t\tcurrentBranches.delete(branch);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Clean up our trunk branches map by removing any empty sets.\n\t\t\tif (currentBranches.size === 0) {\n\t\t\t\tthis.trunkBranches.delete(previousSequenceId);\n\t\t\t}\n\t\t\tif (newBranches.size === 0) {\n\t\t\t\tthis.trunkBranches.delete(sequenceId);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Return the sequence number at which the given commit was sequenced on the trunk, or undefined if the commit is not part of the trunk.\n\t */\n\tpublic getSequenceNumber(trunkCommit: GraphCommit<TChangeset>): SeqNumber | undefined {\n\t\treturn this.trunkMetadata.get(trunkCommit.revision)?.sequenceId.sequenceNumber;\n\t}\n\n\t/**\n\t * Advances the minimum sequence number, and removes all commits from the trunk which lie outside the collaboration window,\n\t * if they are not retained by revertibles or local branches.\n\t * @param minimumSequenceNumber - the sequence number of the newest commit that all peers (including this one) have received and applied to their trunks.\n\t *\n\t * @remarks If there are more than one commit with the same sequence number we assume this refers to the last commit in the batch.\n\t */\n\tpublic advanceMinimumSequenceNumber(\n\t\tminimumSequenceNumber: SeqNumber,\n\t\ttrimTrunk = true,\n\t): void {\n\t\tif (minimumSequenceNumber === this.minimumSequenceNumber) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tminimumSequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x476 /* number must be larger or equal to current minimumSequenceNumber. */,\n\t\t);\n\n\t\tthis.minimumSequenceNumber = minimumSequenceNumber;\n\t\tif (trimTrunk) {\n\t\t\tthis.trimTrunk();\n\t\t}\n\t}\n\n\t/**\n\t * Examines the latest known minimum sequence number and the trunk bases of any registered branches to determine\n\t * if any commits on the trunk are unreferenced and unneeded for future computation; those found are evicted from the trunk.\n\t */\n\tprivate trimTrunk(): void {\n\t\t/** The sequence id of the most recent commit on the trunk that will be trimmed */\n\t\tlet trunkTailSequenceId: SequenceId = {\n\t\t\tsequenceNumber: this.minimumSequenceNumber,\n\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t};\n\t\t// If there are any outstanding registered branches, get the one that is the oldest (has the \"most behind\" trunk base)\n\t\tconst minimumBranchBaseSequenceId = this.trunkBranches.minKey();\n\t\tif (minimumBranchBaseSequenceId !== undefined) {\n\t\t\t// If that branch is behind the minimum sequence id, we only want to evict commits older than it,\n\t\t\t// even if those commits are behind the minimum sequence id\n\t\t\tconst sequenceIdBeforeMinimumBranchBase = getUpperBoundOfPreviousSequenceId(\n\t\t\t\tminimumBranchBaseSequenceId,\n\t\t\t);\n\t\t\ttrunkTailSequenceId = minSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tsequenceIdBeforeMinimumBranchBase,\n\t\t\t);\n\t\t}\n\n\t\tconst [sequenceId, latestEvicted] = this.getClosestTrunkCommit(\n\t\t\tmaxSequenceId(\n\t\t\t\ttrunkTailSequenceId,\n\t\t\t\tthis.sequenceMap.minKey() ?? minimumPossibleSequenceId,\n\t\t\t),\n\t\t);\n\n\t\t// Don't do any work if the commit found by the search is already the tail of the trunk\n\t\tif (latestEvicted !== this.trunkBase) {\n\t\t\t// The minimum sequence number informs us that all peer branches are at least caught up to the tail commit,\n\t\t\t// so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.\n\t\t\tfor (const [, branch] of this.peerLocalBranches) {\n\t\t\t\tbranch.rebaseOnto(this.trunk, latestEvicted);\n\t\t\t}\n\n\t\t\t// This mutation is a performance hack. If commits are truly immutable, then changing the trunk's tail requires\n\t\t\t// regenerating the entire commit graph. Instead, we can simply chop off the tail like this if we're certain\n\t\t\t// that there are no outstanding references to any of the commits being removed (other than the references via\n\t\t\t// the trunk). The peer branches have been rebased to the head of the trunk, the local branch is already rebased\n\t\t\t// to the head of the trunk, and all other branches are tracked by `trunkBranches` and known to be ahead of or at\n\t\t\t// `newTrunkBase`. Therefore, no branches should have unique references to any of the commits being evicted here.\n\t\t\t// We mutate the most recent of the evicted commits to become the new trunk base. That way, any other commits that\n\t\t\t// have parent pointers to the latest evicted commit will stay linked, even though that it is no longer part of the trunk.\n\t\t\tconst newTrunkBase = latestEvicted as Mutable<typeof latestEvicted>;\n\t\t\t// The metadata for new trunk base revision needs to be deleted before modifying it.\n\t\t\tthis.trunkMetadata.delete(newTrunkBase.revision);\n\t\t\t// collect the revisions that will be trimmed to send as part of the branch trimmed event\n\t\t\tconst trimmedRevisions: RevisionTag[] = getPathFromBase(\n\t\t\t\tnewTrunkBase,\n\t\t\t\tthis.trunkBase,\n\t\t\t).map((c) => c.revision);\n\t\t\t// Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.\n\t\t\tdelete newTrunkBase.parent;\n\t\t\tthis.trunkBase = newTrunkBase;\n\n\t\t\t// Update any state that is derived from trunk commits\n\t\t\tthis.sequenceMap.editRange(minimumPossibleSequenceId, sequenceId, true, (s, commit) => {\n\t\t\t\t// Cleanup look-aside data for each evicted commit\n\t\t\t\tthis.trunkMetadata.delete(commit.revision);\n\t\t\t\t// Delete all evicted commits from `sequenceMap` except for the latest one, which is the new `trunkBase`\n\t\t\t\tif (equalSequenceIds(s, sequenceId)) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcommit === newTrunkBase,\n\t\t\t\t\t\t0x729 /* Expected last evicted commit to be new trunk base */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tReflect.defineProperty(commit, \"change\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa5e /* Should not access 'change' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\tReflect.defineProperty(commit, \"revision\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa5f /* Should not access 'revision' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\tReflect.defineProperty(commit, \"parent\", {\n\t\t\t\t\t\tget: () =>\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t0xa60 /* Should not access 'parent' property of an evicted commit */,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t\treturn { delete: true };\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst trunkSize = getPathFromBase(this.trunk.getHead(), this.trunkBase).length;\n\t\t\tassert(\n\t\t\t\tthis.sequenceMap.size === trunkSize + 1,\n\t\t\t\t0x744 /* The size of the sequenceMap must have one element more than the trunk */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tthis.trunkMetadata.size === trunkSize,\n\t\t\t\t0x745 /* The size of the trunkMetadata must be the same as the trunk */,\n\t\t\t);\n\n\t\t\tthis._events.emit(\"ancestryTrimmed\", trimmedRevisions);\n\t\t}\n\t}\n\n\tpublic isEmpty(): boolean {\n\t\treturn (\n\t\t\tthis.trunk.getHead() === this.trunkBase &&\n\t\t\tthis.peerLocalBranches.size === 0 &&\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead() &&\n\t\t\tthis.minimumSequenceNumber === minimumPossibleSequenceNumber\n\t\t);\n\t}\n\n\tpublic getSummaryData(): SummaryData<TChangeset> {\n\t\t// The assert below is acceptable at present because summarization only ever occurs on a client with no\n\t\t// local/in-flight changes.\n\t\t// In the future we may wish to relax this constraint. For that to work, the current implementation of\n\t\t// `EditManager` would have to be amended in one of two ways:\n\t\t// A) Changes made by the local session should be represented by a branch in `EditManager.branches`.\n\t\t// B) The contents of such a branch should be computed on demand based on the trunk.\n\t\t// Note that option (A) would be a simple change to `addSequencedChange` whereas (B) would likely require\n\t\t// rebasing trunk changes over the inverse of trunk changes.\n\t\tassert(\n\t\t\tthis.localBranch.getHead() === this.trunk.getHead(),\n\t\t\t0x428 /* Clients with local changes cannot be used to generate summaries */,\n\t\t);\n\n\t\t// Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.\n\t\tthis.trimTrunk();\n\n\t\tlet oldestCommitInCollabWindow = this.getClosestTrunkCommit(this.minimumSequenceNumber)[1];\n\t\tassert(\n\t\t\toldestCommitInCollabWindow.parent !== undefined ||\n\t\t\t\toldestCommitInCollabWindow === this.trunkBase,\n\t\t\t0x8c7 /* Expected oldest commit in collab window to have a parent or be the trunk base */,\n\t\t);\n\n\t\t// Path construction is exclusive, so we need to use the parent of the oldest commit in the window if it exists\n\t\toldestCommitInCollabWindow =\n\t\t\toldestCommitInCollabWindow.parent ?? oldestCommitInCollabWindow;\n\n\t\tconst trunk = getPathFromBase(this.trunk.getHead(), oldestCommitInCollabWindow).map(\n\t\t\t(c) => {\n\t\t\t\tassert(\n\t\t\t\t\tc !== this.trunkBase,\n\t\t\t\t\t0xa61 /* Serialized trunk should not include the trunk base */,\n\t\t\t\t);\n\t\t\t\tconst metadata =\n\t\t\t\t\tthis.trunkMetadata.get(c.revision) ?? fail(\"Expected metadata for trunk commit\");\n\t\t\t\tconst commit: SequencedCommit<TChangeset> = {\n\t\t\t\t\tchange: c.change,\n\t\t\t\t\trevision: c.revision,\n\t\t\t\t\tsequenceNumber: metadata.sequenceId.sequenceNumber,\n\t\t\t\t\tsessionId: metadata.sessionId,\n\t\t\t\t};\n\t\t\t\tif (metadata.sequenceId.indexInBatch !== undefined) {\n\t\t\t\t\tcommit.indexInBatch = metadata.sequenceId.indexInBatch;\n\t\t\t\t}\n\t\t\t\treturn commit;\n\t\t\t},\n\t\t);\n\n\t\tconst peerLocalBranches = new Map<SessionId, SummarySessionBranch<TChangeset>>(\n\t\t\tmapIterable(this.peerLocalBranches.entries(), ([sessionId, branch]) => {\n\t\t\t\tconst branchPath: GraphCommit<TChangeset>[] = [];\n\t\t\t\tconst ancestor =\n\t\t\t\t\tfindCommonAncestor([branch.getHead(), branchPath], this.trunk.getHead()) ??\n\t\t\t\t\tfail(\"Expected branch to be based on trunk\");\n\n\t\t\t\tconst base = ancestor === this.trunkBase ? rootRevision : ancestor.revision;\n\t\t\t\treturn [\n\t\t\t\t\tsessionId,\n\t\t\t\t\t{\n\t\t\t\t\t\tbase,\n\t\t\t\t\t\tcommits: branchPath.map((c) => {\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tc !== this.trunkBase,\n\t\t\t\t\t\t\t\t0xa62 /* Serialized branch should not include the trunk base */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst commit: Commit<TChangeset> = {\n\t\t\t\t\t\t\t\tchange: c.change,\n\t\t\t\t\t\t\t\trevision: c.revision,\n\t\t\t\t\t\t\t\tsessionId,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn commit;\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t}),\n\t\t);\n\n\t\treturn { trunk, peerLocalBranches };\n\t}\n\n\tpublic loadSummaryData(data: SummaryData<TChangeset>): void {\n\t\tassert(\n\t\t\tthis.isEmpty(),\n\t\t\t0x68a /* Attempted to load from summary after edit manager was already mutated */,\n\t\t);\n\t\t// Record the tags of each trunk commit as we generate the trunk so they can be looked up quickly\n\t\t// when hydrating the peer branches below\n\t\tconst trunkRevisionCache = new Map<RevisionTag, GraphCommit<TChangeset>>();\n\t\ttrunkRevisionCache.set(this.trunkBase.revision, this.trunkBase);\n\t\tthis.trunk.setHead(\n\t\t\tdata.trunk.reduce((base, c) => {\n\t\t\t\tconst sequenceId: SequenceId =\n\t\t\t\t\tc.indexInBatch === undefined\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tsequenceNumber: c.sequenceNumber,\n\t\t\t\t\t\t\t\tindexInBatch: c.indexInBatch,\n\t\t\t\t\t\t\t};\n\t\t\t\tconst commit = mintCommit(base, c);\n\t\t\t\tthis.sequenceMap.set(sequenceId, commit);\n\t\t\t\tthis.trunkMetadata.set(c.revision, {\n\t\t\t\t\tsequenceId,\n\t\t\t\t\tsessionId: c.sessionId,\n\t\t\t\t});\n\t\t\t\ttrunkRevisionCache.set(c.revision, commit);\n\t\t\t\treturn commit;\n\t\t\t}, this.trunkBase),\n\t\t);\n\n\t\tthis.localBranch.setHead(this.trunk.getHead());\n\n\t\tfor (const [sessionId, branch] of data.peerLocalBranches) {\n\t\t\tconst commit =\n\t\t\t\ttrunkRevisionCache.get(branch.base) ??\n\t\t\t\tfail(\"Expected summary branch to be based off of a revision in the trunk\");\n\n\t\t\tthis.peerLocalBranches.set(\n\t\t\t\tsessionId,\n\t\t\t\tnew SharedTreeBranch(\n\t\t\t\t\tbranch.commits.reduce(mintCommit, commit),\n\t\t\t\t\tthis.changeFamily,\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate getCommitSequenceId(trunkCommitOrTrunkBase: GraphCommit<TChangeset>): SequenceId {\n\t\tconst id = this.trunkMetadata.get(trunkCommitOrTrunkBase.revision)?.sequenceId;\n\t\tif (id === undefined) {\n\t\t\tassert(\n\t\t\t\ttrunkCommitOrTrunkBase === this.trunkBase,\n\t\t\t\t0xa63 /* Commit must be either be on the trunk or be the trunk base */,\n\t\t\t);\n\t\t\treturn minimumPossibleSequenceId;\n\t\t}\n\t\treturn id;\n\t}\n\n\tpublic getTrunkChanges(): readonly TChangeset[] {\n\t\treturn this.getTrunkCommits().map((c) => c.change);\n\t}\n\n\tpublic getTrunkCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn getPathFromBase(this.trunk.getHead(), this.trunkBase);\n\t}\n\n\tpublic getTrunkHead(): GraphCommit<TChangeset> {\n\t\treturn this.trunk.getHead();\n\t}\n\n\tpublic getLocalChanges(): readonly TChangeset[] {\n\t\treturn this.getLocalCommits().map((c) => c.change);\n\t}\n\n\tpublic getLocalCommits(): readonly GraphCommit<TChangeset>[] {\n\t\treturn this.localCommits;\n\t}\n\n\t/**\n\t * @returns The length of the longest branch maintained by this EditManager.\n\t * This may be the length of a peer branch or the local branch.\n\t * The length is counted from the lowest common ancestor with the trunk such that a fully sequenced branch would\n\t * have length zero.\n\t */\n\tpublic getLongestBranchLength(): number {\n\t\tlet max = 0;\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tfor (const branch of this.peerLocalBranches.values()) {\n\t\t\tconst branchPath = getPathFromBase(branch.getHead(), trunkHead);\n\t\t\tif (branchPath.length > max) {\n\t\t\t\tmax = branchPath.length;\n\t\t\t}\n\t\t}\n\t\tconst localPath = getPathFromBase(this.localBranch.getHead(), trunkHead);\n\t\treturn Math.max(max, localPath.length);\n\t}\n\n\tpublic addSequencedChange(\n\t\tnewCommit: Commit<TChangeset>,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t): void {\n\t\tassert(\n\t\t\tsequenceNumber > this.minimumSequenceNumber,\n\t\t\t0x713 /* Expected change sequence number to exceed the last known minimum sequence number */,\n\t\t);\n\n\t\tassert(\n\t\t\tsequenceNumber >= // This is \">=\", not \">\" because changes in the same batch will have the same sequence number\n\t\t\t\t(this.sequenceMap.maxKey()?.sequenceNumber ?? minimumPossibleSequenceNumber),\n\t\t\t0xa64 /* Attempted to sequence change with an outdated sequence number */,\n\t\t);\n\n\t\tconst commitsSequenceNumber = this.getBatch(sequenceNumber);\n\t\tconst sequenceId: SequenceId =\n\t\t\tcommitsSequenceNumber.length === 0\n\t\t\t\t? {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\tindexInBatch: commitsSequenceNumber.length,\n\t\t\t\t\t};\n\n\t\tif (newCommit.sessionId === this.localSessionId) {\n\t\t\treturn this.fastForwardNextLocalCommit(sequenceId);\n\t\t}\n\n\t\t// Get the revision that the remote change is based on\n\t\tconst [, baseRevisionInTrunk] = this.getClosestTrunkCommit(referenceSequenceNumber);\n\t\t// Rebase that branch over the part of the trunk up to the base revision\n\t\t// This will be a no-op if the sending client has not advanced since the last time we received an edit from it\n\t\tconst peerLocalBranch = getOrCreate(\n\t\t\tthis.peerLocalBranches,\n\t\t\tnewCommit.sessionId,\n\t\t\t() => new SharedTreeBranch(baseRevisionInTrunk, this.changeFamily, this.mintRevisionTag),\n\t\t);\n\t\tpeerLocalBranch.rebaseOnto(this.trunk, baseRevisionInTrunk);\n\n\t\tif (peerLocalBranch.getHead() === this.trunk.getHead()) {\n\t\t\t// If the branch is fully caught up and empty after being rebased, then push to the trunk directly\n\t\t\tthis.pushCommitToTrunk(sequenceId, newCommit);\n\t\t\tpeerLocalBranch.setHead(this.trunk.getHead());\n\t\t} else {\n\t\t\t// Otherwise, rebase the change over the trunk and append it, and append the original change to the peer branch.\n\t\t\tconst { duration, output: newChangeFullyRebased } = measure(() =>\n\t\t\t\trebaseChange(\n\t\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\t\tnewCommit,\n\t\t\t\t\tpeerLocalBranch.getHead(),\n\t\t\t\t\tthis.trunk.getHead(),\n\t\t\t\t\tthis.mintRevisionTag,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tthis.telemetryEventBatcher?.accumulateAndLog({\n\t\t\t\tduration,\n\t\t\t\t...newChangeFullyRebased.telemetryProperties,\n\t\t\t});\n\n\t\t\tpeerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));\n\t\t\tthis.pushCommitToTrunk(sequenceId, {\n\t\t\t\t...newCommit,\n\t\t\t\tchange: newChangeFullyRebased.change,\n\t\t\t});\n\t\t}\n\n\t\tthis.localBranch.rebaseOnto(this.trunk);\n\t}\n\n\tpublic findLocalCommit(\n\t\trevision: RevisionTag,\n\t): [commit: GraphCommit<TChangeset>, commitsAfter: GraphCommit<TChangeset>[]] {\n\t\tconst commits: GraphCommit<TChangeset>[] = [];\n\t\tconst commit = findAncestor(\n\t\t\t[this.localBranch.getHead(), commits],\n\t\t\t(c) => c.revision === revision,\n\t\t);\n\t\tassert(commit !== undefined, 0x599 /* Expected local branch to contain revision */);\n\t\treturn [commit, commits];\n\t}\n\n\tprivate pushCommitToTrunk(sequenceId: SequenceId, commit: Commit<TChangeset>): void {\n\t\tconst mintedCommit = mintCommit(this.trunk.getHead(), commit);\n\t\tthis.pushGraphCommitToTrunk(sequenceId, mintedCommit, commit.sessionId);\n\t}\n\n\tprivate pushGraphCommitToTrunk(\n\t\tsequenceId: SequenceId,\n\t\tgraphCommit: GraphCommit<TChangeset>,\n\t\tsessionId: SessionId,\n\t): void {\n\t\tthis.trunk.setHead(graphCommit);\n\t\tconst trunkHead = this.trunk.getHead();\n\t\tthis.sequenceMap.set(sequenceId, trunkHead);\n\t\tthis.trunkMetadata.set(trunkHead.revision, { sequenceId, sessionId });\n\t}\n\n\t/**\n\t * Finds the most recent trunk commit that was sequenced at or before the given point.\n\t * @param searchBy - the sequence number or the sequence id to search for\n\t * @remarks Fails if there is no eligible commit.\n\t * @returns the closest commit and its sequence id\n\t */\n\tprivate getClosestTrunkCommit(searchBy: SeqNumber): [SequenceId, GraphCommit<TChangeset>];\n\tprivate getClosestTrunkCommit(searchBy: SequenceId): [SequenceId, GraphCommit<TChangeset>];\n\tprivate getClosestTrunkCommit(\n\t\tsearchBy: SeqNumber | SequenceId,\n\t): [SequenceId, GraphCommit<TChangeset>] {\n\t\tconst sequenceId: SequenceId =\n\t\t\ttypeof searchBy === \"number\"\n\t\t\t\t? {\n\t\t\t\t\t\t// This is to make sure that the correct commit is selected in this 2 scenarios:\n\t\t\t\t\t\t// 1) The commit is unique for that sequence number\n\t\t\t\t\t\t// 2) There are more than one commit for the same sequence number, in this case we need to select the last one.\n\t\t\t\t\t\tsequenceNumber: searchBy,\n\t\t\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t\t\t}\n\t\t\t\t: searchBy;\n\n\t\tconst commit = this.sequenceMap.getPairOrNextLower(sequenceId);\n\t\tassert(commit !== undefined, 0x746 /* sequence id has been evicted */);\n\t\treturn commit;\n\t}\n\n\tprivate getBatch(sequenceNumber: SeqNumber): [SequenceId, GraphCommit<TChangeset>][] {\n\t\tconst startSequenceId: SequenceId = {\n\t\t\tsequenceNumber,\n\t\t};\n\t\tconst endSequenceId: SequenceId = {\n\t\t\tsequenceNumber: brand((sequenceNumber as number) + 1),\n\t\t};\n\n\t\treturn this.sequenceMap.getRange(startSequenceId, endSequenceId, false);\n\t}\n}\n\n/**\n * The in-memory data that summaries contain\n */\nexport interface SummaryData<TChangeset> {\n\treadonly trunk: readonly SequencedCommit<TChangeset>[];\n\treadonly peerLocalBranches: ReadonlyMap<SessionId, SummarySessionBranch<TChangeset>>;\n}\n\n/**\n * @returns the path from the base of a branch to its head\n */\nfunction getPathFromBase<TCommit extends { parent?: TCommit }>(\n\tbranchHead: TCommit,\n\tbaseBranchHead: TCommit,\n): TCommit[] {\n\tconst path: TCommit[] = [];\n\tassert(\n\t\tfindCommonAncestor([branchHead, path], baseBranchHead) !== undefined,\n\t\t0x573 /* Expected branches to be related */,\n\t);\n\treturn path;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import type { IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
6
+ import type { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
7
7
  import type { IJsonCodec } from "../codec/index.js";
8
8
  import type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from "../core/index.js";
9
9
  import type { JsonCompatibleReadOnly } from "../util/index.js";
@@ -24,7 +24,6 @@ export declare class EditManagerSummarizer<TChangeset> implements Summarizable {
24
24
  getAttachSummary(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
25
25
  summarize(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
26
26
  private summarizeCore;
27
- getGCData(fullGC?: boolean): IGarbageCollectionData;
28
27
  load(services: IChannelStorageService, parse: SummaryElementParser): Promise<void>;
29
28
  }
30
29
  //# sourceMappingURL=editManagerSummarizer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerSummarizer.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EACX,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EACX,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAInE;;GAEG;AACH,qBAAa,qBAAqB,CAAC,UAAU,CAAE,YAAW,YAAY;IAIpE,OAAO,CAAC,QAAQ,CAAC,WAAW;IAK5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAMtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;IAflC,SAAgB,GAAG,iBAAiB;gBAGlB,WAAW,EAAE,WAAW,CACxC,kBAAkB,EAClB,UAAU,EACV,YAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAC5C,EACgB,KAAK,EAAE,UAAU,CACjC,WAAW,CAAC,UAAU,CAAC,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,CAC1B,EACgB,YAAY,EAAE,aAAa,EAC3B,eAAe,CAAC,6BAAiB;IAG5C,gBAAgB,CACtB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAIX,SAAS,CACrB,SAAS,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,qBAAqB,CAAC;IAIjC,OAAO,CAAC,aAAa;IAUd,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAU7C,IAAI,CAChB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC;CAehB"}
1
+ {"version":3,"file":"editManagerSummarizer.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAA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31,6 @@ export class EditManagerSummarizer {
31
31
  const dataString = stringify(jsonCompatible);
32
32
  return createSingleBlobSummary(stringKey, dataString);
33
33
  }
34
- getGCData(fullGC) {
35
- // TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically
36
- // by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates
37
- // to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each
38
- // blob.
39
- return {
40
- gcNodes: {},
41
- };
42
- }
43
34
  async load(services, parse) {
44
35
  const schemaBuffer = await services.readBlob(stringKey);
45
36
  // After the awaits, validate that the data is in a clean state.
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAO7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAetF,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAGjC,YACkB,WAIhB,EACgB,KAKhB,EACgB,YAA2B,EAC3B,eAAiC;QAZjC,gBAAW,GAAX,WAAW,CAI3B;QACgB,UAAK,GAAL,KAAK,CAKrB;QACgB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,oBAAe,GAAf,eAAe,CAAkB;QAfnC,QAAG,GAAG,aAAa,CAAC;IAgBjC,CAAC;IAEG,gBAAgB,CACtB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,SAAS,CACrB,SAAoC,EACpC,QAAkB,EAClB,UAAoB,EACpB,gBAAoC;QAEpC,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC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corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./sharedTreeCore.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nconst stringKey = \"String\";\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset> implements Summarizable {\n\tpublic readonly key = \"EditManager\";\n\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tprivate summarizeCore(stringify: SummaryElementStringifier): ISummaryTreeWithStats {\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy !== undefined\n\t\t\t\t? { schema: this.schemaAndPolicy, idCompressor: this.idCompressor }\n\t\t\t\t: { idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\treturn createSingleBlobSummary(stringKey, dataString);\n\t}\n\n\tpublic getGCData(fullGC?: boolean): IGarbageCollectionData {\n\t\t// TODO: Properly implement garbage collection. Right now, garbage collection is performed automatically\n\t\t// by the code in SharedObject (from which SharedTreeCore extends). The `runtime.uploadBlob` API delegates\n\t\t// to the `BlobManager`, which automatically populates the summary with ISummaryAttachment entries for each\n\t\t// blob.\n\t\treturn {\n\t\t\tgcNodes: {},\n\t\t};\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf-8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
1
+ {"version":3,"file":"editManagerSummarizer.js","sourceRoot":"","sources":["../../src/shared-tree-core/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uB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,QAAgC,EAChC,KAA2B;QAE3B,MAAM,YAAY,GAAoB,MAAM,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAEzE,gEAAgE;QAChE,wEAAwE;QACxE,gDAAgD;QAChD,MAAM,CACL,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAC1B,KAAK,CAAC,mFAAmF,CACzF,CAAC;QAEF,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAA2B,CAAC;QACvF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor, SchemaAndPolicy } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { EditManager, SummaryData } from \"./editManager.js\";\nimport type { EditManagerEncodingContext } from \"./editManagerCodecs.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"./sharedTreeCore.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nconst stringKey = \"String\";\n\n/**\n * Provides methods for summarizing and loading an `EditManager`\n */\nexport class EditManagerSummarizer<TChangeset> implements Summarizable {\n\tpublic readonly key = \"EditManager\";\n\n\tpublic constructor(\n\t\tprivate readonly editManager: EditManager<\n\t\t\tChangeFamilyEditor,\n\t\t\tTChangeset,\n\t\t\tChangeFamily<ChangeFamilyEditor, TChangeset>\n\t\t>,\n\t\tprivate readonly codec: IJsonCodec<\n\t\t\tSummaryData<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tEditManagerEncodingContext\n\t\t>,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tprivate readonly schemaAndPolicy?: SchemaAndPolicy,\n\t) {}\n\n\tpublic getAttachSummary(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tpublic async summarize(\n\t\tstringify: SummaryElementStringifier,\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.summarizeCore(stringify);\n\t}\n\n\tprivate summarizeCore(stringify: SummaryElementStringifier): ISummaryTreeWithStats {\n\t\tconst context: EditManagerEncodingContext =\n\t\t\tthis.schemaAndPolicy !== undefined\n\t\t\t\t? { schema: this.schemaAndPolicy, idCompressor: this.idCompressor }\n\t\t\t\t: { idCompressor: this.idCompressor };\n\t\tconst jsonCompatible = this.codec.encode(this.editManager.getSummaryData(), context);\n\t\tconst dataString = stringify(jsonCompatible);\n\t\treturn createSingleBlobSummary(stringKey, dataString);\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst schemaBuffer: ArrayBufferLike = await services.readBlob(stringKey);\n\n\t\t// After the awaits, validate that the data is in a clean state.\n\t\t// This detects any data that could have been accidentally added through\n\t\t// invalid means and is about to be overwritten.\n\t\tassert(\n\t\t\tthis.editManager.isEmpty(),\n\t\t\t0x42c /* There should not already be stored EditManager data when loading from summary */,\n\t\t);\n\n\t\tconst summary = parse(bufferToString(schemaBuffer, \"utf-8\")) as JsonCompatibleReadOnly;\n\t\tconst data = this.codec.decode(summary, { idCompressor: this.idCompressor });\n\t\tthis.editManager.loadSummaryData(data);\n\t}\n}\n"]}
@@ -3,9 +3,20 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { SequenceId } from "./editManagerFormat.js";
6
+ /**
7
+ * Compares two sequenceIds. Returns a negative number if a \< b, a positive number if a \> b, and 0 if a === b.
8
+ * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.
9
+ */
6
10
  export declare const sequenceIdComparator: (a: SequenceId, b: SequenceId) => number;
7
11
  export declare const equalSequenceIds: (a: SequenceId, b: SequenceId) => boolean;
8
12
  export declare const minSequenceId: (a: SequenceId, b: SequenceId) => SequenceId;
9
13
  export declare const maxSequenceId: (a: SequenceId, b: SequenceId) => SequenceId;
10
- export declare const decrementSequenceId: (sequenceId: SequenceId) => SequenceId;
14
+ /**
15
+ * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.
16
+ * Some examples:
17
+ * 1. sequenceId = \{ sequenceNumber: 1, indexInBatch: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: 1 \}.
18
+ * 2. sequenceId = \{ sequenceNumber: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \}.
19
+ * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.
20
+ */
21
+ export declare const getUpperBoundOfPreviousSequenceId: (sequenceId: SequenceId) => SequenceId;
11
22
  //# sourceMappingURL=sequenceIdUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceIdUtils.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,eAAO,MAAM,oBAAoB,MAAO,UAAU,KAAK,UAAU,KAAG,MAGnB,CAAC;AAClD,eAAO,MAAM,gBAAgB,MAAO,UAAU,KAAK,UAAU,KAAG,OAC/B,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC,eAAO,MAAM,mBAAmB,eAAgB,UAAU,KAAG,UAO5D,CAAC"}
1
+ {"version":3,"file":"sequenceIdUtils.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAO,UAAU,KAAK,UAAU,KAAG,MAKlB,CAAC;AACnD,eAAO,MAAM,gBAAgB,MAAO,UAAU,KAAK,UAAU,KAAG,OAC/B,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC,eAAO,MAAM,aAAa,MAAO,UAAU,KAAK,UAAU,KAAG,UACtB,CAAC;AACxC;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,eAAgB,UAAU,KAAG,UAc1E,CAAC"}
@@ -2,19 +2,37 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { assert } from "@fluidframework/core-utils/internal";
5
6
  import { brand } from "../util/index.js";
7
+ /**
8
+ * Compares two sequenceIds. Returns a negative number if a \< b, a positive number if a \> b, and 0 if a === b.
9
+ * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.
10
+ */
6
11
  export const sequenceIdComparator = (a, b) => a.sequenceNumber !== b.sequenceNumber
7
12
  ? a.sequenceNumber - b.sequenceNumber
8
- : (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);
13
+ : a.indexInBatch === b.indexInBatch
14
+ ? 0
15
+ : (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);
9
16
  export const equalSequenceIds = (a, b) => sequenceIdComparator(a, b) === 0;
10
17
  export const minSequenceId = (a, b) => sequenceIdComparator(a, b) < 0 ? a : b;
11
18
  export const maxSequenceId = (a, b) => sequenceIdComparator(a, b) > 0 ? a : b;
12
- export const decrementSequenceId = (sequenceId) => {
13
- return sequenceId.indexInBatch !== undefined
19
+ /**
20
+ * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.
21
+ * Some examples:
22
+ * 1. sequenceId = \{ sequenceNumber: 1, indexInBatch: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: 1 \}.
23
+ * 2. sequenceId = \{ sequenceNumber: 2 \}. The upper bound is \{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \}.
24
+ * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.
25
+ */
26
+ export const getUpperBoundOfPreviousSequenceId = (sequenceId) => {
27
+ assert(sequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch), 0xabc /* indexInBatch must not be infinity */);
28
+ return sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0
14
29
  ? {
30
+ sequenceNumber: brand(sequenceId.sequenceNumber - 1),
31
+ indexInBatch: Number.POSITIVE_INFINITY,
32
+ }
33
+ : {
15
34
  sequenceNumber: brand(sequenceId.sequenceNumber),
16
35
  indexInBatch: sequenceId.indexInBatch - 1,
17
- }
18
- : { sequenceNumber: brand(sequenceId.sequenceNumber - 1) };
36
+ };
19
37
  };
20
38
  //# sourceMappingURL=sequenceIdUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceIdUtils.js","sour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C,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { brand } from \"../util/index.js\";\n\nimport type { SequenceId } from \"./editManagerFormat.js\";\n\nexport const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>\n\ta.sequenceNumber !== b.sequenceNumber\n\t\t? a.sequenceNumber - b.sequenceNumber\n\t\t: (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);\nexport const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>\n\tsequenceIdComparator(a, b) === 0;\nexport const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) < 0 ? a : b;\nexport const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) > 0 ? a : b;\nexport const decrementSequenceId = (sequenceId: SequenceId): SequenceId => {\n\treturn sequenceId.indexInBatch !== undefined\n\t\t? {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber),\n\t\t\t\tindexInBatch: sequenceId.indexInBatch - 1,\n\t\t\t}\n\t\t: { sequenceNumber: brand(sequenceId.sequenceNumber - 1) };\n};\n"]}
1
+ {"version":3,"file":"sequenceIdUtils.js","sourceRoot":"","sources":["../../src/shared-tree-core/sequenceIdUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE,CAC5E,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC,cAAc;IACpC,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,cAAc;IACrC,CAAC,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC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/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { brand } from \"../util/index.js\";\n\nimport type { SequenceId } from \"./editManagerFormat.js\";\n\n/**\n * Compares two sequenceIds. Returns a negative number if a \\< b, a positive number if a \\> b, and 0 if a === b.\n * Note that this handles cases where indexInBatch is Number.POSITIVE_INFINITY.\n */\nexport const sequenceIdComparator = (a: SequenceId, b: SequenceId): number =>\n\ta.sequenceNumber !== b.sequenceNumber\n\t\t? a.sequenceNumber - b.sequenceNumber\n\t\t: a.indexInBatch === b.indexInBatch\n\t\t\t? 0\n\t\t\t: (a.indexInBatch ?? 0) - (b.indexInBatch ?? 0);\nexport const equalSequenceIds = (a: SequenceId, b: SequenceId): boolean =>\n\tsequenceIdComparator(a, b) === 0;\nexport const minSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) < 0 ? a : b;\nexport const maxSequenceId = (a: SequenceId, b: SequenceId): SequenceId =>\n\tsequenceIdComparator(a, b) > 0 ? a : b;\n/**\n * Returns the upper bound (maximum possible) sequenceId that can occur just before the given sequenceId.\n * Some examples:\n * 1. sequenceId = \\{ sequenceNumber: 1, indexInBatch: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: 1 \\}.\n * 2. sequenceId = \\{ sequenceNumber: 2 \\}. The upper bound is \\{ sequenceNumber: 1, indexInBatch: Number.POSITIVE_INFINITY \\}.\n * The indexInBatch value of the previous commit will depend on how many ops were in the previous batch of messages received.\n */\nexport const getUpperBoundOfPreviousSequenceId = (sequenceId: SequenceId): SequenceId => {\n\tassert(\n\t\tsequenceId.indexInBatch === undefined || Number.isFinite(sequenceId.indexInBatch),\n\t\t0xabc /* indexInBatch must not be infinity */,\n\t);\n\treturn sequenceId.indexInBatch === undefined || sequenceId.indexInBatch === 0\n\t\t? {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber - 1),\n\t\t\t\tindexInBatch: Number.POSITIVE_INFINITY,\n\t\t\t}\n\t\t: {\n\t\t\t\tsequenceNumber: brand(sequenceId.sequenceNumber),\n\t\t\t\tindexInBatch: sequenceId.indexInBatch - 1,\n\t\t\t};\n};\n"]}
@@ -2,17 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
5
+ import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
6
7
  import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
7
- import type { IExperimentalIncrementalSummaryContext, IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
8
- import { type IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base/internal";
8
+ import type { IExperimentalIncrementalSummaryContext, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
9
+ import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
9
10
  import type { ICodecOptions } from "../codec/index.js";
10
11
  import { type ChangeFamily, type ChangeFamilyEditor, type GraphCommit, type RevisionTag, type SchemaAndPolicy, type SchemaPolicy, type TreeStoredSchemaRepository } from "../core/index.js";
11
- import { type JsonCompatibleReadOnly, Breakable, type WithBreakable } from "../util/index.js";
12
+ import { type JsonCompatibleReadOnly, type Breakable, type WithBreakable } from "../util/index.js";
12
13
  import type { SharedTreeBranch } from "./branch.js";
13
14
  import { type ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
14
15
  import type { ResubmitMachine } from "./resubmitMachine.js";
15
16
  import { BranchCommitEnricher } from "./branchCommitEnricher.js";
17
+ import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
18
+ import type { IChannelView } from "../shared-tree/index.js";
16
19
  export interface ExplicitCoreCodecVersions {
17
20
  editManager: number;
18
21
  message: number;
@@ -23,8 +26,13 @@ export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
23
26
  /**
24
27
  * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.
25
28
  */
26
- export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange> extends SharedObject implements WithBreakable {
29
+ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange> implements WithBreakable {
27
30
  readonly breaker: Breakable;
31
+ readonly sharedObject: IChannelView & IFluidLoadable;
32
+ readonly serializer: IFluidSerializer;
33
+ readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void;
34
+ private readonly idCompressor;
35
+ readonly getEditor: () => TEditor;
28
36
  private readonly editManager;
29
37
  private readonly summarizables;
30
38
  /**
@@ -33,11 +41,6 @@ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
33
41
  * Is `undefined` after (and only after) this instance is attached.
34
42
  */
35
43
  private detachedRevision;
36
- /**
37
- * Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
38
- * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
39
- */
40
- get editor(): TEditor;
41
44
  /**
42
45
  * Used to encode/decode messages sent to/received from the Fluid runtime.
43
46
  *
@@ -48,23 +51,21 @@ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
48
51
  * and an op needs to be interpreted which isn't written with the current configuration).
49
52
  */
50
53
  private readonly messageCodec;
51
- private readonly idCompressor;
52
54
  private readonly resubmitMachine;
53
- protected readonly commitEnricher: BranchCommitEnricher<TChange>;
54
- protected readonly mintRevisionTag: () => RevisionTag;
55
+ readonly commitEnricher: BranchCommitEnricher<TChange>;
56
+ readonly mintRevisionTag: () => RevisionTag;
55
57
  private readonly schemaAndPolicy;
56
58
  /**
57
59
  * @param summarizables - Summarizers for all indexes used by this tree
58
60
  * @param changeFamily - The change family
59
61
  * @param editManager - The edit manager
60
- * @param id - The id of the shared object
61
62
  * @param runtime - The IFluidDataStoreRuntime which contains the shared object
62
- * @param attributes - Attributes of the shared object
63
- * @param telemetryContextPrefix - The property prefix for telemetry pertaining to this object. See {@link ITelemetryContext}
63
+ * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
64
+ * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
64
65
  */
65
- constructor(summarizables: readonly Summarizable[], changeFamily: ChangeFamily<TEditor, TChange>, options: ICodecOptions, formatOptions: ExplicitCoreCodecVersions, id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, telemetryContextPrefix: string, schema: TreeStoredSchemaRepository, schemaPolicy: SchemaPolicy, resubmitMachine?: ResubmitMachine<TChange>, enricher?: ChangeEnricherReadonlyCheckout<TChange>);
66
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): ISummaryTreeWithStats;
67
- protected loadCore(services: IChannelStorageService): Promise<void>;
66
+ constructor(breaker: Breakable, sharedObject: IChannelView & IFluidLoadable, serializer: IFluidSerializer, submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void, logger: ITelemetryBaseLogger | undefined, summarizables: readonly Summarizable[], changeFamily: ChangeFamily<TEditor, TChange>, options: ICodecOptions, formatOptions: ExplicitCoreCodecVersions, idCompressor: IIdCompressor, schema: TreeStoredSchemaRepository, schemaPolicy: SchemaPolicy, resubmitMachine?: ResubmitMachine<TChange>, enricher?: ChangeEnricherReadonlyCheckout<TChange>, getEditor?: () => TEditor);
67
+ summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): ISummaryTreeWithStats;
68
+ loadCore(services: IChannelStorageService): Promise<void>;
68
69
  private loadSummarizable;
69
70
  /**
70
71
  * Submits an op to the Fluid runtime containing the given commit
@@ -73,13 +74,11 @@ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
73
74
  * and may differ from `commit` due to enrichments like detached tree refreshers.
74
75
  */
75
76
  protected submitCommit(commit: GraphCommit<TChange>, schemaAndPolicy: ClonableSchemaAndPolicy, isResubmit: boolean): void;
76
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
77
- protected getLocalBranch(): SharedTreeBranch<TEditor, TChange>;
78
- protected onDisconnect(): void;
79
- protected didAttach(): void;
80
- protected reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void;
81
- protected applyStashedOp(content: JsonCompatibleReadOnly): void;
82
- getGCData(fullGC?: boolean): IGarbageCollectionData;
77
+ processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
78
+ getLocalBranch(): SharedTreeBranch<TEditor, TChange>;
79
+ didAttach(): void;
80
+ reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void;
81
+ applyStashedOp(content: JsonCompatibleReadOnly): void;
83
82
  }
84
83
  /**
85
84
  * Specifies the behavior of a component that puts data in a summary.
@@ -99,10 +98,6 @@ export interface Summarizable {
99
98
  * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.
100
99
  */
101
100
  summarize(stringify: SummaryElementStringifier, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
102
- /**
103
- * {@inheritDoc (ISharedObject:interface).getGCData}
104
- */
105
- getGCData(fullGC?: boolean): IGarbageCollectionData;
106
101
  /**
107
102
  * Allows the component to perform custom loading. The storage service is scoped to this component and therefore
108
103
  * paths in this component will not collide with those in other components, even if they are the same string.
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EAAE,yBAAyB,EAAE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