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

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