@fluidframework/container-runtime 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/.eslintrc.js +19 -19
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +2 -2
  4. package/dist/batchTracker.d.ts.map +1 -1
  5. package/dist/batchTracker.js +2 -1
  6. package/dist/batchTracker.js.map +1 -1
  7. package/dist/blobManager.d.ts +9 -2
  8. package/dist/blobManager.d.ts.map +1 -1
  9. package/dist/blobManager.js +80 -33
  10. package/dist/blobManager.js.map +1 -1
  11. package/dist/connectionTelemetry.d.ts.map +1 -1
  12. package/dist/connectionTelemetry.js +11 -9
  13. package/dist/connectionTelemetry.js.map +1 -1
  14. package/dist/containerHandleContext.d.ts.map +1 -1
  15. package/dist/containerHandleContext.js +3 -1
  16. package/dist/containerHandleContext.js.map +1 -1
  17. package/dist/containerRuntime.d.ts +10 -0
  18. package/dist/containerRuntime.d.ts.map +1 -1
  19. package/dist/containerRuntime.js +140 -72
  20. package/dist/containerRuntime.js.map +1 -1
  21. package/dist/dataStore.d.ts.map +1 -1
  22. package/dist/dataStore.js +11 -9
  23. package/dist/dataStore.js.map +1 -1
  24. package/dist/dataStoreContext.d.ts +18 -1
  25. package/dist/dataStoreContext.d.ts.map +1 -1
  26. package/dist/dataStoreContext.js +66 -15
  27. package/dist/dataStoreContext.js.map +1 -1
  28. package/dist/dataStoreContexts.d.ts.map +1 -1
  29. package/dist/dataStoreContexts.js +7 -3
  30. package/dist/dataStoreContexts.js.map +1 -1
  31. package/dist/dataStoreRegistry.d.ts.map +1 -1
  32. package/dist/dataStoreRegistry.js +3 -1
  33. package/dist/dataStoreRegistry.js.map +1 -1
  34. package/dist/dataStores.d.ts +26 -1
  35. package/dist/dataStores.d.ts.map +1 -1
  36. package/dist/dataStores.js +103 -18
  37. package/dist/dataStores.js.map +1 -1
  38. package/dist/deltaScheduler.d.ts.map +1 -1
  39. package/dist/deltaScheduler.js +8 -3
  40. package/dist/deltaScheduler.js.map +1 -1
  41. package/dist/garbageCollection.d.ts +34 -14
  42. package/dist/garbageCollection.d.ts.map +1 -1
  43. package/dist/garbageCollection.js +188 -93
  44. package/dist/garbageCollection.js.map +1 -1
  45. package/dist/garbageCollectionConstants.d.ts +3 -0
  46. package/dist/garbageCollectionConstants.d.ts.map +1 -1
  47. package/dist/garbageCollectionConstants.js +6 -1
  48. package/dist/garbageCollectionConstants.js.map +1 -1
  49. package/dist/garbageCollectionHelpers.d.ts +26 -0
  50. package/dist/garbageCollectionHelpers.d.ts.map +1 -0
  51. package/dist/garbageCollectionHelpers.js +45 -0
  52. package/dist/garbageCollectionHelpers.js.map +1 -0
  53. package/dist/gcSweepReadyUsageDetection.d.ts +5 -5
  54. package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
  55. package/dist/gcSweepReadyUsageDetection.js +14 -10
  56. package/dist/gcSweepReadyUsageDetection.js.map +1 -1
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/opLifecycle/batchManager.d.ts +5 -5
  61. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  62. package/dist/opLifecycle/batchManager.js +19 -12
  63. package/dist/opLifecycle/batchManager.js.map +1 -1
  64. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  65. package/dist/opLifecycle/definitions.js.map +1 -1
  66. package/dist/opLifecycle/index.d.ts.map +1 -1
  67. package/dist/opLifecycle/index.js.map +1 -1
  68. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  69. package/dist/opLifecycle/opCompressor.js.map +1 -1
  70. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  71. package/dist/opLifecycle/opDecompressor.js +5 -2
  72. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  73. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  74. package/dist/opLifecycle/opSplitter.js +4 -1
  75. package/dist/opLifecycle/opSplitter.js.map +1 -1
  76. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  77. package/dist/opLifecycle/outbox.js +19 -17
  78. package/dist/opLifecycle/outbox.js.map +1 -1
  79. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  80. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  81. package/dist/opProperties.d.ts.map +1 -1
  82. package/dist/opProperties.js +1 -3
  83. package/dist/opProperties.js.map +1 -1
  84. package/dist/orderedClientElection.d.ts.map +1 -1
  85. package/dist/orderedClientElection.js +10 -4
  86. package/dist/orderedClientElection.js.map +1 -1
  87. package/dist/packageVersion.d.ts +1 -1
  88. package/dist/packageVersion.js +1 -1
  89. package/dist/packageVersion.js.map +1 -1
  90. package/dist/pendingStateManager.d.ts +7 -0
  91. package/dist/pendingStateManager.d.ts.map +1 -1
  92. package/dist/pendingStateManager.js +7 -4
  93. package/dist/pendingStateManager.js.map +1 -1
  94. package/dist/runWhileConnectedCoordinator.d.ts.map +1 -1
  95. package/dist/runWhileConnectedCoordinator.js.map +1 -1
  96. package/dist/runningSummarizer.d.ts.map +1 -1
  97. package/dist/runningSummarizer.js +34 -21
  98. package/dist/runningSummarizer.js.map +1 -1
  99. package/dist/scheduleManager.d.ts.map +1 -1
  100. package/dist/scheduleManager.js +3 -2
  101. package/dist/scheduleManager.js.map +1 -1
  102. package/dist/serializedSnapshotStorage.d.ts +2 -2
  103. package/dist/serializedSnapshotStorage.d.ts.map +1 -1
  104. package/dist/serializedSnapshotStorage.js +5 -3
  105. package/dist/serializedSnapshotStorage.js.map +1 -1
  106. package/dist/summarizer.d.ts +2 -2
  107. package/dist/summarizer.d.ts.map +1 -1
  108. package/dist/summarizer.js +37 -17
  109. package/dist/summarizer.js.map +1 -1
  110. package/dist/summarizerClientElection.d.ts.map +1 -1
  111. package/dist/summarizerClientElection.js.map +1 -1
  112. package/dist/summarizerHandle.d.ts.map +1 -1
  113. package/dist/summarizerHandle.js.map +1 -1
  114. package/dist/summarizerHeuristics.d.ts.map +1 -1
  115. package/dist/summarizerHeuristics.js +6 -9
  116. package/dist/summarizerHeuristics.js.map +1 -1
  117. package/dist/summarizerTypes.d.ts +21 -21
  118. package/dist/summarizerTypes.d.ts.map +1 -1
  119. package/dist/summarizerTypes.js.map +1 -1
  120. package/dist/summaryCollection.d.ts.map +1 -1
  121. package/dist/summaryCollection.js +18 -8
  122. package/dist/summaryCollection.js.map +1 -1
  123. package/dist/summaryFormat.d.ts +22 -0
  124. package/dist/summaryFormat.d.ts.map +1 -1
  125. package/dist/summaryFormat.js +18 -10
  126. package/dist/summaryFormat.js.map +1 -1
  127. package/dist/summaryGenerator.d.ts.map +1 -1
  128. package/dist/summaryGenerator.js +34 -15
  129. package/dist/summaryGenerator.js.map +1 -1
  130. package/dist/summaryManager.d.ts.map +1 -1
  131. package/dist/summaryManager.js +21 -9
  132. package/dist/summaryManager.js.map +1 -1
  133. package/dist/throttler.d.ts +2 -2
  134. package/dist/throttler.d.ts.map +1 -1
  135. package/dist/throttler.js +4 -4
  136. package/dist/throttler.js.map +1 -1
  137. package/garbageCollection.md +15 -2
  138. package/lib/batchTracker.d.ts.map +1 -1
  139. package/lib/batchTracker.js +2 -1
  140. package/lib/batchTracker.js.map +1 -1
  141. package/lib/blobManager.d.ts +9 -2
  142. package/lib/blobManager.d.ts.map +1 -1
  143. package/lib/blobManager.js +82 -35
  144. package/lib/blobManager.js.map +1 -1
  145. package/lib/connectionTelemetry.d.ts.map +1 -1
  146. package/lib/connectionTelemetry.js +11 -9
  147. package/lib/connectionTelemetry.js.map +1 -1
  148. package/lib/containerHandleContext.d.ts.map +1 -1
  149. package/lib/containerHandleContext.js +3 -1
  150. package/lib/containerHandleContext.js.map +1 -1
  151. package/lib/containerRuntime.d.ts +10 -0
  152. package/lib/containerRuntime.d.ts.map +1 -1
  153. package/lib/containerRuntime.js +146 -78
  154. package/lib/containerRuntime.js.map +1 -1
  155. package/lib/dataStore.d.ts.map +1 -1
  156. package/lib/dataStore.js +11 -9
  157. package/lib/dataStore.js.map +1 -1
  158. package/lib/dataStoreContext.d.ts +18 -1
  159. package/lib/dataStoreContext.d.ts.map +1 -1
  160. package/lib/dataStoreContext.js +68 -17
  161. package/lib/dataStoreContext.js.map +1 -1
  162. package/lib/dataStoreContexts.d.ts.map +1 -1
  163. package/lib/dataStoreContexts.js +7 -3
  164. package/lib/dataStoreContexts.js.map +1 -1
  165. package/lib/dataStoreRegistry.d.ts.map +1 -1
  166. package/lib/dataStoreRegistry.js +3 -1
  167. package/lib/dataStoreRegistry.js.map +1 -1
  168. package/lib/dataStores.d.ts +26 -1
  169. package/lib/dataStores.d.ts.map +1 -1
  170. package/lib/dataStores.js +109 -24
  171. package/lib/dataStores.js.map +1 -1
  172. package/lib/deltaScheduler.d.ts.map +1 -1
  173. package/lib/deltaScheduler.js +9 -4
  174. package/lib/deltaScheduler.js.map +1 -1
  175. package/lib/garbageCollection.d.ts +34 -14
  176. package/lib/garbageCollection.d.ts.map +1 -1
  177. package/lib/garbageCollection.js +190 -95
  178. package/lib/garbageCollection.js.map +1 -1
  179. package/lib/garbageCollectionConstants.d.ts +3 -0
  180. package/lib/garbageCollectionConstants.d.ts.map +1 -1
  181. package/lib/garbageCollectionConstants.js +5 -0
  182. package/lib/garbageCollectionConstants.js.map +1 -1
  183. package/lib/garbageCollectionHelpers.d.ts +26 -0
  184. package/lib/garbageCollectionHelpers.d.ts.map +1 -0
  185. package/lib/garbageCollectionHelpers.js +40 -0
  186. package/lib/garbageCollectionHelpers.js.map +1 -0
  187. package/lib/gcSweepReadyUsageDetection.d.ts +5 -5
  188. package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
  189. package/lib/gcSweepReadyUsageDetection.js +14 -10
  190. package/lib/gcSweepReadyUsageDetection.js.map +1 -1
  191. package/lib/index.d.ts +2 -2
  192. package/lib/index.d.ts.map +1 -1
  193. package/lib/index.js +1 -1
  194. package/lib/index.js.map +1 -1
  195. package/lib/opLifecycle/batchManager.d.ts +5 -5
  196. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  197. package/lib/opLifecycle/batchManager.js +19 -12
  198. package/lib/opLifecycle/batchManager.js.map +1 -1
  199. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  200. package/lib/opLifecycle/definitions.js.map +1 -1
  201. package/lib/opLifecycle/index.d.ts.map +1 -1
  202. package/lib/opLifecycle/index.js.map +1 -1
  203. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  204. package/lib/opLifecycle/opCompressor.js.map +1 -1
  205. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  206. package/lib/opLifecycle/opDecompressor.js +5 -2
  207. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  208. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  209. package/lib/opLifecycle/opSplitter.js +5 -2
  210. package/lib/opLifecycle/opSplitter.js.map +1 -1
  211. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  212. package/lib/opLifecycle/outbox.js +19 -17
  213. package/lib/opLifecycle/outbox.js.map +1 -1
  214. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  215. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  216. package/lib/opProperties.d.ts.map +1 -1
  217. package/lib/opProperties.js +1 -3
  218. package/lib/opProperties.js.map +1 -1
  219. package/lib/orderedClientElection.d.ts.map +1 -1
  220. package/lib/orderedClientElection.js +10 -4
  221. package/lib/orderedClientElection.js.map +1 -1
  222. package/lib/packageVersion.d.ts +1 -1
  223. package/lib/packageVersion.js +1 -1
  224. package/lib/packageVersion.js.map +1 -1
  225. package/lib/pendingStateManager.d.ts +7 -0
  226. package/lib/pendingStateManager.d.ts.map +1 -1
  227. package/lib/pendingStateManager.js +7 -4
  228. package/lib/pendingStateManager.js.map +1 -1
  229. package/lib/runWhileConnectedCoordinator.d.ts.map +1 -1
  230. package/lib/runWhileConnectedCoordinator.js.map +1 -1
  231. package/lib/runningSummarizer.d.ts.map +1 -1
  232. package/lib/runningSummarizer.js +35 -22
  233. package/lib/runningSummarizer.js.map +1 -1
  234. package/lib/scheduleManager.d.ts.map +1 -1
  235. package/lib/scheduleManager.js +3 -2
  236. package/lib/scheduleManager.js.map +1 -1
  237. package/lib/serializedSnapshotStorage.d.ts +2 -2
  238. package/lib/serializedSnapshotStorage.d.ts.map +1 -1
  239. package/lib/serializedSnapshotStorage.js +5 -3
  240. package/lib/serializedSnapshotStorage.js.map +1 -1
  241. package/lib/summarizer.d.ts +2 -2
  242. package/lib/summarizer.d.ts.map +1 -1
  243. package/lib/summarizer.js +37 -17
  244. package/lib/summarizer.js.map +1 -1
  245. package/lib/summarizerClientElection.d.ts.map +1 -1
  246. package/lib/summarizerClientElection.js.map +1 -1
  247. package/lib/summarizerHandle.d.ts.map +1 -1
  248. package/lib/summarizerHandle.js.map +1 -1
  249. package/lib/summarizerHeuristics.d.ts.map +1 -1
  250. package/lib/summarizerHeuristics.js +6 -9
  251. package/lib/summarizerHeuristics.js.map +1 -1
  252. package/lib/summarizerTypes.d.ts +21 -21
  253. package/lib/summarizerTypes.d.ts.map +1 -1
  254. package/lib/summarizerTypes.js.map +1 -1
  255. package/lib/summaryCollection.d.ts.map +1 -1
  256. package/lib/summaryCollection.js +18 -8
  257. package/lib/summaryCollection.js.map +1 -1
  258. package/lib/summaryFormat.d.ts +22 -0
  259. package/lib/summaryFormat.d.ts.map +1 -1
  260. package/lib/summaryFormat.js +20 -12
  261. package/lib/summaryFormat.js.map +1 -1
  262. package/lib/summaryGenerator.d.ts.map +1 -1
  263. package/lib/summaryGenerator.js +34 -15
  264. package/lib/summaryGenerator.js.map +1 -1
  265. package/lib/summaryManager.d.ts.map +1 -1
  266. package/lib/summaryManager.js +21 -9
  267. package/lib/summaryManager.js.map +1 -1
  268. package/lib/throttler.d.ts +2 -2
  269. package/lib/throttler.d.ts.map +1 -1
  270. package/lib/throttler.js +4 -4
  271. package/lib/throttler.js.map +1 -1
  272. package/package.json +121 -149
  273. package/prettier.config.cjs +1 -1
  274. package/src/batchTracker.ts +54 -49
  275. package/src/blobManager.ts +793 -672
  276. package/src/connectionTelemetry.ts +280 -249
  277. package/src/containerHandleContext.ts +27 -29
  278. package/src/containerRuntime.ts +3168 -2940
  279. package/src/dataStore.ts +172 -159
  280. package/src/dataStoreContext.ts +1098 -996
  281. package/src/dataStoreContexts.ts +178 -161
  282. package/src/dataStoreRegistry.ts +25 -20
  283. package/src/dataStores.ts +884 -728
  284. package/src/deltaScheduler.ts +158 -150
  285. package/src/garbageCollection.ts +1883 -1692
  286. package/src/garbageCollectionConstants.ts +6 -0
  287. package/src/garbageCollectionHelpers.ts +61 -0
  288. package/src/gcSweepReadyUsageDetection.ts +89 -83
  289. package/src/index.ts +67 -66
  290. package/src/opLifecycle/README.md +152 -0
  291. package/src/opLifecycle/batchManager.ts +145 -141
  292. package/src/opLifecycle/definitions.ts +29 -29
  293. package/src/opLifecycle/index.ts +5 -5
  294. package/src/opLifecycle/opCompressor.ts +54 -53
  295. package/src/opLifecycle/opDecompressor.ts +100 -81
  296. package/src/opLifecycle/opSplitter.ts +214 -188
  297. package/src/opLifecycle/outbox.ts +204 -194
  298. package/src/opLifecycle/remoteMessageProcessor.ts +62 -62
  299. package/src/opProperties.ts +11 -9
  300. package/src/orderedClientElection.ts +489 -457
  301. package/src/packageVersion.ts +1 -1
  302. package/src/pendingStateManager.ts +384 -338
  303. package/src/runWhileConnectedCoordinator.ts +78 -71
  304. package/src/runningSummarizer.ts +619 -581
  305. package/src/scheduleManager.ts +299 -269
  306. package/src/serializedSnapshotStorage.ts +126 -112
  307. package/src/summarizer.ts +417 -381
  308. package/src/summarizerClientElection.ts +107 -100
  309. package/src/summarizerHandle.ts +11 -9
  310. package/src/summarizerHeuristics.ts +183 -186
  311. package/src/summarizerTypes.ts +344 -330
  312. package/src/summaryCollection.ts +378 -349
  313. package/src/summaryFormat.ts +170 -126
  314. package/src/summaryGenerator.ts +465 -406
  315. package/src/summaryManager.ts +377 -348
  316. package/src/throttler.ts +131 -122
  317. package/tsconfig.esnext.json +6 -6
  318. package/tsconfig.json +9 -13
  319. package/dist/garbageCollectionTombstoneUtils.d.ts +0 -14
  320. package/dist/garbageCollectionTombstoneUtils.d.ts.map +0 -1
  321. package/dist/garbageCollectionTombstoneUtils.js +0 -23
  322. package/dist/garbageCollectionTombstoneUtils.js.map +0 -1
  323. package/lib/garbageCollectionTombstoneUtils.d.ts +0 -14
  324. package/lib/garbageCollectionTombstoneUtils.d.ts.map +0 -1
  325. package/lib/garbageCollectionTombstoneUtils.js +0 -19
  326. package/lib/garbageCollectionTombstoneUtils.js.map +0 -1
  327. package/src/garbageCollectionTombstoneUtils.ts +0 -28
