@fluidframework/container-runtime 2.0.0-dev-rc.5.0.0.268409 → 2.0.0-dev-rc.5.0.0.270987

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 (306) hide show
  1. package/api-report/container-runtime.alpha.api.md +3 -8
  2. package/api-report/container-runtime.beta.api.md +2 -2
  3. package/api-report/container-runtime.public.api.md +2 -2
  4. package/biome.jsonc +4 -0
  5. package/container-runtime.test-files.tar +0 -0
  6. package/dist/batchTracker.js +5 -1
  7. package/dist/batchTracker.js.map +1 -1
  8. package/dist/blobManager.d.ts +1 -18
  9. package/dist/blobManager.d.ts.map +1 -1
  10. package/dist/blobManager.js +39 -48
  11. package/dist/blobManager.js.map +1 -1
  12. package/dist/channelCollection.d.ts +8 -9
  13. package/dist/channelCollection.d.ts.map +1 -1
  14. package/dist/channelCollection.js +71 -51
  15. package/dist/channelCollection.js.map +1 -1
  16. package/dist/connectionTelemetry.d.ts +1 -2
  17. package/dist/connectionTelemetry.d.ts.map +1 -1
  18. package/dist/connectionTelemetry.js +32 -14
  19. package/dist/connectionTelemetry.js.map +1 -1
  20. package/dist/containerHandleContext.js +4 -0
  21. package/dist/containerHandleContext.js.map +1 -1
  22. package/dist/containerRuntime.d.ts +7 -18
  23. package/dist/containerRuntime.d.ts.map +1 -1
  24. package/dist/containerRuntime.js +145 -43
  25. package/dist/containerRuntime.js.map +1 -1
  26. package/dist/dataStore.js +9 -1
  27. package/dist/dataStore.js.map +1 -1
  28. package/dist/dataStoreContext.d.ts +23 -37
  29. package/dist/dataStoreContext.d.ts.map +1 -1
  30. package/dist/dataStoreContext.js +159 -133
  31. package/dist/dataStoreContext.js.map +1 -1
  32. package/dist/dataStoreContexts.js +29 -28
  33. package/dist/dataStoreContexts.js.map +1 -1
  34. package/dist/dataStoreRegistry.js +1 -0
  35. package/dist/dataStoreRegistry.js.map +1 -1
  36. package/dist/deltaManagerProxies.d.ts +4 -4
  37. package/dist/deltaManagerProxies.d.ts.map +1 -1
  38. package/dist/deltaManagerProxies.js +33 -28
  39. package/dist/deltaManagerProxies.js.map +1 -1
  40. package/dist/deltaScheduler.d.ts +1 -2
  41. package/dist/deltaScheduler.d.ts.map +1 -1
  42. package/dist/deltaScheduler.js +13 -9
  43. package/dist/deltaScheduler.js.map +1 -1
  44. package/dist/error.js +2 -1
  45. package/dist/error.js.map +1 -1
  46. package/dist/gc/garbageCollection.d.ts.map +1 -1
  47. package/dist/gc/garbageCollection.js +37 -17
  48. package/dist/gc/garbageCollection.js.map +1 -1
  49. package/dist/gc/gcDefinitions.d.ts +0 -4
  50. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  51. package/dist/gc/gcDefinitions.js +1 -3
  52. package/dist/gc/gcDefinitions.js.map +1 -1
  53. package/dist/gc/gcSummaryStateTracker.js +19 -14
  54. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  55. package/dist/gc/gcTelemetry.js +12 -5
  56. package/dist/gc/gcTelemetry.js.map +1 -1
  57. package/dist/gc/gcUnreferencedStateTracker.js +12 -1
  58. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  59. package/dist/gc/index.d.ts +1 -1
  60. package/dist/gc/index.d.ts.map +1 -1
  61. package/dist/gc/index.js +1 -2
  62. package/dist/gc/index.js.map +1 -1
  63. package/dist/messageTypes.d.ts +1 -1
  64. package/dist/messageTypes.d.ts.map +1 -1
  65. package/dist/messageTypes.js.map +1 -1
  66. package/dist/opLifecycle/batchManager.js +5 -3
  67. package/dist/opLifecycle/batchManager.js.map +1 -1
  68. package/dist/opLifecycle/opCompressor.js +1 -0
  69. package/dist/opLifecycle/opCompressor.js.map +1 -1
  70. package/dist/opLifecycle/opDecompressor.d.ts +1 -1
  71. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  72. package/dist/opLifecycle/opDecompressor.js +6 -4
  73. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  74. package/dist/opLifecycle/opGroupingManager.d.ts +1 -1
  75. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  76. package/dist/opLifecycle/opGroupingManager.js +3 -1
  77. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  78. package/dist/opLifecycle/opSplitter.d.ts +1 -1
  79. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  80. package/dist/opLifecycle/opSplitter.js +6 -0
  81. package/dist/opLifecycle/opSplitter.js.map +1 -1
  82. package/dist/opLifecycle/outbox.js +15 -10
  83. package/dist/opLifecycle/outbox.js.map +1 -1
  84. package/dist/opLifecycle/remoteMessageProcessor.d.ts +1 -1
  85. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  86. package/dist/opLifecycle/remoteMessageProcessor.js +3 -0
  87. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  88. package/dist/opProperties.d.ts +1 -1
  89. package/dist/opProperties.d.ts.map +1 -1
  90. package/dist/opProperties.js.map +1 -1
  91. package/dist/packageVersion.d.ts +1 -1
  92. package/dist/packageVersion.js +1 -1
  93. package/dist/packageVersion.js.map +1 -1
  94. package/dist/pendingStateManager.d.ts.map +1 -1
  95. package/dist/pendingStateManager.js +34 -18
  96. package/dist/pendingStateManager.js.map +1 -1
  97. package/dist/scheduleManager.d.ts +1 -2
  98. package/dist/scheduleManager.d.ts.map +1 -1
  99. package/dist/scheduleManager.js +15 -4
  100. package/dist/scheduleManager.js.map +1 -1
  101. package/dist/storageServiceWithAttachBlobs.js +1 -0
  102. package/dist/storageServiceWithAttachBlobs.js.map +1 -1
  103. package/dist/summary/documentSchema.js +17 -1
  104. package/dist/summary/documentSchema.js.map +1 -1
  105. package/dist/summary/orderedClientElection.js +19 -11
  106. package/dist/summary/orderedClientElection.js.map +1 -1
  107. package/dist/summary/runWhileConnectedCoordinator.js +4 -2
  108. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  109. package/dist/summary/runningSummarizer.d.ts +1 -1
  110. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  111. package/dist/summary/runningSummarizer.js +56 -38
  112. package/dist/summary/runningSummarizer.js.map +1 -1
  113. package/dist/summary/summarizer.js +17 -8
  114. package/dist/summary/summarizer.js.map +1 -1
  115. package/dist/summary/summarizerClientElection.js +18 -7
  116. package/dist/summary/summarizerClientElection.js.map +1 -1
  117. package/dist/summary/summarizerHeuristics.js +30 -25
  118. package/dist/summary/summarizerHeuristics.js.map +1 -1
  119. package/dist/summary/summarizerNode/summarizerNode.d.ts +1 -2
  120. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  121. package/dist/summary/summarizerNode/summarizerNode.js +12 -3
  122. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  123. package/dist/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  124. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  125. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +20 -6
  126. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  127. package/dist/summary/summarizerTypes.d.ts +2 -2
  128. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  129. package/dist/summary/summarizerTypes.js.map +1 -1
  130. package/dist/summary/summaryCollection.d.ts +1 -2
  131. package/dist/summary/summaryCollection.d.ts.map +1 -1
  132. package/dist/summary/summaryCollection.js +23 -11
  133. package/dist/summary/summaryCollection.js.map +1 -1
  134. package/dist/summary/summaryFormat.d.ts +1 -2
  135. package/dist/summary/summaryFormat.d.ts.map +1 -1
  136. package/dist/summary/summaryFormat.js.map +1 -1
  137. package/dist/summary/summaryGenerator.js +12 -5
  138. package/dist/summary/summaryGenerator.js.map +1 -1
  139. package/dist/summary/summaryManager.js +58 -48
  140. package/dist/summary/summaryManager.js.map +1 -1
  141. package/dist/throttler.js +4 -1
  142. package/dist/throttler.js.map +1 -1
  143. package/lib/batchTracker.js +5 -1
  144. package/lib/batchTracker.js.map +1 -1
  145. package/lib/blobManager.d.ts +1 -18
  146. package/lib/blobManager.d.ts.map +1 -1
  147. package/lib/blobManager.js +39 -48
  148. package/lib/blobManager.js.map +1 -1
  149. package/lib/channelCollection.d.ts +8 -9
  150. package/lib/channelCollection.d.ts.map +1 -1
  151. package/lib/channelCollection.js +72 -53
  152. package/lib/channelCollection.js.map +1 -1
  153. package/lib/connectionTelemetry.d.ts +1 -2
  154. package/lib/connectionTelemetry.d.ts.map +1 -1
  155. package/lib/connectionTelemetry.js +33 -15
  156. package/lib/connectionTelemetry.js.map +1 -1
  157. package/lib/containerHandleContext.js +4 -0
  158. package/lib/containerHandleContext.js.map +1 -1
  159. package/lib/containerRuntime.d.ts +7 -18
  160. package/lib/containerRuntime.d.ts.map +1 -1
  161. package/lib/containerRuntime.js +145 -43
  162. package/lib/containerRuntime.js.map +1 -1
  163. package/lib/dataStore.js +9 -1
  164. package/lib/dataStore.js.map +1 -1
  165. package/lib/dataStoreContext.d.ts +23 -37
  166. package/lib/dataStoreContext.d.ts.map +1 -1
  167. package/lib/dataStoreContext.js +162 -136
  168. package/lib/dataStoreContext.js.map +1 -1
  169. package/lib/dataStoreContexts.js +29 -28
  170. package/lib/dataStoreContexts.js.map +1 -1
  171. package/lib/dataStoreRegistry.js +1 -0
  172. package/lib/dataStoreRegistry.js.map +1 -1
  173. package/lib/deltaManagerProxies.d.ts +4 -4
  174. package/lib/deltaManagerProxies.d.ts.map +1 -1
  175. package/lib/deltaManagerProxies.js +33 -28
  176. package/lib/deltaManagerProxies.js.map +1 -1
  177. package/lib/deltaScheduler.d.ts +1 -2
  178. package/lib/deltaScheduler.d.ts.map +1 -1
  179. package/lib/deltaScheduler.js +13 -9
  180. package/lib/deltaScheduler.js.map +1 -1
  181. package/lib/error.js +2 -1
  182. package/lib/error.js.map +1 -1
  183. package/lib/gc/garbageCollection.d.ts.map +1 -1
  184. package/lib/gc/garbageCollection.js +37 -17
  185. package/lib/gc/garbageCollection.js.map +1 -1
  186. package/lib/gc/gcDefinitions.d.ts +0 -4
  187. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  188. package/lib/gc/gcDefinitions.js +0 -2
  189. package/lib/gc/gcDefinitions.js.map +1 -1
  190. package/lib/gc/gcSummaryStateTracker.js +19 -14
  191. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  192. package/lib/gc/gcTelemetry.js +12 -5
  193. package/lib/gc/gcTelemetry.js.map +1 -1
  194. package/lib/gc/gcUnreferencedStateTracker.js +12 -1
  195. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  196. package/lib/gc/index.d.ts +1 -1
  197. package/lib/gc/index.d.ts.map +1 -1
  198. package/lib/gc/index.js +1 -1
  199. package/lib/gc/index.js.map +1 -1
  200. package/lib/messageTypes.d.ts +1 -1
  201. package/lib/messageTypes.d.ts.map +1 -1
  202. package/lib/messageTypes.js.map +1 -1
  203. package/lib/opLifecycle/batchManager.js +5 -3
  204. package/lib/opLifecycle/batchManager.js.map +1 -1
  205. package/lib/opLifecycle/opCompressor.js +1 -0
  206. package/lib/opLifecycle/opCompressor.js.map +1 -1
  207. package/lib/opLifecycle/opDecompressor.d.ts +1 -1
  208. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  209. package/lib/opLifecycle/opDecompressor.js +6 -4
  210. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  211. package/lib/opLifecycle/opGroupingManager.d.ts +1 -1
  212. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  213. package/lib/opLifecycle/opGroupingManager.js +3 -1
  214. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  215. package/lib/opLifecycle/opSplitter.d.ts +1 -1
  216. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  217. package/lib/opLifecycle/opSplitter.js +6 -0
  218. package/lib/opLifecycle/opSplitter.js.map +1 -1
  219. package/lib/opLifecycle/outbox.js +15 -10
  220. package/lib/opLifecycle/outbox.js.map +1 -1
  221. package/lib/opLifecycle/remoteMessageProcessor.d.ts +1 -1
  222. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  223. package/lib/opLifecycle/remoteMessageProcessor.js +4 -1
  224. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  225. package/lib/opProperties.d.ts +1 -1
  226. package/lib/opProperties.d.ts.map +1 -1
  227. package/lib/opProperties.js.map +1 -1
  228. package/lib/packageVersion.d.ts +1 -1
  229. package/lib/packageVersion.js +1 -1
  230. package/lib/packageVersion.js.map +1 -1
  231. package/lib/pendingStateManager.d.ts.map +1 -1
  232. package/lib/pendingStateManager.js +34 -18
  233. package/lib/pendingStateManager.js.map +1 -1
  234. package/lib/scheduleManager.d.ts +1 -2
  235. package/lib/scheduleManager.d.ts.map +1 -1
  236. package/lib/scheduleManager.js +15 -4
  237. package/lib/scheduleManager.js.map +1 -1
  238. package/lib/storageServiceWithAttachBlobs.js +1 -0
  239. package/lib/storageServiceWithAttachBlobs.js.map +1 -1
  240. package/lib/summary/documentSchema.js +17 -1
  241. package/lib/summary/documentSchema.js.map +1 -1
  242. package/lib/summary/orderedClientElection.js +19 -11
  243. package/lib/summary/orderedClientElection.js.map +1 -1
  244. package/lib/summary/runWhileConnectedCoordinator.js +4 -2
  245. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  246. package/lib/summary/runningSummarizer.d.ts +1 -1
  247. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  248. package/lib/summary/runningSummarizer.js +57 -39
  249. package/lib/summary/runningSummarizer.js.map +1 -1
  250. package/lib/summary/summarizer.js +17 -8
  251. package/lib/summary/summarizer.js.map +1 -1
  252. package/lib/summary/summarizerClientElection.js +18 -7
  253. package/lib/summary/summarizerClientElection.js.map +1 -1
  254. package/lib/summary/summarizerHeuristics.js +30 -25
  255. package/lib/summary/summarizerHeuristics.js.map +1 -1
  256. package/lib/summary/summarizerNode/summarizerNode.d.ts +1 -2
  257. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  258. package/lib/summary/summarizerNode/summarizerNode.js +12 -3
  259. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  260. package/lib/summary/summarizerNode/summarizerNodeUtils.js +2 -0
  261. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  262. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +20 -6
  263. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  264. package/lib/summary/summarizerTypes.d.ts +2 -2
  265. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  266. package/lib/summary/summarizerTypes.js.map +1 -1
  267. package/lib/summary/summaryCollection.d.ts +1 -2
  268. package/lib/summary/summaryCollection.d.ts.map +1 -1
  269. package/lib/summary/summaryCollection.js +23 -11
  270. package/lib/summary/summaryCollection.js.map +1 -1
  271. package/lib/summary/summaryFormat.d.ts +1 -2
  272. package/lib/summary/summaryFormat.d.ts.map +1 -1
  273. package/lib/summary/summaryFormat.js.map +1 -1
  274. package/lib/summary/summaryGenerator.js +12 -5
  275. package/lib/summary/summaryGenerator.js.map +1 -1
  276. package/lib/summary/summaryManager.js +58 -48
  277. package/lib/summary/summaryManager.js.map +1 -1
  278. package/lib/throttler.js +4 -1
  279. package/lib/throttler.js.map +1 -1
  280. package/package.json +23 -20
  281. package/src/batchTracker.ts +1 -1
  282. package/src/blobManager.ts +1 -39
  283. package/src/channelCollection.ts +63 -76
  284. package/src/connectionTelemetry.ts +5 -2
  285. package/src/containerRuntime.ts +9 -32
  286. package/src/dataStoreContext.ts +38 -79
  287. package/src/deltaManagerProxies.ts +3 -5
  288. package/src/deltaScheduler.ts +4 -2
  289. package/src/gc/garbageCollection.ts +0 -2
  290. package/src/gc/gcDefinitions.ts +0 -4
  291. package/src/gc/index.ts +0 -1
  292. package/src/messageTypes.ts +1 -1
  293. package/src/opLifecycle/opDecompressor.ts +1 -1
  294. package/src/opLifecycle/opGroupingManager.ts +1 -1
  295. package/src/opLifecycle/opSplitter.ts +1 -1
  296. package/src/opLifecycle/remoteMessageProcessor.ts +4 -2
  297. package/src/opProperties.ts +4 -2
  298. package/src/packageVersion.ts +1 -1
  299. package/src/pendingStateManager.ts +16 -5
  300. package/src/scheduleManager.ts +4 -2
  301. package/src/summary/runningSummarizer.ts +5 -2
  302. package/src/summary/summarizerNode/summarizerNode.ts +5 -2
  303. package/src/summary/summarizerTypes.ts +5 -2
  304. package/src/summary/summaryCollection.ts +1 -1
  305. package/src/summary/summaryFormat.ts +2 -1
  306. package/tsconfig.json +2 -0
