@fluidframework/container-runtime 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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 (554) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/container-runtime.api.md +471 -52
  3. package/dist/batchTracker.d.ts +1 -1
  4. package/dist/batchTracker.d.ts.map +1 -1
  5. package/dist/batchTracker.js +4 -4
  6. package/dist/batchTracker.js.map +1 -1
  7. package/dist/blobManager.d.ts +33 -30
  8. package/dist/blobManager.d.ts.map +1 -1
  9. package/dist/blobManager.js +82 -107
  10. package/dist/blobManager.js.map +1 -1
  11. package/dist/channelCollection.d.ts +27 -22
  12. package/dist/channelCollection.d.ts.map +1 -1
  13. package/dist/channelCollection.js +155 -165
  14. package/dist/channelCollection.js.map +1 -1
  15. package/dist/connectionTelemetry.d.ts +3 -3
  16. package/dist/connectionTelemetry.d.ts.map +1 -1
  17. package/dist/connectionTelemetry.js +17 -17
  18. package/dist/connectionTelemetry.js.map +1 -1
  19. package/dist/containerHandleContext.d.ts.map +1 -1
  20. package/dist/containerHandleContext.js +2 -2
  21. package/dist/containerHandleContext.js.map +1 -1
  22. package/dist/containerRuntime.d.ts +42 -39
  23. package/dist/containerRuntime.d.ts.map +1 -1
  24. package/dist/containerRuntime.js +425 -292
  25. package/dist/containerRuntime.js.map +1 -1
  26. package/dist/dataStore.d.ts +1 -1
  27. package/dist/dataStore.d.ts.map +1 -1
  28. package/dist/dataStore.js +8 -8
  29. package/dist/dataStore.js.map +1 -1
  30. package/dist/dataStoreContext.d.ts +58 -19
  31. package/dist/dataStoreContext.d.ts.map +1 -1
  32. package/dist/dataStoreContext.js +169 -114
  33. package/dist/dataStoreContext.js.map +1 -1
  34. package/dist/dataStoreContexts.d.ts +1 -0
  35. package/dist/dataStoreContexts.d.ts.map +1 -1
  36. package/dist/dataStoreContexts.js +12 -11
  37. package/dist/dataStoreContexts.js.map +1 -1
  38. package/dist/dataStoreRegistry.d.ts +5 -1
  39. package/dist/dataStoreRegistry.d.ts.map +1 -1
  40. package/dist/dataStoreRegistry.js +4 -4
  41. package/dist/dataStoreRegistry.js.map +1 -1
  42. package/dist/deltaManagerSummarizerProxy.d.ts +1 -1
  43. package/dist/deltaManagerSummarizerProxy.d.ts.map +1 -1
  44. package/dist/deltaManagerSummarizerProxy.js.map +1 -1
  45. package/dist/deltaScheduler.d.ts +1 -1
  46. package/dist/deltaScheduler.d.ts.map +1 -1
  47. package/dist/deltaScheduler.js +6 -6
  48. package/dist/deltaScheduler.js.map +1 -1
  49. package/dist/error.d.ts +1 -1
  50. package/dist/error.d.ts.map +1 -1
  51. package/dist/error.js +4 -4
  52. package/dist/error.js.map +1 -1
  53. package/dist/gc/garbageCollection.d.ts +3 -2
  54. package/dist/gc/garbageCollection.d.ts.map +1 -1
  55. package/dist/gc/garbageCollection.js +23 -23
  56. package/dist/gc/garbageCollection.js.map +1 -1
  57. package/dist/gc/gcConfigs.d.ts +2 -2
  58. package/dist/gc/gcConfigs.d.ts.map +1 -1
  59. package/dist/gc/gcConfigs.js +4 -5
  60. package/dist/gc/gcConfigs.js.map +1 -1
  61. package/dist/gc/gcDefinitions.d.ts +4 -5
  62. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  63. package/dist/gc/gcDefinitions.js.map +1 -1
  64. package/dist/gc/gcHelpers.d.ts +5 -1
  65. package/dist/gc/gcHelpers.d.ts.map +1 -1
  66. package/dist/gc/gcHelpers.js +21 -12
  67. package/dist/gc/gcHelpers.js.map +1 -1
  68. package/dist/gc/gcSummaryStateTracker.d.ts +2 -2
  69. package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
  70. package/dist/gc/gcSummaryStateTracker.js +11 -11
  71. package/dist/gc/gcSummaryStateTracker.js.map +1 -1
  72. package/dist/gc/gcTelemetry.d.ts +2 -1
  73. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  74. package/dist/gc/gcTelemetry.js +11 -9
  75. package/dist/gc/gcTelemetry.js.map +1 -1
  76. package/dist/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  77. package/dist/gc/gcUnreferencedStateTracker.js +6 -6
  78. package/dist/gc/gcUnreferencedStateTracker.js.map +1 -1
  79. package/dist/gc/index.d.ts +1 -1
  80. package/dist/gc/index.d.ts.map +1 -1
  81. package/dist/gc/index.js +2 -1
  82. package/dist/gc/index.js.map +1 -1
  83. package/dist/index.d.ts +5 -2
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +12 -2
  86. package/dist/index.js.map +1 -1
  87. package/dist/legacy.d.ts +91 -0
  88. package/dist/messageTypes.d.ts +11 -5
  89. package/dist/messageTypes.d.ts.map +1 -1
  90. package/dist/messageTypes.js +4 -0
  91. package/dist/messageTypes.js.map +1 -1
  92. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  93. package/dist/opLifecycle/batchManager.js.map +1 -1
  94. package/dist/opLifecycle/definitions.d.ts +2 -20
  95. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  96. package/dist/opLifecycle/definitions.js.map +1 -1
  97. package/dist/opLifecycle/index.d.ts +3 -3
  98. package/dist/opLifecycle/index.d.ts.map +1 -1
  99. package/dist/opLifecycle/index.js +3 -1
  100. package/dist/opLifecycle/index.js.map +1 -1
  101. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  102. package/dist/opLifecycle/opCompressor.js +5 -6
  103. package/dist/opLifecycle/opCompressor.js.map +1 -1
  104. package/dist/opLifecycle/opDecompressor.d.ts +15 -4
  105. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  106. package/dist/opLifecycle/opDecompressor.js +62 -63
  107. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  108. package/dist/opLifecycle/opGroupingManager.d.ts +2 -1
  109. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  110. package/dist/opLifecycle/opGroupingManager.js +14 -16
  111. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  112. package/dist/opLifecycle/opSplitter.d.ts +12 -4
  113. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  114. package/dist/opLifecycle/opSplitter.js +63 -53
  115. package/dist/opLifecycle/opSplitter.js.map +1 -1
  116. package/dist/opLifecycle/outbox.d.ts +2 -1
  117. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  118. package/dist/opLifecycle/outbox.js +30 -29
  119. package/dist/opLifecycle/outbox.js.map +1 -1
  120. package/dist/opLifecycle/remoteMessageProcessor.d.ts +8 -0
  121. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  122. package/dist/opLifecycle/remoteMessageProcessor.js +36 -32
  123. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  124. package/dist/packageVersion.d.ts +1 -1
  125. package/dist/packageVersion.js +1 -1
  126. package/dist/packageVersion.js.map +1 -1
  127. package/dist/pendingStateManager.d.ts +1 -1
  128. package/dist/pendingStateManager.d.ts.map +1 -1
  129. package/dist/pendingStateManager.js +18 -18
  130. package/dist/pendingStateManager.js.map +1 -1
  131. package/dist/public.d.ts +12 -0
  132. package/dist/scheduleManager.d.ts +1 -1
  133. package/dist/scheduleManager.d.ts.map +1 -1
  134. package/dist/scheduleManager.js +28 -24
  135. package/dist/scheduleManager.js.map +1 -1
  136. package/dist/storageServiceWithAttachBlobs.d.ts +2 -2
  137. package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -1
  138. package/dist/storageServiceWithAttachBlobs.js +2 -2
  139. package/dist/storageServiceWithAttachBlobs.js.map +1 -1
  140. package/dist/summary/documentSchema.d.ts +209 -0
  141. package/dist/summary/documentSchema.d.ts.map +1 -0
  142. package/dist/summary/documentSchema.js +390 -0
  143. package/dist/summary/documentSchema.js.map +1 -0
  144. package/dist/summary/index.d.ts +2 -1
  145. package/dist/summary/index.d.ts.map +1 -1
  146. package/dist/summary/index.js +4 -1
  147. package/dist/summary/index.js.map +1 -1
  148. package/dist/summary/orderedClientElection.d.ts +2 -2
  149. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  150. package/dist/summary/orderedClientElection.js +12 -7
  151. package/dist/summary/orderedClientElection.js.map +1 -1
  152. package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -1
  153. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  154. package/dist/summary/runWhileConnectedCoordinator.js +3 -3
  155. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  156. package/dist/summary/runningSummarizer.d.ts +3 -3
  157. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  158. package/dist/summary/runningSummarizer.js +16 -16
  159. package/dist/summary/runningSummarizer.js.map +1 -1
  160. package/dist/summary/summarizer.d.ts +3 -2
  161. package/dist/summary/summarizer.d.ts.map +1 -1
  162. package/dist/summary/summarizer.js +13 -13
  163. package/dist/summary/summarizer.js.map +1 -1
  164. package/dist/summary/summarizerClientElection.d.ts +2 -2
  165. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  166. package/dist/summary/summarizerClientElection.js.map +1 -1
  167. package/dist/summary/summarizerHeuristics.d.ts +1 -1
  168. package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
  169. package/dist/summary/summarizerHeuristics.js +2 -2
  170. package/dist/summary/summarizerHeuristics.js.map +1 -1
  171. package/dist/summary/summarizerNode/summarizerNode.d.ts +3 -2
  172. package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  173. package/dist/summary/summarizerNode/summarizerNode.js +28 -28
  174. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  175. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
  176. package/dist/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  177. package/dist/summary/summarizerNode/summarizerNodeUtils.js +3 -3
  178. package/dist/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  179. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
  180. package/dist/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  181. package/dist/summary/summarizerNode/summarizerNodeWithGc.js +14 -14
  182. package/dist/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  183. package/dist/summary/summarizerTypes.d.ts +5 -3
  184. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  185. package/dist/summary/summarizerTypes.js.map +1 -1
  186. package/dist/summary/summaryCollection.d.ts +2 -2
  187. package/dist/summary/summaryCollection.d.ts.map +1 -1
  188. package/dist/summary/summaryCollection.js +7 -7
  189. package/dist/summary/summaryCollection.js.map +1 -1
  190. package/dist/summary/summaryFormat.d.ts +6 -17
  191. package/dist/summary/summaryFormat.d.ts.map +1 -1
  192. package/dist/summary/summaryFormat.js +8 -8
  193. package/dist/summary/summaryFormat.js.map +1 -1
  194. package/dist/summary/summaryGenerator.d.ts +4 -3
  195. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  196. package/dist/summary/summaryGenerator.js +17 -17
  197. package/dist/summary/summaryGenerator.js.map +1 -1
  198. package/dist/summary/summaryManager.d.ts +1 -1
  199. package/dist/summary/summaryManager.d.ts.map +1 -1
  200. package/dist/summary/summaryManager.js +15 -14
  201. package/dist/summary/summaryManager.js.map +1 -1
  202. package/internal.d.ts +11 -0
  203. package/legacy.d.ts +11 -0
  204. package/lib/batchTracker.d.ts +1 -1
  205. package/lib/batchTracker.d.ts.map +1 -1
  206. package/lib/batchTracker.js +2 -2
  207. package/lib/batchTracker.js.map +1 -1
  208. package/lib/blobManager.d.ts +33 -30
  209. package/lib/blobManager.d.ts.map +1 -1
  210. package/lib/blobManager.js +48 -73
  211. package/lib/blobManager.js.map +1 -1
  212. package/lib/channelCollection.d.ts +27 -22
  213. package/lib/channelCollection.d.ts.map +1 -1
  214. package/lib/channelCollection.js +96 -106
  215. package/lib/channelCollection.js.map +1 -1
  216. package/lib/connectionTelemetry.d.ts +3 -3
  217. package/lib/connectionTelemetry.d.ts.map +1 -1
  218. package/lib/connectionTelemetry.js +3 -3
  219. package/lib/connectionTelemetry.js.map +1 -1
  220. package/lib/containerHandleContext.d.ts.map +1 -1
  221. package/lib/containerHandleContext.js +1 -1
  222. package/lib/containerHandleContext.js.map +1 -1
  223. package/lib/containerRuntime.d.ts +42 -39
  224. package/lib/containerRuntime.d.ts.map +1 -1
  225. package/lib/containerRuntime.js +276 -141
  226. package/lib/containerRuntime.js.map +1 -1
  227. package/lib/dataStore.d.ts +1 -1
  228. package/lib/dataStore.d.ts.map +1 -1
  229. package/lib/dataStore.js +3 -3
  230. package/lib/dataStore.js.map +1 -1
  231. package/lib/dataStoreContext.d.ts +58 -19
  232. package/lib/dataStoreContext.d.ts.map +1 -1
  233. package/lib/dataStoreContext.js +107 -52
  234. package/lib/dataStoreContext.js.map +1 -1
  235. package/lib/dataStoreContexts.d.ts +1 -0
  236. package/lib/dataStoreContexts.d.ts.map +1 -1
  237. package/lib/dataStoreContexts.js +3 -2
  238. package/lib/dataStoreContexts.js.map +1 -1
  239. package/lib/dataStoreRegistry.d.ts +5 -1
  240. package/lib/dataStoreRegistry.d.ts.map +1 -1
  241. package/lib/dataStoreRegistry.js +1 -1
  242. package/lib/dataStoreRegistry.js.map +1 -1
  243. package/lib/deltaManagerSummarizerProxy.d.ts +1 -1
  244. package/lib/deltaManagerSummarizerProxy.d.ts.map +1 -1
  245. package/lib/deltaManagerSummarizerProxy.js.map +1 -1
  246. package/lib/deltaScheduler.d.ts +1 -1
  247. package/lib/deltaScheduler.d.ts.map +1 -1
  248. package/lib/deltaScheduler.js +1 -1
  249. package/lib/deltaScheduler.js.map +1 -1
  250. package/lib/error.d.ts +1 -1
  251. package/lib/error.d.ts.map +1 -1
  252. package/lib/error.js +2 -2
  253. package/lib/error.js.map +1 -1
  254. package/lib/gc/garbageCollection.d.ts +3 -2
  255. package/lib/gc/garbageCollection.d.ts.map +1 -1
  256. package/lib/gc/garbageCollection.js +8 -8
  257. package/lib/gc/garbageCollection.js.map +1 -1
  258. package/lib/gc/gcConfigs.d.ts +2 -2
  259. package/lib/gc/gcConfigs.d.ts.map +1 -1
  260. package/lib/gc/gcConfigs.js +4 -5
  261. package/lib/gc/gcConfigs.js.map +1 -1
  262. package/lib/gc/gcDefinitions.d.ts +4 -5
  263. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  264. package/lib/gc/gcDefinitions.js.map +1 -1
  265. package/lib/gc/gcHelpers.d.ts +5 -1
  266. package/lib/gc/gcHelpers.d.ts.map +1 -1
  267. package/lib/gc/gcHelpers.js +10 -2
  268. package/lib/gc/gcHelpers.js.map +1 -1
  269. package/lib/gc/gcSummaryStateTracker.d.ts +2 -2
  270. package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
  271. package/lib/gc/gcSummaryStateTracker.js +2 -2
  272. package/lib/gc/gcSummaryStateTracker.js.map +1 -1
  273. package/lib/gc/gcTelemetry.d.ts +2 -1
  274. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  275. package/lib/gc/gcTelemetry.js +4 -2
  276. package/lib/gc/gcTelemetry.js.map +1 -1
  277. package/lib/gc/gcUnreferencedStateTracker.d.ts.map +1 -1
  278. package/lib/gc/gcUnreferencedStateTracker.js +2 -2
  279. package/lib/gc/gcUnreferencedStateTracker.js.map +1 -1
  280. package/lib/gc/index.d.ts +1 -1
  281. package/lib/gc/index.d.ts.map +1 -1
  282. package/lib/gc/index.js +1 -1
  283. package/lib/gc/index.js.map +1 -1
  284. package/lib/index.d.ts +5 -2
  285. package/lib/index.d.ts.map +1 -1
  286. package/lib/index.js +5 -2
  287. package/lib/index.js.map +1 -1
  288. package/lib/legacy.d.ts +91 -0
  289. package/lib/messageTypes.d.ts +11 -5
  290. package/lib/messageTypes.d.ts.map +1 -1
  291. package/lib/messageTypes.js +4 -0
  292. package/lib/messageTypes.js.map +1 -1
  293. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  294. package/lib/opLifecycle/batchManager.js.map +1 -1
  295. package/lib/opLifecycle/definitions.d.ts +2 -20
  296. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  297. package/lib/opLifecycle/definitions.js.map +1 -1
  298. package/lib/opLifecycle/index.d.ts +3 -3
  299. package/lib/opLifecycle/index.d.ts.map +1 -1
  300. package/lib/opLifecycle/index.js +2 -2
  301. package/lib/opLifecycle/index.js.map +1 -1
  302. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  303. package/lib/opLifecycle/opCompressor.js +2 -3
  304. package/lib/opLifecycle/opCompressor.js.map +1 -1
  305. package/lib/opLifecycle/opDecompressor.d.ts +15 -4
  306. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  307. package/lib/opLifecycle/opDecompressor.js +61 -62
  308. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  309. package/lib/opLifecycle/opGroupingManager.d.ts +2 -1
  310. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  311. package/lib/opLifecycle/opGroupingManager.js +9 -12
  312. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  313. package/lib/opLifecycle/opSplitter.d.ts +12 -4
  314. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  315. package/lib/opLifecycle/opSplitter.js +47 -38
  316. package/lib/opLifecycle/opSplitter.js.map +1 -1
  317. package/lib/opLifecycle/outbox.d.ts +2 -1
  318. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  319. package/lib/opLifecycle/outbox.js +19 -18
  320. package/lib/opLifecycle/outbox.js.map +1 -1
  321. package/lib/opLifecycle/remoteMessageProcessor.d.ts +8 -0
  322. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  323. package/lib/opLifecycle/remoteMessageProcessor.js +36 -32
  324. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  325. package/lib/packageVersion.d.ts +1 -1
  326. package/lib/packageVersion.js +1 -1
  327. package/lib/packageVersion.js.map +1 -1
  328. package/lib/pendingStateManager.d.ts +1 -1
  329. package/lib/pendingStateManager.d.ts.map +1 -1
  330. package/lib/pendingStateManager.js +2 -2
  331. package/lib/pendingStateManager.js.map +1 -1
  332. package/lib/public.d.ts +12 -0
  333. package/lib/scheduleManager.d.ts +1 -1
  334. package/lib/scheduleManager.d.ts.map +1 -1
  335. package/lib/scheduleManager.js +7 -3
  336. package/lib/scheduleManager.js.map +1 -1
  337. package/lib/storageServiceWithAttachBlobs.d.ts +2 -2
  338. package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -1
  339. package/lib/storageServiceWithAttachBlobs.js +1 -1
  340. package/lib/storageServiceWithAttachBlobs.js.map +1 -1
  341. package/lib/summary/documentSchema.d.ts +209 -0
  342. package/lib/summary/documentSchema.d.ts.map +1 -0
  343. package/lib/summary/documentSchema.js +386 -0
  344. package/lib/summary/documentSchema.js.map +1 -0
  345. package/lib/summary/index.d.ts +2 -1
  346. package/lib/summary/index.d.ts.map +1 -1
  347. package/lib/summary/index.js +1 -0
  348. package/lib/summary/index.js.map +1 -1
  349. package/lib/summary/orderedClientElection.d.ts +2 -2
  350. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  351. package/lib/summary/orderedClientElection.js +7 -2
  352. package/lib/summary/orderedClientElection.js.map +1 -1
  353. package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -1
  354. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  355. package/lib/summary/runWhileConnectedCoordinator.js +1 -1
  356. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  357. package/lib/summary/runningSummarizer.d.ts +3 -3
  358. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  359. package/lib/summary/runningSummarizer.js +3 -3
  360. package/lib/summary/runningSummarizer.js.map +1 -1
  361. package/lib/summary/summarizer.d.ts +3 -2
  362. package/lib/summary/summarizer.d.ts.map +1 -1
  363. package/lib/summary/summarizer.js +3 -3
  364. package/lib/summary/summarizer.js.map +1 -1
  365. package/lib/summary/summarizerClientElection.d.ts +2 -2
  366. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  367. package/lib/summary/summarizerClientElection.js.map +1 -1
  368. package/lib/summary/summarizerHeuristics.d.ts +1 -1
  369. package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
  370. package/lib/summary/summarizerHeuristics.js +1 -1
  371. package/lib/summary/summarizerHeuristics.js.map +1 -1
  372. package/lib/summary/summarizerNode/summarizerNode.d.ts +3 -2
  373. package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
  374. package/lib/summary/summarizerNode/summarizerNode.js +5 -5
  375. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  376. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts +2 -1
  377. package/lib/summary/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  378. package/lib/summary/summarizerNode/summarizerNodeUtils.js +1 -1
  379. package/lib/summary/summarizerNode/summarizerNodeUtils.js.map +1 -1
  380. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts +2 -1
  381. package/lib/summary/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  382. package/lib/summary/summarizerNode/summarizerNodeWithGc.js +3 -3
  383. package/lib/summary/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  384. package/lib/summary/summarizerTypes.d.ts +5 -3
  385. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  386. package/lib/summary/summarizerTypes.js.map +1 -1
  387. package/lib/summary/summaryCollection.d.ts +2 -2
  388. package/lib/summary/summaryCollection.d.ts.map +1 -1
  389. package/lib/summary/summaryCollection.js +1 -1
  390. package/lib/summary/summaryCollection.js.map +1 -1
  391. package/lib/summary/summaryFormat.d.ts +6 -17
  392. package/lib/summary/summaryFormat.d.ts.map +1 -1
  393. package/lib/summary/summaryFormat.js +3 -3
  394. package/lib/summary/summaryFormat.js.map +1 -1
  395. package/lib/summary/summaryGenerator.d.ts +4 -3
  396. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  397. package/lib/summary/summaryGenerator.js +4 -4
  398. package/lib/summary/summaryGenerator.js.map +1 -1
  399. package/lib/summary/summaryManager.d.ts +1 -1
  400. package/lib/summary/summaryManager.d.ts.map +1 -1
  401. package/lib/summary/summaryManager.js +9 -8
  402. package/lib/summary/summaryManager.js.map +1 -1
  403. package/package.json +57 -65
  404. package/src/batchTracker.ts +4 -3
  405. package/src/blobManager.ts +100 -77
  406. package/src/channelCollection.ts +180 -165
  407. package/src/connectionTelemetry.ts +12 -12
  408. package/src/containerHandleContext.ts +3 -2
  409. package/src/containerRuntime.ts +481 -277
  410. package/src/dataStore.ts +9 -4
  411. package/src/dataStoreContext.ts +195 -93
  412. package/src/dataStoreContexts.ts +5 -2
  413. package/src/dataStoreRegistry.ts +3 -2
  414. package/src/deltaManagerSummarizerProxy.ts +1 -1
  415. package/src/deltaScheduler.ts +2 -1
  416. package/src/error.ts +2 -2
  417. package/src/gc/garbageCollection.ts +21 -20
  418. package/src/gc/gcConfigs.ts +15 -18
  419. package/src/gc/gcDefinitions.ts +6 -8
  420. package/src/gc/gcHelpers.ts +22 -5
  421. package/src/gc/gcSummaryStateTracker.ts +7 -5
  422. package/src/gc/gcTelemetry.ts +13 -7
  423. package/src/gc/gcUnreferencedStateTracker.ts +3 -2
  424. package/src/gc/index.ts +1 -0
  425. package/src/index.ts +22 -1
  426. package/src/messageTypes.ts +20 -6
  427. package/src/opLifecycle/README.md +89 -0
  428. package/src/opLifecycle/batchManager.ts +1 -0
  429. package/src/opLifecycle/definitions.ts +3 -21
  430. package/src/opLifecycle/index.ts +3 -9
  431. package/src/opLifecycle/opCompressor.ts +6 -5
  432. package/src/opLifecycle/opDecompressor.ts +90 -100
  433. package/src/opLifecycle/opGroupingManager.ts +12 -14
  434. package/src/opLifecycle/opSplitter.ts +76 -48
  435. package/src/opLifecycle/outbox.ts +30 -38
  436. package/src/opLifecycle/remoteMessageProcessor.ts +43 -55
  437. package/src/packageVersion.ts +1 -1
  438. package/src/pendingStateManager.ts +6 -6
  439. package/src/scheduleManager.ts +10 -8
  440. package/src/storageServiceWithAttachBlobs.ts +2 -2
  441. package/src/summary/documentSchema.ts +631 -0
  442. package/src/summary/index.ts +10 -1
  443. package/src/summary/orderedClientElection.ts +7 -7
  444. package/src/summary/runWhileConnectedCoordinator.ts +3 -2
  445. package/src/summary/runningSummarizer.ts +22 -20
  446. package/src/summary/summarizer.ts +17 -15
  447. package/src/summary/summarizerClientElection.ts +3 -2
  448. package/src/summary/summarizerHeuristics.ts +4 -2
  449. package/src/summary/summarizerNode/summarizerNode.ts +20 -18
  450. package/src/summary/summarizerNode/summarizerNodeUtils.ts +3 -2
  451. package/src/summary/summarizerNode/summarizerNodeWithGc.ts +16 -8
  452. package/src/summary/summarizerTypes.ts +7 -3
  453. package/src/summary/summaryCollection.ts +3 -3
  454. package/src/summary/summaryFormat.ts +14 -26
  455. package/src/summary/summaryGenerator.ts +12 -15
  456. package/src/summary/summaryManager.ts +16 -13
  457. package/api-extractor-cjs.json +0 -8
  458. package/dist/container-runtime-alpha.d.ts +0 -1753
  459. package/dist/container-runtime-beta.d.ts +0 -268
  460. package/dist/container-runtime-public.d.ts +0 -268
  461. package/dist/container-runtime-untrimmed.d.ts +0 -1893
  462. package/lib/container-runtime-alpha.d.ts +0 -1753
  463. package/lib/container-runtime-beta.d.ts +0 -268
  464. package/lib/container-runtime-public.d.ts +0 -268
  465. package/lib/container-runtime-untrimmed.d.ts +0 -1893
  466. package/lib/test/batchTracker.spec.js +0 -88
  467. package/lib/test/batchTracker.spec.js.map +0 -1
  468. package/lib/test/blobManager.spec.js +0 -835
  469. package/lib/test/blobManager.spec.js.map +0 -1
  470. package/lib/test/channelCollection.spec.js +0 -141
  471. package/lib/test/channelCollection.spec.js.map +0 -1
  472. package/lib/test/containerRuntime.spec.js +0 -1748
  473. package/lib/test/containerRuntime.spec.js.map +0 -1
  474. package/lib/test/dataStoreContext.spec.js +0 -801
  475. package/lib/test/dataStoreContext.spec.js.map +0 -1
  476. package/lib/test/dataStoreCreation.spec.js +0 -312
  477. package/lib/test/dataStoreCreation.spec.js.map +0 -1
  478. package/lib/test/dataStoreRegistry.spec.js +0 -26
  479. package/lib/test/dataStoreRegistry.spec.js.map +0 -1
  480. package/lib/test/fuzz/fuzzUtils.js +0 -66
  481. package/lib/test/fuzz/fuzzUtils.js.map +0 -1
  482. package/lib/test/fuzz/summarizer.fuzz.spec.js +0 -31
  483. package/lib/test/fuzz/summarizer.fuzz.spec.js.map +0 -1
  484. package/lib/test/fuzz/summarizerFuzzMocks.js +0 -162
  485. package/lib/test/fuzz/summarizerFuzzMocks.js.map +0 -1
  486. package/lib/test/fuzz/summarizerFuzzSuite.js +0 -106
  487. package/lib/test/fuzz/summarizerFuzzSuite.js.map +0 -1
  488. package/lib/test/gc/garbageCollection.spec.js +0 -1465
  489. package/lib/test/gc/garbageCollection.spec.js.map +0 -1
  490. package/lib/test/gc/gcConfigs.spec.js +0 -690
  491. package/lib/test/gc/gcConfigs.spec.js.map +0 -1
  492. package/lib/test/gc/gcHelpers.spec.js +0 -110
  493. package/lib/test/gc/gcHelpers.spec.js.map +0 -1
  494. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js +0 -68
  495. package/lib/test/gc/gcReferenceGraphAlgorithm.spec.js.map +0 -1
  496. package/lib/test/gc/gcStats.spec.js +0 -391
  497. package/lib/test/gc/gcStats.spec.js.map +0 -1
  498. package/lib/test/gc/gcSummaryStateTracker.spec.js +0 -228
  499. package/lib/test/gc/gcSummaryStateTracker.spec.js.map +0 -1
  500. package/lib/test/gc/gcTelemetry.spec.js +0 -530
  501. package/lib/test/gc/gcTelemetry.spec.js.map +0 -1
  502. package/lib/test/gc/gcUnitTestHelpers.js +0 -29
  503. package/lib/test/gc/gcUnitTestHelpers.js.map +0 -1
  504. package/lib/test/gc/gcUnreferencedStateTracker.spec.js +0 -192
  505. package/lib/test/gc/gcUnreferencedStateTracker.spec.js.map +0 -1
  506. package/lib/test/getPendingBlobs.spec.js +0 -193
  507. package/lib/test/getPendingBlobs.spec.js.map +0 -1
  508. package/lib/test/hardwareStats.spec.js +0 -93
  509. package/lib/test/hardwareStats.spec.js.map +0 -1
  510. package/lib/test/index.js +0 -6
  511. package/lib/test/index.js.map +0 -1
  512. package/lib/test/opLifecycle/OpGroupingManager.spec.js +0 -225
  513. package/lib/test/opLifecycle/OpGroupingManager.spec.js.map +0 -1
  514. package/lib/test/opLifecycle/batchManager.spec.js +0 -189
  515. package/lib/test/opLifecycle/batchManager.spec.js.map +0 -1
  516. package/lib/test/opLifecycle/opCompressor.spec.js +0 -74
  517. package/lib/test/opLifecycle/opCompressor.spec.js.map +0 -1
  518. package/lib/test/opLifecycle/opDecompressor.spec.js +0 -218
  519. package/lib/test/opLifecycle/opDecompressor.spec.js.map +0 -1
  520. package/lib/test/opLifecycle/opSplitter.spec.js +0 -272
  521. package/lib/test/opLifecycle/opSplitter.spec.js.map +0 -1
  522. package/lib/test/opLifecycle/outbox.spec.js +0 -675
  523. package/lib/test/opLifecycle/outbox.spec.js.map +0 -1
  524. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js +0 -196
  525. package/lib/test/opLifecycle/remoteMessageProcessor.spec.js.map +0 -1
  526. package/lib/test/pendingStateManager.spec.js +0 -329
  527. package/lib/test/pendingStateManager.spec.js.map +0 -1
  528. package/lib/test/scheduleManager.spec.js +0 -270
  529. package/lib/test/scheduleManager.spec.js.map +0 -1
  530. package/lib/test/summarizerNode.spec.js +0 -326
  531. package/lib/test/summarizerNode.spec.js.map +0 -1
  532. package/lib/test/summarizerNodeWithGc.spec.js +0 -318
  533. package/lib/test/summarizerNodeWithGc.spec.js.map +0 -1
  534. package/lib/test/summary/orderedClientElection.spec.js +0 -535
  535. package/lib/test/summary/orderedClientElection.spec.js.map +0 -1
  536. package/lib/test/summary/runningSummarizer.spec.js +0 -1349
  537. package/lib/test/summary/runningSummarizer.spec.js.map +0 -1
  538. package/lib/test/summary/summarizer.spec.js +0 -29
  539. package/lib/test/summary/summarizer.spec.js.map +0 -1
  540. package/lib/test/summary/summarizerClientElection.spec.js +0 -436
  541. package/lib/test/summary/summarizerClientElection.spec.js.map +0 -1
  542. package/lib/test/summary/summarizerHeuristics.spec.js +0 -289
  543. package/lib/test/summary/summarizerHeuristics.spec.js.map +0 -1
  544. package/lib/test/summary/summaryCollection.spec.js +0 -200
  545. package/lib/test/summary/summaryCollection.spec.js.map +0 -1
  546. package/lib/test/summary/summaryManager.spec.js +0 -430
  547. package/lib/test/summary/summaryManager.spec.js.map +0 -1
  548. package/lib/test/summary/testQuorumClients.js +0 -34
  549. package/lib/test/summary/testQuorumClients.js.map +0 -1
  550. package/lib/test/throttler.spec.js +0 -175
  551. package/lib/test/throttler.spec.js.map +0 -1
  552. package/lib/test/types/validateContainerRuntimePrevious.generated.js +0 -180
  553. package/lib/test/types/validateContainerRuntimePrevious.generated.js.map +0 -1
  554. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -0,0 +1,631 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import { DataProcessingError } from "@fluidframework/telemetry-utils/internal";