@@ -6,36 +6,44 @@
6
6
  import { assert } from "@fluidframework/common-utils";
7
7
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
8
8
  import { readAndParse } from "@fluidframework/driver-utils";
9
- import { ISequencedDocumentMessage, ISnapshotTree, SummaryType } from "@fluidframework/protocol-definitions";
10
- import { channelsTreeName, gcTreeKey, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
9
+ import {
10
+ ISequencedDocumentMessage,
11
+ ISnapshotTree,
12
+ SummaryType,
13
+ } from "@fluidframework/protocol-definitions";
14
+ import {
15
+ channelsTreeName,
16
+ gcTreeKey,
17
+ ISummaryTreeWithStats,
18
+ } from "@fluidframework/runtime-definitions";
11
19
 
12
20
  type OmitAttributesVersions<T> = Omit<T, "snapshotFormatVersion" | "summaryFormatVersion">;
13
21
  interface IFluidDataStoreAttributes0 {
14
- readonly snapshotFormatVersion?: undefined;
15
- readonly summaryFormatVersion?: undefined;
16
- pkg: string;
17
- /**
18
- * This tells whether a data store is root. Root data stores are never collected.
19
- * Non-root data stores may be collected if they are not used. If this is not present, default it to
20
- * true. This will ensure that older data stores are incorrectly collected.
21
- */
22
- readonly isRootDataStore?: boolean;
22
+ readonly snapshotFormatVersion?: undefined;
23
+ readonly summaryFormatVersion?: undefined;
24
+ pkg: string;
25
+ /**
26
+ * This tells whether a data store is root. Root data stores are never collected.
27
+ * Non-root data stores may be collected if they are not used. If this is not present, default it to
28
+ * true. This will ensure that older data stores are incorrectly collected.
29
+ */
30
+ readonly isRootDataStore?: boolean;
23
31
  }
24
32
  interface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {
25
- readonly snapshotFormatVersion: "0.1";
26
- readonly summaryFormatVersion?: undefined;
33
+ readonly snapshotFormatVersion: "0.1";
34
+ readonly summaryFormatVersion?: undefined;
27
35
  }
28
36
  interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {
29
- /** Switch from snapshotFormatVersion to summaryFormatVersion */
30
- readonly snapshotFormatVersion?: undefined;
31
- readonly summaryFormatVersion: 2;
32
- /**
33
- * True if channels are not isolated in .channels subtrees, otherwise isolated.
34
- * This is required in both datastore attributes as well as the root container,
35
- * because reused summary handles may cause different format versions in each
36
- * datastore subtree within the summary.
37
- */
38
- readonly disableIsolatedChannels?: true;
37
+ /** Switch from snapshotFormatVersion to summaryFormatVersion */
38
+ readonly snapshotFormatVersion?: undefined;
39
+ readonly summaryFormatVersion: 2;
40
+ /**
41
+ * True if channels are not isolated in .channels subtrees, otherwise isolated.
42
+ * This is required in both datastore attributes as well as the root container,
43
+ * because reused summary handles may cause different format versions in each
44
+ * datastore subtree within the summary.
45
+ */
46
+ readonly disableIsolatedChannels?: true;
39
47
  }
40
48
  /**
41
49
  * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a
@@ -43,111 +51,140 @@ interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataSt
43
51
  * snapshotFormatVersion.
44
52
  */
45
53
  export type ReadFluidDataStoreAttributes =
46
- | IFluidDataStoreAttributes0
47
- | IFluidDataStoreAttributes1
48
- | IFluidDataStoreAttributes2;
54
+ | IFluidDataStoreAttributes0
55
+ | IFluidDataStoreAttributes1
56
+ | IFluidDataStoreAttributes2;
49
57
  export type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;
50
58
 
51
59
  export function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {
52
- if (attributes.summaryFormatVersion) {
53
- /**
54
- * Version 2+: Introduces .channels trees for isolation of
55
- * channel trees from data store objects.
56
- */
57
- return attributes.summaryFormatVersion;
58
- } else if (attributes.snapshotFormatVersion === "0.1") {
59
- /**
60
- * Version 1: from this version the pkg within the data store
61
- * attributes blob is a JSON array rather than a string.
62
- */
63
- return 1;
64
- }
65
- /**
66
- * Version 0: format version is missing from summary.
67
- * This indicates it is an older version.
68
- */
69
- return 0;
60
+ if (attributes.summaryFormatVersion) {
61
+ /**
62
+ * Version 2+: Introduces .channels trees for isolation of
63
+ * channel trees from data store objects.
64
+ */
65
+ return attributes.summaryFormatVersion;
66
+ } else if (attributes.snapshotFormatVersion === "0.1") {
67
+ /**
68
+ * Version 1: from this version the pkg within the data store
69
+ * attributes blob is a JSON array rather than a string.
70
+ */
71
+ return 1;
72
+ }
73
+ /**
74
+ * Version 0: format version is missing from summary.
75
+ * This indicates it is an older version.
76
+ */
77
+ return 0;
70
78
  }
71
79
 
72
80
  export function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {
73
- return !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;
81
+ return !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;
74
82
  }
75
83
  export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
76
- readonly summaryFormatVersion: 1;
77
- /** The last message processed at the time of summary. Only primitive property types are added to the summary. */
78
- readonly message: ISummaryMetadataMessage | undefined;
79
- /** True if channels are not isolated in .channels subtrees, otherwise isolated. */
80
- readonly disableIsolatedChannels?: true;
81
- /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
82
- readonly summaryNumber?: number;
84
+ readonly summaryFormatVersion: 1;
85
+ /** The last message processed at the time of summary. Only primitive property types are added to the summary. */
86
+ readonly message: ISummaryMetadataMessage | undefined;
87
+ /** True if channels are not isolated in .channels subtrees, otherwise isolated. */
88
+ readonly disableIsolatedChannels?: true;
89
+ /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
90
+ readonly summaryNumber?: number;
83
91
  }
