@fluidframework/container-runtime 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.2.0.0.245554

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 (695) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +5 -5
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +54 -0
  4. package/README.md +46 -1
  5. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  6. package/api-extractor-lint.json +1 -1
  7. package/api-extractor.json +1 -1
  8. package/api-report/container-runtime.api.md +435 -33
  9. package/dist/batchTracker.d.ts +1 -2
  10. package/dist/batchTracker.d.ts.map +1 -1
  11. package/dist/batchTracker.js.map +1 -1
  12. package/dist/blobManager.d.ts +0 -5
  13. package/dist/blobManager.d.ts.map +1 -1
  14. package/dist/blobManager.js +0 -12
  15. package/dist/blobManager.js.map +1 -1
  16. package/dist/channelCollection.d.ts +225 -0
  17. package/dist/channelCollection.d.ts.map +1 -0
  18. package/dist/{dataStores.js → channelCollection.js} +449 -143
  19. package/dist/channelCollection.js.map +1 -0
  20. package/dist/connectionTelemetry.d.ts +11 -1
  21. package/dist/connectionTelemetry.d.ts.map +1 -1
  22. package/dist/connectionTelemetry.js +42 -4
  23. package/dist/connectionTelemetry.js.map +1 -1
  24. package/dist/container-runtime-alpha.d.ts +138 -49
  25. package/dist/container-runtime-beta.d.ts +75 -9
  26. package/dist/container-runtime-public.d.ts +75 -9
  27. package/dist/container-runtime-untrimmed.d.ts +717 -49
  28. package/dist/containerHandleContext.d.ts +1 -1
  29. package/dist/containerHandleContext.d.ts.map +1 -1
  30. package/dist/containerHandleContext.js.map +1 -1
  31. package/dist/containerRuntime.d.ts +84 -64
  32. package/dist/containerRuntime.d.ts.map +1 -1
  33. package/dist/containerRuntime.js +550 -427
  34. package/dist/containerRuntime.js.map +1 -1
  35. package/dist/dataStore.d.ts +2 -3
  36. package/dist/dataStore.d.ts.map +1 -1
  37. package/dist/dataStore.js +12 -11
  38. package/dist/dataStore.js.map +1 -1
  39. package/dist/dataStoreContext.d.ts +118 -38
  40. package/dist/dataStoreContext.d.ts.map +1 -1
  41. package/dist/dataStoreContext.js +249 -161
  42. package/dist/dataStoreContext.js.map +1 -1
  43. package/dist/dataStoreContexts.d.ts +2 -1
  44. package/dist/dataStoreContexts.d.ts.map +1 -1
  45. package/dist/dataStoreContexts.js +1 -0
  46. package/dist/dataStoreContexts.js.map +1 -1
  47. package/dist/deltaManagerSummarizerProxy.d.ts +29 -4
  48. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
  49. package/dist/deltaManagerSummarizerProxy.js +91 -5
  50. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  51. package/dist/gc/garbageCollection.d.ts +29 -7
  52. package/dist/gc/garbageCollection.d.ts.map +1 -1
  53. package/dist/gc/garbageCollection.js +179 -98
  54. package/dist/gc/garbageCollection.js.map +1 -1
  55. package/dist/gc/gcConfigs.d.ts +2 -2
  56. package/dist/gc/gcConfigs.d.ts.map +1 -1
  57. package/dist/gc/gcConfigs.js +30 -23
  58. package/dist/gc/gcConfigs.js.map +1 -1
  59. package/dist/gc/gcDefinitions.d.ts +40 -15
  60. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  61. package/dist/gc/gcDefinitions.js +11 -4
  62. package/dist/gc/gcDefinitions.js.map +1 -1
  63. package/dist/gc/gcHelpers.d.ts +2 -2
  64. package/dist/gc/gcHelpers.d.ts.map +1 -1
  65. package/dist/gc/gcHelpers.js.map +1 -1
  66. package/dist/gc/gcReferenceGraphAlgorithm.d.ts +1 -1
  67. package/dist/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -1
  68. package/dist/gc/gcReferenceGraphAlgorithm.js.map +1 -1
  69. package/dist/gc/gcSummaryStateTracker.d.ts +12 -5
  70. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  71. package/dist/gc/gcSummaryStateTracker.js +18 -6
  72. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  73. package/dist/gc/gcTelemetry.d.ts +7 -7
  74. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  75. package/dist/gc/gcTelemetry.js +20 -20
  76. package/dist/gc/gcTelemetry.js.map +1 -1
  77. package/dist/gc/gcUnreferencedStateTracker.d.ts +6 -1
  78. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  79. package/dist/gc/gcUnreferencedStateTracker.js +22 -11
  80. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  81. package/dist/gc/index.d.ts +8 -8
  82. package/dist/gc/index.d.ts.map +1 -1
  83. package/dist/gc/index.js +40 -38
  84. package/dist/gc/index.js.map +1 -1
  85. package/dist/index.d.ts +11 -20
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +36 -40
  88. package/dist/index.js.map +1 -1
  89. package/dist/messageTypes.d.ts +4 -4
  90. package/dist/messageTypes.d.ts.map +1 -1
  91. package/dist/messageTypes.js.map +1 -1
  92. package/dist/opLifecycle/batchManager.d.ts +2 -2
  93. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  94. package/dist/opLifecycle/batchManager.js.map +1 -1
  95. package/dist/opLifecycle/definitions.d.ts +2 -2
  96. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  97. package/dist/opLifecycle/definitions.js.map +1 -1
  98. package/dist/opLifecycle/index.d.ts +8 -8
  99. package/dist/opLifecycle/index.d.ts.map +1 -1
  100. package/dist/opLifecycle/index.js +18 -18
  101. package/dist/opLifecycle/index.js.map +1 -1
  102. package/dist/opLifecycle/opCompressor.d.ts +1 -1
  103. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  104. package/dist/opLifecycle/opCompressor.js +4 -4
  105. package/dist/opLifecycle/opCompressor.js.map +1 -1
  106. package/dist/opLifecycle/opDecompressor.d.ts +1 -1
  107. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  108. package/dist/opLifecycle/opDecompressor.js +3 -3
  109. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  110. package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
  111. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  112. package/dist/opLifecycle/opGroupingManager.js +1 -10
  113. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  114. package/dist/opLifecycle/opSplitter.d.ts +1 -1
  115. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  116. package/dist/opLifecycle/opSplitter.js +5 -5
  117. package/dist/opLifecycle/opSplitter.js.map +1 -1
  118. package/dist/opLifecycle/outbox.d.ts +7 -7
  119. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  120. package/dist/opLifecycle/outbox.js +20 -12
  121. package/dist/opLifecycle/outbox.js.map +1 -1
  122. package/dist/opLifecycle/remoteMessageProcessor.d.ts +4 -4
  123. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  124. package/dist/opLifecycle/remoteMessageProcessor.js +2 -2
  125. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  126. package/dist/package.json +3 -0
  127. package/dist/packageVersion.d.ts +1 -1
  128. package/dist/packageVersion.js +1 -1
  129. package/dist/packageVersion.js.map +1 -1
  130. package/dist/pendingStateManager.d.ts +2 -1
  131. package/dist/pendingStateManager.d.ts.map +1 -1
  132. package/dist/pendingStateManager.js +18 -10
  133. package/dist/pendingStateManager.js.map +1 -1
  134. package/dist/scheduleManager.d.ts +1 -2
  135. package/dist/scheduleManager.d.ts.map +1 -1
  136. package/dist/scheduleManager.js +5 -5
  137. package/dist/scheduleManager.js.map +1 -1
  138. package/dist/summary/index.d.ts +12 -12
  139. package/dist/summary/index.d.ts.map +1 -1
  140. package/dist/summary/index.js +43 -43
  141. package/dist/summary/index.js.map +1 -1
  142. package/dist/summary/orderedClientElection.js +8 -8
  143. package/dist/summary/orderedClientElection.js.map +1 -1
  144. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
  145. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  146. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  147. package/dist/summary/runningSummarizer.d.ts +11 -10
  148. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  149. package/dist/summary/runningSummarizer.js +114 -81
  150. package/dist/summary/runningSummarizer.js.map +1 -1
  151. package/dist/summary/summarizer.d.ts +4 -4
  152. package/dist/summary/summarizer.d.ts.map +1 -1
  153. package/dist/summary/summarizer.js +6 -6
  154. package/dist/summary/summarizer.js.map +1 -1
  155. package/dist/summary/summarizerClientElection.d.ts +2 -2
  156. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  157. package/dist/summary/summarizerClientElection.js.map +1 -1
  158. package/dist/summary/summarizerHeuristics.d.ts +3 -3
  159. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  160. package/dist/summary/summarizerHeuristics.js.map +1 -1
  161. package/dist/summary/summarizerNode/index.d.ts +3 -3
  162. package/dist/summary/summarizerNode/index.d.ts.map +1 -1
  163. package/dist/summary/summarizerNode/index.js +4 -4
  164. package/dist/summary/summarizerNode/index.js.map +1 -1
  165. package/dist/summary/summarizerNode/summarizerNode.d.ts +17 -7
  166. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  167. package/dist/summary/summarizerNode/summarizerNode.js +45 -57
  168. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  169. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +10 -19
  170. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  171. package/dist/summary/summarizerNode/summarizerNodeUtils.js +1 -21
  172. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  173. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +5 -6
  174. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  175. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +16 -16
  176. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  177. package/dist/summary/summarizerTypes.d.ts +10 -21
  178. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  179. package/dist/summary/summarizerTypes.js.map +1 -1
  180. package/dist/summary/summaryFormat.d.ts +15 -2
  181. package/dist/summary/summaryFormat.d.ts.map +1 -1
  182. package/dist/summary/summaryFormat.js.map +1 -1
  183. package/dist/summary/summaryGenerator.d.ts +6 -5
  184. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  185. package/dist/summary/summaryGenerator.js +10 -1
  186. package/dist/summary/summaryGenerator.js.map +1 -1
  187. package/dist/summary/summaryManager.d.ts +5 -6
  188. package/dist/summary/summaryManager.d.ts.map +1 -1
  189. package/dist/summary/summaryManager.js +4 -5
  190. package/dist/summary/summaryManager.js.map +1 -1
  191. package/dist/tsdoc-metadata.json +1 -1
  192. package/lib/{batchTracker.d.mts → batchTracker.d.ts} +2 -3
  193. package/lib/batchTracker.d.ts.map +1 -0
  194. package/lib/{batchTracker.mjs → batchTracker.js} +1 -1
  195. package/lib/batchTracker.js.map +1 -0
  196. package/lib/{blobManager.d.mts → blobManager.d.ts} +1 -6
  197. package/lib/blobManager.d.ts.map +1 -0
  198. package/lib/{blobManager.mjs → blobManager.js} +1 -13
  199. package/lib/blobManager.js.map +1 -0
  200. package/lib/channelCollection.d.ts +225 -0
  201. package/lib/channelCollection.d.ts.map +1 -0
  202. package/lib/{dataStores.mjs → channelCollection.js} +436 -133
  203. package/lib/channelCollection.js.map +1 -0
  204. package/lib/{connectionTelemetry.d.mts → connectionTelemetry.d.ts} +12 -2
  205. package/lib/connectionTelemetry.d.ts.map +1 -0
  206. package/lib/{connectionTelemetry.mjs → connectionTelemetry.js} +43 -5
  207. package/lib/connectionTelemetry.js.map +1 -0
  208. package/lib/{container-runtime-alpha.d.mts → container-runtime-alpha.d.ts} +138 -49
  209. package/lib/{container-runtime-beta.d.mts → container-runtime-beta.d.ts} +75 -9
  210. package/lib/{container-runtime-public.d.mts → container-runtime-public.d.ts} +75 -9
  211. package/lib/{container-runtime-untrimmed.d.mts → container-runtime-untrimmed.d.ts} +717 -49
  212. package/lib/{containerHandleContext.d.mts → containerHandleContext.d.ts} +2 -2
  213. package/lib/containerHandleContext.d.ts.map +1 -0
  214. package/lib/{containerHandleContext.mjs → containerHandleContext.js} +1 -1
  215. package/lib/containerHandleContext.js.map +1 -0
  216. package/lib/{containerRuntime.d.mts → containerRuntime.d.ts} +89 -65
  217. package/lib/containerRuntime.d.ts.map +1 -0
  218. package/lib/{containerRuntime.mjs → containerRuntime.js} +469 -348
  219. package/lib/containerRuntime.js.map +1 -0
  220. package/lib/{dataStore.d.mts → dataStore.d.ts} +3 -4
  221. package/lib/dataStore.d.ts.map +1 -0
  222. package/lib/{dataStore.mjs → dataStore.js} +13 -12
  223. package/lib/dataStore.js.map +1 -0
  224. package/lib/{dataStoreContext.d.mts → dataStoreContext.d.ts} +119 -39
  225. package/lib/dataStoreContext.d.ts.map +1 -0
  226. package/lib/{dataStoreContext.mjs → dataStoreContext.js} +241 -153
  227. package/lib/dataStoreContext.js.map +1 -0
  228. package/lib/{dataStoreContexts.d.mts → dataStoreContexts.d.ts} +3 -2
  229. package/lib/dataStoreContexts.d.ts.map +1 -0
  230. package/lib/{dataStoreContexts.mjs → dataStoreContexts.js} +2 -1
  231. package/lib/dataStoreContexts.js.map +1 -0
  232. package/lib/{dataStoreRegistry.d.mts → dataStoreRegistry.d.ts} +1 -1
  233. package/lib/dataStoreRegistry.d.ts.map +1 -0
  234. package/lib/{dataStoreRegistry.mjs → dataStoreRegistry.js} +5 -1
  235. package/lib/dataStoreRegistry.js.map +1 -0
  236. package/{dist/deltaManagerProxyBase.d.ts → lib/deltaManagerSummarizerProxy.d.ts} +16 -7
  237. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -0
  238. package/lib/deltaManagerSummarizerProxy.js +124 -0
  239. package/lib/deltaManagerSummarizerProxy.js.map +1 -0
  240. package/lib/{deltaScheduler.d.mts → deltaScheduler.d.ts} +1 -1
  241. package/lib/deltaScheduler.d.ts.map +1 -0
  242. package/lib/{deltaScheduler.mjs → deltaScheduler.js} +1 -1
  243. package/lib/deltaScheduler.js.map +1 -0
  244. package/lib/{error.d.mts → error.d.ts} +1 -1
  245. package/lib/error.d.ts.map +1 -0
  246. package/lib/{error.mjs → error.js} +1 -1
  247. package/lib/error.js.map +1 -0
  248. package/lib/gc/{garbageCollection.d.mts → garbageCollection.d.ts} +30 -8
  249. package/lib/gc/garbageCollection.d.ts.map +1 -0
  250. package/lib/gc/{garbageCollection.mjs → garbageCollection.js} +149 -68
  251. package/lib/gc/garbageCollection.js.map +1 -0
  252. package/lib/gc/{gcConfigs.d.mts → gcConfigs.d.ts} +3 -3
  253. package/lib/gc/gcConfigs.d.ts.map +1 -0
  254. package/lib/gc/{gcConfigs.mjs → gcConfigs.js} +14 -7
  255. package/lib/gc/gcConfigs.js.map +1 -0
  256. package/lib/gc/{gcDefinitions.d.mts → gcDefinitions.d.ts} +41 -16
  257. package/lib/gc/gcDefinitions.d.ts.map +1 -0
  258. package/lib/gc/{gcDefinitions.mjs → gcDefinitions.js} +11 -4
  259. package/lib/gc/gcDefinitions.js.map +1 -0
  260. package/lib/gc/{gcHelpers.d.mts → gcHelpers.d.ts} +3 -3
  261. package/lib/gc/{gcHelpers.d.mts.map → gcHelpers.d.ts.map} +1 -1
  262. package/lib/gc/{gcHelpers.mjs → gcHelpers.js} +1 -1
  263. package/lib/gc/gcHelpers.js.map +1 -0
  264. package/lib/gc/{gcReferenceGraphAlgorithm.d.mts → gcReferenceGraphAlgorithm.d.ts} +2 -2
  265. package/lib/gc/gcReferenceGraphAlgorithm.d.ts.map +1 -0
  266. package/lib/gc/{gcReferenceGraphAlgorithm.mjs → gcReferenceGraphAlgorithm.js} +1 -1
  267. package/lib/gc/gcReferenceGraphAlgorithm.js.map +1 -0
  268. package/lib/gc/{gcSummaryDefinitions.d.mts → gcSummaryDefinitions.d.ts} +1 -1
  269. package/lib/gc/gcSummaryDefinitions.d.ts.map +1 -0
  270. package/lib/gc/{gcSummaryDefinitions.mjs → gcSummaryDefinitions.js} +1 -1
  271. package/lib/gc/gcSummaryDefinitions.js.map +1 -0
  272. package/lib/gc/{gcSummaryStateTracker.d.mts → gcSummaryStateTracker.d.ts} +13 -6
  273. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -0
  274. package/lib/gc/{gcSummaryStateTracker.mjs → gcSummaryStateTracker.js} +17 -5
  275. package/lib/gc/gcSummaryStateTracker.js.map +1 -0
  276. package/lib/gc/{gcTelemetry.d.mts → gcTelemetry.d.ts} +8 -8
  277. package/lib/gc/gcTelemetry.d.ts.map +1 -0
  278. package/lib/gc/{gcTelemetry.mjs → gcTelemetry.js} +5 -5
  279. package/lib/gc/gcTelemetry.js.map +1 -0
  280. package/lib/gc/{gcUnreferencedStateTracker.d.mts → gcUnreferencedStateTracker.d.ts} +7 -2
  281. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -0
  282. package/lib/gc/{gcUnreferencedStateTracker.mjs → gcUnreferencedStateTracker.js} +12 -2
  283. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -0
  284. package/lib/gc/index.d.ts +13 -0
  285. package/lib/gc/index.d.ts.map +1 -0
  286. package/lib/gc/{index.mjs → index.js} +8 -8
  287. package/lib/gc/index.js.map +1 -0
  288. package/lib/{index.d.mts → index.d.ts} +12 -21
  289. package/lib/index.d.ts.map +1 -0
  290. package/lib/index.js +15 -0
  291. package/lib/index.js.map +1 -0
  292. package/lib/{messageTypes.d.mts → messageTypes.d.ts} +5 -5
  293. package/lib/messageTypes.d.ts.map +1 -0
  294. package/lib/{messageTypes.mjs → messageTypes.js} +1 -1
  295. package/lib/messageTypes.js.map +1 -0
  296. package/lib/{metadata.d.mts → metadata.d.ts} +1 -1
  297. package/lib/metadata.d.ts.map +1 -0
  298. package/lib/{metadata.mjs → metadata.js} +1 -1
  299. package/lib/metadata.js.map +1 -0
  300. package/lib/opLifecycle/{batchManager.d.mts → batchManager.d.ts} +3 -3
  301. package/lib/opLifecycle/batchManager.d.ts.map +1 -0
  302. package/lib/opLifecycle/{batchManager.mjs → batchManager.js} +1 -1
  303. package/lib/opLifecycle/batchManager.js.map +1 -0
  304. package/lib/opLifecycle/{definitions.d.mts → definitions.d.ts} +3 -3
  305. package/lib/opLifecycle/definitions.d.ts.map +1 -0
  306. package/lib/opLifecycle/{definitions.mjs → definitions.js} +1 -1
  307. package/lib/opLifecycle/definitions.js.map +1 -0
  308. package/lib/opLifecycle/index.d.ts +13 -0
  309. package/lib/opLifecycle/index.d.ts.map +1 -0
  310. package/lib/opLifecycle/index.js +12 -0
  311. package/lib/opLifecycle/index.js.map +1 -0
  312. package/lib/opLifecycle/{opCompressor.d.mts → opCompressor.d.ts} +2 -2
  313. package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
  314. package/lib/opLifecycle/{opCompressor.mjs → opCompressor.js} +3 -3
  315. package/lib/opLifecycle/opCompressor.js.map +1 -0
  316. package/lib/opLifecycle/{opDecompressor.d.mts → opDecompressor.d.ts} +2 -2
  317. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
  318. package/lib/opLifecycle/{opDecompressor.mjs → opDecompressor.js} +2 -2
  319. package/lib/opLifecycle/opDecompressor.js.map +1 -0
  320. package/lib/opLifecycle/{opGroupingManager.d.mts → opGroupingManager.d.ts} +2 -2
  321. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -0
  322. package/lib/opLifecycle/{opGroupingManager.mjs → opGroupingManager.js} +2 -11
  323. package/lib/opLifecycle/opGroupingManager.js.map +1 -0
  324. package/lib/opLifecycle/{opSplitter.d.mts → opSplitter.d.ts} +2 -2
  325. package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
  326. package/lib/opLifecycle/{opSplitter.mjs → opSplitter.js} +3 -3
  327. package/lib/opLifecycle/opSplitter.js.map +1 -0
  328. package/lib/opLifecycle/{outbox.d.mts → outbox.d.ts} +8 -8
  329. package/lib/opLifecycle/outbox.d.ts.map +1 -0
  330. package/lib/opLifecycle/{outbox.mjs → outbox.js} +12 -4
  331. package/lib/opLifecycle/outbox.js.map +1 -0
  332. package/lib/opLifecycle/{remoteMessageProcessor.d.mts → remoteMessageProcessor.d.ts} +5 -5
  333. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  334. package/lib/opLifecycle/{remoteMessageProcessor.mjs → remoteMessageProcessor.js} +2 -2
  335. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
  336. package/lib/{opProperties.d.mts → opProperties.d.ts} +1 -1
  337. package/lib/opProperties.d.ts.map +1 -0
  338. package/lib/{opProperties.mjs → opProperties.js} +1 -1
  339. package/lib/opProperties.js.map +1 -0
  340. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  341. package/lib/packageVersion.d.ts.map +1 -0
  342. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  343. package/lib/packageVersion.js.map +1 -0
  344. package/lib/{pendingStateManager.d.mts → pendingStateManager.d.ts} +3 -2
  345. package/lib/pendingStateManager.d.ts.map +1 -0
  346. package/lib/{pendingStateManager.mjs → pendingStateManager.js} +18 -10
  347. package/lib/pendingStateManager.js.map +1 -0
  348. package/lib/{scheduleManager.d.mts → scheduleManager.d.ts} +6 -3
  349. package/lib/scheduleManager.d.ts.map +1 -0
  350. package/lib/{scheduleManager.mjs → scheduleManager.js} +3 -3
  351. package/lib/scheduleManager.js.map +1 -0
  352. package/lib/{storageServiceWithAttachBlobs.d.mts → storageServiceWithAttachBlobs.d.ts} +1 -1
  353. package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -0
  354. package/lib/{storageServiceWithAttachBlobs.mjs → storageServiceWithAttachBlobs.js} +1 -1
  355. package/lib/storageServiceWithAttachBlobs.js.map +1 -0
  356. package/lib/summary/{index.d.mts → index.d.ts} +13 -13
  357. package/lib/summary/index.d.ts.map +1 -0
  358. package/lib/summary/{index.mjs → index.js} +12 -12
  359. package/lib/summary/index.js.map +1 -0
  360. package/lib/summary/{orderedClientElection.d.mts → orderedClientElection.d.ts} +5 -1
  361. package/lib/summary/orderedClientElection.d.ts.map +1 -0
  362. package/lib/summary/{orderedClientElection.mjs → orderedClientElection.js} +2 -2
  363. package/lib/summary/orderedClientElection.js.map +1 -0
  364. package/lib/summary/{runWhileConnectedCoordinator.d.mts → runWhileConnectedCoordinator.d.ts} +2 -2
  365. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -0
  366. package/lib/summary/{runWhileConnectedCoordinator.mjs → runWhileConnectedCoordinator.js} +1 -1
  367. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -0
  368. package/lib/summary/{runningSummarizer.d.mts → runningSummarizer.d.ts} +12 -11
  369. package/lib/summary/runningSummarizer.d.ts.map +1 -0
  370. package/lib/summary/{runningSummarizer.mjs → runningSummarizer.js} +108 -75
  371. package/lib/summary/runningSummarizer.js.map +1 -0
  372. package/lib/summary/{summarizer.d.mts → summarizer.d.ts} +5 -5
  373. package/lib/summary/summarizer.d.ts.map +1 -0
  374. package/lib/summary/{summarizer.mjs → summarizer.js} +4 -4
  375. package/lib/summary/summarizer.js.map +1 -0
  376. package/lib/summary/{summarizerClientElection.d.mts → summarizerClientElection.d.ts} +3 -3
  377. package/lib/summary/summarizerClientElection.d.ts.map +1 -0
  378. package/lib/summary/{summarizerClientElection.mjs → summarizerClientElection.js} +1 -1
  379. package/lib/summary/summarizerClientElection.js.map +1 -0
  380. package/lib/summary/{summarizerHeuristics.d.mts → summarizerHeuristics.d.ts} +4 -4
  381. package/lib/summary/summarizerHeuristics.d.ts.map +1 -0
  382. package/lib/summary/{summarizerHeuristics.mjs → summarizerHeuristics.js} +1 -1
  383. package/lib/summary/summarizerHeuristics.js.map +1 -0
  384. package/lib/summary/summarizerNode/{index.d.mts → index.d.ts} +4 -4
  385. package/lib/summary/summarizerNode/index.d.ts.map +1 -0
  386. package/lib/summary/summarizerNode/index.js +7 -0
  387. package/lib/summary/summarizerNode/index.js.map +1 -0
  388. package/lib/summary/summarizerNode/{summarizerNode.d.mts → summarizerNode.d.ts} +18 -8
  389. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -0
  390. package/lib/summary/summarizerNode/{summarizerNode.mjs → summarizerNode.js} +41 -53
  391. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -0
  392. package/lib/summary/summarizerNode/{summarizerNodeUtils.d.mts → summarizerNodeUtils.d.ts} +11 -20
  393. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -0
  394. package/lib/summary/summarizerNode/{summarizerNodeUtils.mjs → summarizerNodeUtils.js} +1 -20
  395. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -0
  396. package/lib/summary/summarizerNode/{summarizerNodeWithGc.d.mts → summarizerNodeWithGc.d.ts} +6 -7
  397. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -0
  398. package/lib/summary/summarizerNode/{summarizerNodeWithGc.mjs → summarizerNodeWithGc.js} +12 -12
  399. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -0
  400. package/lib/summary/{summarizerTypes.d.mts → summarizerTypes.d.ts} +11 -22
  401. package/lib/summary/summarizerTypes.d.ts.map +1 -0
  402. package/lib/summary/{summarizerTypes.mjs → summarizerTypes.js} +1 -1
  403. package/lib/summary/summarizerTypes.js.map +1 -0
  404. package/lib/summary/{summaryCollection.d.mts → summaryCollection.d.ts} +1 -1
  405. package/lib/summary/summaryCollection.d.ts.map +1 -0
  406. package/lib/summary/{summaryCollection.mjs → summaryCollection.js} +1 -1
  407. package/lib/summary/summaryCollection.js.map +1 -0
  408. package/lib/summary/{summaryFormat.d.mts → summaryFormat.d.ts} +16 -3
  409. package/lib/summary/summaryFormat.d.ts.map +1 -0
  410. package/lib/summary/{summaryFormat.mjs → summaryFormat.js} +1 -1
  411. package/lib/summary/summaryFormat.js.map +1 -0
  412. package/lib/summary/{summaryGenerator.d.mts → summaryGenerator.d.ts} +7 -6
  413. package/lib/summary/summaryGenerator.d.ts.map +1 -0
  414. package/lib/summary/{summaryGenerator.mjs → summaryGenerator.js} +11 -2
  415. package/lib/summary/summaryGenerator.js.map +1 -0
  416. package/lib/summary/{summaryManager.d.mts → summaryManager.d.ts} +6 -7
  417. package/lib/summary/summaryManager.d.ts.map +1 -0
  418. package/lib/summary/{summaryManager.mjs → summaryManager.js} +4 -5
  419. package/lib/summary/summaryManager.js.map +1 -0
  420. package/lib/test/batchTracker.spec.js +88 -0
  421. package/lib/test/batchTracker.spec.js.map +1 -0
  422. package/lib/test/blobManager.spec.js +835 -0
  423. package/lib/test/blobManager.spec.js.map +1 -0
  424. package/lib/test/channelCollection.spec.js +138 -0
  425. package/lib/test/channelCollection.spec.js.map +1 -0
  426. package/lib/test/containerRuntime.spec.js +1748 -0
  427. package/lib/test/containerRuntime.spec.js.map +1 -0
  428. package/lib/test/dataStoreContext.spec.js +771 -0
  429. package/lib/test/dataStoreContext.spec.js.map +1 -0
  430. package/lib/test/dataStoreCreation.spec.js +303 -0
  431. package/lib/test/dataStoreCreation.spec.js.map +1 -0
  432. package/lib/test/dataStoreRegistry.spec.js +26 -0
  433. package/lib/test/dataStoreRegistry.spec.js.map +1 -0
  434. package/lib/test/fuzz/fuzzUtils.js +66 -0
  435. package/lib/test/fuzz/fuzzUtils.js.map +1 -0
  436. package/lib/test/fuzz/summarizer.fuzz.spec.js +31 -0
  437. package/lib/test/fuzz/summarizer.fuzz.spec.js.map +1 -0
  438. package/lib/test/fuzz/summarizerFuzzMocks.js +162 -0
  439. package/lib/test/fuzz/summarizerFuzzMocks.js.map +1 -0
  440. package/lib/test/fuzz/summarizerFuzzSuite.js +106 -0
  441. package/lib/test/fuzz/summarizerFuzzSuite.js.map +1 -0
  442. package/lib/test/gc/garbageCollection.spec.js +1464 -0
  443. package/lib/test/gc/garbageCollection.spec.js.map +1 -0
  444. package/lib/test/gc/gcConfigs.spec.js +689 -0
  445. package/lib/test/gc/gcConfigs.spec.js.map +1 -0
  446. package/lib/test/gc/gcHelpers.spec.js +110 -0
  447. package/lib/test/gc/gcHelpers.spec.js.map +1 -0
  448. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +68 -0
  449. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +1 -0
  450. package/lib/test/gc/gcStats.spec.js +390 -0
  451. package/lib/test/gc/gcStats.spec.js.map +1 -0
  452. package/lib/test/gc/gcSummaryStateTracker.spec.js +228 -0
  453. package/lib/test/gc/gcSummaryStateTracker.spec.js.map +1 -0
  454. package/lib/test/gc/gcTelemetry.spec.js +530 -0
  455. package/lib/test/gc/gcTelemetry.spec.js.map +1 -0
  456. package/lib/test/gc/gcUnitTestHelpers.js +29 -0
  457. package/lib/test/gc/gcUnitTestHelpers.js.map +1 -0
  458. package/lib/test/gc/gcUnreferencedStateTracker.spec.js +192 -0
  459. package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +1 -0
  460. package/lib/test/getPendingBlobs.spec.js +193 -0
  461. package/lib/test/getPendingBlobs.spec.js.map +1 -0
  462. package/lib/test/hardwareStats.spec.js +93 -0
  463. package/lib/test/hardwareStats.spec.js.map +1 -0
  464. package/lib/test/index.js +6 -0
  465. package/lib/test/index.js.map +1 -0
  466. package/lib/test/opLifecycle/OpGroupingManager.spec.js +225 -0
  467. package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +1 -0
  468. package/lib/test/opLifecycle/batchManager.spec.js +189 -0
  469. package/lib/test/opLifecycle/batchManager.spec.js.map +1 -0
  470. package/lib/test/opLifecycle/opCompressor.spec.js +74 -0
  471. package/lib/test/opLifecycle/opCompressor.spec.js.map +1 -0
  472. package/lib/test/opLifecycle/opDecompressor.spec.js +218 -0
  473. package/lib/test/opLifecycle/opDecompressor.spec.js.map +1 -0
  474. package/lib/test/opLifecycle/opSplitter.spec.js +272 -0
  475. package/lib/test/opLifecycle/opSplitter.spec.js.map +1 -0
  476. package/lib/test/opLifecycle/outbox.spec.js +675 -0
  477. package/lib/test/opLifecycle/outbox.spec.js.map +1 -0
  478. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +196 -0
  479. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +1 -0
  480. package/lib/test/pendingStateManager.spec.js +329 -0
  481. package/lib/test/pendingStateManager.spec.js.map +1 -0
  482. package/lib/test/scheduleManager.spec.js +270 -0
  483. package/lib/test/scheduleManager.spec.js.map +1 -0
  484. package/lib/test/summarizerNode.spec.js +326 -0
  485. package/lib/test/summarizerNode.spec.js.map +1 -0
  486. package/lib/test/summarizerNodeWithGc.spec.js +318 -0
  487. package/lib/test/summarizerNodeWithGc.spec.js.map +1 -0
  488. package/lib/test/summary/orderedClientElection.spec.js +535 -0
  489. package/lib/test/summary/orderedClientElection.spec.js.map +1 -0
  490. package/lib/test/summary/runningSummarizer.spec.js +1349 -0
  491. package/lib/test/summary/runningSummarizer.spec.js.map +1 -0
  492. package/lib/test/summary/summarizer.spec.js +29 -0
  493. package/lib/test/summary/summarizer.spec.js.map +1 -0
  494. package/lib/test/summary/summarizerClientElection.spec.js +436 -0
  495. package/lib/test/summary/summarizerClientElection.spec.js.map +1 -0
  496. package/lib/test/summary/summarizerHeuristics.spec.js +289 -0
  497. package/lib/test/summary/summarizerHeuristics.spec.js.map +1 -0
  498. package/lib/test/summary/summaryCollection.spec.js +200 -0
  499. package/lib/test/summary/summaryCollection.spec.js.map +1 -0
  500. package/lib/test/summary/summaryManager.spec.js +430 -0
  501. package/lib/test/summary/summaryManager.spec.js.map +1 -0
  502. package/lib/test/summary/testQuorumClients.js +34 -0
  503. package/lib/test/summary/testQuorumClients.js.map +1 -0
  504. package/lib/test/throttler.spec.js +175 -0
  505. package/lib/test/throttler.spec.js.map +1 -0
  506. package/lib/test/types/validateContainerRuntimePrevious.generated.js +180 -0
  507. package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +1 -0
  508. package/lib/{throttler.d.mts → throttler.d.ts} +1 -1
  509. package/lib/throttler.d.ts.map +1 -0
  510. package/lib/{throttler.mjs → throttler.js} +1 -1
  511. package/lib/throttler.js.map +1 -0
  512. package/package.json +106 -87
  513. package/src/batchTracker.ts +1 -1
  514. package/src/blobManager.ts +1 -15
  515. package/src/{dataStores.ts → channelCollection.ts} +622 -170
  516. package/src/connectionTelemetry.ts +42 -3
  517. package/src/containerHandleContext.ts +1 -1
  518. package/src/containerRuntime.ts +683 -483
  519. package/src/dataStore.ts +16 -15
  520. package/src/dataStoreContext.ts +378 -216
  521. package/src/dataStoreContexts.ts +2 -1
  522. package/src/deltaManagerSummarizerProxy.ts +132 -7
  523. package/src/gc/garbageCollection.ts +167 -71
  524. package/src/gc/gcConfigs.ts +17 -7
  525. package/src/gc/gcDefinitions.ts +42 -16
  526. package/src/gc/gcHelpers.ts +2 -2
  527. package/src/gc/gcReferenceGraphAlgorithm.ts +1 -1
  528. package/src/gc/gcSummaryStateTracker.ts +19 -7
  529. package/src/gc/gcTelemetry.ts +10 -9
  530. package/src/gc/gcUnreferencedStateTracker.ts +12 -1
  531. package/src/gc/index.ts +11 -9
  532. package/src/index.ts +29 -26
  533. package/src/messageTypes.ts +4 -4
  534. package/src/opLifecycle/README.md +2 -4
  535. package/src/opLifecycle/batchManager.ts +2 -2
  536. package/src/opLifecycle/definitions.ts +2 -2
  537. package/src/opLifecycle/index.ts +8 -8
  538. package/src/opLifecycle/opCompressor.ts +3 -3
  539. package/src/opLifecycle/opDecompressor.ts +3 -3
  540. package/src/opLifecycle/opGroupingManager.ts +3 -12
  541. package/src/opLifecycle/opSplitter.ts +3 -3
  542. package/src/opLifecycle/outbox.ts +29 -9
  543. package/src/opLifecycle/remoteMessageProcessor.ts +4 -4
  544. package/src/packageVersion.ts +1 -1
  545. package/src/pendingStateManager.ts +19 -13
  546. package/src/scheduleManager.ts +4 -4
  547. package/src/summary/index.ts +13 -12
  548. package/src/summary/orderedClientElection.ts +1 -1
  549. package/src/summary/runWhileConnectedCoordinator.ts +1 -1
  550. package/src/summary/runningSummarizer.ts +141 -93
  551. package/src/summary/summarizer.ts +7 -7
  552. package/src/summary/summarizerClientElection.ts +2 -2
  553. package/src/summary/summarizerHeuristics.ts +3 -3
  554. package/src/summary/summarizerNode/index.ts +6 -3
  555. package/src/summary/summarizerNode/summarizerNode.ts +54 -69
  556. package/src/summary/summarizerNode/summarizerNodeUtils.ts +16 -34
  557. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +11 -17
  558. package/src/summary/summarizerTypes.ts +12 -24
  559. package/src/summary/summaryFormat.ts +16 -2
  560. package/src/summary/summaryGenerator.ts +16 -4
  561. package/src/summary/summaryManager.ts +6 -7
  562. package/tsconfig.cjs.json +7 -0
  563. package/tsconfig.json +2 -5
  564. package/dist/dataStores.d.ts +0 -149
  565. package/dist/dataStores.d.ts.map +0 -1
  566. package/dist/dataStores.js.map +0 -1
  567. package/dist/deltaManagerProxyBase.d.ts.map +0 -1
  568. package/dist/deltaManagerProxyBase.js +0 -77
  569. package/dist/deltaManagerProxyBase.js.map +0 -1
  570. package/lib/batchTracker.d.mts.map +0 -1
  571. package/lib/batchTracker.mjs.map +0 -1
  572. package/lib/blobManager.d.mts.map +0 -1
  573. package/lib/blobManager.mjs.map +0 -1
  574. package/lib/connectionTelemetry.d.mts.map +0 -1
  575. package/lib/connectionTelemetry.mjs.map +0 -1
  576. package/lib/containerHandleContext.d.mts.map +0 -1
  577. package/lib/containerHandleContext.mjs.map +0 -1
  578. package/lib/containerRuntime.d.mts.map +0 -1
  579. package/lib/containerRuntime.mjs.map +0 -1
  580. package/lib/dataStore.d.mts.map +0 -1
  581. package/lib/dataStore.mjs.map +0 -1
  582. package/lib/dataStoreContext.d.mts.map +0 -1
  583. package/lib/dataStoreContext.mjs.map +0 -1
  584. package/lib/dataStoreContexts.d.mts.map +0 -1
  585. package/lib/dataStoreContexts.mjs.map +0 -1
  586. package/lib/dataStoreRegistry.d.mts.map +0 -1
  587. package/lib/dataStoreRegistry.mjs.map +0 -1
  588. package/lib/dataStores.d.mts +0 -149
  589. package/lib/dataStores.d.mts.map +0 -1
  590. package/lib/dataStores.mjs.map +0 -1
  591. package/lib/deltaManagerProxyBase.d.mts +0 -35
  592. package/lib/deltaManagerProxyBase.d.mts.map +0 -1
  593. package/lib/deltaManagerProxyBase.mjs +0 -73
  594. package/lib/deltaManagerProxyBase.mjs.map +0 -1
  595. package/lib/deltaManagerSummarizerProxy.d.mts +0 -19
  596. package/lib/deltaManagerSummarizerProxy.d.mts.map +0 -1
  597. package/lib/deltaManagerSummarizerProxy.mjs +0 -38
  598. package/lib/deltaManagerSummarizerProxy.mjs.map +0 -1
  599. package/lib/deltaScheduler.d.mts.map +0 -1
  600. package/lib/deltaScheduler.mjs.map +0 -1
  601. package/lib/error.d.mts.map +0 -1
  602. package/lib/error.mjs.map +0 -1
  603. package/lib/gc/garbageCollection.d.mts.map +0 -1
  604. package/lib/gc/garbageCollection.mjs.map +0 -1
  605. package/lib/gc/gcConfigs.d.mts.map +0 -1
  606. package/lib/gc/gcConfigs.mjs.map +0 -1
  607. package/lib/gc/gcDefinitions.d.mts.map +0 -1
  608. package/lib/gc/gcDefinitions.mjs.map +0 -1
  609. package/lib/gc/gcHelpers.mjs.map +0 -1
  610. package/lib/gc/gcReferenceGraphAlgorithm.d.mts.map +0 -1
  611. package/lib/gc/gcReferenceGraphAlgorithm.mjs.map +0 -1
  612. package/lib/gc/gcSummaryDefinitions.d.mts.map +0 -1
  613. package/lib/gc/gcSummaryDefinitions.mjs.map +0 -1
  614. package/lib/gc/gcSummaryStateTracker.d.mts.map +0 -1
  615. package/lib/gc/gcSummaryStateTracker.mjs.map +0 -1
  616. package/lib/gc/gcTelemetry.d.mts.map +0 -1
  617. package/lib/gc/gcTelemetry.mjs.map +0 -1
  618. package/lib/gc/gcUnreferencedStateTracker.d.mts.map +0 -1
  619. package/lib/gc/gcUnreferencedStateTracker.mjs.map +0 -1
  620. package/lib/gc/index.d.mts +0 -13
  621. package/lib/gc/index.d.mts.map +0 -1
  622. package/lib/gc/index.mjs.map +0 -1
  623. package/lib/index.d.mts.map +0 -1
  624. package/lib/index.mjs +0 -24
  625. package/lib/index.mjs.map +0 -1
  626. package/lib/messageTypes.d.mts.map +0 -1
  627. package/lib/messageTypes.mjs.map +0 -1
  628. package/lib/metadata.d.mts.map +0 -1
  629. package/lib/metadata.mjs.map +0 -1
  630. package/lib/opLifecycle/batchManager.d.mts.map +0 -1
  631. package/lib/opLifecycle/batchManager.mjs.map +0 -1
  632. package/lib/opLifecycle/definitions.d.mts.map +0 -1
  633. package/lib/opLifecycle/definitions.mjs.map +0 -1
  634. package/lib/opLifecycle/index.d.mts +0 -13
  635. package/lib/opLifecycle/index.d.mts.map +0 -1
  636. package/lib/opLifecycle/index.mjs +0 -12
  637. package/lib/opLifecycle/index.mjs.map +0 -1
  638. package/lib/opLifecycle/opCompressor.d.mts.map +0 -1
  639. package/lib/opLifecycle/opCompressor.mjs.map +0 -1
  640. package/lib/opLifecycle/opDecompressor.d.mts.map +0 -1
  641. package/lib/opLifecycle/opDecompressor.mjs.map +0 -1
  642. package/lib/opLifecycle/opGroupingManager.d.mts.map +0 -1
  643. package/lib/opLifecycle/opGroupingManager.mjs.map +0 -1
  644. package/lib/opLifecycle/opSplitter.d.mts.map +0 -1
  645. package/lib/opLifecycle/opSplitter.mjs.map +0 -1
  646. package/lib/opLifecycle/outbox.d.mts.map +0 -1
  647. package/lib/opLifecycle/outbox.mjs.map +0 -1
  648. package/lib/opLifecycle/remoteMessageProcessor.d.mts.map +0 -1
  649. package/lib/opLifecycle/remoteMessageProcessor.mjs.map +0 -1
  650. package/lib/opProperties.d.mts.map +0 -1
  651. package/lib/opProperties.mjs.map +0 -1
  652. package/lib/packageVersion.d.mts.map +0 -1
  653. package/lib/packageVersion.mjs.map +0 -1
  654. package/lib/pendingStateManager.d.mts.map +0 -1
  655. package/lib/pendingStateManager.mjs.map +0 -1
  656. package/lib/scheduleManager.d.mts.map +0 -1
  657. package/lib/scheduleManager.mjs.map +0 -1
  658. package/lib/storageServiceWithAttachBlobs.d.mts.map +0 -1
  659. package/lib/storageServiceWithAttachBlobs.mjs.map +0 -1
  660. package/lib/summary/index.d.mts.map +0 -1
  661. package/lib/summary/index.mjs.map +0 -1
  662. package/lib/summary/orderedClientElection.d.mts.map +0 -1
  663. package/lib/summary/orderedClientElection.mjs.map +0 -1
  664. package/lib/summary/runWhileConnectedCoordinator.d.mts.map +0 -1
  665. package/lib/summary/runWhileConnectedCoordinator.mjs.map +0 -1
  666. package/lib/summary/runningSummarizer.d.mts.map +0 -1
  667. package/lib/summary/runningSummarizer.mjs.map +0 -1
  668. package/lib/summary/summarizer.d.mts.map +0 -1
  669. package/lib/summary/summarizer.mjs.map +0 -1
  670. package/lib/summary/summarizerClientElection.d.mts.map +0 -1
  671. package/lib/summary/summarizerClientElection.mjs.map +0 -1
  672. package/lib/summary/summarizerHeuristics.d.mts.map +0 -1
  673. package/lib/summary/summarizerHeuristics.mjs.map +0 -1
  674. package/lib/summary/summarizerNode/index.d.mts.map +0 -1
  675. package/lib/summary/summarizerNode/index.mjs +0 -7
  676. package/lib/summary/summarizerNode/index.mjs.map +0 -1
  677. package/lib/summary/summarizerNode/summarizerNode.d.mts.map +0 -1
  678. package/lib/summary/summarizerNode/summarizerNode.mjs.map +0 -1
  679. package/lib/summary/summarizerNode/summarizerNodeUtils.d.mts.map +0 -1
  680. package/lib/summary/summarizerNode/summarizerNodeUtils.mjs.map +0 -1
  681. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.mts.map +0 -1
  682. package/lib/summary/summarizerNode/summarizerNodeWithGc.mjs.map +0 -1
  683. package/lib/summary/summarizerTypes.d.mts.map +0 -1
  684. package/lib/summary/summarizerTypes.mjs.map +0 -1
  685. package/lib/summary/summaryCollection.d.mts.map +0 -1
  686. package/lib/summary/summaryCollection.mjs.map +0 -1
  687. package/lib/summary/summaryFormat.d.mts.map +0 -1
  688. package/lib/summary/summaryFormat.mjs.map +0 -1
  689. package/lib/summary/summaryGenerator.d.mts.map +0 -1
  690. package/lib/summary/summaryGenerator.mjs.map +0 -1
  691. package/lib/summary/summaryManager.d.mts.map +0 -1
  692. package/lib/summary/summaryManager.mjs.map +0 -1
  693. package/lib/throttler.d.mts.map +0 -1
  694. package/lib/throttler.mjs.map +0 -1
  695. package/src/deltaManagerProxyBase.ts +0 -111
