@fluidframework/container-runtime 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1

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