84
92
 
85
93
  export interface ICreateContainerMetadata {
86
- /** Runtime version of the container when it was first created */
87
- createContainerRuntimeVersion?: string;
88
- /** Timestamp of the container when it was first created */
89
- createContainerTimestamp?: number;
94
+ /** Runtime version of the container when it was first created */
95
+ createContainerRuntimeVersion?: string;
96
+ /** Timestamp of the container when it was first created */
97
+ createContainerTimestamp?: number;
98
+ }
99
+
100
+ /** @see IGCMetadata.gcFeatureMatrix */
101
+ export interface GCFeatureMatrix {
102
+ /**
103
+ * The Tombstone Generation value in effect when this file was created.
104
+ * Gives a way for an app to disqualify old files from GC Tombstone enforcement
105
+ * Provided via Container Runtime Options
106
+ */
107
+ tombstoneGeneration?: number;
90
108
  }
91
109
 
92
110
  export type GCVersion = number;
93
111
  export interface IGCMetadata {
94
- /**
95
- * The version of the GC code that was run to generate the GC data that is written in the summary.
96
- * Also, used to determine whether GC is enabled for this container or not:
97
- * - A value of 0 or undefined means GC is disabled.
98
- * - A value greater than 0 means GC is enabled.
99
- */
100
- readonly gcFeature?: GCVersion;
101
- /**
102
- * Tells whether the GC sweep phase is enabled for this container.
103
- * - True means sweep phase is enabled.
104
- * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
105
- */
106
- readonly sweepEnabled?: boolean;
107
- /** If this is present, the session for this container will expire after this time and the container will close */
108
- readonly sessionExpiryTimeoutMs?: number;
109
- /** How long to wait after an object is unreferenced before deleting it via GC Sweep */
110
- readonly sweepTimeoutMs?: number;
112
+ /**
113
+ * The version of the GC code that was run to generate the GC data that is written in the summary.
114
+ * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.
115
+ * Also, used to determine whether GC is enabled for this container or not:
116
+ * - A value of 0 or undefined means GC is disabled.
117
+ * - A value greater than 0 means GC is enabled.
118
+ */
119
+ readonly gcFeature?: GCVersion;
120
+
121
+ /**
122
+ * A collection of different numerical "Generations" for different features,
123
+ * used to determine feature availability over time.
124
+ * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),
125
+ * and pertains to aspects of the document that may be fixed for its lifetime.
126
+ *
127
+ * For each dimension, if the persisted value doesn't match the currently provided value,
128
+ * then this file does not support the corresponding feature as currently implemented.
129
+ *
130
+ * Guidance is that if no value is provided at runtime, it should result in the current default behavior.
131
+ */
132
+ readonly gcFeatureMatrix?: GCFeatureMatrix;
133
+ /**
134
+ * Tells whether the GC sweep phase is enabled for this container.
135
+ * - True means sweep phase is enabled.
136
+ * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
137
+ */
138
+ readonly sweepEnabled?: boolean;
139
+ /** If this is present, the session for this container will expire after this time and the container will close */
140
+ readonly sessionExpiryTimeoutMs?: number;
141
+ /** How long to wait after an object is unreferenced before deleting it via GC Sweep */
142
+ readonly sweepTimeoutMs?: number;
111
143
  }