@@ -8,35 +8,44 @@ import {
8
8
  IDisposable,
9
9
  IFluidHandle,
10
10
  IRequest,
11
+ FluidObject,
12
+ IResponse,
11
13
  } from "@fluidframework/core-interfaces";
12
14
  import { FluidObjectHandle } from "@fluidframework/datastore";
13
15
  import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
14
16
  import {
15
17
  AliasResult,
16
18
  channelsTreeName,
17
- CreateChildSummarizerNodeFn,
18
- CreateChildSummarizerNodeParam,
19
19
  CreateSummarizerNodeSource,
20
20
  IAttachMessage,
21
21
  IEnvelope,
22
+ IFluidDataStoreChannel,
22
23
  IFluidDataStoreContextDetached,
23
24
  IGarbageCollectionData,
24
25
  IInboundSignalMessage,
26
+ IFluidParentContext,
25
27
  InboundAttachMessage,
26
28
  ISummarizeResult,
27
29
  ISummaryTreeWithStats,
28
30
  ITelemetryContext,
31
+ IFluidDataStoreFactory,
32
+ IFluidDataStoreContext,
33
+ NamedFluidDataStoreRegistryEntries,
34
+ IFluidDataStoreRegistry,
29
35
  } from "@fluidframework/runtime-definitions";
