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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. package/.eslintrc.js +19 -29
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +427 -0
  4. package/README.md +69 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/container-runtime.api.md +863 -0
  8. package/dist/{batchTracker.js → batchTracker.cjs} +9 -8
  9. package/dist/batchTracker.cjs.map +1 -0
  10. package/dist/batchTracker.d.ts +6 -5
  11. package/dist/batchTracker.d.ts.map +1 -1
  12. package/dist/blobManager.cjs +704 -0
  13. package/dist/blobManager.cjs.map +1 -0
  14. package/dist/blobManager.d.ts +135 -39
  15. package/dist/blobManager.d.ts.map +1 -1
  16. package/dist/connectionTelemetry.cjs +230 -0
  17. package/dist/connectionTelemetry.cjs.map +1 -0
  18. package/dist/connectionTelemetry.d.ts +2 -2
  19. package/dist/connectionTelemetry.d.ts.map +1 -1
  20. package/dist/container-runtime-alpha.d.ts +1677 -0
  21. package/dist/container-runtime-beta.d.ts +250 -0
  22. package/dist/container-runtime-public.d.ts +250 -0
  23. package/dist/container-runtime-untrimmed.d.ts +1792 -0
  24. package/dist/{containerHandleContext.js → containerHandleContext.cjs} +4 -2
  25. package/dist/containerHandleContext.cjs.map +1 -0
  26. package/dist/containerHandleContext.d.ts.map +1 -1
  27. package/dist/containerRuntime.cjs +2531 -0
  28. package/dist/containerRuntime.cjs.map +1 -0
  29. package/dist/containerRuntime.d.ts +454 -256
  30. package/dist/containerRuntime.d.ts.map +1 -1
  31. package/dist/{dataStore.js → dataStore.cjs} +54 -45
  32. package/dist/dataStore.cjs.map +1 -0
  33. package/dist/dataStore.d.ts +2 -2
  34. package/dist/dataStore.d.ts.map +1 -1
  35. package/dist/{dataStoreContext.js → dataStoreContext.cjs} +343 -247
  36. package/dist/dataStoreContext.cjs.map +1 -0
  37. package/dist/dataStoreContext.d.ts +73 -41
  38. package/dist/dataStoreContext.d.ts.map +1 -1
  39. package/dist/{dataStoreContexts.js → dataStoreContexts.cjs} +19 -15
  40. package/dist/dataStoreContexts.cjs.map +1 -0
  41. package/dist/dataStoreContexts.d.ts +1 -1
  42. package/dist/dataStoreContexts.d.ts.map +1 -1
  43. package/dist/{dataStoreRegistry.js → dataStoreRegistry.cjs} +9 -4
  44. package/dist/dataStoreRegistry.cjs.map +1 -0
  45. package/dist/dataStoreRegistry.d.ts +3 -0
  46. package/dist/dataStoreRegistry.d.ts.map +1 -1
  47. package/dist/{dataStores.js → dataStores.cjs} +273 -124
  48. package/dist/dataStores.cjs.map +1 -0
  49. package/dist/dataStores.d.ts +53 -23
  50. package/dist/dataStores.d.ts.map +1 -1
  51. package/dist/deltaManagerProxyBase.cjs +77 -0
  52. package/dist/deltaManagerProxyBase.cjs.map +1 -0
  53. package/dist/deltaManagerProxyBase.d.ts +35 -0
  54. package/dist/deltaManagerProxyBase.d.ts.map +1 -0
  55. package/dist/deltaManagerSummarizerProxy.cjs +42 -0
  56. package/dist/deltaManagerSummarizerProxy.cjs.map +1 -0
  57. package/dist/deltaManagerSummarizerProxy.d.ts +19 -0
  58. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -0
  59. package/dist/{deltaScheduler.js → deltaScheduler.cjs} +25 -18
  60. package/dist/deltaScheduler.cjs.map +1 -0
  61. package/dist/deltaScheduler.d.ts +8 -6
  62. package/dist/deltaScheduler.d.ts.map +1 -1
  63. package/dist/error.cjs +21 -0
  64. package/dist/error.cjs.map +1 -0
  65. package/dist/error.d.ts +14 -0
  66. package/dist/error.d.ts.map +1 -0
  67. package/dist/gc/garbageCollection.cjs +861 -0
  68. package/dist/gc/garbageCollection.cjs.map +1 -0
  69. package/dist/gc/garbageCollection.d.ts +224 -0
  70. package/dist/gc/garbageCollection.d.ts.map +1 -0
  71. package/dist/gc/gcConfigs.cjs +153 -0
  72. package/dist/gc/gcConfigs.cjs.map +1 -0
  73. package/dist/gc/gcConfigs.d.ts +23 -0
  74. package/dist/gc/gcConfigs.d.ts.map +1 -0
  75. package/dist/gc/gcDefinitions.cjs +96 -0
  76. package/dist/gc/gcDefinitions.cjs.map +1 -0
  77. package/dist/gc/gcDefinitions.d.ts +437 -0
  78. package/dist/gc/gcDefinitions.d.ts.map +1 -0
  79. package/dist/gc/gcHelpers.cjs +235 -0
  80. package/dist/gc/gcHelpers.cjs.map +1 -0
  81. package/dist/gc/gcHelpers.d.ts +71 -0
  82. package/dist/gc/gcHelpers.d.ts.map +1 -0
  83. package/dist/gc/gcReferenceGraphAlgorithm.cjs +49 -0
  84. package/dist/gc/gcReferenceGraphAlgorithm.cjs.map +1 -0
  85. package/dist/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
  86. package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  87. package/dist/{summarizerTypes.js → gc/gcSummaryDefinitions.cjs} +1 -6
  88. package/dist/gc/gcSummaryDefinitions.cjs.map +1 -0
  89. package/dist/gc/gcSummaryDefinitions.d.ts +52 -0
  90. package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -0
  91. package/dist/gc/gcSummaryStateTracker.cjs +213 -0
  92. package/dist/gc/gcSummaryStateTracker.cjs.map +1 -0
  93. package/dist/gc/gcSummaryStateTracker.d.ts +94 -0
  94. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
  95. package/dist/gc/gcTelemetry.cjs +298 -0
  96. package/dist/gc/gcTelemetry.cjs.map +1 -0
  97. package/dist/gc/gcTelemetry.d.ts +92 -0
  98. package/dist/gc/gcTelemetry.d.ts.map +1 -0
  99. package/dist/gc/gcUnreferencedStateTracker.cjs +118 -0
  100. package/dist/gc/gcUnreferencedStateTracker.cjs.map +1 -0
  101. package/dist/gc/gcUnreferencedStateTracker.d.ts +40 -0
  102. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  103. package/dist/gc/index.cjs +44 -0
  104. package/dist/gc/index.cjs.map +1 -0
  105. package/dist/gc/index.d.ts +13 -0
  106. package/dist/gc/index.d.ts.map +1 -0
  107. package/dist/index.cjs +47 -0
  108. package/dist/index.cjs.map +1 -0
  109. package/dist/index.d.ts +19 -8
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/messageTypes.cjs +37 -0
  112. package/dist/messageTypes.cjs.map +1 -0
  113. package/dist/messageTypes.d.ts +142 -0
  114. package/dist/messageTypes.d.ts.map +1 -0
  115. package/dist/metadata.cjs +7 -0
  116. package/dist/metadata.cjs.map +1 -0
  117. package/dist/metadata.d.ts +24 -0
  118. package/dist/metadata.d.ts.map +1 -0
  119. package/dist/opLifecycle/batchManager.cjs +139 -0
  120. package/dist/opLifecycle/batchManager.cjs.map +1 -0
  121. package/dist/opLifecycle/batchManager.d.ts +48 -0
  122. package/dist/opLifecycle/batchManager.d.ts.map +1 -0
  123. package/dist/opLifecycle/definitions.cjs +7 -0
  124. package/dist/opLifecycle/definitions.cjs.map +1 -0
  125. package/dist/opLifecycle/definitions.d.ts +83 -0
  126. package/dist/opLifecycle/definitions.d.ts.map +1 -0
  127. package/dist/opLifecycle/index.cjs +26 -0
  128. package/dist/opLifecycle/index.cjs.map +1 -0
  129. package/dist/opLifecycle/index.d.ts +13 -0
  130. package/dist/opLifecycle/index.d.ts.map +1 -0
  131. package/dist/opLifecycle/opCompressor.cjs +84 -0
  132. package/dist/opLifecycle/opCompressor.cjs.map +1 -0
  133. package/dist/opLifecycle/opCompressor.d.ts +18 -0
  134. package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
  135. package/dist/opLifecycle/opDecompressor.cjs +132 -0
  136. package/dist/opLifecycle/opDecompressor.cjs.map +1 -0
  137. package/dist/opLifecycle/opDecompressor.d.ts +25 -0
  138. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
  139. package/dist/opLifecycle/opGroupingManager.cjs +95 -0
  140. package/dist/opLifecycle/opGroupingManager.cjs.map +1 -0
  141. package/dist/opLifecycle/opGroupingManager.d.ts +22 -0
  142. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -0
  143. package/dist/opLifecycle/opSplitter.cjs +202 -0
  144. package/dist/opLifecycle/opSplitter.cjs.map +1 -0
  145. package/dist/opLifecycle/opSplitter.d.ts +61 -0
  146. package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
  147. package/dist/opLifecycle/outbox.cjs +323 -0
  148. package/dist/opLifecycle/outbox.cjs.map +1 -0
  149. package/dist/opLifecycle/outbox.d.ts +104 -0
  150. package/dist/opLifecycle/outbox.d.ts.map +1 -0
  151. package/dist/opLifecycle/remoteMessageProcessor.cjs +136 -0
  152. package/dist/opLifecycle/remoteMessageProcessor.cjs.map +1 -0
  153. package/dist/opLifecycle/remoteMessageProcessor.d.ts +47 -0
  154. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  155. package/dist/opProperties.cjs +17 -0
  156. package/dist/opProperties.cjs.map +1 -0
  157. package/dist/opProperties.d.ts +7 -0
  158. package/dist/opProperties.d.ts.map +1 -0
  159. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  160. package/dist/packageVersion.cjs.map +1 -0
  161. package/dist/packageVersion.d.ts +1 -1
  162. package/dist/packageVersion.d.ts.map +1 -1
  163. package/dist/pendingStateManager.cjs +282 -0
  164. package/dist/pendingStateManager.cjs.map +1 -0
  165. package/dist/pendingStateManager.d.ts +32 -69
  166. package/dist/pendingStateManager.d.ts.map +1 -1
  167. package/dist/scheduleManager.cjs +258 -0
  168. package/dist/scheduleManager.cjs.map +1 -0
  169. package/dist/scheduleManager.d.ts +31 -0
  170. package/dist/scheduleManager.d.ts.map +1 -0
  171. package/dist/storageServiceWithAttachBlobs.cjs +32 -0
  172. package/dist/storageServiceWithAttachBlobs.cjs.map +1 -0
  173. package/dist/storageServiceWithAttachBlobs.d.ts +17 -0
  174. package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -0
  175. package/dist/summary/index.cjs +51 -0
  176. package/dist/summary/index.cjs.map +1 -0
  177. package/dist/summary/index.d.ts +17 -0
  178. package/dist/summary/index.d.ts.map +1 -0
  179. package/dist/{orderedClientElection.js → summary/orderedClientElection.cjs} +100 -84
  180. package/dist/summary/orderedClientElection.cjs.map +1 -0
  181. package/{lib → dist/summary}/orderedClientElection.d.ts +41 -18
  182. package/dist/summary/orderedClientElection.d.ts.map +1 -0
  183. package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.cjs} +12 -10
  184. package/dist/summary/runWhileConnectedCoordinator.cjs.map +1 -0
  185. package/{lib → dist/summary}/runWhileConnectedCoordinator.d.ts +8 -2
  186. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  187. package/dist/summary/runningSummarizer.cjs +679 -0
  188. package/dist/summary/runningSummarizer.cjs.map +1 -0
  189. package/dist/summary/runningSummarizer.d.ts +128 -0
  190. package/dist/summary/runningSummarizer.d.ts.map +1 -0
  191. package/dist/summary/summarizer.cjs +263 -0
  192. package/dist/summary/summarizer.cjs.map +1 -0
  193. package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +18 -33
  194. package/dist/summary/summarizer.d.ts.map +1 -0
  195. package/dist/{summarizerClientElection.js → summary/summarizerClientElection.cjs} +15 -46
  196. package/dist/summary/summarizerClientElection.cjs.map +1 -0
  197. package/{lib → dist/summary}/summarizerClientElection.d.ts +4 -4
  198. package/dist/summary/summarizerClientElection.d.ts.map +1 -0
  199. package/dist/summary/summarizerHeuristics.cjs +156 -0
  200. package/dist/summary/summarizerHeuristics.cjs.map +1 -0
  201. package/{lib → dist/summary}/summarizerHeuristics.d.ts +28 -6
  202. package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
  203. package/dist/summary/summarizerNode/index.cjs +12 -0
  204. package/dist/summary/summarizerNode/index.cjs.map +1 -0
  205. package/dist/summary/summarizerNode/index.d.ts +8 -0
  206. package/dist/summary/summarizerNode/index.d.ts.map +1 -0
  207. package/dist/summary/summarizerNode/summarizerNode.cjs +526 -0
  208. package/dist/summary/summarizerNode/summarizerNode.cjs.map +1 -0
  209. package/dist/summary/summarizerNode/summarizerNode.d.ts +167 -0
  210. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  211. package/dist/summary/summarizerNode/summarizerNodeUtils.cjs +130 -0
  212. package/dist/summary/summarizerNode/summarizerNodeUtils.cjs.map +1 -0
  213. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +121 -0
  214. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  215. package/dist/summary/summarizerNode/summarizerNodeWithGc.cjs +375 -0
  216. package/dist/summary/summarizerNode/summarizerNodeWithGc.cjs.map +1 -0
  217. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +153 -0
  218. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  219. package/dist/summary/summarizerTypes.cjs +7 -0
  220. package/dist/summary/summarizerTypes.cjs.map +1 -0
  221. package/{lib → dist/summary}/summarizerTypes.d.ts +233 -83
  222. package/dist/summary/summarizerTypes.d.ts.map +1 -0
  223. package/dist/{summaryCollection.js → summary/summaryCollection.cjs} +80 -49
  224. package/dist/summary/summaryCollection.cjs.map +1 -0
  225. package/dist/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +23 -5
  226. package/dist/summary/summaryCollection.d.ts.map +1 -0
  227. package/dist/{summaryFormat.js → summary/summaryFormat.cjs} +29 -26
  228. package/dist/summary/summaryFormat.cjs.map +1 -0
  229. package/{lib → dist/summary}/summaryFormat.d.ts +25 -30
  230. package/dist/summary/summaryFormat.d.ts.map +1 -0
  231. package/dist/{summaryGenerator.js → summary/summaryGenerator.cjs} +162 -74
  232. package/dist/summary/summaryGenerator.cjs.map +1 -0
  233. package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +53 -11
  234. package/dist/summary/summaryGenerator.d.ts.map +1 -0
  235. package/dist/{summaryManager.js → summary/summaryManager.cjs} +98 -55
  236. package/dist/summary/summaryManager.cjs.map +1 -0
  237. package/{lib → dist/summary}/summaryManager.d.ts +13 -11
  238. package/dist/summary/summaryManager.d.ts.map +1 -0
  239. package/dist/{throttler.js → throttler.cjs} +21 -21
  240. package/dist/throttler.cjs.map +1 -0
  241. package/dist/throttler.d.ts +2 -2
  242. package/dist/throttler.d.ts.map +1 -1
  243. package/dist/tsdoc-metadata.json +11 -0
  244. package/lib/{batchTracker.d.ts → batchTracker.d.mts} +6 -5
  245. package/lib/batchTracker.d.mts.map +1 -0
  246. package/lib/{batchTracker.js → batchTracker.mjs} +9 -8
  247. package/lib/batchTracker.mjs.map +1 -0
  248. package/lib/blobManager.d.mts +191 -0
  249. package/lib/blobManager.d.mts.map +1 -0
  250. package/lib/blobManager.mjs +699 -0
  251. package/lib/blobManager.mjs.map +1 -0
  252. package/lib/{connectionTelemetry.d.ts → connectionTelemetry.d.mts} +2 -2
  253. package/lib/connectionTelemetry.d.mts.map +1 -0
  254. package/lib/connectionTelemetry.mjs +226 -0
  255. package/lib/connectionTelemetry.mjs.map +1 -0
  256. package/lib/container-runtime-alpha.d.mts +1677 -0
  257. package/lib/container-runtime-beta.d.mts +250 -0
  258. package/lib/container-runtime-public.d.mts +250 -0
  259. package/lib/container-runtime-untrimmed.d.mts +1792 -0
  260. package/lib/{containerHandleContext.d.ts → containerHandleContext.d.mts} +1 -1
  261. package/lib/containerHandleContext.d.mts.map +1 -0
  262. package/lib/{containerHandleContext.js → containerHandleContext.mjs} +4 -2
  263. package/lib/containerHandleContext.mjs.map +1 -0
  264. package/lib/containerRuntime.d.mts +809 -0
  265. package/lib/containerRuntime.d.mts.map +1 -0
  266. package/lib/containerRuntime.mjs +2526 -0
  267. package/lib/containerRuntime.mjs.map +1 -0
  268. package/lib/{dataStore.d.ts → dataStore.d.mts} +4 -4
  269. package/lib/dataStore.d.mts.map +1 -0
  270. package/lib/{dataStore.js → dataStore.mjs} +52 -43
  271. package/lib/dataStore.mjs.map +1 -0
  272. package/lib/{dataStoreContext.d.ts → dataStoreContext.d.mts} +74 -42
  273. package/lib/dataStoreContext.d.mts.map +1 -0
  274. package/lib/{dataStoreContext.js → dataStoreContext.mjs} +309 -213
  275. package/lib/dataStoreContext.mjs.map +1 -0
  276. package/lib/{dataStoreContexts.d.ts → dataStoreContexts.d.mts} +2 -2
  277. package/lib/dataStoreContexts.d.mts.map +1 -0
  278. package/lib/{dataStoreContexts.js → dataStoreContexts.mjs} +12 -8
  279. package/lib/dataStoreContexts.mjs.map +1 -0
  280. package/lib/{dataStoreRegistry.d.ts → dataStoreRegistry.d.mts} +3 -0
  281. package/lib/dataStoreRegistry.d.mts.map +1 -0
  282. package/lib/{dataStoreRegistry.js → dataStoreRegistry.mjs} +7 -6
  283. package/lib/dataStoreRegistry.mjs.map +1 -0
  284. package/lib/{dataStores.d.ts → dataStores.d.mts} +56 -26
  285. package/lib/dataStores.d.mts.map +1 -0
  286. package/lib/{dataStores.js → dataStores.mjs} +254 -105
  287. package/lib/dataStores.mjs.map +1 -0
  288. package/lib/deltaManagerProxyBase.d.mts +35 -0
  289. package/lib/deltaManagerProxyBase.d.mts.map +1 -0
  290. package/lib/deltaManagerProxyBase.mjs +73 -0
  291. package/lib/deltaManagerProxyBase.mjs.map +1 -0
  292. package/lib/deltaManagerSummarizerProxy.d.mts +19 -0
  293. package/lib/deltaManagerSummarizerProxy.d.mts.map +1 -0
  294. package/lib/deltaManagerSummarizerProxy.mjs +38 -0
  295. package/lib/deltaManagerSummarizerProxy.mjs.map +1 -0
  296. package/lib/{deltaScheduler.d.ts → deltaScheduler.d.mts} +8 -6
  297. package/lib/deltaScheduler.d.mts.map +1 -0
  298. package/lib/{deltaScheduler.js → deltaScheduler.mjs} +22 -15
  299. package/lib/deltaScheduler.mjs.map +1 -0
  300. package/lib/error.d.mts +14 -0
  301. package/lib/error.d.mts.map +1 -0
  302. package/lib/error.mjs +17 -0
  303. package/lib/error.mjs.map +1 -0
  304. package/lib/gc/garbageCollection.d.mts +224 -0
  305. package/lib/gc/garbageCollection.d.mts.map +1 -0
  306. package/lib/gc/garbageCollection.mjs +857 -0
  307. package/lib/gc/garbageCollection.mjs.map +1 -0
  308. package/lib/gc/gcConfigs.d.mts +23 -0
  309. package/lib/gc/gcConfigs.d.mts.map +1 -0
  310. package/lib/gc/gcConfigs.mjs +149 -0
  311. package/lib/gc/gcConfigs.mjs.map +1 -0
  312. package/lib/gc/gcDefinitions.d.mts +437 -0
  313. package/lib/gc/gcDefinitions.d.mts.map +1 -0
  314. package/lib/gc/gcDefinitions.mjs +93 -0
  315. package/lib/gc/gcDefinitions.mjs.map +1 -0
  316. package/lib/gc/gcHelpers.d.mts +71 -0
  317. package/lib/gc/gcHelpers.d.mts.map +1 -0
  318. package/lib/gc/gcHelpers.mjs +222 -0
  319. package/lib/gc/gcHelpers.mjs.map +1 -0
  320. package/lib/gc/gcReferenceGraphAlgorithm.d.mts +16 -0
  321. package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +1 -0
  322. package/lib/gc/gcReferenceGraphAlgorithm.mjs +45 -0
  323. package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +1 -0
  324. package/lib/gc/gcSummaryDefinitions.d.mts +52 -0
  325. package/lib/gc/gcSummaryDefinitions.d.mts.map +1 -0
  326. package/lib/gc/gcSummaryDefinitions.mjs +6 -0
  327. package/lib/gc/gcSummaryDefinitions.mjs.map +1 -0
  328. package/lib/gc/gcSummaryStateTracker.d.mts +94 -0
  329. package/lib/gc/gcSummaryStateTracker.d.mts.map +1 -0
  330. package/lib/gc/gcSummaryStateTracker.mjs +209 -0
  331. package/lib/gc/gcSummaryStateTracker.mjs.map +1 -0
  332. package/lib/gc/gcTelemetry.d.mts +92 -0
  333. package/lib/gc/gcTelemetry.d.mts.map +1 -0
  334. package/lib/gc/gcTelemetry.mjs +293 -0
  335. package/lib/gc/gcTelemetry.mjs.map +1 -0
  336. package/lib/gc/gcUnreferencedStateTracker.d.mts +40 -0
  337. package/lib/gc/gcUnreferencedStateTracker.d.mts.map +1 -0
  338. package/lib/gc/gcUnreferencedStateTracker.mjs +114 -0
  339. package/lib/gc/gcUnreferencedStateTracker.mjs.map +1 -0
  340. package/lib/gc/index.d.mts +13 -0
  341. package/lib/gc/index.d.mts.map +1 -0
  342. package/lib/gc/index.mjs +12 -0
  343. package/lib/gc/index.mjs.map +1 -0
  344. package/lib/index.d.mts +25 -0
  345. package/lib/index.d.mts.map +1 -0
  346. package/lib/index.mjs +24 -0
  347. package/lib/index.mjs.map +1 -0
  348. package/lib/messageTypes.d.mts +142 -0
  349. package/lib/messageTypes.d.mts.map +1 -0
  350. package/lib/messageTypes.mjs +34 -0
  351. package/lib/messageTypes.mjs.map +1 -0
  352. package/lib/metadata.d.mts +24 -0
  353. package/lib/metadata.d.mts.map +1 -0
  354. package/lib/metadata.mjs +6 -0
  355. package/lib/metadata.mjs.map +1 -0
  356. package/lib/opLifecycle/batchManager.d.mts +48 -0
  357. package/lib/opLifecycle/batchManager.d.mts.map +1 -0
  358. package/lib/opLifecycle/batchManager.mjs +133 -0
  359. package/lib/opLifecycle/batchManager.mjs.map +1 -0
  360. package/lib/opLifecycle/definitions.d.mts +83 -0
  361. package/lib/opLifecycle/definitions.d.mts.map +1 -0
  362. package/lib/opLifecycle/definitions.mjs +6 -0
  363. package/lib/opLifecycle/definitions.mjs.map +1 -0
  364. package/lib/opLifecycle/index.d.mts +13 -0
  365. package/lib/opLifecycle/index.d.mts.map +1 -0
  366. package/lib/opLifecycle/index.mjs +12 -0
  367. package/lib/opLifecycle/index.mjs.map +1 -0
  368. package/lib/opLifecycle/opCompressor.d.mts +18 -0
  369. package/lib/opLifecycle/opCompressor.d.mts.map +1 -0
  370. package/lib/opLifecycle/opCompressor.mjs +80 -0
  371. package/lib/opLifecycle/opCompressor.mjs.map +1 -0
  372. package/lib/opLifecycle/opDecompressor.d.mts +25 -0
  373. package/lib/opLifecycle/opDecompressor.d.mts.map +1 -0
  374. package/lib/opLifecycle/opDecompressor.mjs +128 -0
  375. package/lib/opLifecycle/opDecompressor.mjs.map +1 -0
  376. package/lib/opLifecycle/opGroupingManager.d.mts +22 -0
  377. package/lib/opLifecycle/opGroupingManager.d.mts.map +1 -0
  378. package/lib/opLifecycle/opGroupingManager.mjs +91 -0
  379. package/lib/opLifecycle/opGroupingManager.mjs.map +1 -0
  380. package/lib/opLifecycle/opSplitter.d.mts +61 -0
  381. package/lib/opLifecycle/opSplitter.d.mts.map +1 -0
  382. package/lib/opLifecycle/opSplitter.mjs +197 -0
  383. package/lib/opLifecycle/opSplitter.mjs.map +1 -0
  384. package/lib/opLifecycle/outbox.d.mts +104 -0
  385. package/lib/opLifecycle/outbox.d.mts.map +1 -0
  386. package/lib/opLifecycle/outbox.mjs +318 -0
  387. package/lib/opLifecycle/outbox.mjs.map +1 -0
  388. package/lib/opLifecycle/remoteMessageProcessor.d.mts +47 -0
  389. package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +1 -0
  390. package/lib/opLifecycle/remoteMessageProcessor.mjs +131 -0
  391. package/lib/opLifecycle/remoteMessageProcessor.mjs.map +1 -0
  392. package/lib/opProperties.d.mts +7 -0
  393. package/lib/opProperties.d.mts.map +1 -0
  394. package/lib/opProperties.mjs +13 -0
  395. package/lib/opProperties.mjs.map +1 -0
  396. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  397. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  398. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  399. package/lib/packageVersion.mjs.map +1 -0
  400. package/lib/{pendingStateManager.d.ts → pendingStateManager.d.mts} +32 -69
  401. package/lib/pendingStateManager.d.mts.map +1 -0
  402. package/lib/pendingStateManager.mjs +275 -0
  403. package/lib/pendingStateManager.mjs.map +1 -0
  404. package/lib/scheduleManager.d.mts +27 -0
  405. package/lib/scheduleManager.d.mts.map +1 -0
  406. package/lib/scheduleManager.mjs +254 -0
  407. package/lib/scheduleManager.mjs.map +1 -0
  408. package/lib/storageServiceWithAttachBlobs.d.mts +17 -0
  409. package/lib/storageServiceWithAttachBlobs.d.mts.map +1 -0
  410. package/lib/storageServiceWithAttachBlobs.mjs +28 -0
  411. package/lib/storageServiceWithAttachBlobs.mjs.map +1 -0
  412. package/lib/summary/index.d.mts +17 -0
  413. package/lib/summary/index.d.mts.map +1 -0
  414. package/lib/summary/index.mjs +16 -0
  415. package/lib/summary/index.mjs.map +1 -0
  416. package/{dist/orderedClientElection.d.ts → lib/summary/orderedClientElection.d.mts} +41 -22
  417. package/lib/summary/orderedClientElection.d.mts.map +1 -0
  418. package/lib/{orderedClientElection.js → summary/orderedClientElection.mjs} +95 -79
  419. package/lib/summary/orderedClientElection.mjs.map +1 -0
  420. package/{dist/runWhileConnectedCoordinator.d.ts → lib/summary/runWhileConnectedCoordinator.d.mts} +9 -3
  421. package/lib/summary/runWhileConnectedCoordinator.d.mts.map +1 -0
  422. package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.mjs} +12 -10
  423. package/lib/summary/runWhileConnectedCoordinator.mjs.map +1 -0
  424. package/lib/summary/runningSummarizer.d.mts +128 -0
  425. package/lib/summary/runningSummarizer.d.mts.map +1 -0
  426. package/lib/summary/runningSummarizer.mjs +675 -0
  427. package/lib/summary/runningSummarizer.mjs.map +1 -0
  428. package/lib/{summarizer.d.ts → summary/summarizer.d.mts} +20 -35
  429. package/lib/summary/summarizer.d.mts.map +1 -0
  430. package/lib/summary/summarizer.mjs +257 -0
  431. package/lib/summary/summarizer.mjs.map +1 -0
  432. package/{dist/summarizerClientElection.d.ts → lib/summary/summarizerClientElection.d.mts} +6 -6
  433. package/lib/summary/summarizerClientElection.d.mts.map +1 -0
  434. package/lib/{summarizerClientElection.js → summary/summarizerClientElection.mjs} +14 -45
  435. package/lib/summary/summarizerClientElection.mjs.map +1 -0
  436. package/{dist/summarizerHeuristics.d.ts → lib/summary/summarizerHeuristics.d.mts} +29 -7
  437. package/lib/summary/summarizerHeuristics.d.mts.map +1 -0
  438. package/lib/summary/summarizerHeuristics.mjs +151 -0
  439. package/lib/summary/summarizerHeuristics.mjs.map +1 -0
  440. package/lib/summary/summarizerNode/index.d.mts +8 -0
  441. package/lib/summary/summarizerNode/index.d.mts.map +1 -0
  442. package/lib/summary/summarizerNode/index.mjs +7 -0
  443. package/lib/summary/summarizerNode/index.mjs.map +1 -0
  444. package/lib/summary/summarizerNode/summarizerNode.d.mts +167 -0
  445. package/lib/summary/summarizerNode/summarizerNode.d.mts.map +1 -0
  446. package/lib/summary/summarizerNode/summarizerNode.mjs +521 -0
  447. package/lib/summary/summarizerNode/summarizerNode.mjs.map +1 -0
  448. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts +121 -0
  449. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +1 -0
  450. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs +123 -0
  451. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +1 -0
  452. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts +153 -0
  453. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +1 -0
  454. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs +370 -0
  455. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +1 -0
  456. package/{dist/summarizerTypes.d.ts → lib/summary/summarizerTypes.d.mts} +234 -84
  457. package/lib/summary/summarizerTypes.d.mts.map +1 -0
  458. package/lib/summary/summarizerTypes.mjs +6 -0
  459. package/lib/summary/summarizerTypes.mjs.map +1 -0
  460. package/lib/{summaryCollection.d.ts → summary/summaryCollection.d.mts} +23 -5
  461. package/lib/summary/summaryCollection.d.mts.map +1 -0
  462. package/lib/{summaryCollection.js → summary/summaryCollection.mjs} +76 -45
  463. package/lib/summary/summaryCollection.mjs.map +1 -0
  464. package/{dist/summaryFormat.d.ts → lib/summary/summaryFormat.d.mts} +25 -30
  465. package/lib/summary/summaryFormat.d.mts.map +1 -0
  466. package/lib/{summaryFormat.js → summary/summaryFormat.mjs} +30 -26
  467. package/lib/summary/summaryFormat.mjs.map +1 -0
  468. package/lib/summary/summaryGenerator.d.mts +127 -0
  469. package/lib/summary/summaryGenerator.d.mts.map +1 -0
  470. package/lib/{summaryGenerator.js → summary/summaryGenerator.mjs} +153 -67
  471. package/lib/summary/summaryGenerator.mjs.map +1 -0
  472. package/{dist/summaryManager.d.ts → lib/summary/summaryManager.d.mts} +15 -13
  473. package/lib/summary/summaryManager.d.mts.map +1 -0
  474. package/lib/{summaryManager.js → summary/summaryManager.mjs} +94 -51
  475. package/lib/summary/summaryManager.mjs.map +1 -0
  476. package/lib/{throttler.d.ts → throttler.d.mts} +2 -2
  477. package/lib/throttler.d.mts.map +1 -0
  478. package/lib/{throttler.js → throttler.mjs} +21 -21
  479. package/lib/throttler.mjs.map +1 -0
  480. package/package.json +173 -72
  481. package/prettier.config.cjs +8 -0
  482. package/src/batchTracker.ts +59 -54
  483. package/src/blobManager.ts +937 -294
  484. package/src/connectionTelemetry.ts +342 -252
  485. package/src/containerHandleContext.ts +27 -29
  486. package/src/containerRuntime.ts +3879 -3143
  487. package/src/dataStore.ts +170 -140
  488. package/src/dataStoreContext.ts +1166 -986
  489. package/src/dataStoreContexts.ts +176 -163
  490. package/src/dataStoreRegistry.ts +29 -21
  491. package/src/dataStores.ts +921 -678
  492. package/src/deltaManagerProxyBase.ts +111 -0
  493. package/src/deltaManagerSummarizerProxy.ts +49 -0
  494. package/src/deltaScheduler.ts +161 -156
  495. package/src/error.ts +21 -0
  496. package/src/gc/garbageCollection.md +106 -0
  497. package/src/gc/garbageCollection.ts +1153 -0
  498. package/src/gc/gcConfigs.ts +216 -0
  499. package/src/gc/gcDefinitions.ts +502 -0
  500. package/src/gc/gcHelpers.ts +284 -0
  501. package/src/gc/gcReferenceGraphAlgorithm.ts +52 -0
  502. package/src/gc/gcSummaryDefinitions.ts +54 -0
  503. package/src/gc/gcSummaryStateTracker.ts +299 -0
  504. package/src/gc/gcTelemetry.ts +423 -0
  505. package/src/gc/gcUnreferencedStateTracker.ts +153 -0
  506. package/src/gc/index.ts +59 -0
  507. package/src/index.ts +101 -74
  508. package/src/messageTypes.ts +238 -0
  509. package/src/metadata.ts +26 -0
  510. package/src/opLifecycle/README.md +321 -0
  511. package/src/opLifecycle/batchManager.ts +179 -0
  512. package/src/opLifecycle/definitions.ts +89 -0
  513. package/src/opLifecycle/index.ts +19 -0
  514. package/src/opLifecycle/opCompressor.ts +99 -0
  515. package/src/opLifecycle/opDecompressor.ts +190 -0
  516. package/src/opLifecycle/opGroupingManager.ts +133 -0
  517. package/src/opLifecycle/opSplitter.ts +279 -0
  518. package/src/opLifecycle/outbox.ts +471 -0
  519. package/src/opLifecycle/remoteMessageProcessor.ts +175 -0
  520. package/src/opProperties.ts +21 -0
  521. package/src/packageVersion.ts +1 -1
  522. package/src/pendingStateManager.ts +396 -465
  523. package/src/scheduleManager.ts +358 -0
  524. package/src/storageServiceWithAttachBlobs.ts +38 -0
  525. package/src/summary/index.ts +109 -0
  526. package/src/summary/orderedClientElection.ts +571 -0
  527. package/src/summary/runWhileConnectedCoordinator.ts +117 -0
  528. package/src/summary/runningSummarizer.ts +920 -0
  529. package/src/summary/summarizer.ts +352 -0
  530. package/src/summary/summarizerClientElection.ts +140 -0
  531. package/src/summary/summarizerHeuristics.ts +227 -0
  532. package/src/summary/summarizerNode/index.ts +12 -0
  533. package/src/summary/summarizerNode/summarizerNode.ts +725 -0
  534. package/src/summary/summarizerNode/summarizerNodeUtils.ts +206 -0
  535. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +571 -0
  536. package/src/summary/summarizerTypes.ts +631 -0
  537. package/src/summary/summaryCollection.ts +474 -0
  538. package/src/summary/summaryFormat.ts +249 -0
  539. package/src/summary/summaryGenerator.ts +539 -0
  540. package/src/summary/summaryManager.ts +452 -0
  541. package/src/throttler.ts +131 -122
  542. package/tsc-multi.test.json +4 -0
  543. package/tsconfig.json +11 -13
  544. package/dist/batchTracker.js.map +0 -1
  545. package/dist/blobManager.js +0 -249
  546. package/dist/blobManager.js.map +0 -1
  547. package/dist/connectionTelemetry.js +0 -178
  548. package/dist/connectionTelemetry.js.map +0 -1
  549. package/dist/containerHandleContext.js.map +0 -1
  550. package/dist/containerRuntime.js +0 -2174
  551. package/dist/containerRuntime.js.map +0 -1
  552. package/dist/dataStore.js.map +0 -1
  553. package/dist/dataStoreContext.js.map +0 -1
  554. package/dist/dataStoreContexts.js.map +0 -1
  555. package/dist/dataStoreRegistry.js.map +0 -1
  556. package/dist/dataStores.js.map +0 -1
  557. package/dist/deltaScheduler.js.map +0 -1
  558. package/dist/garbageCollection.d.ts +0 -319
  559. package/dist/garbageCollection.d.ts.map +0 -1
  560. package/dist/garbageCollection.js +0 -993
  561. package/dist/garbageCollection.js.map +0 -1
  562. package/dist/index.js +0 -33
  563. package/dist/index.js.map +0 -1
  564. package/dist/opTelemetry.d.ts +0 -22
  565. package/dist/opTelemetry.d.ts.map +0 -1
  566. package/dist/opTelemetry.js +0 -60
  567. package/dist/opTelemetry.js.map +0 -1
  568. package/dist/orderedClientElection.d.ts.map +0 -1
  569. package/dist/orderedClientElection.js.map +0 -1
  570. package/dist/packageVersion.js.map +0 -1
  571. package/dist/pendingStateManager.js +0 -346
  572. package/dist/pendingStateManager.js.map +0 -1
  573. package/dist/runWhileConnectedCoordinator.d.ts.map +0 -1
  574. package/dist/runWhileConnectedCoordinator.js.map +0 -1
  575. package/dist/runningSummarizer.d.ts +0 -93
  576. package/dist/runningSummarizer.d.ts.map +0 -1
  577. package/dist/runningSummarizer.js +0 -384
  578. package/dist/runningSummarizer.js.map +0 -1
  579. package/dist/serializedSnapshotStorage.d.ts +0 -58
  580. package/dist/serializedSnapshotStorage.d.ts.map +0 -1
  581. package/dist/serializedSnapshotStorage.js +0 -108
  582. package/dist/serializedSnapshotStorage.js.map +0 -1
  583. package/dist/summarizer.d.ts.map +0 -1
  584. package/dist/summarizer.js +0 -348
  585. package/dist/summarizer.js.map +0 -1
  586. package/dist/summarizerClientElection.d.ts.map +0 -1
  587. package/dist/summarizerClientElection.js.map +0 -1
  588. package/dist/summarizerHandle.d.ts +0 -12
  589. package/dist/summarizerHandle.d.ts.map +0 -1
  590. package/dist/summarizerHandle.js +0 -22
  591. package/dist/summarizerHandle.js.map +0 -1
  592. package/dist/summarizerHeuristics.d.ts.map +0 -1
  593. package/dist/summarizerHeuristics.js +0 -84
  594. package/dist/summarizerHeuristics.js.map +0 -1
  595. package/dist/summarizerTypes.d.ts.map +0 -1
  596. package/dist/summarizerTypes.js.map +0 -1
  597. package/dist/summaryCollection.d.ts.map +0 -1
  598. package/dist/summaryCollection.js.map +0 -1
  599. package/dist/summaryFormat.d.ts.map +0 -1
  600. package/dist/summaryFormat.js.map +0 -1
  601. package/dist/summaryGenerator.d.ts.map +0 -1
  602. package/dist/summaryGenerator.js.map +0 -1
  603. package/dist/summaryManager.d.ts.map +0 -1
  604. package/dist/summaryManager.js.map +0 -1
  605. package/dist/throttler.js.map +0 -1
  606. package/garbageCollection.md +0 -41
  607. package/lib/batchTracker.d.ts.map +0 -1
  608. package/lib/batchTracker.js.map +0 -1
  609. package/lib/blobManager.d.ts +0 -95
  610. package/lib/blobManager.d.ts.map +0 -1
  611. package/lib/blobManager.js +0 -244
  612. package/lib/blobManager.js.map +0 -1
  613. package/lib/connectionTelemetry.d.ts.map +0 -1
  614. package/lib/connectionTelemetry.js +0 -174
  615. package/lib/connectionTelemetry.js.map +0 -1
  616. package/lib/containerHandleContext.d.ts.map +0 -1
  617. package/lib/containerHandleContext.js.map +0 -1
  618. package/lib/containerRuntime.d.ts +0 -615
  619. package/lib/containerRuntime.d.ts.map +0 -1
  620. package/lib/containerRuntime.js +0 -2166
  621. package/lib/containerRuntime.js.map +0 -1
  622. package/lib/dataStore.d.ts.map +0 -1
  623. package/lib/dataStore.js.map +0 -1
  624. package/lib/dataStoreContext.d.ts.map +0 -1
  625. package/lib/dataStoreContext.js.map +0 -1
  626. package/lib/dataStoreContexts.d.ts.map +0 -1
  627. package/lib/dataStoreContexts.js.map +0 -1
  628. package/lib/dataStoreRegistry.d.ts.map +0 -1
  629. package/lib/dataStoreRegistry.js.map +0 -1
  630. package/lib/dataStores.d.ts.map +0 -1
  631. package/lib/dataStores.js.map +0 -1
  632. package/lib/deltaScheduler.d.ts.map +0 -1
  633. package/lib/deltaScheduler.js.map +0 -1
  634. package/lib/garbageCollection.d.ts +0 -319
  635. package/lib/garbageCollection.d.ts.map +0 -1
  636. package/lib/garbageCollection.js +0 -989
  637. package/lib/garbageCollection.js.map +0 -1
  638. package/lib/index.d.ts +0 -14
  639. package/lib/index.d.ts.map +0 -1
  640. package/lib/index.js +0 -13
  641. package/lib/index.js.map +0 -1
  642. package/lib/opTelemetry.d.ts +0 -22
  643. package/lib/opTelemetry.d.ts.map +0 -1
  644. package/lib/opTelemetry.js +0 -56
  645. package/lib/opTelemetry.js.map +0 -1
  646. package/lib/orderedClientElection.d.ts.map +0 -1
  647. package/lib/orderedClientElection.js.map +0 -1
  648. package/lib/packageVersion.js.map +0 -1
  649. package/lib/pendingStateManager.d.ts.map +0 -1
  650. package/lib/pendingStateManager.js +0 -339
  651. package/lib/pendingStateManager.js.map +0 -1
  652. package/lib/runWhileConnectedCoordinator.d.ts.map +0 -1
  653. package/lib/runWhileConnectedCoordinator.js.map +0 -1
  654. package/lib/runningSummarizer.d.ts +0 -93
  655. package/lib/runningSummarizer.d.ts.map +0 -1
  656. package/lib/runningSummarizer.js +0 -380
  657. package/lib/runningSummarizer.js.map +0 -1
  658. package/lib/serializedSnapshotStorage.d.ts +0 -58
  659. package/lib/serializedSnapshotStorage.d.ts.map +0 -1
  660. package/lib/serializedSnapshotStorage.js +0 -104
  661. package/lib/serializedSnapshotStorage.js.map +0 -1
  662. package/lib/summarizer.d.ts.map +0 -1
  663. package/lib/summarizer.js +0 -342
  664. package/lib/summarizer.js.map +0 -1
  665. package/lib/summarizerClientElection.d.ts.map +0 -1
  666. package/lib/summarizerClientElection.js.map +0 -1
  667. package/lib/summarizerHandle.d.ts +0 -12
  668. package/lib/summarizerHandle.d.ts.map +0 -1
  669. package/lib/summarizerHandle.js +0 -18
  670. package/lib/summarizerHandle.js.map +0 -1
  671. package/lib/summarizerHeuristics.d.ts.map +0 -1
  672. package/lib/summarizerHeuristics.js +0 -79
  673. package/lib/summarizerHeuristics.js.map +0 -1
  674. package/lib/summarizerTypes.d.ts.map +0 -1
  675. package/lib/summarizerTypes.js +0 -9
  676. package/lib/summarizerTypes.js.map +0 -1
  677. package/lib/summaryCollection.d.ts.map +0 -1
  678. package/lib/summaryCollection.js.map +0 -1
  679. package/lib/summaryFormat.d.ts.map +0 -1
  680. package/lib/summaryFormat.js.map +0 -1
  681. package/lib/summaryGenerator.d.ts +0 -85
  682. package/lib/summaryGenerator.d.ts.map +0 -1
  683. package/lib/summaryGenerator.js.map +0 -1
  684. package/lib/summaryManager.d.ts.map +0 -1
  685. package/lib/summaryManager.js.map +0 -1
  686. package/lib/throttler.d.ts.map +0 -1
  687. package/lib/throttler.js.map +0 -1
  688. package/src/garbageCollection.ts +0 -1434
  689. package/src/opTelemetry.ts +0 -71
  690. package/src/orderedClientElection.ts +0 -511
  691. package/src/runWhileConnectedCoordinator.ts +0 -106
  692. package/src/runningSummarizer.ts +0 -550
  693. package/src/serializedSnapshotStorage.ts +0 -146
  694. package/src/summarizer.ts +0 -438
  695. package/src/summarizerClientElection.ts +0 -161
  696. package/src/summarizerHandle.ts +0 -21
  697. package/src/summarizerHeuristics.ts +0 -108
  698. package/src/summarizerTypes.ts +0 -462
  699. package/src/summaryCollection.ts +0 -406
  700. package/src/summaryFormat.ts +0 -239
  701. package/src/summaryGenerator.ts +0 -427
  702. package/src/summaryManager.ts +0 -368
  703. package/tsconfig.esnext.json +0 -7
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.compatBehaviorAllowsGCMessageType = exports.trimLeadingAndTrailingSlashes = exports.unpackChildNodesGCDetails = exports.getGCDataFromSnapshot = exports.concatGarbageCollectionData = exports.cloneGCData = exports.concatGarbageCollectionStates = exports.generateSortedGCState = exports.shouldAllowGcSweep = exports.getGCVersion = void 0;
8
+ const core_utils_1 = require("@fluidframework/core-utils");
9
+ const runtime_definitions_1 = require("@fluidframework/runtime-definitions");
10
+ function getGCVersion(metadata) {
11
+ if (!metadata) {
12
+ // Force to 0/disallowed in prior versions
13
+ return 0;
14
+ }
15
+ return metadata.gcFeature ?? 0;
16
+ }
17
+ exports.getGCVersion = getGCVersion;
18
+ /**
19
+ * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.
20
+ * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.
21
+ *
22
+ * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants
23
+ * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep
24
+ * such that containers created with a different value will not be subjected to GC Sweep.
25
+ *
26
+ * If no generation is provided, Sweep will be enabled for all documents.
27
+ *
28
+ * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.
29
+ *
30
+ * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value
31
+ * @param currentGeneration - The current app-provided gcGeneration value
32
+ * @returns true if GC Sweep should be allowed for this document
33
+ */
34
+ function shouldAllowGcSweep(featureMatrix, currentGeneration) {
35
+ // If no Generation value is provided for this session, default to true
36
+ if (currentGeneration === undefined) {
37
+ return true;
38
+ }
39
+ // tombstoneGeneration is the predecessor and needs to be supported for back-compat reasons
40
+ const targetGeneration = featureMatrix.tombstoneGeneration ?? featureMatrix.gcGeneration;
41
+ return currentGeneration === targetGeneration;
42
+ }
43
+ exports.shouldAllowGcSweep = shouldAllowGcSweep;
44
+ /**
45
+ * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.
46
+ */
47
+ function generateSortedGCState(gcState) {
48
+ const sortableArray = Object.entries(gcState.gcNodes);
49
+ sortableArray.sort(([a], [b]) => a.localeCompare(b));
50
+ const sortedGCState = { gcNodes: {} };
51
+ for (const [nodeId, nodeData] of sortableArray) {
52
+ nodeData.outboundRoutes.sort();
53
+ sortedGCState.gcNodes[nodeId] = nodeData;
54
+ }
55
+ return sortedGCState;
56
+ }
57
+ exports.generateSortedGCState = generateSortedGCState;
58
+ /**
59
+ * Concatenates the given GC states and returns the concatenated GC state.
60
+ */
61
+ function concatGarbageCollectionStates(gcState1, gcState2) {
62
+ const combinedGCNodes = {};
63
+ for (const [nodeId, nodeData] of Object.entries(gcState1.gcNodes)) {
64
+ combinedGCNodes[nodeId] = {
65
+ outboundRoutes: Array.from(nodeData.outboundRoutes),
66
+ unreferencedTimestampMs: nodeData.unreferencedTimestampMs,
67
+ };
68
+ }
69
+ for (const [nodeId, nodeData] of Object.entries(gcState2.gcNodes)) {
70
+ let combineNodeData = combinedGCNodes[nodeId];
71
+ if (combineNodeData === undefined) {
72
+ combineNodeData = {
73
+ outboundRoutes: Array.from(nodeData.outboundRoutes),
74
+ unreferencedTimestampMs: nodeData.unreferencedTimestampMs,
75
+ };
76
+ }
77
+ else {
78
+ // Validate that same node doesn't have different unreferenced timestamp.
79
+ if (nodeData.unreferencedTimestampMs !== undefined &&
80
+ combineNodeData.unreferencedTimestampMs !== undefined) {
81
+ (0, core_utils_1.assert)(nodeData.unreferencedTimestampMs === combineNodeData.unreferencedTimestampMs, 0x5d7 /* Two entries for the same GC node with different unreferenced timestamp */);
82
+ }
83
+ combineNodeData = {
84
+ outboundRoutes: [
85
+ ...new Set([...nodeData.outboundRoutes, ...combineNodeData.outboundRoutes]),
86
+ ],
87
+ unreferencedTimestampMs: nodeData.unreferencedTimestampMs ?? combineNodeData.unreferencedTimestampMs,
88
+ };
89
+ }
90
+ combinedGCNodes[nodeId] = combineNodeData;
91
+ }
92
+ return { gcNodes: combinedGCNodes };
93
+ }
94
+ exports.concatGarbageCollectionStates = concatGarbageCollectionStates;
95
+ /**
96
+ * Helper function that clones the GC data.
97
+ * @param gcData - The GC data to clone.
98
+ * @returns a clone of the given GC data.
99
+ */
100
+ function cloneGCData(gcData) {
101
+ const clonedGCNodes = {};
102
+ for (const [id, outboundRoutes] of Object.entries(gcData.gcNodes)) {
103
+ clonedGCNodes[id] = Array.from(outboundRoutes);
104
+ }
105
+ return {
106
+ gcNodes: clonedGCNodes,
107
+ };
108
+ }
109
+ exports.cloneGCData = cloneGCData;
110
+ /**
111
+ * Concatenates the given GC data and returns the concatenated GC data.
112
+ */
113
+ function concatGarbageCollectionData(gcData1, gcData2) {
114
+ const combinedGCData = cloneGCData(gcData1);
115
+ for (const [id, routes] of Object.entries(gcData2.gcNodes)) {
116
+ if (combinedGCData.gcNodes[id] === undefined) {
117
+ combinedGCData.gcNodes[id] = Array.from(routes);
118
+ }
119
+ else {
120
+ const combinedRoutes = [...routes, ...combinedGCData.gcNodes[id]];
121
+ combinedGCData.gcNodes[id] = [...new Set(combinedRoutes)];
122
+ }
123
+ }
124
+ return combinedGCData;
125
+ }
126
+ exports.concatGarbageCollectionData = concatGarbageCollectionData;
127
+ /**
128
+ * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and
129
+ * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.
130
+ */
131
+ async function getGCDataFromSnapshot(gcSnapshotTree, readAndParseBlob) {
132
+ let rootGCState = { gcNodes: {} };
133
+ let tombstones;
134
+ let deletedNodes;
135
+ for (const key of Object.keys(gcSnapshotTree.blobs)) {
136
+ // Update deleted nodes blob.
137
+ if (key === runtime_definitions_1.gcDeletedBlobKey) {
138
+ deletedNodes = await readAndParseBlob(gcSnapshotTree.blobs[key]);
139
+ continue;
140
+ }
141
+ // Update tombstone blob.
142
+ if (key === runtime_definitions_1.gcTombstoneBlobKey) {
143
+ tombstones = await readAndParseBlob(gcSnapshotTree.blobs[key]);
144
+ continue;
145
+ }
146
+ // Skip blobs that do not start with the GC prefix.
147
+ if (!key.startsWith(runtime_definitions_1.gcBlobPrefix)) {
148
+ continue;
149
+ }
150
+ const blobId = gcSnapshotTree.blobs[key];
151
+ if (blobId === undefined) {
152
+ continue;
153
+ }
154
+ const gcState = await readAndParseBlob(blobId);
155
+ (0, core_utils_1.assert)(gcState !== undefined, 0x5d8 /* GC blob missing from snapshot */);
156
+ // Merge the GC state of this blob into the root GC state.
157
+ rootGCState = concatGarbageCollectionStates(rootGCState, gcState);
158
+ }
159
+ return { gcState: rootGCState, tombstones, deletedNodes };
160
+ }
161
+ exports.getGCDataFromSnapshot = getGCDataFromSnapshot;
162
+ /**
163
+ * Helper function that unpacks the GC details of the children from a given node's GC details.
164
+ * @param gcDetails - The GC details of a node.
165
+ * @returns A map of GC details of each children of the the given node.
166
+ */
167
+ function unpackChildNodesGCDetails(gcDetails) {
168
+ const childGCDetailsMap = new Map();
169
+ // If GC data is not available, bail out.
170
+ if (gcDetails.gcData === undefined) {
171
+ return childGCDetailsMap;
172
+ }
173
+ const gcNodes = gcDetails.gcData.gcNodes;
174
+ for (const [id, outboundRoutes] of Object.entries(gcNodes)) {
175
+ // Skip self-node since only children GC data is to be generated.
176
+ if (id === "/") {
177
+ continue;
178
+ }
179
+ (0, core_utils_1.assert)(id.startsWith("/"), 0x5d9 /* node id should always be an absolute route */);
180
+ const childId = id.split("/")[1];
181
+ let childGCNodeId = id.slice(childId.length + 1);
182
+ // GC node id always begins with "/". Handle the special case where a child's id in the parent's GC nodes is
183
+ // of format `/root`. In this case, the childId is root and childGCNodeId is "". Make childGCNodeId = "/".
184
+ if (childGCNodeId === "") {
185
+ childGCNodeId = "/";
186
+ }
187
+ let childGCDetails = childGCDetailsMap.get(childId);
188
+ if (childGCDetails === undefined) {
189
+ childGCDetails = { gcData: { gcNodes: {} }, usedRoutes: [] };
190
+ }
191
+ // gcData should not undefined as its always at least initialized as empty above.
192
+ (0, core_utils_1.assert)(childGCDetails.gcData !== undefined, 0x5da /* Child GC data should have been initialized */);
193
+ childGCDetails.gcData.gcNodes[childGCNodeId] = [...new Set(outboundRoutes)];
194
+ childGCDetailsMap.set(childId, childGCDetails);
195
+ }
196
+ if (gcDetails.usedRoutes === undefined) {
197
+ return childGCDetailsMap;
198
+ }
199
+ // Remove the node's self used route, if any, and generate the children used routes.
200
+ const usedRoutes = gcDetails.usedRoutes.filter((route) => route !== "" && route !== "/");
201
+ for (const route of usedRoutes) {
202
+ (0, core_utils_1.assert)(route.startsWith("/"), 0x5db /* Used route should always be an absolute route */);
203
+ const childId = route.split("/")[1];
204
+ const childUsedRoute = route.slice(childId.length + 1);
205
+ const childGCDetails = childGCDetailsMap.get(childId);
206
+ (0, core_utils_1.assert)(childGCDetails?.usedRoutes !== undefined, 0x5dc /* This should have be initialized when generate GC nodes above */);
207
+ childGCDetails.usedRoutes.push(childUsedRoute);
208
+ childGCDetailsMap.set(childId, childGCDetails);
209
+ }
210
+ return childGCDetailsMap;
211
+ }
212
+ exports.unpackChildNodesGCDetails = unpackChildNodesGCDetails;
213
+ /**
214
+ * Trims the leading and trailing slashes from the given string.
215
+ * @param str - A string that may contain leading and / or trailing slashes.
216
+ * @returns A new string without leading and trailing slashes.
217
+ */
218
+ function trimLeadingAndTrailingSlashes(str) {
219
+ return str.replace(/^\/+|\/+$/g, "");
220
+ }
221
+ exports.trimLeadingAndTrailingSlashes = trimLeadingAndTrailingSlashes;
222
+ /**
223
+ * Utility to implement compat behaviors given an unknown message type
224
+ * The parameters are typed to support compile-time enforcement of handling all known types/behaviors
225
+ *
226
+ * @param _unknownGCMessageType - Typed as never to ensure all known types have been
227
+ * handled before calling this function (e.g. in a switch statement).
228
+ * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type
229
+ */
230
+ function compatBehaviorAllowsGCMessageType(_unknownGCMessageType, compatBehavior) {
231
+ // undefined defaults to same behavior as "FailToProcess"
232
+ return compatBehavior === "Ignore";
233
+ }
234
+ exports.compatBehaviorAllowsGCMessageType = compatBehaviorAllowsGCM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AE,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC;IACzF,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE;QAC/B,IAAA,mBAAM,EAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEvD,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtD,IAAA,mBAAM,EACL,cAAc,EAAE,UAAU,KAAK,SAAS,EACxC,KAAK,CAAC,kEAAkE,CACxE,CAAC;QAEF,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC/C;IACD,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AA1DD,8DA0DC;AAED;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,GAAW;IACxD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAFD,sEAEC;AAED;;;;;;;GAOG;AACH,SAAgB,iCAAiC,CAChD,qBAA4B,EAC5B,cAAsD;IAEtD,yDAAyD;IACzD,OAAO,cAAc,KAAK,QAAQ,CAAC;AACpC,CAAC;AAND,8EAMC","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\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n} from \"@fluidframework/runtime-definitions\";\nimport { GCFeatureMatrix, GCVersion, IGCMetadata } from \"./gcDefinitions\";\nimport {\n\tIGarbageCollectionNodeData,\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions\";\n\nexport function getGCVersion(metadata?: IGCMetadata): GCVersion {\n\tif (!metadata) {\n\t\t// Force to 0/disallowed in prior versions\n\t\treturn 0;\n\t}\n\treturn metadata.gcFeature ?? 0;\n}\n\n/**\n * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.\n * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.\n *\n * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants\n * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep\n * such that containers created with a different value will not be subjected to GC Sweep.\n *\n * If no generation is provided, Sweep will be enabled for all documents.\n *\n * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.\n *\n * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value\n * @param currentGeneration - The current app-provided gcGeneration value\n * @returns true if GC Sweep should be allowed for this document\n */\nexport function shouldAllowGcSweep(\n\tfeatureMatrix: GCFeatureMatrix,\n\tcurrentGeneration: number | undefined,\n): boolean {\n\t// If no Generation value is provided for this session, default to true\n\tif (currentGeneration === undefined) {\n\t\treturn true;\n\t}\n\n\t// tombstoneGeneration is the predecessor and needs to be supported for back-compat reasons\n\tconst targetGeneration = featureMatrix.tombstoneGeneration ?? featureMatrix.gcGeneration;\n\n\treturn currentGeneration === targetGeneration;\n}\n\n/**\n * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.\n */\nexport function generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState {\n\tconst sortableArray: [string, IGarbageCollectionNodeData][] = Object.entries(gcState.gcNodes);\n\tsortableArray.sort(([a], [b]) => a.localeCompare(b));\n\tconst sortedGCState: IGarbageCollectionState = { gcNodes: {} };\n\tfor (const [nodeId, nodeData] of sortableArray) {\n\t\tnodeData.outboundRoutes.sort();\n\t\tsortedGCState.gcNodes[nodeId] = nodeData;\n\t}\n\treturn sortedGCState;\n}\n\n/**\n * Concatenates the given GC states and returns the concatenated GC state.\n */\nexport function concatGarbageCollectionStates(\n\tgcState1: IGarbageCollectionState,\n\tgcState2: IGarbageCollectionState,\n): IGarbageCollectionState {\n\tconst combinedGCNodes: { [id: string]: IGarbageCollectionNodeData } = {};\n\tfor (const [nodeId, nodeData] of Object.entries(gcState1.gcNodes)) {\n\t\tcombinedGCNodes[nodeId] = {\n\t\t\toutboundRoutes: Array.from(nodeData.outboundRoutes),\n\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t};\n\t}\n\n\tfor (const [nodeId, nodeData] of Object.entries(gcState2.gcNodes)) {\n\t\tlet combineNodeData = combinedGCNodes[nodeId];\n\t\tif (combineNodeData === undefined) {\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: Array.from(nodeData.outboundRoutes),\n\t\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t} else {\n\t\t\t// Validate that same node doesn't have different unreferenced timestamp.\n\t\t\tif (\n\t\t\t\tnodeData.unreferencedTimestampMs !== undefined &&\n\t\t\t\tcombineNodeData.unreferencedTimestampMs !== undefined\n\t\t\t) {\n\t\t\t\tassert(\n\t\t\t\t\tnodeData.unreferencedTimestampMs === combineNodeData.unreferencedTimestampMs,\n\t\t\t\t\t0x5d7 /* Two entries for the same GC node with different unreferenced timestamp */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: [\n\t\t\t\t\t...new Set([...nodeData.outboundRoutes, ...combineNodeData.outboundRoutes]),\n\t\t\t\t],\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tnodeData.unreferencedTimestampMs ?? combineNodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\t\tcombinedGCNodes[nodeId] = combineNodeData;\n\t}\n\treturn { gcNodes: combinedGCNodes };\n}\n\n/**\n * Helper function that clones the GC data.\n * @param gcData - The GC data to clone.\n * @returns a clone of the given GC data.\n */\nexport function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData {\n\tconst clonedGCNodes: { [id: string]: string[] } = {};\n\tfor (const [id, outboundRoutes] of Object.entries(gcData.gcNodes)) {\n\t\tclonedGCNodes[id] = Array.from(outboundRoutes);\n\t}\n\treturn {\n\t\tgcNodes: clonedGCNodes,\n\t};\n}\n\n/**\n * Concatenates the given GC data and returns the concatenated GC data.\n */\nexport function concatGarbageCollectionData(\n\tgcData1: IGarbageCollectionData,\n\tgcData2: IGarbageCollectionData,\n) {\n\tconst combinedGCData: IGarbageCollectionData = cloneGCData(gcData1);\n\tfor (const [id, routes] of Object.entries(gcData2.gcNodes)) {\n\t\tif (combinedGCData.gcNodes[id] === undefined) {\n\t\t\tcombinedGCData.gcNodes[id] = Array.from(routes);\n\t\t} else {\n\t\t\tconst combinedRoutes = [...routes, ...combinedGCData.gcNodes[id]];\n\t\t\tcombinedGCData.gcNodes[id] = [...new Set(combinedRoutes)];\n\t\t}\n\t}\n\treturn combinedGCData;\n}\n\n/**\n * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and\n * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.\n */\nexport async function getGCDataFromSnapshot(\n\tgcSnapshotTree: ISnapshotTree,\n\treadAndParseBlob: <T>(id: string) => Promise<T>,\n): Promise<IGarbageCollectionSnapshotData> {\n\tlet rootGCState: IGarbageCollectionState = { gcNodes: {} };\n\tlet tombstones: string[] | undefined;\n\tlet deletedNodes: string[] | undefined;\n\tfor (const key of Object.keys(gcSnapshotTree.blobs)) {\n\t\t// Update deleted nodes blob.\n\t\tif (key === gcDeletedBlobKey) {\n\t\t\tdeletedNodes = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Update tombstone blob.\n\t\tif (key === gcTombstoneBlobKey) {\n\t\t\ttombstones = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Skip blobs that do not start with the GC prefix.\n\t\tif (!key.startsWith(gcBlobPrefix)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst blobId = gcSnapshotTree.blobs[key];\n\t\tif (blobId === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst gcState = await readAndParseBlob<IGarbageCollectionState>(blobId);\n\t\tassert(gcState !== undefined, 0x5d8 /* GC blob missing from snapshot */);\n\t\t// Merge the GC state of this blob into the root GC state.\n\t\trootGCState = concatGarbageCollectionStates(rootGCState, gcState);\n\t}\n\treturn { gcState: rootGCState, tombstones, deletedNodes };\n}\n\n/**\n * Helper function that unpacks the GC details of the children from a given node's GC details.\n * @param gcDetails - The GC details of a node.\n * @returns A map of GC details of each children of the the given node.\n */\nexport function unpackChildNodesGCDetails(gcDetails: IGarbageCollectionDetailsBase) {\n\tconst childGCDetailsMap: Map<string, IGarbageCollectionDetailsBase> = new Map();\n\n\t// If GC data is not available, bail out.\n\tif (gcDetails.gcData === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\tconst gcNodes = gcDetails.gcData.gcNodes;\n\tfor (const [id, outboundRoutes] of Object.entries(gcNodes)) {\n\t\t// Skip self-node since only children GC data is to be generated.\n\t\tif (id === \"/\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tassert(id.startsWith(\"/\"), 0x5d9 /* node id should always be an absolute route */);\n\t\tconst childId = id.split(\"/\")[1];\n\t\tlet childGCNodeId = id.slice(childId.length + 1);\n\t\t// GC node id always begins with \"/\". Handle the special case where a child's id in the parent's GC nodes is\n\t\t// of format `/root`. In this case, the childId is root and childGCNodeId is \"\". Make childGCNodeId = \"/\".\n\t\tif (childGCNodeId === \"\") {\n\t\t\tchildGCNodeId = \"/\";\n\t\t}\n\n\t\tlet childGCDetails = childGCDetailsMap.get(childId);\n\t\tif (childGCDetails === undefined) {\n\t\t\tchildGCDetails = { gcData: { gcNodes: {} }, usedRoutes: [] };\n\t\t}\n\t\t// gcData should not undefined as its always at least initialized as empty above.\n\t\tassert(\n\t\t\tchildGCDetails.gcData !== undefined,\n\t\t\t0x5da /* Child GC data should have been initialized */,\n\t\t);\n\t\tchildGCDetails.gcData.gcNodes[childGCNodeId] = [...new Set(outboundRoutes)];\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\n\tif (gcDetails.usedRoutes === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\t// Remove the node's self used route, if any, and generate the children used routes.\n\tconst usedRoutes = gcDetails.usedRoutes.filter((route) => route !== \"\" && route !== \"/\");\n\tfor (const route of usedRoutes) {\n\t\tassert(route.startsWith(\"/\"), 0x5db /* Used route should always be an absolute route */);\n\t\tconst childId = route.split(\"/\")[1];\n\t\tconst childUsedRoute = route.slice(childId.length + 1);\n\n\t\tconst childGCDetails = childGCDetailsMap.get(childId);\n\t\tassert(\n\t\t\tchildGCDetails?.usedRoutes !== undefined,\n\t\t\t0x5dc /* This should have be initialized when generate GC nodes above */,\n\t\t);\n\n\t\tchildGCDetails.usedRoutes.push(childUsedRoute);\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\treturn childGCDetailsMap;\n}\n\n/**\n * Trims the leading and trailing slashes from the given string.\n * @param str - A string that may contain leading and / or trailing slashes.\n * @returns A new string without leading and trailing slashes.\n */\nexport function trimLeadingAndTrailingSlashes(str: string) {\n\treturn str.replace(/^\\/+|\\/+$/g, \"\");\n}\n\n/**\n * Utility to implement compat behaviors given an unknown message type\n * The parameters are typed to support compile-time enforcement of handling all known types/behaviors\n *\n * @param _unknownGCMessageType - Typed as never to ensure all known types have been\n * handled before calling this function (e.g. in a switch statement).\n * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type\n */\nexport function compatBehaviorAllowsGCMessageType(\n\t_unknownGCMessageType: never,\n\tcompatBehavior: \"Ignore\" | \"FailToProcess\" | undefined,\n): boolean {\n\t// undefined defaults to same behavior as \"FailToProcess\"\n\treturn compatBehavior === \"Ignore\";\n}\n"]}
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ISnapshotTree } from "@fluidframework/protocol-definitions";
6
+ import { IGarbageCollectionData, IGarbageCollectionDetailsBase } from "@fluidframework/runtime-definitions";
7
+ import { GCFeatureMatrix, GCVersion, IGCMetadata } from "./gcDefinitions";
8
+ import { IGarbageCollectionSnapshotData, IGarbageCollectionState } from "./gcSummaryDefinitions";
9
+ export declare function getGCVersion(metadata?: IGCMetadata): GCVersion;
10
+ /**
11
+ * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.
12
+ * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.
13
+ *
14
+ * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants
15
+ * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep
16
+ * such that containers created with a different value will not be subjected to GC Sweep.
17
+ *
18
+ * If no generation is provided, Sweep will be enabled for all documents.
19
+ *
20
+ * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.
21
+ *
22
+ * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value
23
+ * @param currentGeneration - The current app-provided gcGeneration value
24
+ * @returns true if GC Sweep should be allowed for this document
25
+ */
26
+ export declare function shouldAllowGcSweep(featureMatrix: GCFeatureMatrix, currentGeneration: number | undefined): boolean;
27
+ /**
28
+ * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.
29
+ */
30
+ export declare function generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState;
31
+ /**
32
+ * Concatenates the given GC states and returns the concatenated GC state.
33
+ */
34
+ export declare function concatGarbageCollectionStates(gcState1: IGarbageCollectionState, gcState2: IGarbageCollectionState): IGarbageCollectionState;
35
+ /**
36
+ * Helper function that clones the GC data.
37
+ * @param gcData - The GC data to clone.
38
+ * @returns a clone of the given GC data.
39
+ */
40
+ export declare function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData;
41
+ /**
42
+ * Concatenates the given GC data and returns the concatenated GC data.
43
+ */
44
+ export declare function concatGarbageCollectionData(gcData1: IGarbageCollectionData, gcData2: IGarbageCollectionData): IGarbageCollectionData;
45
+ /**
46
+ * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and
47
+ * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.
48
+ */
49
+ export declare function getGCDataFromSnapshot(gcSnapshotTree: ISnapshotTree, readAndParseBlob: <T>(id: string) => Promise<T>): Promise<IGarbageCollectionSnapshotData>;
50
+ /**
51
+ * Helper function that unpacks the GC details of the children from a given node's GC details.
52
+ * @param gcDetails - The GC details of a node.
53
+ * @returns A map of GC details of each children of the the given node.
54
+ */
55
+ export declare function unpackChildNodesGCDetails(gcDetails: IGarbageCollectionDetailsBase): Map<string, IGarbageCollectionDetailsBase>;
56
+ /**
57
+ * Trims the leading and trailing slashes from the given string.
58
+ * @param str - A string that may contain leading and / or trailing slashes.
59
+ * @returns A new string without leading and trailing slashes.
60
+ */
61
+ export declare function trimLeadingAndTrailingSlashes(str: string): string;
62
+ /**
63
+ * Utility to implement compat behaviors given an unknown message type
64
+ * The parameters are typed to support compile-time enforcement of handling all known types/behaviors
65
+ *
66
+ * @param _unknownGCMessageType - Typed as never to ensure all known types have been
67
+ * handled before calling this function (e.g. in a switch statement).
68
+ * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type
69
+ */
70
+ export declare function compatBehaviorAllowsGCMessageType(_unknownGCMessageType: never, compatBehavior: "Ignore" | "FailToProcess" | undefined): boolean;
71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E,6BAA6B,8CA0DjF;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,UAExD;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAChD,qBAAqB,EAAE,KAAK,EAC5B,cAAc,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,GACpD,OAAO,CAGT"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.runGarbageCollection = void 0;
8
+ /**
9
+ * Runs garbage collection on the given reference graph.
10
+ * @param referenceGraph - The reference graph to run GC on. It's a list of nodes where each node has an id and set of
11
+ * routes to other nodes in the graph.
12
+ * @param rootIds - The ids of root nodes that are considered referenced.
13
+ * @returns the ids of referenced nodes and the ids of deleted nodes in the referenced graph.
14
+ */
15
+ function runGarbageCollection(referenceGraph, rootIds) {
16
+ // This set keeps track of nodes that we have visited. It is used to detect cycles in the graph.
17
+ const visited = new Set();
18
+ // This tracks the ids of referenced nodes. The nodes corresponding to rootIds are always considered
19
+ // referenced so we start with those.
20
+ const referencedIds = [...rootIds];
21
+ for (const id of referencedIds) {
22
+ // If we have already seen this node, ignore and continue. Else, add it to visited list.
23
+ if (visited.has(id)) {
24
+ continue;
25
+ }
26
+ visited.add(id);
27
+ // Get the node for the referenced id and add its outbound routes to referencedIds since they are
28
+ // also referenced.
29
+ const routes = referenceGraph[id];
30
+ if (routes !== undefined) {
31
+ referencedIds.push(...routes);
32
+ }
33
+ }
34
+ const referencedNodeIds = [];
35
+ const deletedNodeIds = [];
36
+ for (const id of Object.keys(referenceGraph)) {
37
+ // The nodes from the reference graph whose ids are in the visited list are referenced.
38
+ // The rest of the nodes are deleted.
39
+ if (visited.has(id)) {
40
+ referencedNodeIds.push(id);
41
+ }
42
+ else {
43
+ deletedNodeIds.push(id);
44
+ }
45
+ }
46
+ return { referencedNodeIds, deletedNodeIds };
47
+ }
48
+ exports.runGarbageCollection = runGarbageCollection;
49
+ //# sourceMappingURL=gcReferenceGraphAlgorithm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcReferenceGraphAlgorithm.cjs","sourceRoot":"","sources":["../../src/gc/gcReferenceGraphAlgorithm.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,oBAAoB,CACnC,cAA0C,EAC1C,OAAiB;IAEjB,gGAAgG;IAChG,MAAM,OAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEvC,oGAAoG;IACpG,qCAAqC;IACrC,MAAM,aAAa,GAAa,CAAC,GAAG,OAAO,CAAC,CAAC;IAC7C,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE;QAC/B,wFAAwF;QACxF,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACpB,SAAS;SACT;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,iGAAiG;QACjG,mBAAmB;QACnB,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS,EAAE;YACzB,aAAa,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;SAC9B;KACD;IAED,MAAM,iBAAiB,GAAa,EAAE,CAAC;IACvC,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QAC7C,uFAAuF;QACvF,qCAAqC;QACrC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACpB,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC3B;aAAM;YACN,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACxB;KACD;IACD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAC9C,CAAC;AArCD,oDAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IGCResult } from \"./gcDefinitions\";\n\n/**\n * Runs garbage collection on the given reference graph.\n * @param referenceGraph - The reference graph to run GC on. It's a list of nodes where each node has an id and set of\n * routes to other nodes in the graph.\n * @param rootIds - The ids of root nodes that are considered referenced.\n * @returns the ids of referenced nodes and the ids of deleted nodes in the referenced graph.\n */\nexport function runGarbageCollection(\n\treferenceGraph: { [id: string]: string[] },\n\trootIds: string[],\n): IGCResult {\n\t// This set keeps track of nodes that we have visited. It is used to detect cycles in the graph.\n\tconst visited: Set<string> = new Set();\n\n\t// This tracks the ids of referenced nodes. The nodes corresponding to rootIds are always considered\n\t// referenced so we start with those.\n\tconst referencedIds: string[] = [...rootIds];\n\tfor (const id of referencedIds) {\n\t\t// If we have already seen this node, ignore and continue. Else, add it to visited list.\n\t\tif (visited.has(id)) {\n\t\t\tcontinue;\n\t\t}\n\t\tvisited.add(id);\n\n\t\t// Get the node for the referenced id and add its outbound routes to referencedIds since they are\n\t\t// also referenced.\n\t\tconst routes = referenceGraph[id];\n\t\tif (routes !== undefined) {\n\t\t\treferencedIds.push(...routes);\n\t\t}\n\t}\n\n\tconst referencedNodeIds: string[] = [];\n\tconst deletedNodeIds: string[] = [];\n\tfor (const id of Object.keys(referenceGraph)) {\n\t\t// The nodes from the reference graph whose ids are in the visited list are referenced.\n\t\t// The rest of the nodes are deleted.\n\t\tif (visited.has(id)) {\n\t\t\treferencedNodeIds.push(id);\n\t\t} else {\n\t\t\tdeletedNodeIds.push(id);\n\t\t}\n\t}\n\treturn { referencedNodeIds, deletedNodeIds };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IGCResult } from "./gcDefinitions";
6
+ /**
7
+ * Runs garbage collection on the given reference graph.
8
+ * @param referenceGraph - The reference graph to run GC on. It's a list of nodes where each node has an id and set of
9
+ * routes to other nodes in the graph.
10
+ * @param rootIds - The ids of root nodes that are considered referenced.
11
+ * @returns the ids of referenced nodes and the ids of deleted nodes in the referenced graph.
12
+ */
13
+ export declare function runGarbageCollection(referenceGraph: {
14
+ [id: string]: string[];
15
+ }, rootIds: string[]): IGCResult;
16
+ //# sourceMappingURL=gcReferenceGraphAlgorithm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcReferenceGraphAlgorithm.d.ts","sourceRoot":"","sources":["../../src/gc/gcReferenceGraphAlgorithm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,cAAc,EAAE;IAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,EAC1C,OAAO,EAAE,MAAM,EAAE,GACf,SAAS,CAkCX"}
@@ -4,9 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ISummarizer = void 0;
8
- /**
9
- * @deprecated - This will be removed in a later release.
10
- */
11
- exports.ISummarizer = "ISummarizer";
12
- //# sourceMappingURL=summarizerTypes.js.map
7
+ //# sourceMappingURL=gcSummaryDefinitions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcSummaryDefinitions.cjs","sourceRoot":"","sources":["../../src/gc/gcSummaryDefinitions.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\n\n/**\n * The garbage collection data of each node in the reference graph. Each node's GC data is written in the summary\n * in this format.\n */\nexport interface IGarbageCollectionNodeData {\n\t/**\n\t * The set of routes to other nodes in the graph.\n\t */\n\toutboundRoutes: string[];\n\t/**\n\t * If the node is unreferenced, the timestamp of when it was marked unreferenced.\n\t */\n\tunreferencedTimestampMs?: number;\n}\n\n/**\n * The garbage collection state of the reference graph. It contains a list of all the nodes in the graph and their\n * GC data. The GC data is written in the summary in this format.\n */\nexport interface IGarbageCollectionState {\n\tgcNodes: { [id: string]: IGarbageCollectionNodeData };\n}\n\n/**\n * The GC data that is read from a snapshot. It contains the Garbage CollectionState state and tombstone state.\n */\nexport interface IGarbageCollectionSnapshotData {\n\t/** The garbage collection state. It is a list of nodes in the container and their GC data. */\n\tgcState: IGarbageCollectionState | undefined;\n\t/** A list of nodes that have been tombstoned by GC. */\n\ttombstones: string[] | undefined;\n\t/** A list of nodes that have been deleted by GC. */\n\tdeletedNodes: string[] | undefined;\n}\n\n/**\n * @deprecated IGarbageCollectionState is written in the root of the summary now.\n * Legacy GC details from when the GC details were written at the data store's summary tree.\n */\nexport interface IGarbageCollectionSummaryDetailsLegacy {\n\t/** A list of routes to Fluid objects that are used in this node. */\n\tusedRoutes?: string[];\n\t/** The GC data of this node. */\n\tgcData?: IGarbageCollectionData;\n\t/** If this node is unreferenced, the time when it was marked as such. */\n\tunrefTimestamp?: number;\n}\n"]}
@@ -0,0 +1,52 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
6
+ /**
7
+ * The garbage collection data of each node in the reference graph. Each node's GC data is written in the summary
8
+ * in this format.
9
+ */
10
+ export interface IGarbageCollectionNodeData {
11
+ /**
12
+ * The set of routes to other nodes in the graph.
13
+ */
14
+ outboundRoutes: string[];
15
+ /**
16
+ * If the node is unreferenced, the timestamp of when it was marked unreferenced.
17
+ */
18
+ unreferencedTimestampMs?: number;
19
+ }
20
+ /**
21
+ * The garbage collection state of the reference graph. It contains a list of all the nodes in the graph and their
22
+ * GC data. The GC data is written in the summary in this format.
23
+ */
24
+ export interface IGarbageCollectionState {
25
+ gcNodes: {
26
+ [id: string]: IGarbageCollectionNodeData;
27
+ };
28
+ }
29
+ /**
30
+ * The GC data that is read from a snapshot. It contains the Garbage CollectionState state and tombstone state.
31
+ */
32
+ export interface IGarbageCollectionSnapshotData {
33
+ /** The garbage collection state. It is a list of nodes in the container and their GC data. */
34
+ gcState: IGarbageCollectionState | undefined;
35
+ /** A list of nodes that have been tombstoned by GC. */
36
+ tombstones: string[] | undefined;
37
+ /** A list of nodes that have been deleted by GC. */
38
+ deletedNodes: string[] | undefined;
39
+ }
40
+ /**
41
+ * @deprecated IGarbageCollectionState is written in the root of the summary now.
42
+ * Legacy GC details from when the GC details were written at the data store's summary tree.
43
+ */
44
+ export interface IGarbageCollectionSummaryDetailsLegacy {
45
+ /** A list of routes to Fluid objects that are used in this node. */
46
+ usedRoutes?: string[];
47
+ /** The GC data of this node. */
48
+ gcData?: IGarbageCollectionData;
49
+ /** If this node is unreferenced, the time when it was marked as such. */
50
+ unrefTimestamp?: number;
51
+ }
52
+ //# sourceMappingURL=gcSummaryDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcSummaryDefinitions.d.ts","sourceRoot":"","sources":["../../src/gc/gcSummaryDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,0BAA0B,CAAA;KAAE,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,8FAA8F;IAC9F,OAAO,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC7C,uDAAuD;IACvD,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACjC,oDAAoD;IACpD,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACtD,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,gCAAgC;IAChC,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}