@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,209 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Descripe allowed type for properties in document schema.
7
+ * Please note that for all property types we should use undefined to indicate that particular capability is off.
8
+ * Using false, or some string value (like "off") will result in clients who do not understand that property failing, whereas
9
+ * we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.
10
+ * @alpha
11
+ */
12
+ export type DocumentSchemaValueType = string | string[] | true | number | undefined;
13
+ /**
14
+ * ID Compressor mode.
15
+ * "on" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all
16
+ * sessions for a given document. This results in IContainerRuntime.idCompressor to be always available.
17
+ * "delayed" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer.
18
+ * In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it "On").
19
+ * The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs.
20
+ * undefined - ID compressor is not loaded.
21
+ * While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.
22
+ *
23
+ * @alpha
24
+ */
25
+ export type IdCompressorMode = "on" | "delayed" | undefined;
26
+ /**
27
+ * Document schema information.
28
+ * Describes overall shape of document schema, including unknown (to this version) properties.
29
+ *
30
+ * Used by runtime to make a call if it can understand document schema.
31
+ * If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures
32
+ * down the road and potentially corrupting documents.
33
+ * For now this structure and appropriate interpretation / behavior is focused only on runtime features.
34
+ * In the future that could be interpolated to more areas, including DDSs used, and even possibly - application
35
+ * schema.
36
+ *
37
+ * Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will
38
+ * stop (and fail session) on any unknown properties within "runtime" sub-tree.
39
+ *
40
+ * In most cases values preserved in the document will not dictate if such features should be enabled in a given session.
41
+ * I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know
42
+ * how to interpret such ops, but does not need to actually use compression itself. That said, some options could be
43
+ * sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example.
44
+ * Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's
45
+ * disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail
46
+ * if opened by clients who do not support compression.
47
+ *
48
+ * For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.
49
+ *
50
+ * @alpha
51
+ */
52
+ export interface IDocumentSchema {
53
+ version: number;
54
+ refSeq: number;
55
+ runtime: Record<string, DocumentSchemaValueType>;
56
+ }
57
+ /**
58
+ * Content of the type=ContainerMessageType.DocumentSchemaChange ops.
59
+ * The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent)
60
+ * ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey
61
+ * regSeq of last known schema change (known to a client proposing schema change).
62
+ * @see ContainerRuntimeDocumentSchemaMessage
63
+ * @alpha
64
+ */
65
+ export type IDocumentSchemaChangeMessage = IDocumentSchema;
66
+ /**
67
+ * Settings that this session would like to have, based on options and feature gates.
68
+ *
69
+ * WARNING: This type is used to infer IDocumentSchemaCurrent type!
70
+ * Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!
71
+ *
72
+ * @alpha
73
+ */
74
+ export interface IDocumentSchemaFeatures {
75
+ explicitSchemaControl: boolean;
76
+ compressionLz4: boolean;
77
+ idCompressorMode: IdCompressorMode;
78
+ opGroupingEnabled: boolean;
79
+ /**
80
+ * List of disallowed versions of the runtime.
81
+ * This option is sticky. Once a version of runtime is added to this list (when supplied to DocumentsSchemaController's constructor)
82
+ * it will be added to the list of disallowed versions and stored in document metadata.
83
+ * Each runtime checks if its version is in this list on container open. If it is, it immediately exits with error message
84
+ * indicating to the user that this version is no longer supported.
85
+ * Currently there is no mechanism to remove version from this list. I.e. If it was once added to the list,
86
+ * 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
87
+ * metadata.
88
+ */
89
+ disallowedVersions: string[];
90
+ }
91
+ /**
92
+ * Current version known properties that define document schema
93
+ * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.
94
+ * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.
95
+ * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
96
+ * @alpha
97
+ */
98
+ export declare const currentDocumentVersionSchema = 1;
99
+ /**
100
+ * Current document schema.
101
+ * @alpha
102
+ */
103
+ export type IDocumentSchemaCurrent = {
104
+ version: 1;
105
+ refSeq: number;
106
+ runtime: {
107
+ [P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean ? true : IDocumentSchemaFeatures[P];
108
+ };
109
+ };
110
+ /**
111
+ * Controller of document schema.
112
+ *
113
+ * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md
114
+ *
115
+ * This class manages current document schema and transitions between document schemas.
116
+ * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data
117
+ * (summary and op format), features & capabilities that a version of runtime has to support and understand in
118
+ * order to collaborate on a document.
119
+ * New features that modify document format have to be included in document schema definition.
120
+ * Usage of such features could only happen after document schema has been updated to reflect such feature.
121
+ *
122
+ * This formality allows clients that do not understand such features to fail right away when they observe
123
+ * document schema listing capabilities that such client does not understand.
124
+ * Old clients will fail in predictable way. This allows us to
125
+ * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.
126
+ * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are
127
+ * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along
128
+ * and potentially corrupt the document. This is especially true for summarizer client, who could simply "undo"
129
+ * changes it does not understands.
130
+ *
131
+ * It's important to note how it overlaps with feature gates and safe velocity.
132
+ * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.
133
+ * But, developers (through code deployment or feature gates) could disable usage of such features.
134
+ * That will stop a process of further document schema changes (for documents that were not using such feature).
135
+ * And documents that already list such capability in their schema will continue to do so. Later ensures that old
136
+ * clients who do not understand such feature will continue to fail to open such documents, as such documents very
137
+ * likely contain data in a new format.
138
+ *
139
+ * Controller operates with 4 schemas:
140
+ * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).
141
+ * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).
142
+ * - session schema - current session schema. It's "and" of the above two schemas.
143
+ * - future schema - "or" of document and desires schemas.
144
+ *
145
+ * "or" & "and" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.
146
+ * But for other properties it's more nuanced.
147
+ *
148
+ * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to
149
+ * future schema.
150
+ *
151
+ * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.
152
+ *
153
+ * There are two modes this class can operate:
154
+ * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,
155
+ * right away, and new features are available right away
156
+ * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.
157
+ * However code should assume that any new features that were not enabled in a given document will not be available
158
+ * for a given session. That's because this session may never send any ops (including read-only documents). Or it may
159
+ * fail to convert schema.
160
+ * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),
161
+ * then eventually all documents that are modified will have that feature reflected in their schema. It could require
162
+ * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults
163
+ * schema on document load).
164
+ *
165
+ * How schemas are changed (in non-legacy mode):
166
+ * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.
167
+ * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.
168
+ * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will
169
+ * reference old schema that is no longer in effect.
170
+ * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do
171
+ * recalc and decide if schema needs to be changed or not).
172
+ *
173
+ * @alpha
174
+ */
175
+ export declare class DocumentsSchemaController {
176
+ private readonly onSchemaChange;
177
+ private explicitSchemaControl;
178
+ private sendOp;
179
+ private documentSchema;
180
+ private readonly desiredSchema;
181
+ private futureSchema;
182
+ sessionSchema: IDocumentSchemaCurrent;
183
+ /**
184
+ * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.
185
+ * @param existing - Is the document existing document, or a new doc.
186
+ * @param documentMetadataSchema - current document's schema, if present.
187
+ * @param features - features of the document schema that current session wants to see enabled.
188
+ * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)
189
+ */
190
+ constructor(existing: boolean, documentMetadataSchema: IDocumentSchema | undefined, features: IDocumentSchemaFeatures, onSchemaChange: (schema: IDocumentSchemaCurrent) => void);
191
+ summarizeDocumentSchema(refSeq: number): IDocumentSchemaCurrent | undefined;
192
+ /**
193
+ * Called by Container runtime whenever it is about to send some op.
194
+ * 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.
195
+ * @returns Optional message to send.
196
+ */
197
+ maybeSendSchemaMessage(): IDocumentSchemaChangeMessage | undefined;
198
+ /**
199
+ * Process document schema change message
200
+ * Called by ContainerRuntime whenever it sees document schema messages.
201
+ * @param content - content of the message
202
+ * @param local - whether op is local
203
+ * @param sequenceNumber - sequence number of the op
204
+ * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)
205
+ */
206
+ processDocumentSchemaOp(content: IDocumentSchemaChangeMessage, local: boolean, sequenceNumber: number): boolean;
207
+ onDisconnect(): void;
208
+ }
209
+ //# sourceMappingURL=documentSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentSchema.d.ts","sourceRoot":"","sources":["../../src/summary/documentSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe;IAI/B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACjD;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IAIvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;;;;;;;;OASG;IACH,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACpC,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,EAAE;SACP,CAAC,IAAI,MAAM,uBAAuB,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,SAAS,OAAO,GAC9E,IAAI,GACJ,uBAAuB,CAAC,CAAC,CAAC;KAC7B,CAAC;CACF,CAAC;AA4NF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,qBAAa,yBAAyB;IAgCpC,OAAO,CAAC,QAAQ,CAAC,cAAc;IA/BhC,OAAO,CAAC,qBAAqB,CAAU;IACvC,OAAO,CAAC,MAAM,CAAQ;IAGtB,OAAO,CAAC,cAAc,CAAyB;IAI/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAGvD,OAAO,CAAC,YAAY,CAAqC;IAOlD,aAAa,EAAE,sBAAsB,CAAC;IAE7C;;;;;;OAMG;gBAEF,QAAQ,EAAE,OAAO,EACjB,sBAAsB,EAAE,eAAe,GAAG,SAAS,EACnD,QAAQ,EAAE,uBAAuB,EAChB,cAAc,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI;IA0EnE,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAsBlF;;;;OAIG;IACI,sBAAsB,IAAI,4BAA4B,GAAG,SAAS;IAezE;;;;;;;OAOG;IACI,uBAAuB,CAC7B,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM;IA+ChB,YAAY;CAGnB"}
@@ -0,0 +1,386 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { assert } from "@fluidframework/core-utils/internal";
6
+ import { DataProcessingError } from "@fluidframework/telemetry-utils/internal";
7
+ import { pkgVersion } from "../packageVersion.js";
8
+ /**
9
+ * Current version known properties that define document schema
10
+ * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.
11
+ * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.
12
+ * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
13
+ * @alpha
14
+ */
15
+ export const currentDocumentVersionSchema = 1;
16
+ class TrueOrUndefined {
17
+ and(currentDocSchema, desiredDocSchema) {
18
+ return currentDocSchema === true && desiredDocSchema === true ? true : undefined;
19
+ }
20
+ or(currentDocSchema, desiredDocSchema) {
21
+ return currentDocSchema === true || desiredDocSchema === true ? true : undefined;
22
+ }
23
+ validate(t) {
24
+ return t === undefined || t === true;
25
+ }
26
+ }
27
+ class TrueOrUndefinedMax extends TrueOrUndefined {
28
+ and(currentDocSchema, desiredDocSchema) {
29
+ return this.or(currentDocSchema, desiredDocSchema);
30
+ }
31
+ }
32
+ class MultiChoice {
33
+ constructor(choices) {
34
+ this.choices = choices;
35
+ }
36
+ and(currentDocSchema, desiredDocSchema) {
37
+ if (currentDocSchema === undefined || desiredDocSchema === undefined) {
38
+ return undefined;
39
+ }
40
+ return this.choices[Math.min(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))];
41
+ }
42
+ or(currentDocSchema, desiredDocSchema) {
43
+ if (currentDocSchema === undefined) {
44
+ return desiredDocSchema;
45
+ }
46
+ if (desiredDocSchema === undefined) {
47
+ return currentDocSchema;
48
+ }
49
+ return this.choices[Math.max(this.choices.indexOf(currentDocSchema), this.choices.indexOf(desiredDocSchema))];
50
+ }
51
+ validate(t) {
52
+ return t === undefined || (typeof t === "string" && this.choices.includes(t));
53
+ }
54
+ }
55
+ class IdCompressorProperty extends MultiChoice {
56
+ // document schema always wins!
57
+ and(currentDocSchema, desiredDocSchema) {
58
+ return currentDocSchema;
59
+ }
60
+ }
61
+ class CheckVersions {
62
+ or(currentDocSchema = [], desiredDocSchema = []) {
63
+ const set = new Set([...currentDocSchema, ...desiredDocSchema]);
64
+ return arrayToProp([...set.values()]);
65
+ }
66
+ // Once version is there, it stays there forever.
67
+ and(currentDocSchema = [], desiredDocSchema = []) {
68
+ return this.or(currentDocSchema, desiredDocSchema);
69
+ }
70
+ validate(t) {
71
+ return t === undefined || (Array.isArray(t) && !t.includes(pkgVersion));
72
+ }
73
+ }
74
+ /**
75
+ * Helper structure to valida if a schema is compatible with existing code.
76
+ */
77
+ const documentSchemaSupportedConfigs = {
78
+ explicitSchemaControl: new TrueOrUndefinedMax(),
79
+ idCompressorMode: new IdCompressorProperty(["delayed", "on"]),
80
+ opGroupingEnabled: new TrueOrUndefined(),
81
+ compressionLz4: new TrueOrUndefined(),
82
+ disallowedVersions: new CheckVersions(),
83
+ };
84
+ /**
85
+ * Checks if a given schema is compatible with current code, i.e. if current code can understand all the features of that schema.
86
+ * If schema is not compatible with current code, it throws an exception.
87
+ * @param documentSchema - current schema
88
+ */
89
+ function checkRuntimeCompatibility(documentSchema) {
90
+ // Back-compat - we can't do anything about legacy documents.
91
+ // There is no way to validate them, so we are taking a guess that safe deployment processes used by a given app
92
+ // do not run into compat problems.
93
+ if (documentSchema === undefined) {
94
+ return;
95
+ }
96
+ const msg = "Document can't be opened with current version of the code";
97
+ if (documentSchema.version !== currentDocumentVersionSchema) {
98
+ throw DataProcessingError.create(msg, "checkRuntimeCompat1", undefined, // message
99
+ {
100
+ runtimeSchemaVersion: documentSchema.version,
101
+ currentRuntimeSchemaVersion: currentDocumentVersionSchema,
102
+ });
103
+ }
104
+ let unknownProperty;
105
+ const regSeq = documentSchema.refSeq;
106
+ // defence in depth - it should not be possible to get here anything other than integer, but worth validating it.
107
+ if (typeof regSeq !== "number" || regSeq < 0 || !Number.isInteger(regSeq)) {
108
+ unknownProperty = "refSeq";
109
+ }
110
+ else if (documentSchema.runtime === null || typeof documentSchema.runtime !== "object") {
111
+ unknownProperty = "runtime";
112
+ }
113
+ else {
114
+ for (const [name, value] of Object.entries(documentSchema.runtime)) {
115
+ const validator = documentSchemaSupportedConfigs[name];
116
+ if (validator === undefined || !validator.validate(value)) {
117
+ unknownProperty = `runtime/${name}`;
118
+ }
119
+ }
120
+ }
121
+ if (unknownProperty !== undefined) {
122
+ const value = documentSchema[unknownProperty];
123
+ throw DataProcessingError.create(msg, "checkRuntimeCompat2", undefined, // message
124
+ {
125
+ codeVersion: currentDocumentVersionSchema,
126
+ property: unknownProperty,
127
+ value,
128
+ });
129
+ }
130
+ }
131
+ function and(currentDocSchema, desiredDocSchema) {
132
+ const runtime = {};
133
+ for (const key of new Set([
134
+ ...Object.keys(currentDocSchema.runtime),
135
+ ...Object.keys(desiredDocSchema.runtime),
136
+ ])) {
137
+ runtime[key] = documentSchemaSupportedConfigs[key].and(currentDocSchema.runtime[key], desiredDocSchema.runtime[key]);
138
+ }
139
+ return {
140
+ version: currentDocumentVersionSchema,
141
+ refSeq: currentDocSchema.refSeq,
142
+ runtime,
143
+ };
144
+ }
145
+ function or(currentDocSchema, desiredDocSchema) {
146
+ const runtime = {};
147
+ for (const key of new Set([
148
+ ...Object.keys(currentDocSchema.runtime),
149
+ ...Object.keys(desiredDocSchema.runtime),
150
+ ])) {
151
+ runtime[key] = documentSchemaSupportedConfigs[key].or(currentDocSchema.runtime[key], desiredDocSchema.runtime[key]);
152
+ }
153
+ return {
154
+ version: currentDocumentVersionSchema,
155
+ refSeq: currentDocSchema.refSeq,
156
+ runtime,
157
+ };
158
+ }
159
+ function same(currentDocSchema, desiredDocSchema) {
160
+ for (const key of new Set([
161
+ ...Object.keys(currentDocSchema.runtime),
162
+ ...Object.keys(desiredDocSchema.runtime),
163
+ ])) {
164
+ // If schemas differ only by type of behavior, then we should not send schema change ops!
165
+ if (key !== "explicitSchemaControl" &&
166
+ currentDocSchema.runtime[key] !== desiredDocSchema.runtime[key]) {
167
+ return false;
168
+ }
169
+ }
170
+ return true;
171
+ }
172
+ function boolToProp(b) {
173
+ return b ? true : undefined;
174
+ }
175
+ function arrayToProp(arr) {
176
+ return arr.length === 0 ? undefined : arr;
177
+ }
178
+ /* eslint-disable jsdoc/check-indentation */
179
+ /**
180
+ * Controller of document schema.
181
+ *
182
+ * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md
183
+ *
184
+ * This class manages current document schema and transitions between document schemas.
185
+ * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data
186
+ * (summary and op format), features & capabilities that a version of runtime has to support and understand in
187
+ * order to collaborate on a document.
188
+ * New features that modify document format have to be included in document schema definition.
189
+ * Usage of such features could only happen after document schema has been updated to reflect such feature.
190
+ *
191
+ * This formality allows clients that do not understand such features to fail right away when they observe
192
+ * document schema listing capabilities that such client does not understand.
193
+ * Old clients will fail in predictable way. This allows us to
194
+ * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.
195
+ * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are
196
+ * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along
197
+ * and potentially corrupt the document. This is especially true for summarizer client, who could simply "undo"
198
+ * changes it does not understands.
199
+ *
200
+ * It's important to note how it overlaps with feature gates and safe velocity.
201
+ * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.
202
+ * But, developers (through code deployment or feature gates) could disable usage of such features.
203
+ * That will stop a process of further document schema changes (for documents that were not using such feature).
204
+ * And documents that already list such capability in their schema will continue to do so. Later ensures that old
205
+ * clients who do not understand such feature will continue to fail to open such documents, as such documents very
206
+ * likely contain data in a new format.
207
+ *
208
+ * Controller operates with 4 schemas:
209
+ * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).
210
+ * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).
211
+ * - session schema - current session schema. It's "and" of the above two schemas.
212
+ * - future schema - "or" of document and desires schemas.
213
+ *
214
+ * "or" & "and" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.
215
+ * But for other properties it's more nuanced.
216
+ *
217
+ * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to
218
+ * future schema.
219
+ *
220
+ * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.
221
+ *
222
+ * There are two modes this class can operate:
223
+ * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,
224
+ * right away, and new features are available right away
225
+ * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.
226
+ * However code should assume that any new features that were not enabled in a given document will not be available
227
+ * for a given session. That's because this session may never send any ops (including read-only documents). Or it may
228
+ * fail to convert schema.
229
+ * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),
230
+ * then eventually all documents that are modified will have that feature reflected in their schema. It could require
231
+ * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults
232
+ * schema on document load).
233
+ *
234
+ * How schemas are changed (in non-legacy mode):
235
+ * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.
236
+ * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.
237
+ * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will
238
+ * reference old schema that is no longer in effect.
239
+ * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do
240
+ * recalc and decide if schema needs to be changed or not).
241
+ *
242
+ * @alpha
243
+ */
244
+ export class DocumentsSchemaController {
245
+ /**
246
+ * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.
247
+ * @param existing - Is the document existing document, or a new doc.
248
+ * @param documentMetadataSchema - current document's schema, if present.
249
+ * @param features - features of the document schema that current session wants to see enabled.
250
+ * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)
251
+ */
252
+ constructor(existing, documentMetadataSchema, features, onSchemaChange) {
253
+ this.onSchemaChange = onSchemaChange;
254
+ this.sendOp = true;
255
+ checkRuntimeCompatibility(documentMetadataSchema);
256
+ // For simplicity, let's only support new schema features for explicit schema control mode
257
+ assert(features.disallowedVersions.length === 0 || features.explicitSchemaControl, 0x949 /* not supported */);
258
+ // Desired schema by this session - almost all props are coming from arguments
259
+ this.desiredSchema = {
260
+ version: currentDocumentVersionSchema,
261
+ refSeq: documentMetadataSchema?.refSeq ?? 0,
262
+ runtime: {
263
+ explicitSchemaControl: boolToProp(features.explicitSchemaControl),
264
+ compressionLz4: boolToProp(features.compressionLz4),
265
+ idCompressorMode: features.idCompressorMode,
266
+ opGroupingEnabled: boolToProp(features.opGroupingEnabled),
267
+ disallowedVersions: arrayToProp(features.disallowedVersions),
268
+ },
269
+ };
270
+ // Schema coming from document metadata (snapshot we loaded from), or if no document exists
271
+ // (this is a new document) then this is the same as desiredSchema (same as session schema in such case).
272
+ // Latter is importnat sure that's what will go into summary.
273
+ this.documentSchema = !existing
274
+ ? this.desiredSchema
275
+ : documentMetadataSchema ??
276
+ ({
277
+ version: currentDocumentVersionSchema,
278
+ // see comment in summarizeDocumentSchema() on why it has to stay zero
279
+ refSeq: 0,
280
+ // If it's existing document and it has no schema, then it was written by legacy client.
281
+ // If it's a new document, then we define it's legacy-related behaviors.
282
+ runtime: {
283
+ explicitSchemaControl: boolToProp(!existing && features.explicitSchemaControl),
284
+ },
285
+ });
286
+ // Use legacy behavior only if both document and options tell us to use legacy.
287
+ // Otherwise it's no longer legacy time!
288
+ this.explicitSchemaControl =
289
+ this.documentSchema.runtime.explicitSchemaControl === true ||
290
+ features.explicitSchemaControl;
291
+ // Calculate
292
+ // - current session schema (overlap of document schema and desired schema)
293
+ // - future schema to propose (concatination of document schema and desired schema)
294
+ if (!this.explicitSchemaControl || !existing) {
295
+ this.sessionSchema = this.desiredSchema;
296
+ assert(boolToProp(this.explicitSchemaControl) ===
297
+ this.sessionSchema.runtime.explicitSchemaControl, 0x94a /* explicitSchemaControl */);
298
+ this.futureSchema = undefined;
299
+ }
300
+ else {
301
+ this.sessionSchema = and(this.documentSchema, this.desiredSchema);
302
+ this.futureSchema = or(this.documentSchema, this.desiredSchema);
303
+ assert(this.sessionSchema.runtime.explicitSchemaControl === true, 0x94b /* legacy */);
304
+ assert(this.futureSchema.runtime.explicitSchemaControl === true, 0x94c /* legacy */);
305
+ if (same(this.documentSchema, this.futureSchema)) {
306
+ this.futureSchema = undefined;
307
+ }
308
+ }
309
+ // Validate that schema we are operating in is actually a schema we consider compatible with current runtime.
310
+ checkRuntimeCompatibility(this.sessionSchema);
311
+ checkRuntimeCompatibility(this.futureSchema);
312
+ }
313
+ summarizeDocumentSchema(refSeq) {
314
+ // For legacy behavior, we could write nothing (return undefined).
315
+ // It does not buy us anything, as whatever written in summary does not actually impact clients operating in legacy mode.
316
+ // But writing current used config (and assuming most of the clients settle on same config over time) will help with transition
317
+ // out of legacy mode, as clients transitioning out of it would be able to use all the
318
+ // features that are mentioned in schema right away, without a need to go through schema transition (and thus for a session or
319
+ // two losing ability to use all the features)
320
+ const schema = this.explicitSchemaControl ? this.documentSchema : this.desiredSchema;
321
+ // It's important to keep refSeq at zero in legacy mode, such that transition out of it is simple and we do not have
322
+ // race conditions. If we put any other number (including latest seq number), then we will have two clients
323
+ // (loading from two different summaries) with different numbers, and eventual consistency will be broken as schema
324
+ // change ops will be interpretted differently by those two clients.
325
+ assert(this.explicitSchemaControl || schema.refSeq === 0, 0x94d /* refSeq should be zero */);
326
+ return schema;
327
+ }
328
+ /**
329
+ * Called by Container runtime whenever it is about to send some op.
330
+ * 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.
331
+ * @returns Optional message to send.
332
+ */
333
+ maybeSendSchemaMessage() {
334
+ if (this.sendOp && this.futureSchema !== undefined) {
335
+ assert(this.explicitSchemaControl &&
336
+ this.futureSchema.runtime.explicitSchemaControl === true, 0x94e /* not legacy */);
337
+ return {
338
+ ...this.futureSchema,
339
+ refSeq: this.documentSchema.refSeq,
340
+ };
341
+ }
342
+ this.sendOp = false;
343
+ }
344
+ /**
345
+ * Process document schema change message
346
+ * Called by ContainerRuntime whenever it sees document schema messages.
347
+ * @param content - content of the message
348
+ * @param local - whether op is local
349
+ * @param sequenceNumber - sequence number of the op
350
+ * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)
351
+ */
352
+ processDocumentSchemaOp(content, local, sequenceNumber) {
353
+ assert(content.refSeq <= this.documentSchema.refSeq, 0x94f /* did we lose a message somewhere? */);
354
+ assert(this.documentSchema.refSeq < sequenceNumber, 0x950 /* time should move forward only! */);
355
+ if (content.refSeq !== this.documentSchema.refSeq) {
356
+ // CAS failed
357
+ return false;
358
+ }
359
+ // This assert should be after checking for successful CAS above.
360
+ // This will ensure we do not trip on our own messages that are no longer wanted as we processed someone else schema change message.
361
+ assert(!local || (this.explicitSchemaControl && this.futureSchema !== undefined), 0x951 /* not sending ops */);
362
+ // Changes are in effect. Immediately check that this client understands these changes
363
+ checkRuntimeCompatibility(content);
364
+ const schema = { ...content, refSeq: sequenceNumber };
365
+ this.documentSchema = schema;
366
+ this.sessionSchema = and(this.documentSchema, this.desiredSchema);
367
+ // legacy behavior is automatically off for the document once someone sends a schema op -
368
+ // from now on it's fully controlled by ops.
369
+ // This is very important, as summarizeDocumentSchema() should use this new schema!
370
+ this.explicitSchemaControl = true;
371
+ // Stop attempting changing schema.
372
+ // If it was local op, then we succeeded and do not need to try again.
373
+ // If it was remote op, then some changes happened to schema.
374
+ // We would need to recalculate this.futureSchema by merging changes that we just received.
375
+ // Avoid this complexity for now - a new client session (loading from new summary with these changes)
376
+ // will automatically do this recalculation and will figure out
377
+ this.futureSchema = undefined;
378
+ this.onSchemaChange(this.sessionSchema);
379
+ return true;
380
+ }
381
+ onDisconnect() {
382
+ this.sendOp = true;
383
+ }
384
+ }
385
+ /* eslint-enable jsdoc/check-indentation */
386
+ //# sourceMappingURL=documentSchema.js.map