30
36
  import {
31
37
  convertSnapshotTreeToSummaryTree,
32
- convertToSummaryTree,
38
+ convertSummaryTreeToITree,
33
39
  create404Response,
34
40
  createResponseError,
35
41
  GCDataBuilder,
36
42
  isSerializedHandle,
43
+ processAttachMessageGCData,
37
44
  responseToException,
38
45
  SummaryTreeBuilder,
39
46
  unpackChildNodesUsedRoutes,
47
+ RequestParser,
48
+ encodeCompactIdToString,
40
49
  } from "@fluidframework/runtime-utils";
41
50
  import {
42
51
  createChildMonitoringContext,
@@ -46,41 +55,199 @@ import {
46
55
  LoggingError,
47
56
  MonitoringContext,
48
57
  tagCodeArtifacts,
58
+ createChildLogger,
49
59
  } from "@fluidframework/telemetry-utils";
50
60
  import { AttachState } from "@fluidframework/container-definitions";
51
61
  import { buildSnapshotTree } from "@fluidframework/driver-utils";
52
- import { assert, Lazy } from "@fluidframework/core-utils";
53
- import { v4 as uuid } from "uuid";
54
- import { DataStoreContexts } from "./dataStoreContexts";
55
- import { ContainerRuntime, defaultRuntimeHeaderData, RuntimeHeaderData } from "./containerRuntime";
62
+ import { assert, Lazy, LazyPromise } from "@fluidframework/core-utils";
63
+ import { DataStoreContexts } from "./dataStoreContexts.js";
64
+ import { defaultRuntimeHeaderData, RuntimeHeaderData } from "./containerRuntime.js";
56
65
  import {
57
66
  FluidDataStoreContext,
58
67
  RemoteFluidDataStoreContext,
59
68
  LocalFluidDataStoreContext,
60
69
  createAttributesBlob,
61
70
  LocalDetachedFluidDataStoreContext,
62
- } from "./dataStoreContext";
63
- import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs";
64
- import { IDataStoreAliasMessage, isDataStoreAliasMessage } from "./dataStore";
65
- import { GCNodeType, detectOutboundRoutesViaDDSKey, disableDatastoreSweepKey } from "./gc";
66
- import { IContainerRuntimeMetadata, nonDataStorePaths, rootHasIsolatedChannels } from "./summary";
71
+ IFluidDataStoreContextInternal,
72
+ ILocalDetachedFluidDataStoreContextProps,
73
+ } from "./dataStoreContext.js";
74
+ import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs.js";
75
+ import {
76
+ IDataStoreAliasMessage,
77
+ channelToDataStore,
78
+ isDataStoreAliasMessage,
79
+ } from "./dataStore.js";
80
+ import {
81
+ GCNodeType,
82
+ detectOutboundRoutesViaDDSKey,
83
+ trimLeadingAndTrailingSlashes,
84
+ } from "./gc/index.js";
85
+ import {
86
+ IContainerRuntimeMetadata,
87
+ nonDataStorePaths,
88
+ rootHasIsolatedChannels,
89
+ } from "./summary/index.js";
90
+ import { ContainerMessageType, LocalContainerRuntimeMessage } from "./messageTypes.js";
91
+ import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
92
+
93
+ /**
94
+ * Accepted header keys for requests coming to the runtime.
95
+ * @internal
96
+ */
97
+ export enum RuntimeHeaders {
98
+ /** True to wait for a data store to be created and loaded before returning it. */
99
+ wait = "wait",
100
+ /** True if the request is coming from an IFluidHandle. */
101
+ viaHandle = "viaHandle",
102
+ }
103
+
104
+ /** True if a tombstoned object should be returned without erroring
105
+ * @alpha
106
+ */
107
+ export const AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
108
+ /**
109
+ * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
110
+ * @internal
111
+ */
112
+ export const AllowInactiveRequestHeaderKey = "allowInactive"; // Belongs in the enum above, but avoiding the breaking change
67
113
 