@@ -6,15 +6,15 @@ import { AttachState } from "@fluidframework/container-definitions";
6
6
  import { assert, Lazy, LazyPromise } from "@fluidframework/core-utils/internal";
7
7
  import { FluidObjectHandle } from "@fluidframework/datastore/internal";
8
8
  import { buildSnapshotTree, getSnapshotTree, isInstanceOfISnapshot, } from "@fluidframework/driver-utils/internal";
9
- import { CreateSummarizerNodeSource, channelsTreeName, } from "@fluidframework/runtime-definitions/internal";
10
- import { GCDataBuilder, RequestParser, SummaryTreeBuilder, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, create404Response, createResponseError, encodeCompactIdToString, isSerializedHandle, processAttachMessageGCData, responseToException, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils/internal";
9
+ import { CreateSummarizerNodeSource, channelsTreeName, gcDataBlobKey, } from "@fluidframework/runtime-definitions/internal";
10
+ import { GCDataBuilder, RequestParser, SummaryTreeBuilder, addBlobToSummary, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, create404Response, createResponseError, encodeCompactIdToString, isSerializedHandle, processAttachMessageGCData, responseToException, unpackChildNodesUsedRoutes, } from "@fluidframework/runtime-utils/internal";
11
11
  import { DataCorruptionError, DataProcessingError, LoggingError, createChildLogger, createChildMonitoringContext, extractSafePropertiesFromMessage, tagCodeArtifacts, } from "@fluidframework/telemetry-utils/internal";
12
12
  import { DeletedResponseHeaderKey, defaultRuntimeHeaderData, } from "./containerRuntime.js";
13
13
  import { channelToDataStore, isDataStoreAliasMessage, } from "./dataStore.js";
14
14
  import { LocalDetachedFluidDataStoreContext, LocalFluidDataStoreContext, RemoteFluidDataStoreContext, createAttributesBlob, } from "./dataStoreContext.js";
15
15
  import { DataStoreContexts } from "./dataStoreContexts.js";
16
16
  import { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
17
- import { GCNodeType, detectOutboundRoutesViaDDSKey, urlToGCNodePath, } from "./gc/index.js";
17
+ import { GCNodeType, urlToGCNodePath } from "./gc/index.js";
18
18
  import { ContainerMessageType } from "./messageTypes.js";
19
19
  import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs.js";
20
20
  import { nonDataStorePaths, rootHasIsolatedChannels, } from "./summary/index.js";
@@ -96,8 +96,8 @@ export function wrapContext(context) {
96
96
  uploadBlob: async (...args) => {
97
97
  return context.uploadBlob(...args);
98
98
  },
99
- addedGCOutboundReference: (...args) => {
100
- return context.addedGCOutboundReference?.(...args);
99
+ addedGCOutboundRoute: (...args) => {
100
+ return context.addedGCOutboundRoute(...args);
101
101
  },
102
102
  getCreateChildSummarizerNodeFn: (...args) => {
103
103
  return context.getCreateChildSummarizerNodeFn?.(...args);
@@ -140,33 +140,42 @@ export function wrapContextForInnerChannel(id, parentContext) {
140
140
  };
141
141
  return context;
142
142
  }
143
+ /**
144
+ * Returns the type of the given local data store from its package path.
145
+ */
146
+ export function getLocalDataStoreType(localDataStore) {
147
+ return localDataStore.packagePath[localDataStore.packagePath.length - 1];
148
+ }
143
149
  /**
144
150
  * This class encapsulates data store handling. Currently it is only used by the container runtime,
145
151
  * but eventually could be hosted on any channel once we formalize the channel api boundary.
146
152
  * @internal
147
153
  */
148
154
  export class ChannelCollection {
155
+ baseSnapshot;
156
+ parentContext;
157
+ gcNodeUpdated;
158
+ isDataStoreDeleted;
159
+ aliasMap;
160
+ // Stores tracked by the Domain
161
+ pendingAttach = new Map();
162
+ // 0.24 back-compat attachingBeforeSummary
163
+ attachOpFiredForDataStore = new Set();
164
+ mc;
165
+ disposeOnce = new Lazy(() => this.contexts.dispose());
166
+ entryPoint;
167
+ containerLoadStats;
168
+ pendingAliasMap = new Map();
169
+ contexts;
170
+ aliasedDataStores;
149
171
  constructor(baseSnapshot, parentContext, baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap, provideEntryPoint) {
150
172
  this.baseSnapshot = baseSnapshot;
151
173
  this.parentContext = parentContext;
152
174
  this.gcNodeUpdated = gcNodeUpdated;
153
175
  this.isDataStoreDeleted = isDataStoreDeleted;
154
176
  this.aliasMap = aliasMap;
155
- // Stores tracked by the Domain
156
- this.pendingAttach = new Map();
157
- // 0.24 back-compat attachingBeforeSummary
158
- this.attachOpFiredForDataStore = new Set();
159
- this.disposeOnce = new Lazy(() => this.contexts.dispose());
160
- // Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new
161
- // root data stores that are added.
162
- this.dataStoresSinceLastGC = [];
163
- this.pendingAliasMap = new Map();
164
- /** For sampling. Only log once per container */
165
- this.shouldSendAttachLog = true;
166
- this.dispose = () => this.disposeOnce.value;
167
177
  this.mc = createChildMonitoringContext({ logger: baseLogger });
168
178
  this.contexts = new DataStoreContexts(baseLogger);
169
- this.containerRuntimeHandle = new FluidObjectHandle(this.parentContext, "/", this.parentContext.IFluidHandleContext);
170
179
  this.entryPoint = new FluidObjectHandle(new LazyPromise(async () => provideEntryPoint(this)), "", this.parentContext.IFluidHandleContext);
171
180
  this.aliasedDataStores = new Set(aliasMap.values());
172
181
  // Extract stores stored inside the snapshot
@@ -241,6 +250,8 @@ export class ChannelCollection {
241
250
  const pendingAliasPromise = this.pendingAliases.get(maybeAlias);
242
251
  return pendingAliasPromise ?? "Success";
243
252
  }
253
+ /** For sampling. Only log once per container */
254
+ shouldSendAttachLog = true;
244
255
  wrapContextForInnerChannel(id) {
245
256
  return wrapContextForInnerChannel(id, this.parentContext);
246
257
  }
@@ -254,12 +265,11 @@ export class ChannelCollection {
254
265
  }
255
266
  processAttachMessage(message, local) {
256
267
  const attachMessage = message.contents;
257
- this.dataStoresSinceLastGC.push(attachMessage.id);
258
268
  // We need to process the GC Data for both local and remote attach messages
259
269
  const foundGCData = processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
260
270
  // nodeId is the relative path under the node being attached. Always starts with "/", but no trailing "/" after an id
261
271
  const fromPath = `/${attachMessage.id}${nodeId === "/" ? "" : nodeId}`;
262
- this.parentContext.addedGCOutboundReference?.({ absolutePath: fromPath }, { absolutePath: toPath });
272
+ this.parentContext.addedGCOutboundRoute(fromPath, toPath);
263
273
  });
264
274
  // Only log once per container to avoid noise/cost.
265
275
  // Allows longitudinal tracking of various state (e.g. foundGCData), and some sampled details
@@ -353,8 +363,7 @@ export class ChannelCollection {
353
363
  });
354
364
  return false;
355
365
  }
356
- const handle = new FluidObjectHandle(context, internalId, this.parentContext.IFluidHandleContext);
357
- this.parentContext.addedGCOutboundReference?.(this.containerRuntimeHandle, handle);
366
+ this.parentContext.addedGCOutboundRoute("/", `/${internalId}`);
358
367
  this.aliasMap.set(alias, context.id);
359
368
  this.aliasedDataStores.add(context.id);
360
369
  context.setInMemoryRoot();
@@ -365,14 +374,17 @@ export class ChannelCollection {
365
374
  }
366
375
  /** Package up the context's attach summary etc into an IAttachMessage */
367
376
  generateAttachMessage(localContext) {
368
- const { attachSummary } = localContext.getAttachData(/* includeGCData: */ true);
369
- const type = localContext.packagePath[localContext.packagePath.length - 1];
377
+ // Get the attach summary.
378
+ const attachSummary = localContext.getAttachSummary();
379
+ // Get the GC data and add it to the attach summary.
380
+ const attachGCData = localContext.getAttachGCData();
381
+ addBlobToSummary(attachSummary, gcDataBlobKey, JSON.stringify(attachGCData));
370
382
  // Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
371
383
  const snapshot = convertSummaryTreeToITree(attachSummary.summary);
372
384
  return {
373
385
  id: localContext.id,
374
386
  snapshot,
375
- type,
387
+ type: getLocalDataStoreType(localContext),
376
388
  };
377
389
  }
378
390
  /**
@@ -462,6 +474,7 @@ export class ChannelCollection {
462
474
  get disposed() {
463
475
  return this.disposeOnce.evaluated;
464
476
  }
477
+ dispose = () => this.disposeOnce.value;
465
478
  reSubmit(type, content, localOpMetadata) {
466
479
  switch (type) {
467
480
  case ContainerMessageType.Attach:
@@ -566,7 +579,7 @@ export class ChannelCollection {
566
579
  this.pendingAttach.set(message.id, message);
567
580
  }
568
581
  }
569
- process(message, local, localMessageMetadata, addedOutboundReference) {
582
+ process(message, local, localMessageMetadata) {
570
583
  switch (message.type) {
571
584
  case ContainerMessageType.Attach:
572
585
  this.processAttachMessage(message, local);
@@ -583,13 +596,8 @@ export class ChannelCollection {
583
596
  contents: innerContents.content,
584
597
  };
585
598
  this.processChannelOp(envelope.address, transformed, local, localMessageMetadata);
586
- // By default, we use the new behavior of detecting outbound routes here.
587
- // If this setting is true, then DataStoreContext would be notifying GC instead.
588
- if (this.mc.config.getBoolean(detectOutboundRoutesViaDDSKey) !== true &&
589
- addedOutboundReference !== undefined) {
590
- // Notify GC of any outbound references that were added by this op.
591
- detectOutboundReferences(envelope.address, transformed.contents, addedOutboundReference);
592
- }
599
+ // Notify GC of any outbound references that were added by this op.
600
+ detectOutboundReferences(envelope.address, transformed.contents, (fromPath, toPath) => this.parentContext.addedGCOutboundRoute(fromPath, toPath));
593
601
  break;
594
602
  }
595
603
  default:
@@ -674,9 +682,9 @@ export class ChannelCollection {
674
682
  ? urlToGCNodePath(originalRequest.url)
675
683
  : dataStoreNodePath;
676
684
  // Log the package details asynchronously since getInitialSnapshotDetails is async
677
- const recentelyDeletedContext = this.contexts.getRecentlyDeletedContext(id);
678
- if (recentelyDeletedContext !== undefined) {
679
- recentelyDeletedContext
685
+ const recentlyDeletedContext = this.contexts.getRecentlyDeletedContext(id);
686
+ if (recentlyDeletedContext !== undefined) {
687
+ recentlyDeletedContext
680
688
  .getInitialSnapshotDetails()
681
689
  .then((details) => {
682
690
  return details.pkg.join("/");
@@ -806,8 +814,7 @@ export class ChannelCollection {
806
814
  .map(([key, value]) => {
807
815
  let dataStoreSummary;
808
816
  if (value.isLoaded) {
809
- dataStoreSummary = value.getAttachData(
810
- /* includeGCCData: */ false, telemetryContext).attachSummary;
817
+ dataStoreSummary = value.getAttachSummary(telemetryContext);
811
818
  }
812
819
  else {
813
820
  // If this data store is not yet loaded, then there should be no changes in the snapshot from
@@ -821,21 +828,30 @@ export class ChannelCollection {
821
828
  return builder.getSummaryTree();
822
829
  }
823
830
  /**
824
- * Before GC runs, called by the garbage collector to update any pending GC state.
825
- * The garbage collector needs to know all outbound references that are added. Since root data stores are not
826
- * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.
831
+ * Gets the GC data. Used when attaching or serializing a detached container.
827
832
  */
828
- async updateStateBeforeGC() {
829
- for (const id of this.dataStoresSinceLastGC) {
830
- const context = this.contexts.get(id);
831
- assert(context !== undefined, 0x2b6 /* Missing data store context */);
832
- if (await context.isRoot()) {
833
- // A root data store is basically a reference from the container runtime to the data store.
834
- const handle = new FluidObjectHandle(context, id, this.parentContext.IFluidHandleContext);
835
- this.parentContext.addedGCOutboundReference?.(this.containerRuntimeHandle, handle);
836
- }
837
- }
838
- this.dataStoresSinceLastGC = [];
833
+ getAttachGCData(telemetryContext) {
834
+ const builder = new GCDataBuilder();
835
+ // Attaching graph of some stores can cause other stores to get bound too.
836
+ // So keep taking summary until no new stores get bound.
837
+ let notBoundContextsLength;
838
+ do {
839
+ notBoundContextsLength = this.contexts.notBoundLength();
840
+ // Iterate over each data store and ask for its GC data.
841
+ Array.from(this.contexts)
842
+ .filter(([key, _]) =>
843
+ // Take GC data of bounded data stores only.
844
+ !this.contexts.isNotBound(key))
845
+ .map(([key, value]) => {
846
+ const contextGCData = value.getAttachGCData(telemetryContext);
847
+ // Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
848
+ // This also gradually builds the id of each node to be a path from the root.
849
+ builder.prefixAndAddNodes(key, contextGCData.gcNodes);
850
+ });
851
+ } while (notBoundContextsLength !== this.contexts.notBoundLength());
852
+ // Get the outbound routes (aliased data stores) and add a GC node for this channel.
853
+ builder.addNode("/", Array.from(this.aliasedDataStores));
854
+ return builder.getGCData();
839
855
  }
840
856
  /**
841
857
  * Generates data used for garbage collection. It does the following:
@@ -1113,12 +1129,15 @@ export function detectOutboundReferences(address, contents, addedOutboundReferen
1113
1129
  }
1114
1130
  /** @internal */
1115
1131
  export class ChannelCollectionFactory {
1132
+ provideEntryPoint;
1133
+ ctor;
1134
+ type = "ChannelCollectionChannel";
1135
+ IFluidDataStoreRegistry;
1116
1136
  constructor(registryEntries,
1117
1137
  // ADO:7302 We need a better type here
1118
1138
  provideEntryPoint, ctor) {
1119
1139
  this.provideEntryPoint = provideEntryPoint;
1120
1140
  this.ctor = ctor;
1121
- this.type = "ChannelCollectionChannel";
1122
1141
  this.IFluidDataStoreRegistry = new FluidDataStoreRegistry(registryEntries);
1123
1142
  }
1124
1143
  get IFluidDataStoreFactory() {