112
144
 
113
145
  /** The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary. */
114
- export type ISummaryMetadataMessage = Pick<ISequencedDocumentMessage,
115
- | "clientId"
116
- | "clientSequenceNumber"
117
- | "minimumSequenceNumber"
118
- | "referenceSequenceNumber"
119
- | "sequenceNumber"
120
- | "timestamp"
121
- | "type">;
146
+ export type ISummaryMetadataMessage = Pick<
147
+ ISequencedDocumentMessage,
148
+ | "clientId"
149
+ | "clientSequenceNumber"
150
+ | "minimumSequenceNumber"
151
+ | "referenceSequenceNumber"
152
+ | "sequenceNumber"
153
+ | "timestamp"
154
+ | "type"
155
+ >;
122
156
 
123
157
  /**
124
158
  * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is
125
159
  * added to the metadata blob in summary.
126
160
  */
127
161
  export const extractSummaryMetadataMessage = (
128
- message?: ISequencedDocumentMessage,
129
- ): ISummaryMetadataMessage | undefined => message === undefined ? undefined : {
130
- clientId: message.clientId,
131
- clientSequenceNumber: message.clientSequenceNumber,
132
- minimumSequenceNumber: message.minimumSequenceNumber,
133
- referenceSequenceNumber: message.referenceSequenceNumber,
134
- sequenceNumber: message.sequenceNumber,
135
- timestamp: message.timestamp,
136
- type: message.type,
137
- };
162
+ message?: ISequencedDocumentMessage,
163
+ ): ISummaryMetadataMessage | undefined =>
164
+ message === undefined
165
+ ? undefined
166
+ : {
167
+ clientId: message.clientId,
168
+ clientSequenceNumber: message.clientSequenceNumber,
169
+ minimumSequenceNumber: message.minimumSequenceNumber,
170
+ referenceSequenceNumber: message.referenceSequenceNumber,
171
+ sequenceNumber: message.sequenceNumber,
172
+ timestamp: message.timestamp,
173
+ type: message.type,
174
+ };
138
175
 