68
114
  type PendingAliasResolve = (success: boolean) => void;
69
115
 
116
+ interface FluidDataStoreMessage {
117
+ content: any;
118
+ type: string;
119
+ }
120
+
121
+ /**
122
+ * Creates a shallow wrapper of {@link IFluidParentContext}. The wrapper can then have its methods overwritten as needed
123
+ */
124
+ export function wrapContext(context: IFluidParentContext): IFluidParentContext {
125
+ return {
126
+ get IFluidDataStoreRegistry() {
127
+ return context.IFluidDataStoreRegistry;
128
+ },
129
+ IFluidHandleContext: context.IFluidHandleContext,
130
+ options: context.options,
131
+ get clientId() {
132
+ return context.clientId;
133
+ },
134
+ get connected() {
135
+ return context.connected;
136
+ },
137
+ deltaManager: context.deltaManager,
138
+ storage: context.storage,
139
+ logger: context.logger,
140
+ get clientDetails() {
141
+ return context.clientDetails;
142
+ },
143
+ get idCompressor() {
144
+ return context.idCompressor;
145
+ },
146
+ loadingGroupId: context.loadingGroupId,
147
+ get attachState() {
148
+ return context.attachState;
149
+ },
150
+ containerRuntime: context.containerRuntime,
151
+ scope: context.scope,
152
+ gcThrowOnTombstoneUsage: context.gcThrowOnTombstoneUsage,
153
+ gcTombstoneEnforcementAllowed: context.gcTombstoneEnforcementAllowed,
154
+ getAbsoluteUrl: async (...args) => {
155
+ return context.getAbsoluteUrl(...args);
156
+ },
157
+ getQuorum: (...args) => {
158
+ return context.getQuorum(...args);
159
+ },
160
+ getAudience: (...args) => {
161
+ return context.getAudience(...args);
162
+ },
163
+ ensureNoDataModelChanges: (...args) => {
164
+ return context.ensureNoDataModelChanges(...args);
165
+ },
166
+ submitMessage: (...args) => {
167
+ return context.submitMessage(...args);
168
+ },
169
+ submitSignal: (...args) => {
170
+ return context.submitSignal(...args);
171
+ },
172
+ makeLocallyVisible: (...args) => {
173
+ return context.makeLocallyVisible(...args);
174
+ },
175
+ uploadBlob: async (...args) => {
176
+ return context.uploadBlob(...args);
177
+ },
178
+ addedGCOutboundReference: (...args) => {
179
+ return context.addedGCOutboundReference?.(...args);
180
+ },
181
+ getCreateChildSummarizerNodeFn: (...args) => {
182
+ return context.getCreateChildSummarizerNodeFn?.(...args);
183
+ },
184
+ deleteChildSummarizerNode: (...args) => {
185
+ return context.deleteChildSummarizerNode?.(...args);
186
+ },
187
+ setChannelDirty: (address: string) => {
188
+ return context.setChannelDirty(address);
189
+ },
190
+ };
191
+ }
192
+
193
+ /**
194
+ * Creates a wrapper of a {@link IFluidParentContext} to be provided to the inner datastore channels.
195
+ * The wrapper will have the submit methods overwritten with the appropriate id as the destination address.
196
+ *
197
+ * @param id - the id of the channel
198
+ * @param parentContext - the {@link IFluidParentContext} to wrap
199
+ * @returns A wrapped {@link IFluidParentContext}
200
+ */
201
+ export function wrapContextForInnerChannel(
202
+ id: string,
203
+ parentContext: IFluidParentContext,
204
+ ): IFluidParentContext {
205
+ const context = wrapContext(parentContext);
206
+
207
+ context.submitMessage = (type: string, content: any, localOpMetadata: unknown) => {
208
+ const fluidDataStoreContent: FluidDataStoreMessage = {
209
+ content,
210
+ type,
211
+ };
212
+ const envelope: IEnvelope = {
213
+ address: id,
214
+ contents: fluidDataStoreContent,
215
+ };
216
+ parentContext.submitMessage(
217
+ ContainerMessageType.FluidDataStoreOp,
218
+ envelope,
219
+ localOpMetadata,
220
+ );
221
+ };
222
+
223
+ context.submitSignal = (type: string, contents: any, targetClientId?: string) => {
224
+ const envelope: IEnvelope = {
225
+ address: id,
226
+ contents,
227
+ };
228
+ parentContext.submitSignal(type, envelope, targetClientId);
229
+ };
230
+
231
+ return context;
232
+ }
233
+
70
234
  /**
71
235
  * This class encapsulates data store handling. Currently it is only used by the container runtime,
72
236
  * but eventually could be hosted on any channel once we formalize the channel api boundary.
237
+ * @internal
73
238
  */