8
+
9
+ import { pkgVersion } from "../packageVersion.js";
10
+
11
+ /**
12
+ * Descripe allowed type for properties in document schema.
13
+ * Please note that for all property types we should use undefined to indicate that particular capability is off.
14
+ * Using false, or some string value (like "off") will result in clients who do not understand that property failing, whereas
15
+ * we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.
16
+ * @alpha
17
+ */
18
+ export type DocumentSchemaValueType = string | string[] | true | number | undefined;
19
+
20
+ /**
21
+ * ID Compressor mode.
22
+ * "on" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all
23
+ * sessions for a given document. This results in IContainerRuntime.idCompressor to be always available.
24
+ * "delayed" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer.
25
+ * In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it "On").
26
+ * The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs.
27
+ * undefined - ID compressor is not loaded.
28
+ * While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.
29
+ *
30
+ * @alpha
31
+ */
32
+ export type IdCompressorMode = "on" | "delayed" | undefined;
33
+
34
+ /**
35
+ * Document schema information.
36
+ * Describes overall shape of document schema, including unknown (to this version) properties.
37
+ *
38
+ * Used by runtime to make a call if it can understand document schema.
39
+ * If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures
40
+ * down the road and potentially corrupting documents.
41
+ * For now this structure and appropriate interpretation / behavior is focused only on runtime features.
42
+ * In the future that could be interpolated to more areas, including DDSs used, and even possibly - application
43
+ * schema.
44
+ *
45
+ * Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will
46
+ * stop (and fail session) on any unknown properties within "runtime" sub-tree.
47
+ *
48
+ * In most cases values preserved in the document will not dictate if such features should be enabled in a given session.
49
+ * I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know
50
+ * how to interpret such ops, but does not need to actually use compression itself. That said, some options could be
51
+ * sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example.
52
+ * Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's
53
+ * disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail
54
+ * if opened by clients who do not support compression.
55
+ *
56
+ * For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.
57
+ *
58
+ * @alpha
59
+ */
60
+ export interface IDocumentSchema {
61
+ // version that describes how data is stored in this structure.
62
+ // If runtime sees a version it does not understand, it should immediately fail and not
63
+ // attempt to interpret any further data.
64
+ version: number;
65
+
66
+ // Sequence number when this schema became active.
67
+ refSeq: number;
68
+
69
+ runtime: Record<string, DocumentSchemaValueType>;
70
+ }
71
+
72
+ /**
73
+ * Content of the type=ContainerMessageType.DocumentSchemaChange ops.
74
+ * The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent)
75
+ * ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey
76
+ * regSeq of last known schema change (known to a client proposing schema change).
77
+ * @see ContainerRuntimeDocumentSchemaMessage
78
+ * @alpha
79
+ */
80
+ export type IDocumentSchemaChangeMessage = IDocumentSchema;
81
+
82
+ /**
83
+ * Settings that this session would like to have, based on options and feature gates.
84
+ *
85
+ * WARNING: This type is used to infer IDocumentSchemaCurrent type!
86
+ * Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!
87
+ *
88
+ * @alpha
89
+ */
90
+ export interface IDocumentSchemaFeatures {
91
+ // Tells if client uses legacy behavior of changing schema.
92
+ // - Legacy behavior - changing schema without leveraging schema change ops.
93
+ // - New behavior - changes in schema require ops and take into affect with delay.
94
+ explicitSchemaControl: boolean;
95
+ compressionLz4: boolean;
96
+ idCompressorMode: IdCompressorMode;
97
+ opGroupingEnabled: boolean;
98
+
99
+ /**
100
+ * List of disallowed versions of the runtime.
101
+ * This option is sticky. Once a version of runtime is added to this list (when supplied to DocumentsSchemaController's constructor)
102
+ * it will be added to the list of disallowed versions and stored in document metadata.
103
+ * Each runtime checks if its version is in this list on container open. If it is, it immediately exits with error message
104
+ * indicating to the user that this version is no longer supported.
105
+ * Currently there is no mechanism to remove version from this list. I.e. If it was once added to the list,
106
+ * it gets added to any document metadata (documents that gets open by this runtime) and there is no way to clear it from document's
107
+ * metadata.
108
+ */
109
+ disallowedVersions: string[];
110
+ }
111
+
112
+ /**
113
+ * Current version known properties that define document schema
114
+ * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.
115
+ * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.
116
+ * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
117
+ * @alpha
118
+ */
119
+ export const currentDocumentVersionSchema = 1;
120
+
121
+ /**
122
+ * Current document schema.
123
+ * @alpha
124
+ */
125
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
126
+ export type IDocumentSchemaCurrent = {
127
+ version: 1;
128
+ refSeq: number;
129
+
130
+ runtime: {
131
+ [P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean
132
+ ? true
133
+ : IDocumentSchemaFeatures[P];
134
+ };
135
+ };
136
+
137
+ interface IProperty<T = unknown> {
138
+ and: (currentDocSchema: T, desiredDocSchema: T) => T;
139
+ or: (currentDocSchema: T, desiredDocSchema: T) => T;
140
+ validate(t: unknown): boolean;
141
+ }
142
+
143
+ class TrueOrUndefined implements IProperty<true | undefined> {
144
+ public and(currentDocSchema?: true, desiredDocSchema?: true) {
145
+ return currentDocSchema === true && desiredDocSchema === true ? true : undefined;
146
+ }
147
+
148
+ public or(currentDocSchema?: true, desiredDocSchema?: true) {
149
+ return currentDocSchema === true || desiredDocSchema === true ? true : undefined;
150
+ }
151
+
152
+ public validate(t: unknown) {
153
+ return t === undefined || t === true;
154
+ }
155
+ }
156
+
157
+ class TrueOrUndefinedMax extends TrueOrUndefined {
158
+ public and(currentDocSchema?: true, desiredDocSchema?: true) {
159
+ return this.or(currentDocSchema, desiredDocSchema);
160
+ }
161
+ }
162
+
163
+ class MultiChoice implements IProperty<string | undefined> {
164
+ constructor(private readonly choices: string[]) {}
165
+
166
+ public and(currentDocSchema?: string, desiredDocSchema?: string) {
167
+ if (currentDocSchema === undefined || desiredDocSchema === undefined) {
168
+ return undefined;
169
+ }
170
+ return this.choices[
171
+ Math.min(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))
172
+ ];
173
+ }
174
+
175
+ public or(currentDocSchema?: string, desiredDocSchema?: string) {
176
+ if (currentDocSchema === undefined) {
177
+ return desiredDocSchema;
178
+ }
179
+ if (desiredDocSchema === undefined) {
180
+ return currentDocSchema;
181
+ }
182
+ return this.choices[
183
+ Math.max(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))
184
+ ];
185
+ }
186
+
187
+ public validate(t: unknown) {
188
+ return t === undefined || (typeof t === "string" && this.choices.includes(t));
189
+ }
190
+ }
191
+
192
+ class IdCompressorProperty extends MultiChoice {
193
+ // document schema always wins!
194
+ public and(currentDocSchema?: string, desiredDocSchema?: string) {
195
+ return currentDocSchema;
196
+ }
197
+ }
198
+
199
+ class CheckVersions implements IProperty<string[] | undefined> {
200
+ public or(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {
201
+ const set = new Set<string>([...currentDocSchema, ...desiredDocSchema]);
202
+ return arrayToProp([...set.values()]);
203
+ }
204
+
205
+ // Once version is there, it stays there forever.
206
+ public and(currentDocSchema: string[] = [], desiredDocSchema: string[] = []) {
207
+ return this.or(currentDocSchema, desiredDocSchema);
208
+ }
209
+
210
+ public validate(t: unknown) {
211
+ return t === undefined || (Array.isArray(t) && !t.includes(pkgVersion));
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Helper structure to valida if a schema is compatible with existing code.
217
+ */
218
+ const documentSchemaSupportedConfigs = {
219
+ explicitSchemaControl: new TrueOrUndefinedMax(), // once new behavior shows up, it's sticky
220
+ idCompressorMode: new IdCompressorProperty(["delayed", "on"]),
221
+ opGroupingEnabled: new TrueOrUndefined(),
222
+ compressionLz4: new TrueOrUndefined(),
223
+ disallowedVersions: new CheckVersions(),
224
+ };
225
+
226
+ /**
227
+ * Checks if a given schema is compatible with current code, i.e. if current code can understand all the features of that schema.
228
+ * If schema is not compatible with current code, it throws an exception.
229
+ * @param documentSchema - current schema
230
+ */
231
+ function checkRuntimeCompatibility(documentSchema?: IDocumentSchema) {
232
+ // Back-compat - we can't do anything about legacy documents.
233
+ // There is no way to validate them, so we are taking a guess that safe deployment processes used by a given app
234
+ // do not run into compat problems.
235
+ if (documentSchema === undefined) {
236
+ return;
237
+ }
238
+
239
+ const msg = "Document can't be opened with current version of the code";
240
+ if (documentSchema.version !== currentDocumentVersionSchema) {
241
+ throw DataProcessingError.create(
242
+ msg,
243
+ "checkRuntimeCompat1",
244
+ undefined, // message
245
+ {
246
+ runtimeSchemaVersion: documentSchema.version,
247
+ currentRuntimeSchemaVersion: currentDocumentVersionSchema,
248
+ },
249
+ );
250
+ }
251
+
252
+ let unknownProperty: string | undefined;
253
+
254
+ const regSeq = documentSchema.refSeq;
255
+ // defence in depth - it should not be possible to get here anything other than integer, but worth validating it.
256
+ if (typeof regSeq !== "number" || regSeq < 0 || !Number.isInteger(regSeq)) {
257
+ unknownProperty = "refSeq";
258
+ } else if (documentSchema.runtime === null || typeof documentSchema.runtime !== "object") {
259
+ unknownProperty = "runtime";
260
+ } else {
261
+ for (const [name, value] of Object.entries(documentSchema.runtime)) {
262
+ const validator = documentSchemaSupportedConfigs[name] as IProperty | undefined;
263
+ if (validator === undefined || !validator.validate(value)) {
264
+ unknownProperty = `runtime/${name}`;
265
+ }
266
+ }
267
+ }
268
+
269
+ if (unknownProperty !== undefined) {
270
+ const value = documentSchema[unknownProperty];
271
+ throw DataProcessingError.create(
272
+ msg,
273
+ "checkRuntimeCompat2",
274
+ undefined, // message
275
+ {
276
+ codeVersion: currentDocumentVersionSchema,
277
+ property: unknownProperty,
278
+ value,
279
+ },
280
+ );
281
+ }
282
+ }
283
+
284
+ function and(
285
+ currentDocSchema: IDocumentSchemaCurrent,
286
+ desiredDocSchema: IDocumentSchemaCurrent,
287
+ ): IDocumentSchemaCurrent {
288
+ const runtime = {};
289
+ for (const key of new Set([
290
+ ...Object.keys(currentDocSchema.runtime),
291
+ ...Object.keys(desiredDocSchema.runtime),
292
+ ])) {
293
+ runtime[key] = (documentSchemaSupportedConfigs[key] as IProperty).and(
294
+ currentDocSchema.runtime[key],
295
+ desiredDocSchema.runtime[key],
296
+ );
297
+ }
298
+ return {
299
+ version: currentDocumentVersionSchema,
300
+ refSeq: currentDocSchema.refSeq,
301
+ runtime,
302
+ } as unknown as IDocumentSchemaCurrent;
303
+ }
304
+
305
+ function or(
306
+ currentDocSchema: IDocumentSchemaCurrent,
307
+ desiredDocSchema: IDocumentSchemaCurrent,
308
+ ): IDocumentSchemaCurrent {
309
+ const runtime = {};
310
+ for (const key of new Set([
311
+ ...Object.keys(currentDocSchema.runtime),
312
+ ...Object.keys(desiredDocSchema.runtime),
313
+ ])) {
314
+ runtime[key] = (documentSchemaSupportedConfigs[key] as IProperty).or(
315
+ currentDocSchema.runtime[key],
316
+ desiredDocSchema.runtime[key],
317
+ );
318
+ }
319
+ return {
320
+ version: currentDocumentVersionSchema,
321
+ refSeq: currentDocSchema.refSeq,
322
+ runtime,
323
+ } as unknown as IDocumentSchemaCurrent;
324
+ }
325
+
326
+ function same(
327
+ currentDocSchema: IDocumentSchemaCurrent,
328
+ desiredDocSchema: IDocumentSchemaCurrent,
329
+ ): boolean {
330
+ for (const key of new Set([
331
+ ...Object.keys(currentDocSchema.runtime),
332
+ ...Object.keys(desiredDocSchema.runtime),
333
+ ])) {
334
+ // If schemas differ only by type of behavior, then we should not send schema change ops!
335
+ if (
336
+ key !== "explicitSchemaControl" &&
337
+ currentDocSchema.runtime[key] !== desiredDocSchema.runtime[key]
338
+ ) {
339
+ return false;
340
+ }
341
+ }
342
+ return true;
343
+ }
344
+
345
+ function boolToProp(b: boolean) {
346
+ return b ? true : undefined;
347
+ }
348
+
349
+ function arrayToProp(arr: string[]) {
350
+ return arr.length === 0 ? undefined : arr;
351
+ }
352
+
353
+ /* eslint-disable jsdoc/check-indentation */
354
+
355
+ /**
356
+ * Controller of document schema.
357
+ *
358
+ * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md
359
+ *
360
+ * This class manages current document schema and transitions between document schemas.
361
+ * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data
362
+ * (summary and op format), features & capabilities that a version of runtime has to support and understand in
363
+ * order to collaborate on a document.
364
+ * New features that modify document format have to be included in document schema definition.
365
+ * Usage of such features could only happen after document schema has been updated to reflect such feature.
366
+ *
367
+ * This formality allows clients that do not understand such features to fail right away when they observe
368
+ * document schema listing capabilities that such client does not understand.
369
+ * Old clients will fail in predictable way. This allows us to
370
+ * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.
371
+ * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are
372
+ * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along
373
+ * and potentially corrupt the document. This is especially true for summarizer client, who could simply "undo"
374
+ * changes it does not understands.
375
+ *
376
+ * It's important to note how it overlaps with feature gates and safe velocity.
377
+ * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.
378
+ * But, developers (through code deployment or feature gates) could disable usage of such features.
379
+ * That will stop a process of further document schema changes (for documents that were not using such feature).
380
+ * And documents that already list such capability in their schema will continue to do so. Later ensures that old
381
+ * clients who do not understand such feature will continue to fail to open such documents, as such documents very
382
+ * likely contain data in a new format.
383
+ *
384
+ * Controller operates with 4 schemas:
385
+ * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).
386
+ * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).
387
+ * - session schema - current session schema. It's "and" of the above two schemas.
388
+ * - future schema - "or" of document and desires schemas.
389
+ *
390
+ * "or" & "and" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.
391
+ * But for other properties it's more nuanced.
392
+ *
393
+ * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to
394
+ * future schema.
395
+ *
396
+ * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.
397
+ *
398
+ * There are two modes this class can operate:
399
+ * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,
400
+ * right away, and new features are available right away
401
+ * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.
402
+ * However code should assume that any new features that were not enabled in a given document will not be available
403
+ * for a given session. That's because this session may never send any ops (including read-only documents). Or it may
404
+ * fail to convert schema.
405
+ * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),
406
+ * then eventually all documents that are modified will have that feature reflected in their schema. It could require
407
+ * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults
408
+ * schema on document load).
409
+ *
410
+ * How schemas are changed (in non-legacy mode):
411
+ * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.
412
+ * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.
413
+ * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will
414
+ * reference old schema that is no longer in effect.
415
+ * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do
416
+ * recalc and decide if schema needs to be changed or not).
417
+ *
418
+ * @alpha
419
+ */
420
+ export class DocumentsSchemaController {
421
+ private explicitSchemaControl: boolean;
422
+ private sendOp = true;
423
+
424
+ // schema coming from document metadata (snapshot we loaded from)
425
+ private documentSchema: IDocumentSchemaCurrent;
426
+
427
+ // desired schema, based on feature gates / runtime options.
428
+ // This includes requests to enable to disable functionality
429
+ private readonly desiredSchema: IDocumentSchemaCurrent;
430
+
431
+ // OR() of document schema and desired schema. It enables all the features that are enabled in either of schemas.
432
+ private futureSchema: IDocumentSchemaCurrent | undefined;
433
+
434
+ // Current schema this session operates with.
435
+ // 1) Legacy mode: this is same as desired schema - all options that were requested to be on are on, and all options requested to be off are off.
436
+ // 2) Non-legacy mode: this is AND() of document schema and desired schema. Only options that are enabled in both are enabled here.
437
+ // If there are any options that are not enabled in document schema, but are enabled in desired schema, then attempt to change schema
438
+ // (and enable such options) will be made through the session.
439
+ public sessionSchema: IDocumentSchemaCurrent;
440
+
441
+ /**
442
+ * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.
443
+ * @param existing - Is the document existing document, or a new doc.
444
+ * @param documentMetadataSchema - current document's schema, if present.
445
+ * @param features - features of the document schema that current session wants to see enabled.
446
+ * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)
447
+ */
448
+ constructor(
449
+ existing: boolean,
450
+ documentMetadataSchema: IDocumentSchema | undefined,
451
+ features: IDocumentSchemaFeatures,
452
+ private readonly onSchemaChange: (schema: IDocumentSchemaCurrent) => void,
453
+ ) {
454
+ checkRuntimeCompatibility(documentMetadataSchema);
455
+
456
+ // For simplicity, let's only support new schema features for explicit schema control mode
457
+ assert(
458
+ features.disallowedVersions.length === 0 || features.explicitSchemaControl,
459
+ 0x949 /* not supported */,
460
+ );
461
+
462
+ // Desired schema by this session - almost all props are coming from arguments
463
+ this.desiredSchema = {
464
+ version: currentDocumentVersionSchema,
465
+ refSeq: documentMetadataSchema?.refSeq ?? 0,
466
+ runtime: {
467
+ explicitSchemaControl: boolToProp(features.explicitSchemaControl),
468
+ compressionLz4: boolToProp(features.compressionLz4),
469
+ idCompressorMode: features.idCompressorMode,
470
+ opGroupingEnabled: boolToProp(features.opGroupingEnabled),
471
+ disallowedVersions: arrayToProp(features.disallowedVersions),
472
+ },
473
+ };
474
+
475
+ // Schema coming from document metadata (snapshot we loaded from), or if no document exists
476
+ // (this is a new document) then this is the same as desiredSchema (same as session schema in such case).
477
+ // Latter is importnat sure that's what will go into summary.
478
+ this.documentSchema = !existing
479
+ ? this.desiredSchema
480
+ : (documentMetadataSchema as IDocumentSchemaCurrent) ??
481
+ ({
482
+ version: currentDocumentVersionSchema,
483
+ // see comment in summarizeDocumentSchema() on why it has to stay zero
484
+ refSeq: 0,
485
+ // If it's existing document and it has no schema, then it was written by legacy client.
486
+ // If it's a new document, then we define it's legacy-related behaviors.
487
+ runtime: {
488
+ explicitSchemaControl: boolToProp(
489
+ !existing && features.explicitSchemaControl,
490
+ ),
491
+ },
492
+ } satisfies IDocumentSchemaCurrent);
493
+
494
+ // Use legacy behavior only if both document and options tell us to use legacy.
495
+ // Otherwise it's no longer legacy time!
496
+ this.explicitSchemaControl =
497
+ this.documentSchema.runtime.explicitSchemaControl === true ||
498
+ features.explicitSchemaControl;
499
+
500
+ // Calculate
501
+ // - current session schema (overlap of document schema and desired schema)
502
+ // - future schema to propose (concatination of document schema and desired schema)
503
+ if (!this.explicitSchemaControl || !existing) {
504
+ this.sessionSchema = this.desiredSchema;
505
+ assert(
506
+ boolToProp(this.explicitSchemaControl) ===
507
+ this.sessionSchema.runtime.explicitSchemaControl,
508
+ 0x94a /* explicitSchemaControl */,
509
+ );
510
+ this.futureSchema = undefined;
511
+ } else {
512
+ this.sessionSchema = and(this.documentSchema, this.desiredSchema);
513
+ this.futureSchema = or(this.documentSchema, this.desiredSchema);
514
+ assert(this.sessionSchema.runtime.explicitSchemaControl === true, 0x94b /* legacy */);
515
+ assert(this.futureSchema.runtime.explicitSchemaControl === true, 0x94c /* legacy */);
516
+ if (same(this.documentSchema, this.futureSchema)) {
517
+ this.futureSchema = undefined;
518
+ }
519
+ }
520
+
521
+ // Validate that schema we are operating in is actually a schema we consider compatible with current runtime.
522
+ checkRuntimeCompatibility(this.sessionSchema);
523
+ checkRuntimeCompatibility(this.futureSchema);
524
+ }
525
+
526
+ public summarizeDocumentSchema(refSeq: number): IDocumentSchemaCurrent | undefined {
527
+ // For legacy behavior, we could write nothing (return undefined).
528
+ // It does not buy us anything, as whatever written in summary does not actually impact clients operating in legacy mode.
529
+ // But writing current used config (and assuming most of the clients settle on same config over time) will help with transition
530
+ // out of legacy mode, as clients transitioning out of it would be able to use all the
531
+ // features that are mentioned in schema right away, without a need to go through schema transition (and thus for a session or
532
+ // two losing ability to use all the features)
533
+
534
+ const schema = this.explicitSchemaControl ? this.documentSchema : this.desiredSchema;
535
+
536
+ // It's important to keep refSeq at zero in legacy mode, such that transition out of it is simple and we do not have
537
+ // race conditions. If we put any other number (including latest seq number), then we will have two clients
538
+ // (loading from two different summaries) with different numbers, and eventual consistency will be broken as schema
539
+ // change ops will be interpretted differently by those two clients.
540
+ assert(
541
+ this.explicitSchemaControl || schema.refSeq === 0,
542
+ 0x94d /* refSeq should be zero */,
543
+ );
544
+
545
+ return schema;
546
+ }
547
+
548
+ /**
549
+ * Called by Container runtime whenever it is about to send some op.
550
+ * It gives opportunity for controller to issue its own ops - we do not want to send ops if there are no local changes in document.
551
+ * @returns Optional message to send.
552
+ */
553
+ public maybeSendSchemaMessage(): IDocumentSchemaChangeMessage | undefined {
554
+ if (this.sendOp && this.futureSchema !== undefined) {
555
+ assert(
556
+ this.explicitSchemaControl &&
557
+ this.futureSchema.runtime.explicitSchemaControl === true,
558
+ 0x94e /* not legacy */,
559
+ );
560
+ return {
561
+ ...this.futureSchema,
562
+ refSeq: this.documentSchema.refSeq,
563
+ };
564
+ }
565
+ this.sendOp = false;
566
+ }
567
+
568
+ /**
569
+ * Process document schema change message
570
+ * Called by ContainerRuntime whenever it sees document schema messages.
571
+ * @param content - content of the message
572
+ * @param local - whether op is local
573
+ * @param sequenceNumber - sequence number of the op
574
+ * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)
575
+ */
576
+ public processDocumentSchemaOp(
577
+ content: IDocumentSchemaChangeMessage,
578
+ local: boolean,
579
+ sequenceNumber: number,
580
+ ) {
581
+ assert(
582
+ content.refSeq <= this.documentSchema.refSeq,
583
+ 0x94f /* did we lose a message somewhere? */,
584
+ );
585
+ assert(
586
+ this.documentSchema.refSeq < sequenceNumber,
587
+ 0x950 /* time should move forward only! */,
588
+ );
589
+ if (content.refSeq !== this.documentSchema.refSeq) {
590
+ // CAS failed
591
+ return false;
592
+ }
593
+
594
+ // This assert should be after checking for successful CAS above.
595
+ // This will ensure we do not trip on our own messages that are no longer wanted as we processed someone else schema change message.
596
+ assert(
597
+ !local || (this.explicitSchemaControl && this.futureSchema !== undefined),
598
+ 0x951 /* not sending ops */,
599
+ );
600
+
601
+ // Changes are in effect. Immediately check that this client understands these changes
602
+ checkRuntimeCompatibility(content);
603
+
604
+ const schema: IDocumentSchema = { ...content, refSeq: sequenceNumber };
605
+ this.documentSchema = schema as IDocumentSchemaCurrent;
606
+ this.sessionSchema = and(this.documentSchema, this.desiredSchema);
607
+
608
+ // legacy behavior is automatically off for the document once someone sends a schema op -
609
+ // from now on it's fully controlled by ops.
610
+ // This is very important, as summarizeDocumentSchema() should use this new schema!
611
+ this.explicitSchemaControl = true;
612
+
613
+ // Stop attempting changing schema.
614
+ // If it was local op, then we succeeded and do not need to try again.
615
+ // If it was remote op, then some changes happened to schema.
616
+ // We would need to recalculate this.futureSchema by merging changes that we just received.
617
+ // Avoid this complexity for now - a new client session (loading from new summary with these changes)
618
+ // will automatically do this recalculation and will figure out
619
+ this.futureSchema = undefined;
620
+
621
+ this.onSchemaChange(this.sessionSchema);
622
+
623
+ return true;
624
+ }
625
+
626
+ public onDisconnect() {
627
+ this.sendOp = true;
628
+ }
629
+ }
630
+
631
+ /* eslint-enable jsdoc/check-indentation */
@@ -98,8 +98,17 @@ export {
98
98
  WriteFluidDataStoreAttributes,
99
99
  wrapSummaryInChannelsTree,
100
100
  idCompressorBlobName,
101
- IdCompressorMode,
102
101
  } from "./summaryFormat.js";
102
+ export {
103
+ IdCompressorMode,
104
+ IDocumentSchemaCurrent,
105
+ IDocumentSchema,
106
+ currentDocumentVersionSchema,
107
+ DocumentSchemaValueType,
108
+ DocumentsSchemaController,
109
+ IDocumentSchemaChangeMessage,
110
+ IDocumentSchemaFeatures,
111
+ } from "./documentSchema.js";
103
112
  export { getFailMessage, RetriableSummaryError, SummarizeReason } from "./summaryGenerator.js";
104
113
  export {
105
114
  IConnectedEvents,
@@ -2,17 +2,17 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+
5
6
  /* eslint-disable @rushstack/no-new-null */
6
- import { IEvent, IEventProvider, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
- import {
8
- ITelemetryLoggerExt,
9
- createChildLogger,
10
- UsageError,
11
- } from "@fluidframework/telemetry-utils";
12
- import { assert } from "@fluidframework/core-utils";
7
+
13
8
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
14
9
  import { IDeltaManager } from "@fluidframework/container-definitions";
10
+ import { IEvent, IEventProvider, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
11
+ import { assert } from "@fluidframework/core-utils/internal";
15
12
  import { IClient, IQuorumClients, ISequencedClient } from "@fluidframework/protocol-definitions";
13
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
14
+ import { UsageError, createChildLogger } from "@fluidframework/telemetry-utils/internal";
15
+
16
16
  import { summarizerClientType } from "./summarizerClientElection.js";
17
17
 
18
18
  // helper types for recursive readonly.
@@ -3,11 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert, Deferred } from "@fluidframework/core-utils";
6
+ import { assert, Deferred } from "@fluidframework/core-utils/internal";
7
+
7
8
  import {
8
- SummarizerStopReason,
9
9
  IConnectableRuntime,
10
10
  ISummaryCancellationToken,
11
+ SummarizerStopReason,
11
12
  } from "./summarizerTypes.js";
12
13
 
13
14
  /**