139
176
  export function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {
140
- /**
141
- * Version 2+: Introduces runtime sequence number for data verification.
142
- *
143
- * Version 1+: Introduces .metadata blob and .channels trees for isolation of
144
- * data store trees from container-level objects.
145
- * Also introduces enableGC option stored in the summary.
146
- *
147
- * Version 0: metadata blob missing; format version is missing from summary.
148
- * This indicates it is an older version.
149
- */
150
- return metadata?.summaryFormatVersion ?? 0;
177
+ /**
178
+ * Version 2+: Introduces runtime sequence number for data verification.
179
+ *
180
+ * Version 1+: Introduces .metadata blob and .channels trees for isolation of
181
+ * data store trees from container-level objects.
182
+ * Also introduces enableGC option stored in the summary.
183
+ *
184
+ * Version 0: metadata blob missing; format version is missing from summary.
185
+ * This indicates it is an older version.
186
+ */
187
+ return metadata?.summaryFormatVersion ?? 0;
151
188
  }
152
189
 
153
190
  export const aliasBlobName = ".aliases";
@@ -157,15 +194,15 @@ export const electedSummarizerBlobName = ".electedSummarizer";
157
194
  export const blobsTreeName = ".blobs";
158
195
 
159
196
  export function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {
160
- return !!metadata && !metadata.disableIsolatedChannels;
197
+ return !!metadata && !metadata.disableIsolatedChannels;
161
198
  }
