@fluidframework/container-runtime 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (563) hide show
  1. package/.eslintrc.js +21 -10
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +2 -2
  4. package/dist/batchTracker.d.ts +1 -2
  5. package/dist/batchTracker.d.ts.map +1 -1
  6. package/dist/batchTracker.js +2 -1
  7. package/dist/batchTracker.js.map +1 -1
  8. package/dist/blobManager.d.ts +74 -42
  9. package/dist/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager.js +321 -152
  11. package/dist/blobManager.js.map +1 -1
  12. package/dist/connectionTelemetry.d.ts.map +1 -1
  13. package/dist/connectionTelemetry.js +11 -9
  14. package/dist/connectionTelemetry.js.map +1 -1
  15. package/dist/containerHandleContext.d.ts.map +1 -1
  16. package/dist/containerHandleContext.js +3 -1
  17. package/dist/containerHandleContext.js.map +1 -1
  18. package/dist/containerRuntime.d.ts +148 -114
  19. package/dist/containerRuntime.d.ts.map +1 -1
  20. package/dist/containerRuntime.js +534 -342
  21. package/dist/containerRuntime.js.map +1 -1
  22. package/dist/dataStore.d.ts.map +1 -1
  23. package/dist/dataStore.js +11 -9
  24. package/dist/dataStore.js.map +1 -1
  25. package/dist/dataStoreContext.d.ts +40 -13
  26. package/dist/dataStoreContext.d.ts.map +1 -1
  27. package/dist/dataStoreContext.js +146 -66
  28. package/dist/dataStoreContext.js.map +1 -1
  29. package/dist/dataStoreContexts.d.ts.map +1 -1
  30. package/dist/dataStoreContexts.js +7 -3
  31. package/dist/dataStoreContexts.js.map +1 -1
  32. package/dist/dataStoreRegistry.d.ts.map +1 -1
  33. package/dist/dataStoreRegistry.js +3 -1
  34. package/dist/dataStoreRegistry.js.map +1 -1
  35. package/dist/dataStores.d.ts +39 -12
  36. package/dist/dataStores.d.ts.map +1 -1
  37. package/dist/dataStores.js +164 -76
  38. package/dist/dataStores.js.map +1 -1
  39. package/dist/deltaManagerSummarizerProxy.d.ts +19 -0
  40. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -0
  41. package/dist/deltaManagerSummarizerProxy.js +40 -0
  42. package/dist/deltaManagerSummarizerProxy.js.map +1 -0
  43. package/dist/deltaScheduler.d.ts.map +1 -1
  44. package/dist/deltaScheduler.js +8 -3
  45. package/dist/deltaScheduler.js.map +1 -1
  46. package/dist/gc/garbageCollection.d.ts +204 -0
  47. package/dist/gc/garbageCollection.d.ts.map +1 -0
  48. package/dist/gc/garbageCollection.js +926 -0
  49. package/dist/gc/garbageCollection.js.map +1 -0
  50. package/dist/gc/gcConfigs.d.ts +22 -0
  51. package/dist/gc/gcConfigs.d.ts.map +1 -0
  52. package/dist/gc/gcConfigs.js +143 -0
  53. package/dist/gc/gcConfigs.js.map +1 -0
  54. package/dist/gc/gcDefinitions.d.ts +320 -0
  55. package/dist/gc/gcDefinitions.d.ts.map +1 -0
  56. package/dist/gc/gcDefinitions.js +81 -0
  57. package/dist/gc/gcDefinitions.js.map +1 -0
  58. package/dist/gc/gcHelpers.d.ts +86 -0
  59. package/dist/gc/gcHelpers.d.ts.map +1 -0
  60. package/dist/gc/gcHelpers.js +268 -0
  61. package/dist/gc/gcHelpers.js.map +1 -0
  62. package/dist/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
  63. package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  64. package/dist/gc/gcReferenceGraphAlgorithm.js +49 -0
  65. package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -0
  66. package/dist/gc/gcSummaryDefinitions.d.ts +52 -0
  67. package/dist/gc/gcSummaryDefinitions.d.ts.map +1 -0
  68. package/dist/gc/gcSummaryDefinitions.js +7 -0
  69. package/dist/gc/gcSummaryDefinitions.js.map +1 -0
  70. package/dist/gc/gcSummaryStateTracker.d.ts +93 -0
  71. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -0
  72. package/dist/gc/gcSummaryStateTracker.js +239 -0
  73. package/dist/gc/gcSummaryStateTracker.js.map +1 -0
  74. package/{lib → dist/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
  75. package/dist/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
  76. package/dist/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
  77. package/dist/gc/gcSweepReadyUsageDetection.js.map +1 -0
  78. package/dist/gc/gcUnreferencedStateTracker.d.ts +34 -0
  79. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  80. package/dist/gc/gcUnreferencedStateTracker.js +94 -0
  81. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -0
  82. package/dist/gc/index.d.ts +13 -0
  83. package/dist/gc/index.d.ts.map +1 -0
  84. package/dist/gc/index.js +50 -0
  85. package/dist/gc/index.js.map +1 -0
  86. package/dist/index.d.ts +3 -8
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +7 -13
  89. package/dist/index.js.map +1 -1
  90. package/dist/opLifecycle/batchManager.d.ts +10 -0
  91. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  92. package/dist/opLifecycle/batchManager.js +37 -8
  93. package/dist/opLifecycle/batchManager.js.map +1 -1
  94. package/dist/opLifecycle/definitions.d.ts +29 -1
  95. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  96. package/dist/opLifecycle/definitions.js.map +1 -1
  97. package/dist/opLifecycle/index.d.ts +3 -3
  98. package/dist/opLifecycle/index.d.ts.map +1 -1
  99. package/dist/opLifecycle/index.js +3 -1
  100. package/dist/opLifecycle/index.js.map +1 -1
  101. package/dist/opLifecycle/opCompressor.d.ts +1 -1
  102. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  103. package/dist/opLifecycle/opCompressor.js +46 -17
  104. package/dist/opLifecycle/opCompressor.js.map +1 -1
  105. package/dist/opLifecycle/opDecompressor.d.ts +6 -1
  106. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  107. package/dist/opLifecycle/opDecompressor.js +72 -18
  108. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  109. package/dist/opLifecycle/opSplitter.d.ts +46 -2
  110. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  111. package/dist/opLifecycle/opSplitter.js +142 -5
  112. package/dist/opLifecycle/opSplitter.js.map +1 -1
  113. package/dist/opLifecycle/outbox.d.ts +23 -2
  114. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  115. package/dist/opLifecycle/outbox.js +101 -51
  116. package/dist/opLifecycle/outbox.js.map +1 -1
  117. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  118. package/dist/opLifecycle/remoteMessageProcessor.js +17 -2
  119. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  120. package/dist/opProperties.d.ts.map +1 -1
  121. package/dist/opProperties.js +1 -3
  122. package/dist/opProperties.js.map +1 -1
  123. package/dist/packageVersion.d.ts +1 -1
  124. package/dist/packageVersion.js +1 -1
  125. package/dist/packageVersion.js.map +1 -1
  126. package/dist/pendingStateManager.d.ts +6 -15
  127. package/dist/pendingStateManager.d.ts.map +1 -1
  128. package/dist/pendingStateManager.js +137 -165
  129. package/dist/pendingStateManager.js.map +1 -1
  130. package/dist/scheduleManager.d.ts +0 -1
  131. package/dist/scheduleManager.d.ts.map +1 -1
  132. package/dist/scheduleManager.js +11 -21
  133. package/dist/scheduleManager.js.map +1 -1
  134. package/dist/storageServiceWithAttachBlobs.d.ts +17 -0
  135. package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -0
  136. package/dist/storageServiceWithAttachBlobs.js +32 -0
  137. package/dist/storageServiceWithAttachBlobs.js.map +1 -0
  138. package/dist/summary/index.d.ts +17 -0
  139. package/dist/summary/index.d.ts.map +1 -0
  140. package/dist/summary/index.js +46 -0
  141. package/dist/summary/index.js.map +1 -0
  142. package/dist/summary/orderedClientElection.d.ts.map +1 -0
  143. package/dist/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
  144. package/dist/summary/orderedClientElection.js.map +1 -0
  145. package/{lib → dist/summary}/runWhileConnectedCoordinator.d.ts +3 -2
  146. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  147. package/dist/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +5 -4
  148. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -0
  149. package/{lib → dist/summary}/runningSummarizer.d.ts +19 -18
  150. package/dist/summary/runningSummarizer.d.ts.map +1 -0
  151. package/dist/{runningSummarizer.js → summary/runningSummarizer.js} +191 -77
  152. package/dist/summary/runningSummarizer.js.map +1 -0
  153. package/dist/{summarizer.d.ts → summary/summarizer.d.ts} +6 -12
  154. package/dist/summary/summarizer.d.ts.map +1 -0
  155. package/dist/{summarizer.js → summary/summarizer.js} +32 -76
  156. package/dist/summary/summarizer.js.map +1 -0
  157. package/dist/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +1 -2
  158. package/dist/summary/summarizerClientElection.d.ts.map +1 -0
  159. package/dist/{summarizerClientElection.js → summary/summarizerClientElection.js} +3 -30
  160. package/dist/summary/summarizerClientElection.js.map +1 -0
  161. package/dist/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
  162. package/dist/summary/summarizerHeuristics.d.ts.map +1 -0
  163. package/dist/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +9 -12
  164. package/dist/summary/summarizerHeuristics.js.map +1 -0
  165. package/dist/summary/summarizerNode/index.d.ts +8 -0
  166. package/dist/summary/summarizerNode/index.d.ts.map +1 -0
  167. package/dist/summary/summarizerNode/index.js +12 -0
  168. package/dist/summary/summarizerNode/index.js.map +1 -0
  169. package/dist/summary/summarizerNode/summarizerNode.d.ts +149 -0
  170. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  171. package/dist/summary/summarizerNode/summarizerNode.js +531 -0
  172. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -0
  173. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +125 -0
  174. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  175. package/dist/summary/summarizerNode/summarizerNodeUtils.js +132 -0
  176. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
  177. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +22 -0
  178. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  179. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +423 -0
  180. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
  181. package/{lib → dist/summary}/summarizerTypes.d.ts +29 -42
  182. package/dist/summary/summarizerTypes.d.ts.map +1 -0
  183. package/dist/{summarizerTypes.js → summary/summarizerTypes.js} +0 -5
  184. package/dist/summary/summarizerTypes.js.map +1 -0
  185. package/dist/summary/summaryCollection.d.ts.map +1 -0
  186. package/dist/{summaryCollection.js → summary/summaryCollection.js} +18 -8
  187. package/dist/summary/summaryCollection.js.map +1 -0
  188. package/{lib → dist/summary}/summaryFormat.d.ts +3 -21
  189. package/dist/summary/summaryFormat.d.ts.map +1 -0
  190. package/dist/{summaryFormat.js → summary/summaryFormat.js} +19 -21
  191. package/dist/summary/summaryFormat.js.map +1 -0
  192. package/dist/summary/summaryGenerator.d.ts.map +1 -0
  193. package/dist/{summaryGenerator.js → summary/summaryGenerator.js} +34 -16
  194. package/dist/summary/summaryGenerator.js.map +1 -0
  195. package/dist/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
  196. package/dist/summary/summaryManager.d.ts.map +1 -0
  197. package/dist/{summaryManager.js → summary/summaryManager.js} +21 -9
  198. package/dist/summary/summaryManager.js.map +1 -0
  199. package/dist/throttler.d.ts +2 -2
  200. package/dist/throttler.d.ts.map +1 -1
  201. package/dist/throttler.js +4 -4
  202. package/dist/throttler.js.map +1 -1
  203. package/lib/batchTracker.d.ts +1 -2
  204. package/lib/batchTracker.d.ts.map +1 -1
  205. package/lib/batchTracker.js +2 -1
  206. package/lib/batchTracker.js.map +1 -1
  207. package/lib/blobManager.d.ts +74 -42
  208. package/lib/blobManager.d.ts.map +1 -1
  209. package/lib/blobManager.js +322 -153
  210. package/lib/blobManager.js.map +1 -1
  211. package/lib/connectionTelemetry.d.ts.map +1 -1
  212. package/lib/connectionTelemetry.js +11 -9
  213. package/lib/connectionTelemetry.js.map +1 -1
  214. package/lib/containerHandleContext.d.ts.map +1 -1
  215. package/lib/containerHandleContext.js +3 -1
  216. package/lib/containerHandleContext.js.map +1 -1
  217. package/lib/containerRuntime.d.ts +148 -114
  218. package/lib/containerRuntime.d.ts.map +1 -1
  219. package/lib/containerRuntime.js +506 -314
  220. package/lib/containerRuntime.js.map +1 -1
  221. package/lib/dataStore.d.ts.map +1 -1
  222. package/lib/dataStore.js +11 -9
  223. package/lib/dataStore.js.map +1 -1
  224. package/lib/dataStoreContext.d.ts +40 -13
  225. package/lib/dataStoreContext.d.ts.map +1 -1
  226. package/lib/dataStoreContext.js +136 -56
  227. package/lib/dataStoreContext.js.map +1 -1
  228. package/lib/dataStoreContexts.d.ts.map +1 -1
  229. package/lib/dataStoreContexts.js +7 -3
  230. package/lib/dataStoreContexts.js.map +1 -1
  231. package/lib/dataStoreRegistry.d.ts.map +1 -1
  232. package/lib/dataStoreRegistry.js +3 -1
  233. package/lib/dataStoreRegistry.js.map +1 -1
  234. package/lib/dataStores.d.ts +39 -12
  235. package/lib/dataStores.d.ts.map +1 -1
  236. package/lib/dataStores.js +162 -74
  237. package/lib/dataStores.js.map +1 -1
  238. package/lib/deltaManagerSummarizerProxy.d.ts +19 -0
  239. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
  240. package/lib/deltaManagerSummarizerProxy.js +36 -0
  241. package/lib/deltaManagerSummarizerProxy.js.map +1 -0
  242. package/lib/deltaScheduler.d.ts.map +1 -1
  243. package/lib/deltaScheduler.js +9 -4
  244. package/lib/deltaScheduler.js.map +1 -1
  245. package/lib/gc/garbageCollection.d.ts +204 -0
  246. package/lib/gc/garbageCollection.d.ts.map +1 -0
  247. package/lib/gc/garbageCollection.js +922 -0
  248. package/lib/gc/garbageCollection.js.map +1 -0
  249. package/lib/gc/gcConfigs.d.ts +22 -0
  250. package/lib/gc/gcConfigs.d.ts.map +1 -0
  251. package/lib/gc/gcConfigs.js +139 -0
  252. package/lib/gc/gcConfigs.js.map +1 -0
  253. package/lib/gc/gcDefinitions.d.ts +320 -0
  254. package/lib/gc/gcDefinitions.d.ts.map +1 -0
  255. package/lib/gc/gcDefinitions.js +78 -0
  256. package/lib/gc/gcDefinitions.js.map +1 -0
  257. package/lib/gc/gcHelpers.d.ts +86 -0
  258. package/lib/gc/gcHelpers.d.ts.map +1 -0
  259. package/lib/gc/gcHelpers.js +254 -0
  260. package/lib/gc/gcHelpers.js.map +1 -0
  261. package/lib/gc/gcReferenceGraphAlgorithm.d.ts +16 -0
  262. package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  263. package/lib/gc/gcReferenceGraphAlgorithm.js +45 -0
  264. package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
  265. package/lib/gc/gcSummaryDefinitions.d.ts +52 -0
  266. package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
  267. package/lib/gc/gcSummaryDefinitions.js +6 -0
  268. package/lib/gc/gcSummaryDefinitions.js.map +1 -0
  269. package/lib/gc/gcSummaryStateTracker.d.ts +93 -0
  270. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
  271. package/lib/gc/gcSummaryStateTracker.js +235 -0
  272. package/lib/gc/gcSummaryStateTracker.js.map +1 -0
  273. package/{dist → lib/gc}/gcSweepReadyUsageDetection.d.ts +5 -5
  274. package/lib/gc/gcSweepReadyUsageDetection.d.ts.map +1 -0
  275. package/lib/{gcSweepReadyUsageDetection.js → gc/gcSweepReadyUsageDetection.js} +15 -11
  276. package/lib/gc/gcSweepReadyUsageDetection.js.map +1 -0
  277. package/lib/gc/gcUnreferencedStateTracker.d.ts +34 -0
  278. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  279. package/lib/gc/gcUnreferencedStateTracker.js +90 -0
  280. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
  281. package/lib/gc/index.d.ts +13 -0
  282. package/lib/gc/index.d.ts.map +1 -0
  283. package/lib/gc/index.js +12 -0
  284. package/lib/gc/index.js.map +1 -0
  285. package/lib/index.d.ts +3 -8
  286. package/lib/index.d.ts.map +1 -1
  287. package/lib/index.js +2 -6
  288. package/lib/index.js.map +1 -1
  289. package/lib/opLifecycle/batchManager.d.ts +10 -0
  290. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  291. package/lib/opLifecycle/batchManager.js +35 -7
  292. package/lib/opLifecycle/batchManager.js.map +1 -1
  293. package/lib/opLifecycle/definitions.d.ts +29 -1
  294. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  295. package/lib/opLifecycle/definitions.js.map +1 -1
  296. package/lib/opLifecycle/index.d.ts +3 -3
  297. package/lib/opLifecycle/index.d.ts.map +1 -1
  298. package/lib/opLifecycle/index.js +2 -2
  299. package/lib/opLifecycle/index.js.map +1 -1
  300. package/lib/opLifecycle/opCompressor.d.ts +1 -1
  301. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  302. package/lib/opLifecycle/opCompressor.js +47 -18
  303. package/lib/opLifecycle/opCompressor.js.map +1 -1
  304. package/lib/opLifecycle/opDecompressor.d.ts +6 -1
  305. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  306. package/lib/opLifecycle/opDecompressor.js +72 -18
  307. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  308. package/lib/opLifecycle/opSplitter.d.ts +46 -2
  309. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  310. package/lib/opLifecycle/opSplitter.js +141 -5
  311. package/lib/opLifecycle/opSplitter.js.map +1 -1
  312. package/lib/opLifecycle/outbox.d.ts +23 -2
  313. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  314. package/lib/opLifecycle/outbox.js +103 -53
  315. package/lib/opLifecycle/outbox.js.map +1 -1
  316. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  317. package/lib/opLifecycle/remoteMessageProcessor.js +17 -2
  318. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  319. package/lib/opProperties.d.ts.map +1 -1
  320. package/lib/opProperties.js +1 -3
  321. package/lib/opProperties.js.map +1 -1
  322. package/lib/packageVersion.d.ts +1 -1
  323. package/lib/packageVersion.js +1 -1
  324. package/lib/packageVersion.js.map +1 -1
  325. package/lib/pendingStateManager.d.ts +6 -15
  326. package/lib/pendingStateManager.d.ts.map +1 -1
  327. package/lib/pendingStateManager.js +137 -165
  328. package/lib/pendingStateManager.js.map +1 -1
  329. package/lib/scheduleManager.d.ts +0 -1
  330. package/lib/scheduleManager.d.ts.map +1 -1
  331. package/lib/scheduleManager.js +11 -21
  332. package/lib/scheduleManager.js.map +1 -1
  333. package/lib/storageServiceWithAttachBlobs.d.ts +17 -0
  334. package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
  335. package/lib/storageServiceWithAttachBlobs.js +28 -0
  336. package/lib/storageServiceWithAttachBlobs.js.map +1 -0
  337. package/lib/summary/index.d.ts +17 -0
  338. package/lib/summary/index.d.ts.map +1 -0
  339. package/lib/summary/index.js +15 -0
  340. package/lib/summary/index.js.map +1 -0
  341. package/lib/summary/orderedClientElection.d.ts.map +1 -0
  342. package/lib/{orderedClientElection.js → summary/orderedClientElection.js} +10 -4
  343. package/lib/summary/orderedClientElection.js.map +1 -0
  344. package/{dist → lib/summary}/runWhileConnectedCoordinator.d.ts +3 -2
  345. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  346. package/lib/{runWhileConnectedCoordinator.js → summary/runWhileConnectedCoordinator.js} +5 -4
  347. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
  348. package/{dist → lib/summary}/runningSummarizer.d.ts +19 -18
  349. package/lib/summary/runningSummarizer.d.ts.map +1 -0
  350. package/lib/{runningSummarizer.js → summary/runningSummarizer.js} +193 -79
  351. package/lib/summary/runningSummarizer.js.map +1 -0
  352. package/lib/{summarizer.d.ts → summary/summarizer.d.ts} +6 -12
  353. package/lib/summary/summarizer.d.ts.map +1 -0
  354. package/lib/{summarizer.js → summary/summarizer.js} +34 -78
  355. package/lib/summary/summarizer.js.map +1 -0
  356. package/lib/{summarizerClientElection.d.ts → summary/summarizerClientElection.d.ts} +1 -2
  357. package/lib/summary/summarizerClientElection.d.ts.map +1 -0
  358. package/lib/{summarizerClientElection.js → summary/summarizerClientElection.js} +3 -30
  359. package/lib/summary/summarizerClientElection.js.map +1 -0
  360. package/lib/{summarizerHeuristics.d.ts → summary/summarizerHeuristics.d.ts} +1 -1
  361. package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
  362. package/lib/{summarizerHeuristics.js → summary/summarizerHeuristics.js} +9 -12
  363. package/lib/summary/summarizerHeuristics.js.map +1 -0
  364. package/lib/summary/summarizerNode/index.d.ts +8 -0
  365. package/lib/summary/summarizerNode/index.d.ts.map +1 -0
  366. package/lib/summary/summarizerNode/index.js +7 -0
  367. package/lib/summary/summarizerNode/index.js.map +1 -0
  368. package/lib/summary/summarizerNode/summarizerNode.d.ts +149 -0
  369. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  370. package/lib/summary/summarizerNode/summarizerNode.js +526 -0
  371. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
  372. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +125 -0
  373. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  374. package/lib/summary/summarizerNode/summarizerNodeUtils.js +125 -0
  375. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
  376. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +22 -0
  377. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  378. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +419 -0
  379. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
  380. package/{dist → lib/summary}/summarizerTypes.d.ts +29 -42
  381. package/lib/summary/summarizerTypes.d.ts.map +1 -0
  382. package/lib/summary/summarizerTypes.js +6 -0
  383. package/lib/summary/summarizerTypes.js.map +1 -0
  384. package/lib/summary/summaryCollection.d.ts.map +1 -0
  385. package/lib/{summaryCollection.js → summary/summaryCollection.js} +18 -8
  386. package/lib/summary/summaryCollection.js.map +1 -0
  387. package/{dist → lib/summary}/summaryFormat.d.ts +3 -21
  388. package/lib/summary/summaryFormat.d.ts.map +1 -0
  389. package/lib/{summaryFormat.js → summary/summaryFormat.js} +20 -21
  390. package/lib/summary/summaryFormat.js.map +1 -0
  391. package/lib/summary/summaryGenerator.d.ts.map +1 -0
  392. package/lib/{summaryGenerator.js → summary/summaryGenerator.js} +34 -16
  393. package/lib/summary/summaryGenerator.js.map +1 -0
  394. package/lib/{summaryManager.d.ts → summary/summaryManager.d.ts} +1 -1
  395. package/lib/summary/summaryManager.d.ts.map +1 -0
  396. package/lib/{summaryManager.js → summary/summaryManager.js} +21 -9
  397. package/lib/summary/summaryManager.js.map +1 -0
  398. package/lib/throttler.d.ts +2 -2
  399. package/lib/throttler.d.ts.map +1 -1
  400. package/lib/throttler.js +4 -4
  401. package/lib/throttler.js.map +1 -1
  402. package/package.json +67 -61
  403. package/prettier.config.cjs +1 -1
  404. package/src/batchTracker.ts +55 -50
  405. package/src/blobManager.ts +863 -594
  406. package/src/connectionTelemetry.ts +280 -249
  407. package/src/containerHandleContext.ts +27 -29
  408. package/src/containerRuntime.ts +3174 -2805
  409. package/src/dataStore.ts +172 -159
  410. package/src/dataStoreContext.ts +1141 -993
  411. package/src/dataStoreContexts.ts +178 -161
  412. package/src/dataStoreRegistry.ts +25 -20
  413. package/src/dataStores.ts +887 -716
  414. package/src/deltaManagerSummarizerProxy.ts +46 -0
  415. package/src/deltaScheduler.ts +158 -150
  416. package/{garbageCollection.md → src/gc/garbageCollection.md} +16 -3
  417. package/src/gc/garbageCollection.ts +1250 -0
  418. package/src/gc/gcConfigs.ts +193 -0
  419. package/src/gc/gcDefinitions.ts +387 -0
  420. package/src/gc/gcHelpers.ts +332 -0
  421. package/src/gc/gcReferenceGraphAlgorithm.ts +52 -0
  422. package/src/gc/gcSummaryDefinitions.ts +54 -0
  423. package/src/gc/gcSummaryStateTracker.ts +329 -0
  424. package/src/gc/gcSweepReadyUsageDetection.ts +145 -0
  425. package/src/gc/gcUnreferencedStateTracker.ts +114 -0
  426. package/src/gc/index.ts +65 -0
  427. package/src/index.ts +61 -75
  428. package/src/opLifecycle/README.md +157 -0
  429. package/src/opLifecycle/batchManager.ts +119 -86
  430. package/src/opLifecycle/definitions.ts +49 -19
  431. package/src/opLifecycle/index.ts +7 -6
  432. package/src/opLifecycle/opCompressor.ts +78 -40
  433. package/src/opLifecycle/opDecompressor.ts +148 -64
  434. package/src/opLifecycle/opSplitter.ts +269 -66
  435. package/src/opLifecycle/outbox.ts +268 -184
  436. package/src/opLifecycle/remoteMessageProcessor.ts +63 -47
  437. package/src/opProperties.ts +11 -9
  438. package/src/packageVersion.ts +1 -1
  439. package/src/pendingStateManager.ts +386 -381
  440. package/src/scheduleManager.ts +299 -280
  441. package/src/storageServiceWithAttachBlobs.ts +38 -0
  442. package/src/summary/index.ts +105 -0
  443. package/src/summary/orderedClientElection.ts +564 -0
  444. package/src/summary/runWhileConnectedCoordinator.ts +113 -0
  445. package/src/summary/runningSummarizer.ts +788 -0
  446. package/src/summary/summarizer.ts +372 -0
  447. package/src/summary/summarizerClientElection.ts +139 -0
  448. package/src/summary/summarizerHeuristics.ts +224 -0
  449. package/src/summary/summarizerNode/index.ts +12 -0
  450. package/src/summary/summarizerNode/summarizerNode.ts +766 -0
  451. package/src/summary/summarizerNode/summarizerNodeUtils.ts +214 -0
  452. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +644 -0
  453. package/src/summary/summarizerTypes.ts +507 -0
  454. package/src/summary/summaryCollection.ts +450 -0
  455. package/src/summary/summaryFormat.ts +228 -0
  456. package/src/summary/summaryGenerator.ts +505 -0
  457. package/src/summary/summaryManager.ts +423 -0
  458. package/src/throttler.ts +131 -122
  459. package/tsconfig.esnext.json +6 -6
  460. package/tsconfig.json +9 -13
  461. package/dist/garbageCollection.d.ts +0 -387
  462. package/dist/garbageCollection.d.ts.map +0 -1
  463. package/dist/garbageCollection.js +0 -1138
  464. package/dist/garbageCollection.js.map +0 -1
  465. package/dist/garbageCollectionConstants.d.ts +0 -19
  466. package/dist/garbageCollectionConstants.d.ts.map +0 -1
  467. package/dist/garbageCollectionConstants.js +0 -34
  468. package/dist/garbageCollectionConstants.js.map +0 -1
  469. package/dist/gcSweepReadyUsageDetection.d.ts.map +0 -1
  470. package/dist/gcSweepReadyUsageDetection.js.map +0 -1
  471. package/dist/orderedClientElection.d.ts.map +0 -1
  472. package/dist/orderedClientElection.js.map +0 -1
  473. package/dist/runWhileConnectedCoordinator.d.ts.map +0 -1
  474. package/dist/runWhileConnectedCoordinator.js.map +0 -1
  475. package/dist/runningSummarizer.d.ts.map +0 -1
  476. package/dist/runningSummarizer.js.map +0 -1
  477. package/dist/serializedSnapshotStorage.d.ts +0 -58
  478. package/dist/serializedSnapshotStorage.d.ts.map +0 -1
  479. package/dist/serializedSnapshotStorage.js +0 -108
  480. package/dist/serializedSnapshotStorage.js.map +0 -1
  481. package/dist/summarizer.d.ts.map +0 -1
  482. package/dist/summarizer.js.map +0 -1
  483. package/dist/summarizerClientElection.d.ts.map +0 -1
  484. package/dist/summarizerClientElection.js.map +0 -1
  485. package/dist/summarizerHandle.d.ts +0 -12
  486. package/dist/summarizerHandle.d.ts.map +0 -1
  487. package/dist/summarizerHandle.js +0 -22
  488. package/dist/summarizerHandle.js.map +0 -1
  489. package/dist/summarizerHeuristics.d.ts.map +0 -1
  490. package/dist/summarizerHeuristics.js.map +0 -1
  491. package/dist/summarizerTypes.d.ts.map +0 -1
  492. package/dist/summarizerTypes.js.map +0 -1
  493. package/dist/summaryCollection.d.ts.map +0 -1
  494. package/dist/summaryCollection.js.map +0 -1
  495. package/dist/summaryFormat.d.ts.map +0 -1
  496. package/dist/summaryFormat.js.map +0 -1
  497. package/dist/summaryGenerator.d.ts.map +0 -1
  498. package/dist/summaryGenerator.js.map +0 -1
  499. package/dist/summaryManager.d.ts.map +0 -1
  500. package/dist/summaryManager.js.map +0 -1
  501. package/lib/garbageCollection.d.ts +0 -387
  502. package/lib/garbageCollection.d.ts.map +0 -1
  503. package/lib/garbageCollection.js +0 -1133
  504. package/lib/garbageCollection.js.map +0 -1
  505. package/lib/garbageCollectionConstants.d.ts +0 -19
  506. package/lib/garbageCollectionConstants.d.ts.map +0 -1
  507. package/lib/garbageCollectionConstants.js +0 -31
  508. package/lib/garbageCollectionConstants.js.map +0 -1
  509. package/lib/gcSweepReadyUsageDetection.d.ts.map +0 -1
  510. package/lib/gcSweepReadyUsageDetection.js.map +0 -1
  511. package/lib/orderedClientElection.d.ts.map +0 -1
  512. package/lib/orderedClientElection.js.map +0 -1
  513. package/lib/runWhileConnectedCoordinator.d.ts.map +0 -1
  514. package/lib/runWhileConnectedCoordinator.js.map +0 -1
  515. package/lib/runningSummarizer.d.ts.map +0 -1
  516. package/lib/runningSummarizer.js.map +0 -1
  517. package/lib/serializedSnapshotStorage.d.ts +0 -58
  518. package/lib/serializedSnapshotStorage.d.ts.map +0 -1
  519. package/lib/serializedSnapshotStorage.js +0 -104
  520. package/lib/serializedSnapshotStorage.js.map +0 -1
  521. package/lib/summarizer.d.ts.map +0 -1
  522. package/lib/summarizer.js.map +0 -1
  523. package/lib/summarizerClientElection.d.ts.map +0 -1
  524. package/lib/summarizerClientElection.js.map +0 -1
  525. package/lib/summarizerHandle.d.ts +0 -12
  526. package/lib/summarizerHandle.d.ts.map +0 -1
  527. package/lib/summarizerHandle.js +0 -18
  528. package/lib/summarizerHandle.js.map +0 -1
  529. package/lib/summarizerHeuristics.d.ts.map +0 -1
  530. package/lib/summarizerHeuristics.js.map +0 -1
  531. package/lib/summarizerTypes.d.ts.map +0 -1
  532. package/lib/summarizerTypes.js +0 -9
  533. package/lib/summarizerTypes.js.map +0 -1
  534. package/lib/summaryCollection.d.ts.map +0 -1
  535. package/lib/summaryCollection.js.map +0 -1
  536. package/lib/summaryFormat.d.ts.map +0 -1
  537. package/lib/summaryFormat.js.map +0 -1
  538. package/lib/summaryGenerator.d.ts.map +0 -1
  539. package/lib/summaryGenerator.js.map +0 -1
  540. package/lib/summaryManager.d.ts.map +0 -1
  541. package/lib/summaryManager.js.map +0 -1
  542. package/src/garbageCollection.ts +0 -1646
  543. package/src/garbageCollectionConstants.ts +0 -35
  544. package/src/gcSweepReadyUsageDetection.ts +0 -139
  545. package/src/orderedClientElection.ts +0 -532
  546. package/src/runWhileConnectedCoordinator.ts +0 -106
  547. package/src/runningSummarizer.ts +0 -611
  548. package/src/serializedSnapshotStorage.ts +0 -146
  549. package/src/summarizer.ts +0 -421
  550. package/src/summarizerClientElection.ts +0 -161
  551. package/src/summarizerHandle.ts +0 -21
  552. package/src/summarizerHeuristics.ts +0 -222
  553. package/src/summarizerTypes.ts +0 -510
  554. package/src/summaryCollection.ts +0 -421
  555. package/src/summaryFormat.ts +0 -235
  556. package/src/summaryGenerator.ts +0 -446
  557. package/src/summaryManager.ts +0 -394
  558. /package/dist/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
  559. /package/dist/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
  560. /package/dist/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
  561. /package/lib/{orderedClientElection.d.ts → summary/orderedClientElection.d.ts} +0 -0
  562. /package/lib/{summaryCollection.d.ts → summary/summaryCollection.d.ts} +0 -0
  563. /package/lib/{summaryGenerator.d.ts → summary/summaryGenerator.d.ts} +0 -0
@@ -0,0 +1,320 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ICriticalContainerError } from "@fluidframework/container-definitions";
6
+ import { IRequestHeader } from "@fluidframework/core-interfaces";
7
+ import { ISnapshotTree } from "@fluidframework/protocol-definitions";
8
+ import { IGarbageCollectionData, IGarbageCollectionDetailsBase, ISummarizeResult, ITelemetryContext } from "@fluidframework/runtime-definitions";
9
+ import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
10
+ import { ITelemetryLogger } from "@fluidframework/common-definitions";
11
+ import { IContainerRuntimeMetadata, ICreateContainerMetadata, RefreshSummaryResult } from "../summary";
12
+ export declare type GCVersion = number;
13
+ /** The stable version of garbage collection in production. */
14
+ export declare const stableGCVersion: GCVersion;
15
+ /** The current version of garbage collection. */
16
+ export declare const currentGCVersion: GCVersion;
17
+ /**
18
+ * This undocumented GC Option (on ContainerRuntime Options) allows an app to disable enforcing GC on old documents by incrementing this value
19
+ *
20
+ * If unset, GC Tombstone phase will operate as otherwise configured
21
+ * Otherwise, only enforce GC Tombstone if the passed in value matches the persisted value
22
+ */
23
+ export declare const gcTombstoneGenerationOptionName = "gcTombstoneGeneration";
24
+ /**
25
+ * This GC Option (on ContainerRuntime Options) allows an app to disable GC Sweep on old documents by incrementing this value.
26
+ *
27
+ * If unset altogether, Sweep will be disabled.
28
+ * If 0 is passed in, Sweep will be enabled for any document with gcSweepGeneration OR gcTombstoneGeneration as 0.
29
+ * If any other number is passed in, Sweep will be enabled only for documents with the same value persisted.
30
+ */
31
+ export declare const gcSweepGenerationOptionName = "gcSweepGeneration";
32
+ export declare const runGCKey = "Fluid.GarbageCollection.RunGC";
33
+ export declare const runSweepKey = "Fluid.GarbageCollection.RunSweep";
34
+ export declare const gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
35
+ export declare const runSessionExpiryKey = "Fluid.GarbageCollection.RunSessionExpiry";
36
+ export declare const disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
37
+ export declare const disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
38
+ export declare const throwOnTombstoneLoadKey = "Fluid.GarbageCollection.ThrowOnTombstoneLoad";
39
+ export declare const throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
40
+ export declare const gcVersionUpgradeToV3Key = "Fluid.GarbageCollection.GCVersionUpgradeToV3";
41
+ export declare const sweepDatastoresKey = "Fluid.GarbageCollection.Test.SweepDataStores";
42
+ export declare const sweepAttachmentBlobsKey = "Fluid.GarbageCollection.Test.SweepAttachmentBlobs";
43
+ export declare const oneDayMs: number;
44
+ /**
45
+ * The maximum snapshot cache expiry in the driver. This is used to calculate the sweep timeout.
46
+ * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.
47
+ * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot
48
+ * in cache will be invalidated before 5 days.
49
+ */
50
+ export declare const maxSnapshotCacheExpiryMs: number;
51
+ export declare const defaultInactiveTimeoutMs: number;
52
+ export declare const defaultSessionExpiryDurationMs: number;
53
+ /** @see IGCMetadata.gcFeatureMatrix */
54
+ export interface GCFeatureMatrix {
55
+ /**
56
+ * The Tombstone Generation value in effect when this file was created.
57
+ * Gives a way for an app to disqualify old files from GC Tombstone enforcement.
58
+ * Provided via Container Runtime Options.
59
+ */
60
+ tombstoneGeneration?: number;
61
+ /**
62
+ * The Sweep Generation value in effect when this file was created.
63
+ * Gives a way for an app to disqualify old files from GC Sweep.
64
+ * Provided via Container Runtime Options.
65
+ */
66
+ sweepGeneration?: number;
67
+ }
68
+ export interface IGCMetadata {
69
+ /**
70
+ * The version of the GC code that was run to generate the GC data that is written in the summary.
71
+ * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.
72
+ * Also, used to determine whether GC is enabled for this container or not:
73
+ * - A value of 0 or undefined means GC is disabled.
74
+ * - A value greater than 0 means GC is enabled.
75
+ */
76
+ readonly gcFeature?: GCVersion;
77
+ /**
78
+ * A collection of different numerical "Generations" for different features,
79
+ * used to determine feature availability over time.
80
+ * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),
81
+ * and pertains to aspects of the document that may be fixed for its lifetime.
82
+ *
83
+ * For each dimension, if the persisted value doesn't match the currently provided value,
84
+ * then this file does not support the corresponding feature as currently implemented.
85
+ *
86
+ * Guidance is that if no value is provided at runtime, it should result in the current default behavior.
87
+ */
88
+ readonly gcFeatureMatrix?: GCFeatureMatrix;
89
+ /**
90
+ * @deprecated - @see GCFeatureMatrix.sweepGeneration
91
+ *
92
+ * Tells whether the GC sweep phase is enabled for this container.
93
+ * - True means sweep phase is enabled.
94
+ * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
95
+ */
96
+ readonly sweepEnabled?: boolean;
97
+ /** If this is present, the session for this container will expire after this time and the container will close */
98
+ readonly sessionExpiryTimeoutMs?: number;
99
+ /** How long to wait after an object is unreferenced before deleting it via GC Sweep */
100
+ readonly sweepTimeoutMs?: number;
101
+ }
102
+ /** The statistics of the system state after a garbage collection run. */
103
+ export interface IGCStats {
104
+ /** The number of nodes in the container. */
105
+ nodeCount: number;
106
+ /** The number of data stores in the container. */
107
+ dataStoreCount: number;
108
+ /** The number of attachment blobs in the container. */
109
+ attachmentBlobCount: number;
110
+ /** The number of unreferenced nodes in the container. */
111
+ unrefNodeCount: number;
112
+ /** The number of unreferenced data stores in the container. */
113
+ unrefDataStoreCount: number;
114
+ /** The number of unreferenced attachment blobs in the container. */
115
+ unrefAttachmentBlobCount: number;
116
+ /** The number of nodes whose reference state updated since last GC run. */
117
+ updatedNodeCount: number;
118
+ /** The number of data stores whose reference state updated since last GC run. */
119
+ updatedDataStoreCount: number;
120
+ /** The number of attachment blobs whose reference state updated since last GC run. */
121
+ updatedAttachmentBlobCount: number;
122
+ }
123
+ /** The types of GC nodes in the GC reference graph. */
124
+ export declare const GCNodeType: {
125
+ DataStore: string;
126
+ SubDataStore: string;
127
+ Blob: string;
128
+ Other: string;
129
+ };
130
+ export declare type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];
131
+ /**
132
+ * Defines the APIs for the runtime object to be passed to the garbage collector.
133
+ */
134
+ export interface IGarbageCollectionRuntime {
135
+ /** Before GC runs, called to notify the runtime to update any pending GC state. */
136
+ updateStateBeforeGC(): Promise<void>;
137
+ /** Returns the garbage collection data of the runtime. */
138
+ getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
139
+ /** After GC has run, called to notify the runtime of routes that are used in it. */
140
+ updateUsedRoutes(usedRoutes: string[]): void;
141
+ /** After GC has run, called to notify the runtime of routes that are unused in it. */
142
+ updateUnusedRoutes(unusedRoutes: string[]): void;
143
+ /**
144
+ * After GC has run and identified nodes that are sweep ready, called to delete the sweep ready nodes. The runtime
145
+ * should return the routes of nodes that were deleted.
146
+ * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.
147
+ */
148
+ deleteSweepReadyNodes(sweepReadyRoutes: string[]): string[];
149
+ /** Called to notify the runtime of routes that are tombstones. */
150
+ updateTombstonedRoutes(tombstoneRoutes: string[]): void;
151
+ /** Returns a referenced timestamp to be used to track unreferenced nodes. */
152
+ getCurrentReferenceTimestampMs(): number | undefined;
153
+ /** Returns the type of the GC node. */
154
+ getNodeType(nodePath: string): GCNodeType;
155
+ /** Called when the runtime should close because of an error. */
156
+ closeFn: (error?: ICriticalContainerError) => void;
157
+ /** If false, loading or using a Tombstoned object should merely log, not fail */
158
+ gcTombstoneEnforcementAllowed: boolean;
159
+ }
160
+ /** Defines the contract for the garbage collector. */
161
+ export interface IGarbageCollector {
162
+ /** Tells whether GC should run or not. */
163
+ readonly shouldRunGC: boolean;
164
+ /** Tells whether the GC state in summary needs to be reset in the next summary. */
165
+ readonly summaryStateNeedsReset: boolean;
166
+ /** Initialize the state from the base snapshot after its creation. */
167
+ initializeBaseState(): Promise<void>;
168
+ /** Run garbage collection and update the reference / used state of the system. */
169
+ collectGarbage(options: {
170
+ logger?: ITelemetryLogger;
171
+ runSweep?: boolean;
172
+ fullGC?: boolean;
173
+ }, telemetryContext?: ITelemetryContext): Promise<IGCStats | undefined>;
174
+ /** Summarizes the GC data and returns it as a summary tree. */
175
+ summarize(fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): ISummarizeResult | undefined;
176
+ /** Returns the garbage collector specific metadata to be written into the summary. */
177
+ getMetadata(): IGCMetadata;
178
+ /** Returns the GC details generated from the base snapshot. */
179
+ getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
180
+ /** Called when the latest summary of the system has been refreshed. */
181
+ refreshLatestSummary(proposalHandle: string | undefined, result: RefreshSummaryResult, readAndParseBlob: ReadAndParseBlob): Promise<void>;
182
+ /** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */
183
+ nodeUpdated(nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], requestHeaders?: IRequestHeader): void;
184
+ /** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */
185
+ addedOutboundReference(fromNodePath: string, toNodePath: string): void;
186
+ /** Returns true if this node has been deleted by GC during sweep phase. */
187
+ isNodeDeleted(nodePath: string): boolean;
188
+ setConnectionState(connected: boolean, clientId?: string): void;
189
+ dispose(): void;
190
+ }
191
+ /** Parameters necessary for creating a GarbageCollector. */
192
+ export interface IGarbageCollectorCreateParams {
193
+ readonly runtime: IGarbageCollectionRuntime;
194
+ readonly gcOptions: IGCRuntimeOptions;
195
+ readonly baseLogger: ITelemetryLogger;
196
+ readonly existing: boolean;
197
+ readonly metadata: IContainerRuntimeMetadata | undefined;
198
+ readonly createContainerMetadata: ICreateContainerMetadata;
199
+ readonly baseSnapshot: ISnapshotTree | undefined;
200
+ readonly isSummarizerClient: boolean;
201
+ readonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;
202
+ readonly getLastSummaryTimestampMs: () => number | undefined;
203
+ readonly readAndParseBlob: ReadAndParseBlob;
204
+ readonly activeConnection: () => boolean;
205
+ readonly getContainerDiagnosticId: () => string;
206
+ }
207
+ export interface IGCRuntimeOptions {
208
+ /**
209
+ * Flag that if true, will enable running garbage collection (GC) for a new container.
210
+ *
211
+ * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified
212
+ * and marked as such in the summary. This option enables the mark phase.
213
+ * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.
214
+ * Sweep phase can be enabled via the "sweepAllowed" option.
215
+ *
216
+ * Note: This setting is persisted in the container's summary and cannot be changed.
217
+ */
218
+ gcAllowed?: boolean;
219
+ /**
220
+ * @deprecated - @see gcSweepGenerationOptionName and @see GCFeatureMatrix.sweepGeneration
221
+ *
222
+ * Flag that if true, enables GC's sweep phase for a new container.
223
+ *
224
+ * This will allow GC to eventually delete unreferenced objects from the container.
225
+ * This flag should only be set to true if "gcAllowed" is true.
226
+ *
227
+ * Note: This setting is persisted in the container's summary and cannot be changed.
228
+ */
229
+ sweepAllowed?: boolean;
230
+ /**
231
+ * Flag that if true, will disable garbage collection for the session.
232
+ * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.
233
+ */
234
+ disableGC?: boolean;
235
+ /**
236
+ * Flag that will bypass optimizations and generate GC data for all nodes irrespective of whether a node
237
+ * changed or not.
238
+ */
239
+ runFullGC?: boolean;
240
+ /**
241
+ * Maximum session duration for a new container. If not present, a default value will be used.
242
+ *
243
+ * Note: This setting is persisted in the container's summary and cannot be changed.
244
+ */
245
+ sessionExpiryTimeoutMs?: number;
246
+ /**
247
+ * Allows additional GC options to be passed.
248
+ */
249
+ [key: string]: any;
250
+ }
251
+ /**
252
+ * The configurations for Garbage Collector that determines what runs and how.
253
+ */
254
+ export interface IGarbageCollectorConfigs {
255
+ /**
256
+ * Tracks if GC is enabled for this document. This is specified during document creation and doesn't change
257
+ * throughout its lifetime.
258
+ */
259
+ readonly gcEnabled: boolean;
260
+ /**
261
+ * Tracks if sweep phase is enabled for this document. This is specified during document creation and doesn't change
262
+ * throughout its lifetime.
263
+ */
264
+ readonly sweepEnabled: boolean;
265
+ /**
266
+ * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly
267
+ * disabled via runtime options or feature flags.
268
+ */
269
+ readonly shouldRunGC: boolean;
270
+ /**
271
+ * Tracks if sweep phase should run or not. Even if the sweep phase is enabled for a document (see sweepEnabled), it
272
+ * can be explicitly disabled via feature flags. It also won't run if session expiry is not enabled.
273
+ */
274
+ readonly shouldRunSweep: boolean;
275
+ /**
276
+ * If true, bypass optimizations and generate GC data for all nodes irrespective of whether a node changed or not.
277
+ */
278
+ readonly runFullGC: boolean | undefined;
279
+ /** The time in ms to expire a session for a client for gc. */
280
+ readonly sessionExpiryTimeoutMs: number | undefined;
281
+ /** The time after which an unreferenced node is ready to be swept. */
282
+ readonly sweepTimeoutMs: number | undefined;
283
+ /** The time after which an unreferenced node is inactive. */
284
+ readonly inactiveTimeoutMs: number;
285
+ /** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */
286
+ readonly testMode: boolean;
287
+ /**
288
+ * Tracks whether GC should run in tombstone mode. In this mode, sweep ready objects are marked as tombstones.
289
+ * In interactive (non-summarizer) clients, tombstone objects behave as if they are deleted, i.e., access to them
290
+ * is not allowed. However, these objects can be accessed after referencing them first. It is used as a staging
291
+ * step for sweep where accidental sweep ready objects can be recovered.
292
+ */
293
+ readonly tombstoneMode: boolean;
294
+ /** @see GCFeatureMatrix. */
295
+ readonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;
296
+ /** The version of GC in the base snapshot. */
297
+ readonly gcVersionInBaseSnapshot: GCVersion | undefined;
298
+ /** The current version of GC data in the running code */
299
+ readonly gcVersionInEffect: GCVersion;
300
+ }
301
+ /** The state of node that is unreferenced. */
302
+ export declare const UnreferencedState: {
303
+ /** The node is active, i.e., it can become referenced again. */
304
+ readonly Active: "Active";
305
+ /** The node is inactive, i.e., it should not become referenced. */
306
+ readonly Inactive: "Inactive";
307
+ /** The node is ready to be deleted by the sweep phase. */
308
+ readonly SweepReady: "SweepReady";
309
+ };
310
+ export declare type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];
311
+ /**
312
+ * Represents the result of a GC run.
313
+ */
314
+ export interface IGCResult {
315
+ /** The ids of nodes that are referenced in the referenced graph */
316
+ referencedNodeIds: string[];
317
+ /** The ids of nodes that are not-referenced or deleted in the referenced graph */
318
+ deletedNodeIds: string[];
319
+ }
320
+ //# sourceMappingURL=gcDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcDefinitions.d.ts","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACN,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,YAAY,CAAC;AAEpB,oBAAY,SAAS,GAAG,MAAM,CAAC;AAE/B,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,SAAa,CAAC;AAC5C,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,SAAa,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AACvE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAG/D,eAAO,MAAM,QAAQ,kCAAkC,CAAC;AAExD,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAE9D,eAAO,MAAM,aAAa,uCAAuC,CAAC;AAElE,eAAO,MAAM,mBAAmB,6CAA6C,CAAC;AAE9E,eAAO,MAAM,kBAAkB,4CAA4C,CAAC;AAE5E,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6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.UnreferencedState = exports.GCNodeType = exports.defaultSessionExpiryDurationMs = exports.defaultInactiveTimeoutMs = exports.maxSnapshotCacheExpiryMs = exports.oneDayMs = exports.sweepAttachmentBlobsKey = exports.sweepDatastoresKey = exports.gcVersionUpgradeToV3Key = exports.throwOnTombstoneUsageKey = exports.throwOnTombstoneLoadKey = exports.disableTombstoneKey = exports.disableSweepLogKey = exports.runSessionExpiryKey = exports.gcTestModeKey = exports.runSweepKey = exports.runGCKey = exports.gcSweepGenerationOptionName = exports.gcTombstoneGenerationOptionName = exports.currentGCVersion = exports.stableGCVersion = void 0;
8
+ /** The stable version of garbage collection in production. */
9
+ exports.stableGCVersion = 1;
10
+ /** The current version of garbage collection. */
11
+ exports.currentGCVersion = 3;
12
+ /**
13
+ * This undocumented GC Option (on ContainerRuntime Options) allows an app to disable enforcing GC on old documents by incrementing this value
14
+ *
15
+ * If unset, GC Tombstone phase will operate as otherwise configured
16
+ * Otherwise, only enforce GC Tombstone if the passed in value matches the persisted value
17
+ */
18
+ exports.gcTombstoneGenerationOptionName = "gcTombstoneGeneration";
19
+ /**
20
+ * This GC Option (on ContainerRuntime Options) allows an app to disable GC Sweep on old documents by incrementing this value.
21
+ *
22
+ * If unset altogether, Sweep will be disabled.
23
+ * If 0 is passed in, Sweep will be enabled for any document with gcSweepGeneration OR gcTombstoneGeneration as 0.
24
+ * If any other number is passed in, Sweep will be enabled only for documents with the same value persisted.
25
+ */
26
+ exports.gcSweepGenerationOptionName = "gcSweepGeneration";
27
+ // Feature gate key to turn GC on / off.
28
+ exports.runGCKey = "Fluid.GarbageCollection.RunGC";
29
+ // Feature gate key to turn GC sweep on / off.
30
+ exports.runSweepKey = "Fluid.GarbageCollection.RunSweep";
31
+ // Feature gate key to turn GC test mode on / off.
32
+ exports.gcTestModeKey = "Fluid.GarbageCollection.GCTestMode";
33
+ // Feature gate key to expire a session after a set period of time.
34
+ exports.runSessionExpiryKey = "Fluid.GarbageCollection.RunSessionExpiry";
35
+ // Feature gate key to turn GC sweep log off.
36
+ exports.disableSweepLogKey = "Fluid.GarbageCollection.DisableSweepLog";
37
+ // Feature gate key to disable the tombstone feature, i.e., tombstone information is not read / written into summary.
38
+ exports.disableTombstoneKey = "Fluid.GarbageCollection.DisableTombstone";
39
+ // Feature gate to enable throwing an error when tombstone object is loaded (requested).
40
+ exports.throwOnTombstoneLoadKey = "Fluid.GarbageCollection.ThrowOnTombstoneLoad";
41
+ // Feature gate to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops).
42
+ exports.throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
43
+ // Feature gate to enable GC version upgrade.
44
+ exports.gcVersionUpgradeToV3Key = "Fluid.GarbageCollection.GCVersionUpgradeToV3";
45
+ // Feature gate to enable GC sweep for datastores.
46
+ // TODO: Remove Test from the flag when we are confident to turn on sweep
47
+ exports.sweepDatastoresKey = "Fluid.GarbageCollection.Test.SweepDataStores";
48
+ // Feature gate to enable GC sweep for attachment blobs.
49
+ exports.sweepAttachmentBlobsKey = "Fluid.GarbageCollection.Test.SweepAttachmentBlobs";
50
+ // One day in milliseconds.
51
+ exports.oneDayMs = 1 * 24 * 60 * 60 * 1000;
52
+ /**
53
+ * The maximum snapshot cache expiry in the driver. This is used to calculate the sweep timeout.
54
+ * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.
55
+ * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot
56
+ * in cache will be invalidated before 5 days.
57
+ */
58
+ exports.maxSnapshotCacheExpiryMs = 5 * exports.oneDayMs;
59
+ exports.defaultInactiveTimeoutMs = 7 * exports.oneDayMs; // 7 days
60
+ exports.defaultSessionExpiryDurationMs = 30 * exports.oneDayMs; // 30 days
61
+ /** The types of GC nodes in the GC reference graph. */
62
+ exports.GCNodeType = {
63
+ // Nodes that are for data stores.
64
+ DataStore: "DataStore",
65
+ // Nodes that are within a data store. For example, DDS nodes.
66
+ SubDataStore: "SubDataStore",
67
+ // Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.
68
+ Blob: "Blob",
69
+ // Nodes that are neither of the above. For example, root node.
70
+ Other: "Other",
71
+ };
72
+ /** The state of node that is unreferenced. */
73
+ exports.UnreferencedState = {
74
+ /** The node is active, i.e., it can become referenced again. */
75
+ Active: "Active",
76
+ /** The node is inactive, i.e., it should not become referenced. */
77
+ Inactive: "Inactive",
78
+ /** The node is ready to be deleted by the sweep phase. */
79
+ SweepReady: "SweepReady",
80
+ };
81
+ //# sourceMappingURL=gcDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcDefinitions.js","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAqBH,8DAA8D;AACjD,QAAA,eAAe,GAAc,CAAC,CAAC;AAC5C,iDAAiD;AACpC,QAAA,gBAAgB,GAAc,CAAC,CAAC;AAE7C;;;;;GAKG;AACU,QAAA,+BAA+B,GAAG,uBAAuB,CAAC;AACvE;;;;;;GAMG;AACU,QAAA,2BAA2B,GAAG,mBAAmB,CAAC;AAE/D,wCAAwC;AAC3B,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,8CAA8C;AACjC,QAAA,WAAW,GAAG,kCAAkC,CAAC;AAC9D,kDAAkD;AACrC,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE,mEAAmE;AACtD,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,6CAA6C;AAChC,QAAA,kBAAkB,GAAG,yCAAyC,CAAC;AAC5E,qHAAqH;AACxG,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,wFAAwF;AAC3E,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,0GAA0G;AAC7F,QAAA,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,6CAA6C;AAChC,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,kDAAkD;AAClD,yEAAyE;AAC5D,QAAA,kBAAkB,GAAG,8CAA8C,CAAC;AACjF,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,mDAAmD,CAAC;AAE3F,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC;AAExC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,CAAC,CAAC,UAAU;AA4EvE,uDAAuD;AAC1C,QAAA,UAAU,GAAG;IACzB,kCAAkC;IAClC,SAAS,EAAE,WAAW;IACtB,8DAA8D;IAC9D,YAAY,EAAE,cAAc;IAC5B,6EAA6E;IAC7E,IAAI,EAAE,MAAM;IACZ,+DAA+D;IAC/D,KAAK,EAAE,OAAO;CACd,CAAC;AAwMF,8CAA8C;AACjC,QAAA,iBAAiB,GAAG;IAChC,gEAAgE;IAChE,MAAM,EAAE,QAAQ;IAChB,mEAAmE;IACnE,QAAQ,EAAE,UAAU;IACpB,0DAA0D;IAC1D,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tRefreshSummaryResult,\n} from \"../summary\";\n\nexport type GCVersion = number;\n\n/** The stable version of garbage collection in production. */\nexport const stableGCVersion: GCVersion = 1;\n/** The current version of garbage collection. */\nexport const currentGCVersion: GCVersion = 3;\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows an app to disable enforcing GC on old documents by incrementing this value\n *\n * If unset, GC Tombstone phase will operate as otherwise configured\n * Otherwise, only enforce GC Tombstone if the passed in value matches the persisted value\n */\nexport const gcTombstoneGenerationOptionName = \"gcTombstoneGeneration\";\n/**\n * This GC Option (on ContainerRuntime Options) allows an app to disable GC Sweep on old documents by incrementing this value.\n *\n * If unset altogether, Sweep will be disabled.\n * If 0 is passed in, Sweep will be enabled for any document with gcSweepGeneration OR gcTombstoneGeneration as 0.\n * If any other number is passed in, Sweep will be enabled only for documents with the same value persisted.\n */\nexport const gcSweepGenerationOptionName = \"gcSweepGeneration\";\n\n// Feature gate key to turn GC on / off.\nexport const runGCKey = \"Fluid.GarbageCollection.RunGC\";\n// Feature gate key to turn GC sweep on / off.\nexport const runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n// Feature gate key to turn GC test mode on / off.\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n// Feature gate key to expire a session after a set period of time.\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n// Feature gate key to turn GC sweep log off.\nexport const disableSweepLogKey = \"Fluid.GarbageCollection.DisableSweepLog\";\n// Feature gate key to disable the tombstone feature, i.e., tombstone information is not read / written into summary.\nexport const disableTombstoneKey = \"Fluid.GarbageCollection.DisableTombstone\";\n// Feature gate to enable throwing an error when tombstone object is loaded (requested).\nexport const throwOnTombstoneLoadKey = \"Fluid.GarbageCollection.ThrowOnTombstoneLoad\";\n// Feature gate to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops).\nexport const throwOnTombstoneUsageKey = \"Fluid.GarbageCollection.ThrowOnTombstoneUsage\";\n// Feature gate to enable GC version upgrade.\nexport const gcVersionUpgradeToV3Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV3\";\n// Feature gate to enable GC sweep for datastores.\n// TODO: Remove Test from the flag when we are confident to turn on sweep\nexport const sweepDatastoresKey = \"Fluid.GarbageCollection.Test.SweepDataStores\";\n// Feature gate to enable GC sweep for attachment blobs.\nexport const sweepAttachmentBlobsKey = \"Fluid.GarbageCollection.Test.SweepAttachmentBlobs\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\n/**\n * The maximum snapshot cache expiry in the driver. This is used to calculate the sweep timeout.\n * Sweep timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot\n * in cache will be invalidated before 5 days.\n */\nexport const maxSnapshotCacheExpiryMs = 5 * oneDayMs;\n\nexport const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\n\n/** @see IGCMetadata.gcFeatureMatrix */\nexport interface GCFeatureMatrix {\n\t/**\n\t * The Tombstone Generation value in effect when this file was created.\n\t * Gives a way for an app to disqualify old files from GC Tombstone enforcement.\n\t * Provided via Container Runtime Options.\n\t */\n\ttombstoneGeneration?: number;\n\t/**\n\t * The Sweep Generation value in effect when this file was created.\n\t * Gives a way for an app to disqualify old files from GC Sweep.\n\t * Provided via Container Runtime Options.\n\t */\n\tsweepGeneration?: number;\n}\n\nexport interface IGCMetadata {\n\t/**\n\t * The version of the GC code that was run to generate the GC data that is written in the summary.\n\t * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.\n\t * Also, used to determine whether GC is enabled for this container or not:\n\t * - A value of 0 or undefined means GC is disabled.\n\t * - A value greater than 0 means GC is enabled.\n\t */\n\treadonly gcFeature?: GCVersion;\n\n\t/**\n\t * A collection of different numerical \"Generations\" for different features,\n\t * used to determine feature availability over time.\n\t * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),\n\t * and pertains to aspects of the document that may be fixed for its lifetime.\n\t *\n\t * For each dimension, if the persisted value doesn't match the currently provided value,\n\t * then this file does not support the corresponding feature as currently implemented.\n\t *\n\t * Guidance is that if no value is provided at runtime, it should result in the current default behavior.\n\t */\n\treadonly gcFeatureMatrix?: GCFeatureMatrix;\n\t/**\n\t * @deprecated - @see GCFeatureMatrix.sweepGeneration\n\t *\n\t * Tells whether the GC sweep phase is enabled for this container.\n\t * - True means sweep phase is enabled.\n\t * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.\n\t */\n\treadonly sweepEnabled?: boolean;\n\t/** If this is present, the session for this container will expire after this time and the container will close */\n\treadonly sessionExpiryTimeoutMs?: number;\n\t/** How long to wait after an object is unreferenced before deleting it via GC Sweep */\n\treadonly sweepTimeoutMs?: number;\n}\n\n/** The statistics of the system state after a garbage collection run. */\nexport interface IGCStats {\n\t/** The number of nodes in the container. */\n\tnodeCount: number;\n\t/** The number of data stores in the container. */\n\tdataStoreCount: number;\n\t/** The number of attachment blobs in the container. */\n\tattachmentBlobCount: number;\n\t/** The number of unreferenced nodes in the container. */\n\tunrefNodeCount: number;\n\t/** The number of unreferenced data stores in the container. */\n\tunrefDataStoreCount: number;\n\t/** The number of unreferenced attachment blobs in the container. */\n\tunrefAttachmentBlobCount: number;\n\t/** The number of nodes whose reference state updated since last GC run. */\n\tupdatedNodeCount: number;\n\t/** The number of data stores whose reference state updated since last GC run. */\n\tupdatedDataStoreCount: number;\n\t/** The number of attachment blobs whose reference state updated since last GC run. */\n\tupdatedAttachmentBlobCount: number;\n}\n\n/** The types of GC nodes in the GC reference graph. */\nexport const GCNodeType = {\n\t// Nodes that are for data stores.\n\tDataStore: \"DataStore\",\n\t// Nodes that are within a data store. For example, DDS nodes.\n\tSubDataStore: \"SubDataStore\",\n\t// Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.\n\tBlob: \"Blob\",\n\t// Nodes that are neither of the above. For example, root node.\n\tOther: \"Other\",\n};\nexport type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];\n\n/**\n * Defines the APIs for the runtime object to be passed to the garbage collector.\n */\nexport interface IGarbageCollectionRuntime {\n\t/** Before GC runs, called to notify the runtime to update any pending GC state. */\n\tupdateStateBeforeGC(): Promise<void>;\n\t/** Returns the garbage collection data of the runtime. */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\t/** After GC has run, called to notify the runtime of routes that are used in it. */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n\t/** After GC has run, called to notify the runtime of routes that are unused in it. */\n\tupdateUnusedRoutes(unusedRoutes: string[]): void;\n\t/**\n\t * After GC has run and identified nodes that are sweep ready, called to delete the sweep ready nodes. The runtime\n\t * should return the routes of nodes that were deleted.\n\t * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.\n\t */\n\tdeleteSweepReadyNodes(sweepReadyRoutes: string[]): string[];\n\t/** Called to notify the runtime of routes that are tombstones. */\n\tupdateTombstonedRoutes(tombstoneRoutes: string[]): void;\n\t/** Returns a referenced timestamp to be used to track unreferenced nodes. */\n\tgetCurrentReferenceTimestampMs(): number | undefined;\n\t/** Returns the type of the GC node. */\n\tgetNodeType(nodePath: string): GCNodeType;\n\t/** Called when the runtime should close because of an error. */\n\tcloseFn: (error?: ICriticalContainerError) => void;\n\t/** If false, loading or using a Tombstoned object should merely log, not fail */\n\tgcTombstoneEnforcementAllowed: boolean;\n}\n\n/** Defines the contract for the garbage collector. */\nexport interface IGarbageCollector {\n\t/** Tells whether GC should run or not. */\n\treadonly shouldRunGC: boolean;\n\t/** Tells whether the GC state in summary needs to be reset in the next summary. */\n\treadonly summaryStateNeedsReset: boolean;\n\t/** Initialize the state from the base snapshot after its creation. */\n\tinitializeBaseState(): Promise<void>;\n\t/** Run garbage collection and update the reference / used state of the system. */\n\tcollectGarbage(\n\t\toptions: {\n\t\t\tlogger?: ITelemetryLogger;\n\t\t\trunSweep?: boolean;\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined>;\n\t/** Summarizes the GC data and returns it as a summary tree. */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined;\n\t/** Returns the garbage collector specific metadata to be written into the summary. */\n\tgetMetadata(): IGCMetadata;\n\t/** Returns the GC details generated from the base snapshot. */\n\tgetBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\t/** Called when the latest summary of the system has been refreshed. */\n\trefreshLatestSummary(\n\t\tproposalHandle: string | undefined,\n\t\tresult: RefreshSummaryResult,\n\t\treadAndParseBlob: ReadAndParseBlob,\n\t): Promise<void>;\n\t/** Called when a node is updated. Used to detect and log when an inactive node is changed or loaded. */\n\tnodeUpdated(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequestHeaders?: IRequestHeader,\n\t): void;\n\t/** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */\n\taddedOutboundReference(fromNodePath: string, toNodePath: string): void;\n\t/** Returns true if this node has been deleted by GC during sweep phase. */\n\tisNodeDeleted(nodePath: string): boolean;\n\tsetConnectionState(connected: boolean, clientId?: string): void;\n\tdispose(): void;\n}\n\n/** Parameters necessary for creating a GarbageCollector. */\nexport interface IGarbageCollectorCreateParams {\n\treadonly runtime: IGarbageCollectionRuntime;\n\treadonly gcOptions: IGCRuntimeOptions;\n\treadonly baseLogger: ITelemetryLogger;\n\treadonly existing: boolean;\n\treadonly metadata: IContainerRuntimeMetadata | undefined;\n\treadonly createContainerMetadata: ICreateContainerMetadata;\n\treadonly baseSnapshot: ISnapshotTree | undefined;\n\treadonly isSummarizerClient: boolean;\n\treadonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n\treadonly getLastSummaryTimestampMs: () => number | undefined;\n\treadonly readAndParseBlob: ReadAndParseBlob;\n\treadonly activeConnection: () => boolean;\n\treadonly getContainerDiagnosticId: () => string;\n}\n\nexport interface IGCRuntimeOptions {\n\t/**\n\t * Flag that if true, will enable running garbage collection (GC) for a new container.\n\t *\n\t * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified\n\t * and marked as such in the summary. This option enables the mark phase.\n\t * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.\n\t * Sweep phase can be enabled via the \"sweepAllowed\" option.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tgcAllowed?: boolean;\n\n\t/**\n\t * @deprecated - @see gcSweepGenerationOptionName and @see GCFeatureMatrix.sweepGeneration\n\t *\n\t * Flag that if true, enables GC's sweep phase for a new container.\n\t *\n\t * This will allow GC to eventually delete unreferenced objects from the container.\n\t * This flag should only be set to true if \"gcAllowed\" is true.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tsweepAllowed?: boolean;\n\n\t/**\n\t * Flag that if true, will disable garbage collection for the session.\n\t * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.\n\t */\n\tdisableGC?: boolean;\n\n\t/**\n\t * Flag that will bypass optimizations and generate GC data for all nodes irrespective of whether a node\n\t * changed or not.\n\t */\n\trunFullGC?: boolean;\n\n\t/**\n\t * Maximum session duration for a new container. If not present, a default value will be used.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tsessionExpiryTimeoutMs?: number;\n\n\t/**\n\t * Allows additional GC options to be passed.\n\t */\n\t[key: string]: any;\n}\n\n/**\n * The configurations for Garbage Collector that determines what runs and how.\n */\nexport interface IGarbageCollectorConfigs {\n\t/**\n\t * Tracks if GC is enabled for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly gcEnabled: boolean;\n\t/**\n\t * Tracks if sweep phase is enabled for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly sweepEnabled: boolean;\n\t/**\n\t * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly\n\t * disabled via runtime options or feature flags.\n\t */\n\treadonly shouldRunGC: boolean;\n\t/**\n\t * Tracks if sweep phase should run or not. Even if the sweep phase is enabled for a document (see sweepEnabled), it\n\t * can be explicitly disabled via feature flags. It also won't run if session expiry is not enabled.\n\t */\n\treadonly shouldRunSweep: boolean;\n\t/**\n\t * If true, bypass optimizations and generate GC data for all nodes irrespective of whether a node changed or not.\n\t */\n\treadonly runFullGC: boolean | undefined;\n\t/** The time in ms to expire a session for a client for gc. */\n\treadonly sessionExpiryTimeoutMs: number | undefined;\n\t/** The time after which an unreferenced node is ready to be swept. */\n\treadonly sweepTimeoutMs: number | undefined;\n\t/** The time after which an unreferenced node is inactive. */\n\treadonly inactiveTimeoutMs: number;\n\t/** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */\n\treadonly testMode: boolean;\n\t/**\n\t * Tracks whether GC should run in tombstone mode. In this mode, sweep ready objects are marked as tombstones.\n\t * In interactive (non-summarizer) clients, tombstone objects behave as if they are deleted, i.e., access to them\n\t * is not allowed. However, these objects can be accessed after referencing them first. It is used as a staging\n\t * step for sweep where accidental sweep ready objects can be recovered.\n\t */\n\treadonly tombstoneMode: boolean;\n\t/** @see GCFeatureMatrix. */\n\treadonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\t/** The version of GC in the base snapshot. */\n\treadonly gcVersionInBaseSnapshot: GCVersion | undefined;\n\t/** The current version of GC data in the running code */\n\treadonly gcVersionInEffect: GCVersion;\n}\n\n/** The state of node that is unreferenced. */\nexport const UnreferencedState = {\n\t/** The node is active, i.e., it can become referenced again. */\n\tActive: \"Active\",\n\t/** The node is inactive, i.e., it should not become referenced. */\n\tInactive: \"Inactive\",\n\t/** The node is ready to be deleted by the sweep phase. */\n\tSweepReady: \"SweepReady\",\n} as const;\nexport type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];\n\n/**\n * Represents the result of a GC run.\n */\nexport interface IGCResult {\n\t/** The ids of nodes that are referenced in the referenced graph */\n\treferencedNodeIds: string[];\n\t/** The ids of nodes that are not-referenced or deleted in the referenced graph */\n\tdeletedNodeIds: string[];\n}\n"]}
@@ -0,0 +1,86 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ITelemetryGenericEvent } from "@fluidframework/common-definitions";
6
+ import { ISnapshotTree } from "@fluidframework/protocol-definitions";
7
+ import { IGarbageCollectionData, IGarbageCollectionDetailsBase } from "@fluidframework/runtime-definitions";
8
+ import { MonitoringContext } from "@fluidframework/telemetry-utils";
9
+ import { GCFeatureMatrix, GCVersion, IGCMetadata } from "./gcDefinitions";
10
+ import { IGarbageCollectionSnapshotData, IGarbageCollectionState } from "./gcSummaryDefinitions";
11
+ export declare function getGCVersion(metadata?: IGCMetadata): GCVersion;
12
+ /**
13
+ * Consolidates info / logic for logging when we encounter unexpected usage of GC'd objects. For example, when a
14
+ * tombstoned or deleted object is loaded.
15
+ */
16
+ export declare function sendGCUnexpectedUsageEvent(mc: MonitoringContext, event: ITelemetryGenericEvent & {
17
+ category: "error" | "generic";
18
+ gcTombstoneEnforcementAllowed: boolean | undefined;
19
+ }, packagePath: readonly string[] | undefined, error?: unknown): void;
20
+ /**
21
+ * Indicates whether Tombstone Enforcement is allowed for this document based on the current/persisted
22
+ * TombstoneGeneration values
23
+ *
24
+ * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants
25
+ * such that enforcing GC Tombstone (Failing on Tombstone load/usage) would cause legitimate data loss,
26
+ * the container author may increment the generation value for Tombstone such that containers created
27
+ * with a different value will not be subjected to GC enforcement.
28
+ *
29
+ * If no generation is provided at runtime, this defaults to return true to maintain expected default behavior
30
+ *
31
+ * @param persistedGeneration - The persisted tombstoneGeneration value
32
+ * @param currentGeneration - The current app-provided tombstoneGeneration value
33
+ * @returns true if GC Tombstone enforcement (Fail on Tombstone load/usage) should be allowed for this document
34
+ */
35
+ export declare function shouldAllowGcTombstoneEnforcement(persistedGeneration: number | undefined, currentGeneration: number | undefined): boolean;
36
+ /**
37
+ * Indicates whether Sweep is allowed for this document based on the GC Feature Matrix and current SweepGeneration
38
+ *
39
+ * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants
40
+ * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep
41
+ * such that containers created with a different value will not be subjected to GC Sweep.
42
+ *
43
+ * If no generation is provided, Sweep will be disabled.
44
+ * Passing 0 is a special case: Sweep will be enabled for any document with gcSweepGeneration OR gcTombstoneGeneration as 0.
45
+ *
46
+ * @param persistedGenerations - The persisted sweep/tombstone generations from the GC Feature Matrix
47
+ * @param currentGeneration - The current app-provided sweepGeneration value
48
+ * @returns true if GC Sweep should be allowed for this document
49
+ */
50
+ export declare function shouldAllowGcSweep(persistedGenerations: Pick<GCFeatureMatrix, "sweepGeneration" | "tombstoneGeneration">, currentGeneration: number | undefined): boolean;
51
+ /**
52
+ * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.
53
+ */
54
+ export declare function generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState;
55
+ /**
56
+ * Concatenates the given GC states and returns the concatenated GC state.
57
+ */
58
+ export declare function concatGarbageCollectionStates(gcState1: IGarbageCollectionState, gcState2: IGarbageCollectionState): IGarbageCollectionState;
59
+ /**
60
+ * Helper function that clones the GC data.
61
+ * @param gcData - The GC data to clone.
62
+ * @returns a clone of the given GC data.
63
+ */
64
+ export declare function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData;
65
+ /**
66
+ * Concatenates the given GC data and returns the concatenated GC data.
67
+ */
68
+ export declare function concatGarbageCollectionData(gcData1: IGarbageCollectionData, gcData2: IGarbageCollectionData): IGarbageCollectionData;
69
+ /**
70
+ * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and
71
+ * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.
72
+ */
73
+ export declare function getGCDataFromSnapshot(gcSnapshotTree: ISnapshotTree, readAndParseBlob: <T>(id: string) => Promise<T>): Promise<IGarbageCollectionSnapshotData>;
74
+ /**
75
+ * Helper function that unpacks the GC details of the children from a given node's GC details.
76
+ * @param gcDetails - The GC details of a node.
77
+ * @returns A map of GC details of each children of the the given node.
78
+ */
79
+ export declare function unpackChildNodesGCDetails(gcDetails: IGarbageCollectionDetailsBase): Map<string, IGarbageCollectionDetailsBase>;
80
+ /**
81
+ * Trims the leading and trailing slashes from the given string.
82
+ * @param str - A string that may contain leading and / or trailing slashes.
83
+ * @returns A new string without leading and trailing slashes.
84
+ */
85
+ export declare function trimLeadingAndTrailingSlashes(str: string): string;
86
+ //# sourceMappingURL=gcHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcHelpers.d.ts","sourceRoot":"","sources":["../../src/gc/gcHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAIN,sBAAsB,EACtB,6BAA6B,EAC7B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAEN,eAAe,EACf,SAAS,EACT,WAAW,EAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEN,8BAA8B,EAC9B,uBAAuB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,SAAS,CAM9D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,sBAAsB,GAAG;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,6BAA6B,EAAE,OAAO,GAAG,SAAS,CAAC;C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