74
- export class DataStores implements IDisposable {
239
+ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
75
240
  // Stores tracked by the Domain
76
241
  private readonly pendingAttach = new Map<string, IAttachMessage>();
77
242
  // 0.24 back-compat attachingBeforeSummary
78
243
  public readonly attachOpFiredForDataStore = new Set<string>();
79
244
 
80
- private readonly mc: MonitoringContext;
245
+ protected readonly mc: MonitoringContext;
81
246
 
82
247
  private readonly disposeOnce = new Lazy<void>(() => this.contexts.dispose());
83
248
 
249
+ public readonly entryPoint: IFluidHandle<FluidObject>;
250
+
84
251
  public readonly containerLoadStats: {
85
252
  // number of dataStores during loadContainer
86
253
  readonly containerLoadDataStoreCount: number;
@@ -99,30 +266,35 @@ export class DataStores implements IDisposable {
99
266
  Promise<AliasResult>
100
267
  >();
101
268
 
269
+ protected readonly contexts: DataStoreContexts;
270
+
102
271
  constructor(
103
- private readonly baseSnapshot: ISnapshotTree | undefined,
104
- private readonly runtime: ContainerRuntime,
105
- private readonly submitAttachFn: (attachContent: IAttachMessage) => void,
106
- private readonly getCreateChildSummarizerNodeFn: (
107
- id: string,
108
- createParam: CreateChildSummarizerNodeParam,
109
- ) => CreateChildSummarizerNodeFn,
110
- private readonly deleteChildSummarizerNodeFn: (id: string) => void,
272
+ protected readonly baseSnapshot: ISnapshotTree | undefined,
273
+ public readonly parentContext: IFluidParentContext,
111
274
  baseLogger: ITelemetryBaseLogger,
112
275
  private readonly gcNodeUpdated: (
113
276
  nodePath: string,
114
- timestampMs: number,
277
+ reason: "Loaded" | "Changed",
278
+ timestampMs?: number,
115
279
  packagePath?: readonly string[],
280
+ request?: IRequest,
281
+ headerData?: RuntimeHeaderData,
116
282
  ) => void,
117
283
  private readonly isDataStoreDeleted: (nodePath: string) => boolean,
118
284
  private readonly aliasMap: Map<string, string>,
119
- private readonly contexts: DataStoreContexts = new DataStoreContexts(baseLogger),
285
+ provideEntryPoint: (runtime: ChannelCollection) => Promise<FluidObject>,
120
286
  ) {
121
287
  this.mc = createChildMonitoringContext({ logger: baseLogger });
288
+ this.contexts = new DataStoreContexts(baseLogger);
122
289
  this.containerRuntimeHandle = new FluidObjectHandle(
123
- this.runtime,
290
+ this.parentContext,
124
291
  "/",
125
- this.runtime.IFluidHandleContext,
292
+ this.parentContext.IFluidHandleContext,
293
+ );
294
+ this.entryPoint = new FluidObjectHandle<FluidObject>(
295
+ new LazyPromise(async () => provideEntryPoint(this)),
296
+ "",
297
+ this.parentContext.IFluidHandleContext,
126
298
  );
127
299
 
128
300
  // Extract stores stored inside the snapshot
@@ -143,16 +315,17 @@ export class DataStores implements IDisposable {
143
315
  unreferencedDataStoreCount++;
144
316
  }
145
317
  // If we have a detached container, then create local data store contexts.
146
- if (this.runtime.attachState !== AttachState.Detached) {
318
+ if (this.parentContext.attachState !== AttachState.Detached) {
147
319
  dataStoreContext = new RemoteFluidDataStoreContext({
148
320
  id: key,
149
321
  snapshotTree: value,
150
- runtime: this.runtime,
151
- storage: this.runtime.storage,
152
- scope: this.runtime.scope,
153
- createSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {
322
+ parentContext: this.wrapContextForInnerChannel(key),
323
+ storage: this.parentContext.storage,
324
+ scope: this.parentContext.scope,
325
+ createSummarizerNodeFn: this.parentContext.getCreateChildSummarizerNodeFn(key, {
154
326
  type: CreateSummarizerNodeSource.FromSummary,
155
327
  }),
328
+ loadingGroupId: value.groupId,
156
329
  });
157
330
  } else {
158
331
  if (typeof value !== "object") {
@@ -162,15 +335,14 @@ export class DataStores implements IDisposable {
162
335
  dataStoreContext = new LocalFluidDataStoreContext({
163
336
  id: key,
164
337
  pkg: undefined,
165
- runtime: this.runtime,
166
- storage: this.runtime.storage,
167
- scope: this.runtime.scope,
168
- createSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {
338
+ parentContext: this.wrapContextForInnerChannel(key),
339
+ storage: this.parentContext.storage,
340
+ scope: this.parentContext.scope,
341
+ createSummarizerNodeFn: this.parentContext.getCreateChildSummarizerNodeFn(key, {
169
342
  type: CreateSummarizerNodeSource.FromSummary,
170
343
  }),
171
344
  makeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(key),
172
345
  snapshotTree,
173
- isRootDataStore: undefined,
174
346
  });
175
347
  }
176
348
  this.contexts.addBoundOrRemoted(dataStoreContext);
@@ -194,18 +366,60 @@ export class DataStores implements IDisposable {
194
366
  return pendingAliasPromise ?? "Success";
195
367
  }
196
368
 
197
- public processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {
369
+ /** For sampling. Only log once per container */
370
+ private shouldSendAttachLog = true;
371
+
372
+ protected wrapContextForInnerChannel(id: string): IFluidParentContext {
373
+ return wrapContextForInnerChannel(id, this.parentContext);
374
+ }
375
+
376
+ /**
377
+ * IFluidDataStoreChannel.makeVisibleAndAttachGraph implementation
378
+ * Not clear when it would be called and what it should do.
379
+ * Currently this API is called by context only for root data stores.
380
+ */
381
+ public makeVisibleAndAttachGraph() {
382
+ this.parentContext.makeLocallyVisible();
383
+ }
384
+
385
+ private processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {
198
386
  const attachMessage = message.contents as InboundAttachMessage;
199
387
 
200
388
  this.dataStoresSinceLastGC.push(attachMessage.id);
201
389
 
390
+ // We need to process the GC Data for both local and remote attach messages
391
+ const foundGCData = processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
392
+ // nodeId is the relative path under the node being attached. Always starts with "/", but no trailing "/" after an id
393
+ const fromPath = `/${attachMessage.id}${nodeId === "/" ? "" : nodeId}`;
394
+ this.parentContext.addedGCOutboundReference?.(
395
+ { absolutePath: fromPath },
396
+ { absolutePath: toPath },
397
+ );
398
+ });
399
+
400
+ // Only log once per container to avoid noise/cost.
401
+ // Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
402
+ if (this.shouldSendAttachLog) {
403
+ this.shouldSendAttachLog = false;
404
+ this.mc.logger.sendTelemetryEvent({
405
+ eventName: "dataStoreAttachMessage_sampled",
406
+ ...tagCodeArtifacts({ id: attachMessage.id, pkg: attachMessage.type }),
407
+ details: {
408
+ local,
409
+ snapshot: !!attachMessage.snapshot,
410
+ foundGCData,
411
+ },
412
+ ...extractSafePropertiesFromMessage(message),
413
+ });
414
+ }
415
+
202
416
  // The local object has already been attached
203
417
  if (local) {
204
418
  assert(
205
419
  this.pendingAttach.has(attachMessage.id),
206
420
  0x15e /* "Local object does not have matching attach message id" */,
207
421
  );
208
- this.contexts.get(attachMessage.id)?.emit("attached");
422
+ this.contexts.get(attachMessage.id)?.setAttachState(AttachState.Attached);
209
423
  this.pendingAttach.delete(attachMessage.id);
210
424
  return;
211
425
  }
@@ -236,23 +450,27 @@ export class DataStores implements IDisposable {
236
450
  const remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({
237
451
  id: attachMessage.id,
238
452
  snapshotTree,
239
- runtime: this.runtime,
240
- storage: new StorageServiceWithAttachBlobs(this.runtime.storage, flatAttachBlobs),
241
- scope: this.runtime.scope,
242
- createSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(attachMessage.id, {
243
- type: CreateSummarizerNodeSource.FromAttach,
244
- sequenceNumber: message.sequenceNumber,
245
- snapshot: attachMessage.snapshot ?? {
246
- entries: [createAttributesBlob(pkg, true /* isRootDataStore */)],
453
+ parentContext: this.wrapContextForInnerChannel(attachMessage.id),
454
+ storage: new StorageServiceWithAttachBlobs(this.parentContext.storage, flatAttachBlobs),
455
+ scope: this.parentContext.scope,
456
+ loadingGroupId: attachMessage.snapshot?.groupId,
457
+ createSummarizerNodeFn: this.parentContext.getCreateChildSummarizerNodeFn(
458
+ attachMessage.id,
459
+ {
460
+ type: CreateSummarizerNodeSource.FromAttach,
461
+ sequenceNumber: message.sequenceNumber,
462
+ snapshot: attachMessage.snapshot ?? {
463
+ entries: [createAttributesBlob(pkg, true /* isRootDataStore */)],
464
+ },
247
465
  },
248
- }),
466
+ ),
249
467
  pkg,
250
468
  });
251
469
 
252
470
  this.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);
253
471
  }
254
472
 
255
- public processAliasMessage(
473
+ private processAliasMessage(
256
474
  message: ISequencedDocumentMessage,
257
475
  localOpMetadata: unknown,
258
476
  local: boolean,
@@ -265,47 +483,43 @@ export class DataStores implements IDisposable {
265
483
  }
266
484
 
267
485
  const resolve = localOpMetadata as PendingAliasResolve;
268
- const aliasResult = this.processAliasMessageCore(aliasMessage);
486
+ const aliasResult = this.processAliasMessageCore(
487
+ aliasMessage.internalId,
488
+ aliasMessage.alias,
489
+ );
269
490
  if (local) {
270
491
  resolve(aliasResult);
271
492
  }
272
493
  }
273
494
 
274
- public processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean {
275
- if (this.alreadyProcessed(aliasMessage.alias)) {
495
+ public processAliasMessageCore(internalId: string, alias: string): boolean {
496
+ if (this.alreadyProcessed(alias)) {
276
497
  return false;
277
498
  }
278
499
 
279
- const context = this.contexts.get(aliasMessage.internalId);
500
+ const context = this.contexts.get(internalId);
280
501
  // If the data store has been deleted, log an error and ignore this message. This helps prevent document
281
502
  // corruption in case a deleted data store accidentally submitted a signal.
282
- if (
283
- this.checkAndLogIfDeleted(
284
- aliasMessage.internalId,
285
- context,
286
- "Changed",
287
- "processAliasMessageCore",
288
- )
289
- ) {
503
+ if (this.checkAndLogIfDeleted(internalId, context, "Changed", "processAliasMessageCore")) {
290
504
  return false;
291
505
  }
292
506
 
293
507
  if (context === undefined) {
294
508
  this.mc.logger.sendErrorEvent({
295
509
  eventName: "AliasFluidDataStoreNotFound",
296
- fluidDataStoreId: aliasMessage.internalId,
510
+ fluidDataStoreId: internalId,
297
511
  });
298
512
  return false;
299
513
  }
300
514
 
301
515
  const handle = new FluidObjectHandle(
302
516
  context,
303
- aliasMessage.internalId,
304
- this.runtime.IFluidHandleContext,
517
+ internalId,
518
+ this.parentContext.IFluidHandleContext,
305
519
  );
306
- this.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);
520
+ this.parentContext.addedGCOutboundReference?.(this.containerRuntimeHandle, handle);
307
521
 
308
- this.aliasMap.set(aliasMessage.alias, context.id);
522
+ this.aliasMap.set(alias, context.id);
309
523
  context.setInMemoryRoot();
310
524
  return true;
311
525
  }
@@ -314,9 +528,24 @@ export class DataStores implements IDisposable {
314
528
  return this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;
315
529
  }
316
530
 
531
+ /** Package up the context's attach summary etc into an IAttachMessage */
532
+ private generateAttachMessage(localContext: IFluidDataStoreContextInternal): IAttachMessage {
533
+ const { attachSummary } = localContext.getAttachData(/* includeGCData: */ true);
534
+ const type = localContext.packagePath[localContext.packagePath.length - 1];
535
+
536
+ // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
537
+ const snapshot = convertSummaryTreeToITree(attachSummary.summary);
538
+
539
+ return {
540
+ id: localContext.id,
541
+ snapshot,
542
+ type,
543
+ } satisfies IAttachMessage;
544
+ }
545
+
317
546
  /**
318
- * Make the data stores locally visible in the container graph by moving the data store context from unbound to
319
- * bound list. This data store can now be reached from the root.
547
+ * Make the data store locally visible in the container graph by moving the data store context from unbound to
548
+ * bound list and submitting the attach message. This data store can now be reached from the root.
320
549
  * @param id - The id of the data store context to make visible.
321
550
  */
322
551
  private makeDataStoreLocallyVisible(id: string): void {
@@ -328,58 +557,110 @@ export class DataStores implements IDisposable {
328
557
  * globally visible. Move it to attaching state and send an "attach" op for it.
329
558
  * If the container is detached, this data store will be part of the summary that makes the container attached.
330
559
  */
331
- if (this.runtime.attachState !== AttachState.Detached) {
332
- localContext.emit("attaching");
333
- const message = localContext.generateAttachMessage();
334
-
335
- this.pendingAttach.set(id, message);
336
- this.submitAttachFn(message);
337
- this.attachOpFiredForDataStore.add(id);
560
+ if (this.parentContext.attachState !== AttachState.Detached) {
561
+ localContext.setAttachState(AttachState.Attaching);
562
+ this.submitAttachChannelOp(localContext);
338
563
  }
339
564
 
340
565
  this.contexts.bind(id);
341
566
  }
342
567
 
343
- public createDetachedDataStoreCore(
568
+ protected submitAttachChannelOp(localContext: LocalFluidDataStoreContext) {
569
+ const message = this.generateAttachMessage(localContext);
570
+ this.pendingAttach.set(localContext.id, message);
571
+ this.parentContext.submitMessage(ContainerMessageType.Attach, message, undefined);
572
+ this.attachOpFiredForDataStore.add(localContext.id);
573
+ }
574
+
575
+ /**
576
+ * Generate compact internal DataStore ID.
577
+ *
578
+ * A note about namespace and name collisions:
579
+ * This code assumes that that's the only way to generate internal IDs, and that it's Ok for this namespace to overlap with
580
+ * user-provided alias names namespace.
581
+ * There are two scenarios where it could cause trouble:
582
+ * 1) Old files, where (already removed) CreateRoot*DataStore*() API was used, and thus internal name of data store
583
+ * was provided by user. Such files may experience name collision with future data stores that receive a name generated
584
+ * by this function.
585
+ * 2) Much less likely, but if it happen that internal ID (generated by this function) is exactly the same as alias name
586
+ * that user might use in the future, them ContainerRuntime.getAliasedDataStoreEntryPoint() or
587
+ * ContainerRuntime.getDataStoreFromRequest() could return a data store with internalID matching user request, even though
588
+ * user expected some other data store (that would receive alias later).
589
+ * Please note that above mentioned functions have the implementation they have (allowing #2) due to #1.
590
+ */
591
+ protected createDataStoreId(): string {
592
+ // We use three non-overlapping namespaces:
593
+ // - detached state: even numbers
594
+ // - attached state: odd numbers
595
+ // - uuids
596
+ // In first two cases we will encode result as strings in more compact form.
597
+ if (this.parentContext.attachState === AttachState.Detached) {
598
+ // container is detached, only one client observes content, no way to hit collisions with other clients.
599
+ return encodeCompactIdToString(2 * this.contexts.size);
600
+ }
601
+ const id = this.parentContext.containerRuntime.generateDocumentUniqueId();
602
+ if (typeof id === "number") {
603
+ return encodeCompactIdToString(2 * id + 1);
604
+ }
605
+ return id;
606
+ }
607
+
608
+ public createDetachedDataStore(
344
609
  pkg: Readonly<string[]>,
345
- isRoot: boolean,
346
- id = uuid(),
610
+ loadingGroupId?: string,
347
611
  ): IFluidDataStoreContextDetached {
348
- assert(!id.includes("/"), 0x30c /* Id cannot contain slashes */);
612
+ return this.createContext(
613
+ this.createDataStoreId(),
614
+ pkg,
615
+ LocalDetachedFluidDataStoreContext,
616
+ undefined, // props
617
+ loadingGroupId,
618
+ );
619
+ }
349
620
 
350
- const context = new LocalDetachedFluidDataStoreContext({
351
- id,
621
+ public createDataStoreContext(
622
+ pkg: Readonly<string[]>,
623
+ props?: any,
624
+ loadingGroupId?: string,
625
+ ): IFluidDataStoreContextInternal {
626
+ return this.createContext(
627
+ this.createDataStoreId(),
352
628
  pkg,
353
- runtime: this.runtime,
354
- storage: this.runtime.storage,
355
- scope: this.runtime.scope,
356
- createSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {
357
- type: CreateSummarizerNodeSource.Local,
358
- }),
359
- makeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),
360
- snapshotTree: undefined,
361
- isRootDataStore: isRoot,
362
- });
363
- this.contexts.addUnbound(context);
364
- return context;
629
+ LocalFluidDataStoreContext,
630
+ props,
631
+ loadingGroupId,
632
+ );
365
633
  }
366
634
 
367
- public _createFluidDataStoreContext(pkg: string[], id: string, props?: any) {
368
- assert(!id.includes("/"), 0x30d /* Id cannot contain slashes */);
369
- const context = new LocalFluidDataStoreContext({
635
+ protected createContext<T extends LocalFluidDataStoreContext>(
636
+ id: string,
637
+ pkg: Readonly<string[]>,
638
+ contextCtor: new (props: ILocalDetachedFluidDataStoreContextProps) => T,
639
+ createProps?: any,
640
+ loadingGroupId?: string,
641
+ ) {
642
+ const context = new contextCtor({
370
643
  id,
371
644
  pkg,
372
- runtime: this.runtime,
373
- storage: this.runtime.storage,
374
- scope: this.runtime.scope,
375
- createSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {
645
+ parentContext: this.wrapContextForInnerChannel(id),
646
+ storage: this.parentContext.storage,
647
+ scope: this.parentContext.scope,
648
+ createSummarizerNodeFn: this.parentContext.getCreateChildSummarizerNodeFn(id, {
376
649
  type: CreateSummarizerNodeSource.Local,
377
650
  }),
378
651
  makeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),
379
652
  snapshotTree: undefined,
380
- isRootDataStore: false,
381
- createProps: props,
653
+ createProps,
654
+ loadingGroupId,
655
+ channelToDataStoreFn: (channel: IFluidDataStoreChannel) =>
656
+ channelToDataStore(
657
+ channel,
658
+ id,
659
+ this,
660
+ createChildLogger({ logger: this.parentContext.logger }),
661
+ ),
382
662
  });
663
+
383
664
  this.contexts.addUnbound(context);
384
665
  return context;
385
666
  }
@@ -389,7 +670,21 @@ export class DataStores implements IDisposable {
389
670
  }
390
671
  public readonly dispose = () => this.disposeOnce.value;
391
672
 
392
- public resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {
673
+ public reSubmit(type: string, content: any, localOpMetadata: unknown) {
674
+ switch (type) {
675
+ case ContainerMessageType.Attach:
676
+ case ContainerMessageType.Alias:
677
+ this.parentContext.submitMessage(type, content, localOpMetadata);
678
+ return;
679
+ case ContainerMessageType.FluidDataStoreOp:
680
+ return this.reSubmitChannelOp(type, content, localOpMetadata);
681
+ default:
682
+ assert(false, "unknown op type");
683
+ }
684
+ }
685
+
686
+ protected reSubmitChannelOp(type: string, content: any, localOpMetadata: unknown) {
687
+ const envelope = content as IEnvelope;
393
688
  const context = this.contexts.get(envelope.address);
394
689
  // If the data store has been deleted, log an error and throw an error. If there are local changes for a
395
690
  // deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
@@ -402,10 +697,13 @@ export class DataStores implements IDisposable {
402
697
  });
403
698
  }
404
699
  assert(!!context, 0x160 /* "There should be a store context for the op" */);
405
- context.reSubmit(envelope.contents, localOpMetadata);
700
+ const innerContents = envelope.contents as FluidDataStoreMessage;
701
+ context.reSubmit(innerContents.type, innerContents.content, localOpMetadata);
406
702
  }
407
703
 
408
- public rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {
704
+ public rollback(type: string, content: any, localOpMetadata: unknown) {
705
+ assert(type === ContainerMessageType.FluidDataStoreOp, 0x8e8 /* type */);
706
+ const envelope = content as IEnvelope;
409
707
  const context = this.contexts.get(envelope.address);
410
708
  // If the data store has been deleted, log an error and throw an error. If there are local changes for a
411
709
  // deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
@@ -418,10 +716,25 @@ export class DataStores implements IDisposable {
418
716
  });
419
717
  }
420
718
  assert(!!context, 0x2e8 /* "There should be a store context for the op" */);
421
- context.rollback(envelope.contents, localOpMetadata);
719
+ const innerContents = envelope.contents as FluidDataStoreMessage;
720
+ context.rollback(innerContents.type, innerContents.content, localOpMetadata);
422
721
  }
423
722
 
424
- public async applyStashedOp(envelope: IEnvelope): Promise<unknown> {
723
+ public async applyStashedOp(content: unknown): Promise<unknown> {
724
+ const opContents = content as LocalContainerRuntimeMessage;
725
+ switch (opContents.type) {
726
+ case ContainerMessageType.Attach:
727
+ return this.applyStashedAttachOp(opContents.contents);
728
+ case ContainerMessageType.Alias:
729
+ return;
730
+ case ContainerMessageType.FluidDataStoreOp:
731
+ return this.applyStashedChannelChannelOp(opContents.contents);
732
+ default:
733
+ assert(false, "unknon type of op");
734
+ }
735
+ }
736
+
737
+ protected async applyStashedChannelChannelOp(envelope: IEnvelope) {
425
738
  const context = this.contexts.get(envelope.address);
426
739
  // If the data store has been deleted, log an error and ignore this message. This helps prevent document
427
740
  // corruption in case the data store that stashed the op is deleted.
@@ -432,49 +745,94 @@ export class DataStores implements IDisposable {
432
745
  return context.applyStashedOp(envelope.contents);
433
746
  }
434
747
 
435
- public async applyStashedAttachOp(message: IAttachMessage) {
748
+ private async applyStashedAttachOp(message: IAttachMessage) {
436
749
  this.pendingAttach.set(message.id, message);
437
750
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
438
751
  this.processAttachMessage({ contents: message } as ISequencedDocumentMessage, false);
439
752
  }
440
753
 
441
- public processFluidDataStoreOp(
754
+ public process(
442
755
  message: ISequencedDocumentMessage,
443
756
  local: boolean,
444
757
  localMessageMetadata: unknown,
445
- addedOutboundReference: (fromNodePath: string, toNodePath: string) => void,
758
+ addedOutboundReference?: (fromNodePath: string, toNodePath: string) => void,
446
759
  ) {
447
- const envelope = message.contents as IEnvelope;
448
- const transformed = { ...message, contents: envelope.contents };
449
- const context = this.contexts.get(envelope.address);
760
+ switch (message.type) {
761
+ case ContainerMessageType.Attach:
762
+ this.processAttachMessage(message, local);
763
+ return;
764
+ case ContainerMessageType.Alias:
765
+ this.processAliasMessage(message, localMessageMetadata, local);
766
+ return;
767
+ case ContainerMessageType.FluidDataStoreOp: {
768
+ const envelope = message.contents as IEnvelope;
769
+ const innerContents = envelope.contents as FluidDataStoreMessage;
770
+ const transformed = {
771
+ ...message,
772
+ type: innerContents.type,
773
+ contents: innerContents.content,
774
+ };
775
+
776
+ this.processChannelOp(envelope.address, transformed, local, localMessageMetadata);
777
+
778
+ // By default, we use the new behavior of detecting outbound routes here.
779
+ // If this setting is true, then DataStoreContext would be notifying GC instead.
780
+ if (
781
+ this.mc.config.getBoolean(detectOutboundRoutesViaDDSKey) !== true &&
782
+ addedOutboundReference !== undefined
783
+ ) {
784
+ // Notify GC of any outbound references that were added by this op.
785
+ detectOutboundReferences(
786
+ envelope.address,
787
+ transformed.contents,
788
+ addedOutboundReference,
789
+ );
790
+ }
791
+ break;
792
+ }
793
+ default:
794
+ assert(false, 0x8e9 /* unreached */);
795
+ }
796
+ }
797
+
798
+ protected processChannelOp(
799
+ address: string,
800
+ message: ISequencedDocumentMessage,
801
+ local: boolean,
802
+ localMessageMetadata: unknown,
803
+ ) {
804
+ const context = this.contexts.get(address);
450
805
 
451
806
  // If the data store has been deleted, log an error and ignore this message. This helps prevent document
452
807
  // corruption in case a deleted data store accidentally submitted an op.
453
- if (
454
- this.checkAndLogIfDeleted(
455
- envelope.address,
456
- context,
457
- "Changed",
458
- "processFluidDataStoreOp",
459
- )
460
- ) {
808
+ if (this.checkAndLogIfDeleted(address, context, "Changed", "processFluidDataStoreOp")) {
461
809
  return;
462
810
  }
463
811
 
464
- assert(!!context, 0x162 /* "There should be a store context for the op" */);
465
- context.process(transformed, local, localMessageMetadata);
466
-
467
- // By default, we use the new behavior of detecting outbound routes here.
468
- // If this setting is true, then DataStoreContext would be notifying GC instead.
469
- if (this.mc.config.getBoolean(detectOutboundRoutesViaDDSKey) !== true) {
470
- // Notify GC of any outbound references that were added by this op.
471
- detectOutboundReferences(envelope, addedOutboundReference);
812
+ if (context === undefined) {
813
+ // Former assert 0x162
814
+ throw DataProcessingError.create(
815
+ "No context for op",
816
+ "processFluidDataStoreOp",
817
+ message,
818
+ {
819
+ local,
820
+ messageDetails: JSON.stringify({
821
+ type: message.type,
822
+ contentType: typeof message.contents,
823
+ }),
824
+ ...tagCodeArtifacts({ address }),
825
+ },
826
+ );
472
827
  }
473
828
 
829
+ context.process(message, local, localMessageMetadata);
830
+
474
831
  // Notify that a GC node for the data store changed. This is used to detect if a deleted data store is
475
832
  // being used.
476
833
  this.gcNodeUpdated(
477
- `/${envelope.address}`,
834
+ `/${address}`,
835
+ "Changed",
478
836
  message.timestamp,
479
837
  context.isLoaded ? context.packagePath : undefined,
480
838
  );
@@ -483,7 +841,7 @@ export class DataStores implements IDisposable {
483
841
  public async getDataStore(
484
842
  id: string,
485
843
  requestHeaderData: RuntimeHeaderData,
486
- ): Promise<FluidDataStoreContext> {
844
+ ): Promise<IFluidDataStoreContextInternal> {
487
845
  const headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };
488
846
  if (
489
847
  this.checkAndLogIfDeleted(
@@ -517,7 +875,7 @@ export class DataStores implements IDisposable {
517
875
  public async getDataStoreIfAvailable(
518
876
  id: string,
519
877
  requestHeaderData: RuntimeHeaderData,
520
- ): Promise<FluidDataStoreContext | undefined> {
878
+ ): Promise<IFluidDataStoreContextInternal | undefined> {
521
879
  // If the data store has been deleted, log an error and return undefined.
522
880
  if (
523
881
  this.checkAndLogIfDeleted(
@@ -548,7 +906,7 @@ export class DataStores implements IDisposable {
548
906
  */
549
907
  private checkAndLogIfDeleted(
550
908
  id: string,
551
- context: FluidDataStoreContext | undefined,
909
+ context: IFluidDataStoreContext | undefined,
552
910
  deletedLogSuffix: string,
553
911
  callSite: string,
554
912
  requestHeaderData?: RuntimeHeaderData,
@@ -568,7 +926,10 @@ export class DataStores implements IDisposable {
568
926
  return true;
569
927
  }
570
928
 
571
- public processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {
929
+ public processSignal(messageArg: IInboundSignalMessage, local: boolean) {
930
+ const envelope = messageArg.content as IEnvelope;
931
+ const fluidDataStoreId = envelope.address;
932
+ const message = { ...messageArg, content: envelope.contents };
572
933
  const context = this.contexts.get(fluidDataStoreId);
573
934
  // If the data store has been deleted, log an error and ignore this message. This helps prevent document
574
935
  // corruption in case a deleted data store accidentally submitted a signal.
@@ -604,7 +965,7 @@ export class DataStores implements IDisposable {
604
965
  fluidDataStoreId,
605
966
  }),
606
967
  details: JSON.stringify({
607
- runtimeConnected: this.runtime.connected,
968
+ runtimeConnected: this.parentContext.connected,
608
969
  connected,
609
970
  }),
610
971
  },
@@ -615,11 +976,10 @@ export class DataStores implements IDisposable {
615
976
  }
616
977
 
617
978
  public setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {
618
- const eventName = attachState === AttachState.Attaching ? "attaching" : "attached";
619
979
  for (const [, context] of this.contexts) {
620
980
  // Fire only for bounded stores.
621
981
  if (!this.contexts.isNotBound(context.id)) {
622
- context.emit(eventName);
982
+ context.setAttachState(attachState);
623
983
  }
624
984
  }
625
985
  }
@@ -665,7 +1025,10 @@ export class DataStores implements IDisposable {
665
1025
  return summaryBuilder.getSummaryTree();
666
1026
  }
667
1027
 
668
- public createSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {
1028
+ /**
1029
+ * Create a summary. Used when attaching or serializing a detached container.
1030
+ */
1031
+ public getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {
669
1032
  const builder = new SummaryTreeBuilder();
670
1033
  // Attaching graph of some stores can cause other stores to get bound too.
671
1034
  // So keep taking summary until no new stores get bound.
@@ -689,8 +1052,10 @@ export class DataStores implements IDisposable {
689
1052
  .map(([key, value]) => {
690
1053
  let dataStoreSummary: ISummarizeResult;
691
1054
  if (value.isLoaded) {
692
- const snapshot = value.generateAttachMessage().snapshot;
693
- dataStoreSummary = convertToSummaryTree(snapshot, true);
1055
+ dataStoreSummary = value.getAttachData(
1056
+ /* includeGCCData: */ false,
1057
+ telemetryContext,
1058
+ ).attachSummary;
694
1059
  } else {
695
1060
  // If this data store is not yet loaded, then there should be no changes in the snapshot from
696
1061
  // which it was created as it is detached container. So just use the previous snapshot.
@@ -720,8 +1085,12 @@ export class DataStores implements IDisposable {
720
1085
  assert(context !== undefined, 0x2b6 /* Missing data store context */);
721
1086
  if (await context.isRoot()) {
722
1087
  // A root data store is basically a reference from the container runtime to the data store.
723
- const handle = new FluidObjectHandle(context, id, this.runtime.IFluidHandleContext);
724
- this.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);
1088
+ const handle = new FluidObjectHandle(
1089
+ context,
1090
+ id,
1091
+ this.parentContext.IFluidHandleContext,
1092
+ );
1093
+ this.parentContext.addedGCOutboundReference?.(this.containerRuntimeHandle, handle);
725
1094
  }
726
1095
  }
727
1096
  this.dataStoresSinceLastGC = [];
@@ -795,27 +1164,6 @@ export class DataStores implements IDisposable {
795
1164
  }
796
1165
  }
797
1166
 
798
- /**
799
- * This is called to update objects whose routes are unused. The unused objects are deleted.
800
- * @param unusedRoutes - The routes that are unused in all data stores in this Container.
801
- */
802
- public updateUnusedRoutes(unusedRoutes: readonly string[]) {
803
- for (const route of unusedRoutes) {
804
- const pathParts = route.split("/");
805
- // Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data
806
- // store based on its DDS being unused.
807
- if (pathParts.length > 2) {
808
- continue;
809
- }
810
- const dataStoreId = pathParts[1];
811
- assert(this.contexts.has(dataStoreId), 0x2d7 /* No data store with specified id */);
812
- // Delete the contexts of unused data stores.
813
- this.contexts.delete(dataStoreId);
814
- // Delete the summarizer node of the unused data stores.
815
- this.deleteChildSummarizerNodeFn(dataStoreId);
816
- }
817
- }
818
-
819
1167
  /**
820
1168
  * Delete data stores and its objects that are sweep ready.
821
1169
  * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should
@@ -823,16 +1171,13 @@ export class DataStores implements IDisposable {
823
1171
  * @returns The routes of data stores and its objects that were deleted.
824
1172
  */
825
1173
  public deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[] {
826
- // If sweep for data stores is not enabled, return empty list indicating nothing is deleted.
827
- if (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {
828
- return [];
829
- }
830
1174
  for (const route of sweepReadyDataStoreRoutes) {
831
1175
  const pathParts = route.split("/");
832
1176
  const dataStoreId = pathParts[1];
833
1177
 
834
1178
  // Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
835
1179
  // need to delete the data store.
1180
+ // These routes will still be returned below as among the deleted routes
836
1181
  if (pathParts.length > 2) {
837
1182
  continue;
838
1183
  }
@@ -857,7 +1202,7 @@ export class DataStores implements IDisposable {
857
1202
  // Delete the contexts of sweep ready data stores.
858
1203
  this.contexts.delete(dataStoreId);
859
1204
  // Delete the summarizer node of the sweep ready data stores.
860
- this.deleteChildSummarizerNodeFn(dataStoreId);
1205
+ this.parentContext.deleteChildSummarizerNode?.(dataStoreId);
861
1206
  }
862
1207
  return Array.from(sweepReadyDataStoreRoutes);
863
1208
  }
@@ -931,6 +1276,69 @@ export class DataStores implements IDisposable {
931
1276
  }
932
1277
  return GCNodeType.SubDataStore;
933
1278
  }
1279
+
1280
+ public internalId(maybeAlias: string): string {
1281
+ return this.aliases.get(maybeAlias) ?? maybeAlias;
1282
+ }
1283
+
1284
+ public async request(request: IRequest): Promise<IResponse> {
1285
+ const requestParser = RequestParser.create(request);
1286
+ const id = requestParser.pathParts[0];
1287
+
1288
+ // Differentiate between requesting the dataStore directly, or one of its children
1289
+ const requestForChild = !requestParser.isLeaf(1);
1290
+
1291
+ const headerData: RuntimeHeaderData = {};
1292
+ if (typeof request.headers?.[RuntimeHeaders.wait] === "boolean") {
1293
+ headerData.wait = request.headers[RuntimeHeaders.wait];
1294
+ }
1295
+ if (typeof request.headers?.[RuntimeHeaders.viaHandle] === "boolean") {
1296
+ headerData.viaHandle = request.headers[RuntimeHeaders.viaHandle];
1297
+ }
1298
+ if (typeof request.headers?.[AllowTombstoneRequestHeaderKey] === "boolean") {
1299
+ headerData.allowTombstone = request.headers[AllowTombstoneRequestHeaderKey];
1300
+ }
1301
+ if (typeof request.headers?.[AllowInactiveRequestHeaderKey] === "boolean") {
1302
+ headerData.allowInactive = request.headers[AllowInactiveRequestHeaderKey];
1303
+ }
1304
+
1305
+ // We allow Tombstone requests for sub-DataStore objects
1306
+ if (requestForChild) {
1307
+ headerData.allowTombstone = true;
1308
+ }
1309
+
1310
+ await this.waitIfPendingAlias(id);
1311
+ const internalId = this.internalId(id);
1312
+ const dataStoreContext = await this.getDataStore(internalId, headerData);
1313
+
1314
+ // Remove query params, leading and trailing slashes from the url. This is done to make sure the format is
1315
+ // the same as GC nodes id.
1316
+ const urlWithoutQuery = trimLeadingAndTrailingSlashes(request.url.split("?")[0]);
1317
+ // Get the initial snapshot details which contain the data store package path.
1318
+ const details = await dataStoreContext.getInitialSnapshotDetails();
1319
+
1320
+ // Note that this will throw if the data store is inactive or tombstoned and throwing on incorrect usage
1321
+ // is configured.
1322
+ this.gcNodeUpdated(
1323
+ `/${urlWithoutQuery}`,
1324
+ "Loaded",
1325
+ undefined /* timestampMs */,
1326
+ details.pkg,
1327
+ request,
1328
+ headerData,
1329
+ );
1330
+ const dataStore = await dataStoreContext.realize();
1331
+
1332
+ const subRequest = requestParser.createSubRequest(1);
1333
+ // We always expect createSubRequest to include a leading slash, but asserting here to protect against
1334
+ // unintentionally modifying the url if that changes.
1335
+ assert(
1336
+ subRequest.url.startsWith("/"),
1337
+ 0x126 /* "Expected createSubRequest url to include a leading slash" */,
1338
+ );
1339
+
1340
+ return dataStore.request(subRequest);
1341
+ }
934
1342
  }
935
1343
 
936
1344
  export function getSummaryForDatastores(
@@ -962,9 +1370,12 @@ export function getSummaryForDatastores(
962
1370
 
963
1371
  /**
964
1372
  * Traverse this op's contents and detect any outbound routes that were added by this op.
1373
+ *
1374
+ * @internal
965
1375
  */
966
1376
  export function detectOutboundReferences(
967
- envelope: IEnvelope,
1377
+ address: string,
1378
+ contents: unknown,
968
1379
  addedOutboundReference: (fromNodePath: string, toNodePath: string) => void,
969
1380
  ): void {
970
1381
  // These will be built up as we traverse the envelope contents
@@ -991,10 +1402,51 @@ export function detectOutboundReferences(
991
1402
  }
992
1403
  }
993
1404
 
994
- recursivelyFindHandles(envelope.contents);
1405
+ recursivelyFindHandles(contents);
995
1406
 
996
1407
  // GC node paths are all absolute paths, hence the "" prefix.
997
1408
  // e.g. this will yield "/dataStoreId/ddsId"
998
- const fromPath = ["", envelope.address, ddsAddress].join("/");
1409
+ const fromPath = ["", address, ddsAddress].join("/");
999
1410
  outboundPaths.forEach((toPath) => addedOutboundReference(fromPath, toPath));
1000
1411
  }
1412
+
1413
+ /** @internal */
1414
+ export class ChannelCollectionFactory<T extends ChannelCollection = ChannelCollection>
1415
+ implements IFluidDataStoreFactory
1416
+ {
1417
+ public readonly type = "ChannelCollectionChannel";
1418
+
1419
+ public IFluidDataStoreRegistry: IFluidDataStoreRegistry;
1420
+
1421
+ constructor(
1422
+ registryEntries: NamedFluidDataStoreRegistryEntries,
1423
+ // ADO:7302 We need a better type here
1424
+ private readonly provideEntryPoint: (
1425
+ runtime: IFluidDataStoreChannel,
1426
+ ) => Promise<FluidObject>,
1427
+ private readonly ctor: (...args: ConstructorParameters<typeof ChannelCollection>) => T,
1428
+ ) {
1429
+ this.IFluidDataStoreRegistry = new FluidDataStoreRegistry(registryEntries);
1430
+ }
1431
+
1432
+ public get IFluidDataStoreFactory() {
1433
+ return this;
1434
+ }
1435
+
1436
+ public async instantiateDataStore(
1437
+ context: IFluidDataStoreContext,
1438
+ _existing: boolean,
1439
+ ): Promise<IFluidDataStoreChannel> {
1440
+ const runtime = this.ctor(
1441
+ context.baseSnapshot,
1442
+ context, // parentContext
1443
+ context.logger,
1444
+ () => {}, // gcNodeUpdated
1445
+ (_nodePath: string) => false, // isDataStoreDeleted
1446
+ new Map(), // aliasMap
1447
+ this.provideEntryPoint,
1448
+ );
1449
+
1450
+ return runtime;
1451
+ }
1452
+ }