162
199
 
163
200
  export function getGCVersion(metadata?: IGCMetadata): GCVersion {
164
- if (!metadata) {
165
- // Force to 0/disallowed in prior versions
166
- return 0;
167
- }
168
- return metadata.gcFeature ?? 0;
201
+ if (!metadata) {
202
+ // Force to 0/disallowed in prior versions
203
+ return 0;
204
+ }
205
+ return metadata.gcFeature ?? 0;
169
206
  }
170
207
 
171
208
  export const protocolTreeName = ".protocol";
@@ -176,7 +213,13 @@ export const protocolTreeName = ".protocol";
176
213
  * isolated data stores namespace. Without the namespace, this must
177
214
  * be used to prevent name collisions with data store IDs.
178
215
  */
179
- export const nonDataStorePaths = [protocolTreeName, ".logTail", ".serviceProtocol", blobsTreeName, gcTreeKey];
216
+ export const nonDataStorePaths = [
217
+ protocolTreeName,
218
+ ".logTail",
219
+ ".serviceProtocol",
220
+ blobsTreeName,
221
+ gcTreeKey,
222
+ ];
180
223
 
181
224
  export const dataStoreAttributesBlobName = ".component";
182
225
 
@@ -210,25 +253,26 @@ export const dataStoreAttributesBlobName = ".component";
210
253
  * And adds +1 to treeNodeCount in stats.
211
254
  */
212
255
  export function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {
213
- summarizeResult.summary = {
214
- type: SummaryType.Tree,
215
- tree: { [channelsTreeName]: summarizeResult.summary },
216
- };
217
- summarizeResult.stats.treeNodeCount++;
256
+ summarizeResult.summary = {
257
+ type: SummaryType.Tree,
258
+ tree: { [channelsTreeName]: summarizeResult.summary },
259
+ };
260
+ summarizeResult.stats.treeNodeCount++;
218
261
  }
219
262
 
220
263
  export async function getFluidDataStoreAttributes(
221
- storage: IDocumentStorageService,
222
- snapshot: ISnapshotTree,
264
+ storage: IDocumentStorageService,
265
+ snapshot: ISnapshotTree,
223
266
  ): Promise<ReadFluidDataStoreAttributes> {
224
- const attributes = await readAndParse<ReadFluidDataStoreAttributes>(
225
- storage, snapshot.blobs[dataStoreAttributesBlobName]);
226
- // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
227
- // For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
228
- // However the feature of loading a detached container from snapshot, is added when the
229
- // snapshotFormatVersion is at least "0.1" (1), so we don't expect it to be anything else.
230
- const formatVersion = getAttributesFormatVersion(attributes);
231
- assert(formatVersion > 0,
232
- 0x1d5 /* Invalid snapshot format version */);
233
- return attributes;
267
+ const attributes = await readAndParse<ReadFluidDataStoreAttributes>(
268
+ storage,
269
+ snapshot.blobs[dataStoreAttributesBlobName],
270
+ );
271
+ // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
272
+ // For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
273
+ // However the feature of loading a detached container from snapshot, is added when the
274
+ // snapshotFormatVersion is at least "0.1" (1), so we don't expect it to be anything else.
275
+ const formatVersion = getAttributesFormatVersion(attributes);
276
+ assert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);
277
+ return attributes;
234
278
  }