@fluidframework/container-runtime 2.0.0-internal.6.1.2 → 2.0.0-internal.6.2.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 (363) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +4 -3
  3. package/dist/batchTracker.d.ts +1 -1
  4. package/dist/batchTracker.js +1 -1
  5. package/dist/batchTracker.js.map +1 -1
  6. package/dist/blobManager.d.ts +4 -20
  7. package/dist/blobManager.d.ts.map +1 -1
  8. package/dist/blobManager.js +47 -125
  9. package/dist/blobManager.js.map +1 -1
  10. package/dist/containerRuntime.d.ts +82 -14
  11. package/dist/containerRuntime.d.ts.map +1 -1
  12. package/dist/containerRuntime.js +236 -138
  13. package/dist/containerRuntime.js.map +1 -1
  14. package/dist/dataStore.d.ts.map +1 -1
  15. package/dist/dataStore.js +1 -2
  16. package/dist/dataStore.js.map +1 -1
  17. package/dist/dataStoreContext.d.ts.map +1 -1
  18. package/dist/dataStoreContext.js +4 -5
  19. package/dist/dataStoreContext.js.map +1 -1
  20. package/dist/dataStoreContexts.d.ts +1 -2
  21. package/dist/dataStoreContexts.d.ts.map +1 -1
  22. package/dist/dataStoreContexts.js.map +1 -1
  23. package/dist/dataStoreRegistry.js +2 -2
  24. package/dist/dataStoreRegistry.js.map +1 -1
  25. package/dist/dataStores.d.ts.map +1 -1
  26. package/dist/dataStores.js +4 -5
  27. package/dist/dataStores.js.map +1 -1
  28. package/dist/error.d.ts +14 -0
  29. package/dist/error.d.ts.map +1 -0
  30. package/dist/error.js +21 -0
  31. package/dist/error.js.map +1 -0
  32. package/dist/gc/garbageCollection.d.ts +1 -1
  33. package/dist/gc/garbageCollection.d.ts.map +1 -1
  34. package/dist/gc/garbageCollection.js +23 -5
  35. package/dist/gc/garbageCollection.js.map +1 -1
  36. package/dist/gc/gcConfigs.d.ts.map +1 -1
  37. package/dist/gc/gcConfigs.js +5 -3
  38. package/dist/gc/gcConfigs.js.map +1 -1
  39. package/dist/gc/gcDefinitions.d.ts +2 -0
  40. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  41. package/dist/gc/gcDefinitions.js.map +1 -1
  42. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  43. package/dist/gc/gcTelemetry.js +2 -0
  44. package/dist/gc/gcTelemetry.js.map +1 -1
  45. package/dist/id-compressor/appendOnlySortedMap.d.ts +8 -30
  46. package/dist/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
  47. package/dist/id-compressor/appendOnlySortedMap.js +25 -67
  48. package/dist/id-compressor/appendOnlySortedMap.js.map +1 -1
  49. package/dist/id-compressor/finalSpace.d.ts +29 -0
  50. package/dist/id-compressor/finalSpace.d.ts.map +1 -0
  51. package/dist/id-compressor/finalSpace.js +62 -0
  52. package/dist/id-compressor/finalSpace.js.map +1 -0
  53. package/dist/id-compressor/idCompressor.d.ts +25 -250
  54. package/dist/id-compressor/idCompressor.d.ts.map +1 -1
  55. package/dist/id-compressor/idCompressor.js +385 -1149
  56. package/dist/id-compressor/idCompressor.js.map +1 -1
  57. package/dist/id-compressor/identifiers.d.ts +32 -0
  58. package/dist/id-compressor/identifiers.d.ts.map +1 -0
  59. package/dist/id-compressor/identifiers.js +15 -0
  60. package/dist/id-compressor/identifiers.js.map +1 -0
  61. package/dist/id-compressor/index.d.ts +5 -6
  62. package/dist/id-compressor/index.d.ts.map +1 -1
  63. package/dist/id-compressor/index.js +20 -26
  64. package/dist/id-compressor/index.js.map +1 -1
  65. package/dist/id-compressor/persistanceUtilities.d.ts +22 -0
  66. package/dist/id-compressor/persistanceUtilities.d.ts.map +1 -0
  67. package/dist/id-compressor/persistanceUtilities.js +43 -0
  68. package/dist/id-compressor/persistanceUtilities.js.map +1 -0
  69. package/dist/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
  70. package/dist/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
  71. package/dist/id-compressor/sessionSpaceNormalizer.js +80 -0
  72. package/dist/id-compressor/sessionSpaceNormalizer.js.map +1 -0
  73. package/dist/id-compressor/sessions.d.ts +115 -0
  74. package/dist/id-compressor/sessions.d.ts.map +1 -0
  75. package/dist/id-compressor/sessions.js +305 -0
  76. package/dist/id-compressor/sessions.js.map +1 -0
  77. package/dist/id-compressor/utilities.d.ts +49 -0
  78. package/dist/id-compressor/utilities.d.ts.map +1 -0
  79. package/dist/id-compressor/utilities.js +166 -0
  80. package/dist/id-compressor/utilities.js.map +1 -0
  81. package/dist/index.d.ts +3 -3
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +6 -4
  84. package/dist/index.js.map +1 -1
  85. package/dist/opLifecycle/opCompressor.d.ts.map +1 -1
  86. package/dist/opLifecycle/opCompressor.js +1 -2
  87. package/dist/opLifecycle/opCompressor.js.map +1 -1
  88. package/dist/opLifecycle/opSplitter.d.ts.map +1 -1
  89. package/dist/opLifecycle/opSplitter.js +2 -3
  90. package/dist/opLifecycle/opSplitter.js.map +1 -1
  91. package/dist/opLifecycle/outbox.d.ts +1 -0
  92. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  93. package/dist/opLifecycle/outbox.js +10 -11
  94. package/dist/opLifecycle/outbox.js.map +1 -1
  95. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  96. package/dist/opLifecycle/remoteMessageProcessor.js +11 -5
  97. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  98. package/dist/packageVersion.d.ts +1 -1
  99. package/dist/packageVersion.js +1 -1
  100. package/dist/packageVersion.js.map +1 -1
  101. package/dist/pendingStateManager.d.ts +12 -5
  102. package/dist/pendingStateManager.d.ts.map +1 -1
  103. package/dist/pendingStateManager.js +24 -10
  104. package/dist/pendingStateManager.js.map +1 -1
  105. package/dist/scheduleManager.d.ts.map +1 -1
  106. package/dist/scheduleManager.js +4 -5
  107. package/dist/scheduleManager.js.map +1 -1
  108. package/dist/summary/index.d.ts +2 -2
  109. package/dist/summary/index.d.ts.map +1 -1
  110. package/dist/summary/index.js +2 -1
  111. package/dist/summary/index.js.map +1 -1
  112. package/dist/summary/orderedClientElection.d.ts +1 -2
  113. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  114. package/dist/summary/orderedClientElection.js +2 -3
  115. package/dist/summary/orderedClientElection.js.map +1 -1
  116. package/dist/summary/runningSummarizer.d.ts +27 -4
  117. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  118. package/dist/summary/runningSummarizer.js +237 -66
  119. package/dist/summary/runningSummarizer.js.map +1 -1
  120. package/dist/summary/summarizer.d.ts +6 -5
  121. package/dist/summary/summarizer.d.ts.map +1 -1
  122. package/dist/summary/summarizer.js +70 -67
  123. package/dist/summary/summarizer.js.map +1 -1
  124. package/dist/summary/summarizerClientElection.d.ts +1 -1
  125. package/dist/summary/summarizerClientElection.d.ts.map +1 -1
  126. package/dist/summary/summarizerClientElection.js.map +1 -1
  127. package/dist/summary/summarizerTypes.d.ts +38 -25
  128. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  129. package/dist/summary/summarizerTypes.js.map +1 -1
  130. package/dist/summary/summaryCollection.d.ts +1 -2
  131. package/dist/summary/summaryCollection.d.ts.map +1 -1
  132. package/dist/summary/summaryCollection.js.map +1 -1
  133. package/dist/summary/summaryGenerator.d.ts +9 -3
  134. package/dist/summary/summaryGenerator.d.ts.map +1 -1
  135. package/dist/summary/summaryGenerator.js +42 -38
  136. package/dist/summary/summaryGenerator.js.map +1 -1
  137. package/dist/summary/summaryManager.d.ts +7 -6
  138. package/dist/summary/summaryManager.d.ts.map +1 -1
  139. package/dist/summary/summaryManager.js +22 -15
  140. package/dist/summary/summaryManager.js.map +1 -1
  141. package/lib/batchTracker.d.ts +1 -1
  142. package/lib/batchTracker.js +1 -1
  143. package/lib/batchTracker.js.map +1 -1
  144. package/lib/blobManager.d.ts +4 -20
  145. package/lib/blobManager.d.ts.map +1 -1
  146. package/lib/blobManager.js +46 -124
  147. package/lib/blobManager.js.map +1 -1
  148. package/lib/containerRuntime.d.ts +82 -14
  149. package/lib/containerRuntime.d.ts.map +1 -1
  150. package/lib/containerRuntime.js +223 -123
  151. package/lib/containerRuntime.js.map +1 -1
  152. package/lib/dataStore.d.ts.map +1 -1
  153. package/lib/dataStore.js +1 -2
  154. package/lib/dataStore.js.map +1 -1
  155. package/lib/dataStoreContext.d.ts.map +1 -1
  156. package/lib/dataStoreContext.js +1 -2
  157. package/lib/dataStoreContext.js.map +1 -1
  158. package/lib/dataStoreContexts.d.ts +1 -2
  159. package/lib/dataStoreContexts.d.ts.map +1 -1
  160. package/lib/dataStoreContexts.js.map +1 -1
  161. package/lib/dataStoreRegistry.js +1 -1
  162. package/lib/dataStoreRegistry.js.map +1 -1
  163. package/lib/dataStores.d.ts.map +1 -1
  164. package/lib/dataStores.js +1 -2
  165. package/lib/dataStores.js.map +1 -1
  166. package/lib/error.d.ts +14 -0
  167. package/lib/error.d.ts.map +1 -0
  168. package/lib/error.js +17 -0
  169. package/lib/error.js.map +1 -0
  170. package/lib/gc/garbageCollection.d.ts +1 -1
  171. package/lib/gc/garbageCollection.d.ts.map +1 -1
  172. package/lib/gc/garbageCollection.js +22 -4
  173. package/lib/gc/garbageCollection.js.map +1 -1
  174. package/lib/gc/gcConfigs.d.ts.map +1 -1
  175. package/lib/gc/gcConfigs.js +3 -1
  176. package/lib/gc/gcConfigs.js.map +1 -1
  177. package/lib/gc/gcDefinitions.d.ts +2 -0
  178. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  179. package/lib/gc/gcDefinitions.js.map +1 -1
  180. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  181. package/lib/gc/gcTelemetry.js +2 -0
  182. package/lib/gc/gcTelemetry.js.map +1 -1
  183. package/lib/id-compressor/appendOnlySortedMap.d.ts +8 -30
  184. package/lib/id-compressor/appendOnlySortedMap.d.ts.map +1 -1
  185. package/lib/id-compressor/appendOnlySortedMap.js +24 -65
  186. package/lib/id-compressor/appendOnlySortedMap.js.map +1 -1
  187. package/lib/id-compressor/finalSpace.d.ts +29 -0
  188. package/lib/id-compressor/finalSpace.d.ts.map +1 -0
  189. package/lib/id-compressor/finalSpace.js +58 -0
  190. package/lib/id-compressor/finalSpace.js.map +1 -0
  191. package/lib/id-compressor/idCompressor.d.ts +25 -250
  192. package/lib/id-compressor/idCompressor.d.ts.map +1 -1
  193. package/lib/id-compressor/idCompressor.js +381 -1139
  194. package/lib/id-compressor/idCompressor.js.map +1 -1
  195. package/lib/id-compressor/identifiers.d.ts +32 -0
  196. package/lib/id-compressor/identifiers.d.ts.map +1 -0
  197. package/lib/id-compressor/identifiers.js +11 -0
  198. package/lib/id-compressor/identifiers.js.map +1 -0
  199. package/lib/id-compressor/index.d.ts +5 -6
  200. package/lib/id-compressor/index.d.ts.map +1 -1
  201. package/lib/id-compressor/index.js +5 -6
  202. package/lib/id-compressor/index.js.map +1 -1
  203. package/lib/id-compressor/persistanceUtilities.d.ts +22 -0
  204. package/lib/id-compressor/persistanceUtilities.d.ts.map +1 -0
  205. package/lib/id-compressor/persistanceUtilities.js +34 -0
  206. package/lib/id-compressor/persistanceUtilities.js.map +1 -0
  207. package/lib/id-compressor/sessionSpaceNormalizer.d.ts +46 -0
  208. package/lib/id-compressor/sessionSpaceNormalizer.d.ts.map +1 -0
  209. package/lib/id-compressor/sessionSpaceNormalizer.js +76 -0
  210. package/lib/id-compressor/sessionSpaceNormalizer.js.map +1 -0
  211. package/lib/id-compressor/sessions.d.ts +115 -0
  212. package/lib/id-compressor/sessions.d.ts.map +1 -0
  213. package/lib/id-compressor/sessions.js +290 -0
  214. package/lib/id-compressor/sessions.js.map +1 -0
  215. package/lib/id-compressor/utilities.d.ts +49 -0
  216. package/lib/id-compressor/utilities.d.ts.map +1 -0
  217. package/lib/id-compressor/utilities.js +148 -0
  218. package/lib/id-compressor/utilities.js.map +1 -0
  219. package/lib/index.d.ts +3 -3
  220. package/lib/index.d.ts.map +1 -1
  221. package/lib/index.js +2 -2
  222. package/lib/index.js.map +1 -1
  223. package/lib/opLifecycle/opCompressor.d.ts.map +1 -1
  224. package/lib/opLifecycle/opCompressor.js +1 -2
  225. package/lib/opLifecycle/opCompressor.js.map +1 -1
  226. package/lib/opLifecycle/opSplitter.d.ts.map +1 -1
  227. package/lib/opLifecycle/opSplitter.js +1 -2
  228. package/lib/opLifecycle/opSplitter.js.map +1 -1
  229. package/lib/opLifecycle/outbox.d.ts +1 -0
  230. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  231. package/lib/opLifecycle/outbox.js +6 -7
  232. package/lib/opLifecycle/outbox.js.map +1 -1
  233. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  234. package/lib/opLifecycle/remoteMessageProcessor.js +12 -6
  235. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  236. package/lib/packageVersion.d.ts +1 -1
  237. package/lib/packageVersion.js +1 -1
  238. package/lib/packageVersion.js.map +1 -1
  239. package/lib/pendingStateManager.d.ts +12 -5
  240. package/lib/pendingStateManager.d.ts.map +1 -1
  241. package/lib/pendingStateManager.js +21 -7
  242. package/lib/pendingStateManager.js.map +1 -1
  243. package/lib/scheduleManager.d.ts.map +1 -1
  244. package/lib/scheduleManager.js +1 -2
  245. package/lib/scheduleManager.js.map +1 -1
  246. package/lib/summary/index.d.ts +2 -2
  247. package/lib/summary/index.d.ts.map +1 -1
  248. package/lib/summary/index.js +1 -1
  249. package/lib/summary/index.js.map +1 -1
  250. package/lib/summary/orderedClientElection.d.ts +1 -2
  251. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  252. package/lib/summary/orderedClientElection.js +1 -2
  253. package/lib/summary/orderedClientElection.js.map +1 -1
  254. package/lib/summary/runningSummarizer.d.ts +27 -4
  255. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  256. package/lib/summary/runningSummarizer.js +237 -66
  257. package/lib/summary/runningSummarizer.js.map +1 -1
  258. package/lib/summary/summarizer.d.ts +6 -5
  259. package/lib/summary/summarizer.d.ts.map +1 -1
  260. package/lib/summary/summarizer.js +68 -65
  261. package/lib/summary/summarizer.js.map +1 -1
  262. package/lib/summary/summarizerClientElection.d.ts +1 -1
  263. package/lib/summary/summarizerClientElection.d.ts.map +1 -1
  264. package/lib/summary/summarizerClientElection.js.map +1 -1
  265. package/lib/summary/summarizerTypes.d.ts +38 -25
  266. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  267. package/lib/summary/summarizerTypes.js.map +1 -1
  268. package/lib/summary/summaryCollection.d.ts +1 -2
  269. package/lib/summary/summaryCollection.d.ts.map +1 -1
  270. package/lib/summary/summaryCollection.js.map +1 -1
  271. package/lib/summary/summaryGenerator.d.ts +9 -3
  272. package/lib/summary/summaryGenerator.d.ts.map +1 -1
  273. package/lib/summary/summaryGenerator.js +43 -39
  274. package/lib/summary/summaryGenerator.js.map +1 -1
  275. package/lib/summary/summaryManager.d.ts +7 -6
  276. package/lib/summary/summaryManager.d.ts.map +1 -1
  277. package/lib/summary/summaryManager.js +23 -16
  278. package/lib/summary/summaryManager.js.map +1 -1
  279. package/package.json +26 -23
  280. package/src/batchTracker.ts +1 -1
  281. package/src/blobManager.ts +57 -146
  282. package/src/containerRuntime.ts +331 -158
  283. package/src/dataStore.ts +1 -2
  284. package/src/dataStoreContext.ts +3 -6
  285. package/src/dataStoreContexts.ts +1 -2
  286. package/src/dataStoreRegistry.ts +1 -1
  287. package/src/dataStores.ts +3 -5
  288. package/src/error.ts +18 -0
  289. package/src/gc/garbageCollection.ts +38 -5
  290. package/src/gc/gcConfigs.ts +4 -2
  291. package/src/gc/gcDefinitions.ts +2 -0
  292. package/src/gc/gcTelemetry.ts +2 -0
  293. package/src/id-compressor/appendOnlySortedMap.ts +25 -86
  294. package/src/id-compressor/finalSpace.ts +67 -0
  295. package/src/id-compressor/idCompressor.ts +455 -1681
  296. package/src/id-compressor/identifiers.ts +42 -0
  297. package/src/id-compressor/index.ts +11 -20
  298. package/src/id-compressor/persistanceUtilities.ts +58 -0
  299. package/src/id-compressor/sessionSpaceNormalizer.ts +83 -0
  300. package/src/id-compressor/sessions.ts +405 -0
  301. package/src/id-compressor/utilities.ts +187 -0
  302. package/src/index.ts +7 -1
  303. package/src/opLifecycle/opCompressor.ts +1 -2
  304. package/src/opLifecycle/opSplitter.ts +4 -4
  305. package/src/opLifecycle/outbox.ts +13 -10
  306. package/src/opLifecycle/remoteMessageProcessor.ts +19 -6
  307. package/src/packageVersion.ts +1 -1
  308. package/src/pendingStateManager.ts +49 -27
  309. package/src/scheduleManager.ts +5 -4
  310. package/src/summary/index.ts +3 -1
  311. package/src/summary/orderedClientElection.ts +6 -4
  312. package/src/summary/runningSummarizer.ts +276 -95
  313. package/src/summary/summarizer.ts +22 -12
  314. package/src/summary/summarizerClientElection.ts +1 -1
  315. package/src/summary/summarizerTypes.ts +40 -25
  316. package/src/summary/summaryCollection.ts +1 -2
  317. package/src/summary/summaryGenerator.ts +49 -52
  318. package/src/summary/summaryManager.ts +33 -11
  319. package/dist/id-compressor/idRange.d.ts +0 -11
  320. package/dist/id-compressor/idRange.d.ts.map +0 -1
  321. package/dist/id-compressor/idRange.js +0 -29
  322. package/dist/id-compressor/idRange.js.map +0 -1
  323. package/dist/id-compressor/numericUuid.d.ts +0 -59
  324. package/dist/id-compressor/numericUuid.d.ts.map +0 -1
  325. package/dist/id-compressor/numericUuid.js +0 -325
  326. package/dist/id-compressor/numericUuid.js.map +0 -1
  327. package/dist/id-compressor/sessionIdNormalizer.d.ts +0 -138
  328. package/dist/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
  329. package/dist/id-compressor/sessionIdNormalizer.js +0 -483
  330. package/dist/id-compressor/sessionIdNormalizer.js.map +0 -1
  331. package/dist/id-compressor/utils.d.ts +0 -57
  332. package/dist/id-compressor/utils.d.ts.map +0 -1
  333. package/dist/id-compressor/utils.js +0 -90
  334. package/dist/id-compressor/utils.js.map +0 -1
  335. package/dist/id-compressor/uuidUtilities.d.ts +0 -28
  336. package/dist/id-compressor/uuidUtilities.d.ts.map +0 -1
  337. package/dist/id-compressor/uuidUtilities.js +0 -104
  338. package/dist/id-compressor/uuidUtilities.js.map +0 -1
  339. package/lib/id-compressor/idRange.d.ts +0 -11
  340. package/lib/id-compressor/idRange.d.ts.map +0 -1
  341. package/lib/id-compressor/idRange.js +0 -25
  342. package/lib/id-compressor/idRange.js.map +0 -1
  343. package/lib/id-compressor/numericUuid.d.ts +0 -59
  344. package/lib/id-compressor/numericUuid.d.ts.map +0 -1
  345. package/lib/id-compressor/numericUuid.js +0 -315
  346. package/lib/id-compressor/numericUuid.js.map +0 -1
  347. package/lib/id-compressor/sessionIdNormalizer.d.ts +0 -138
  348. package/lib/id-compressor/sessionIdNormalizer.d.ts.map +0 -1
  349. package/lib/id-compressor/sessionIdNormalizer.js +0 -479
  350. package/lib/id-compressor/sessionIdNormalizer.js.map +0 -1
  351. package/lib/id-compressor/utils.d.ts +0 -57
  352. package/lib/id-compressor/utils.d.ts.map +0 -1
  353. package/lib/id-compressor/utils.js +0 -79
  354. package/lib/id-compressor/utils.js.map +0 -1
  355. package/lib/id-compressor/uuidUtilities.d.ts +0 -28
  356. package/lib/id-compressor/uuidUtilities.d.ts.map +0 -1
  357. package/lib/id-compressor/uuidUtilities.js +0 -96
  358. package/lib/id-compressor/uuidUtilities.js.map +0 -1
  359. package/src/id-compressor/idRange.ts +0 -35
  360. package/src/id-compressor/numericUuid.ts +0 -383
  361. package/src/id-compressor/sessionIdNormalizer.ts +0 -609
  362. package/src/id-compressor/utils.ts +0 -114
  363. package/src/id-compressor/uuidUtilities.ts +0 -120
@@ -30,8 +30,9 @@ import {
30
30
  } from "@fluidframework/container-runtime-definitions";
31
31
  import { AttachState, ICriticalContainerError } from "@fluidframework/container-definitions";
32
32
  import {
33
- LoggingError,
34
33
  createChildMonitoringContext,
34
+ GenericError,
35
+ LoggingError,
35
36
  MonitoringContext,
36
37
  PerformanceEvent,
37
38
  } from "@fluidframework/telemetry-utils";
@@ -40,7 +41,7 @@ import {
40
41
  ISummaryTreeWithStats,
41
42
  ITelemetryContext,
42
43
  } from "@fluidframework/runtime-definitions";
43
- import { GenericError } from "@fluidframework/container-utils";
44
+
44
45
  import { ContainerRuntime, TombstoneResponseHeaderKey } from "./containerRuntime";
45
46
  import { sendGCUnexpectedUsageEvent, sweepAttachmentBlobsKey, throwOnTombstoneLoadKey } from "./gc";
46
47
  import { Throttler, formExponentialFn, IThrottler } from "./throttler";
@@ -122,20 +123,12 @@ export type IBlobManagerRuntime = Pick<
122
123
  Pick<ContainerRuntime, "gcTombstoneEnforcementAllowed"> &
123
124
  TypedEventEmitter<IContainerRuntimeEvents>;
124
125
 
125
- // Note that while offline we "submit" an op before uploading the blob, but we always
126
- // expect blobs to be uploaded before we actually see the op round-trip
127
- export enum PendingBlobStatus {
128
- OnlinePendingUpload,
129
- OnlinePendingOp,
130
- OfflinePendingUpload,
131
- OfflinePendingOp,
132
- }
133
-
134
126
  type ICreateBlobResponseWithTTL = ICreateBlobResponse & Partial<Record<"minTTLInSeconds", number>>;
135
127
 
136
128
  interface PendingBlob {
137
129
  blob: ArrayBufferLike;
138
- status: PendingBlobStatus;
130
+ uploading?: boolean;
131
+ opsent?: boolean;
139
132
  storageId?: string;
140
133
  handleP: Deferred<BlobHandle>;
141
134
  uploadP?: Promise<ICreateBlobResponse | void>;
@@ -144,7 +137,6 @@ interface PendingBlob {
144
137
  attached?: boolean;
145
138
  acked?: boolean;
146
139
  abortSignal?: AbortSignal;
147
- opsent?: boolean;
148
140
  }
149
141
 
150
142
  export interface IPendingBlobs {
@@ -177,9 +169,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
177
169
  private readonly redirectTable: Map<string, string | undefined>;
178
170
 
179
171
  /**
180
- * Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.
181
- * Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so
182
- * we must save it. This is true for both the online and offline flow.
172
+ * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.
183
173
  */
184
174
  private readonly pendingBlobs: Map<string, PendingBlob> = new Map();
185
175
 
@@ -245,8 +235,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
245
235
  this.runtime.gcTombstoneEnforcementAllowed &&
246
236
  this.runtime.clientDetails.type !== summarizerClientType;
247
237
 
248
- this.runtime.on("disconnected", () => this.onDisconnected());
249
-
250
238
  this.redirectTable = this.load(snapshot);
251
239
 
252
240
  // Begin uploading stashed blobs from previous container instance
@@ -261,7 +249,8 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
261
249
  if (entry.minTTLInSeconds - timeLapseSinceLocalUpload > entry.minTTLInSeconds / 2) {
262
250
  this.pendingBlobs.set(localId, {
263
251
  blob,
264
- status: PendingBlobStatus.OfflinePendingOp,
252
+ uploading: false,
253
+ opsent: true,
265
254
  handleP: new Deferred(),
266
255
  storageId,
267
256
  uploadP: undefined,
@@ -275,11 +264,12 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
275
264
  }
276
265
  this.pendingBlobs.set(localId, {
277
266
  blob,
278
- status: PendingBlobStatus.OfflinePendingUpload,
267
+ uploading: true,
279
268
  handleP: new Deferred(),
280
269
  uploadP: this.uploadBlob(localId, blob),
281
270
  attached,
282
271
  acked,
272
+ opsent: true,
283
273
  });
284
274
  });
285
275
 
@@ -289,13 +279,11 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
289
279
  pendingEntry !== undefined,
290
280
  0x725 /* Must have pending blob entry for upcoming op */,
291
281
  );
292
- pendingEntry.opsent = true;
293
282
  if (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {
294
283
  const secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;
295
284
  const expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;
296
285
  this.mc.logger.sendTelemetryEvent({
297
286
  eventName: "sendBlobAttach",
298
- entryStatus: pendingEntry.status,
299
287
  secondsSinceUpload,
300
288
  minTTLInSeconds: pendingEntry.minTTLInSeconds,
301
289
  expired,
@@ -309,27 +297,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
309
297
  {
310
298
  localId,
311
299
  blobId,
312
- entryStatus: pendingEntry.status,
313
300
  secondsSinceUpload,
314
301
  },
315
302
  ),
316
303
  );
317
304
  }
318
305
  }
306
+ pendingEntry.opsent = true;
319
307
  return sendBlobAttachOp(localId, blobId);
320
308
  };
321
309
  }
322
310
 
323
- private get pendingOfflineUploads() {
324
- return Array.from(this.pendingBlobs.values()).filter(
325
- (e) => e.status === PendingBlobStatus.OfflinePendingUpload,
326
- );
327
- }
328
-
329
- public get hasPendingOfflineUploads(): boolean {
330
- return this.pendingOfflineUploads.length > 0;
331
- }
332
-
333
311
  public get allBlobsAttached(): boolean {
334
312
  for (const [, entry] of this.pendingBlobs) {
335
313
  if (entry.attached === false) {
@@ -349,20 +327,21 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
349
327
  private createAbortError(pending?: PendingBlob) {
350
328
  return new LoggingError("uploadBlob aborted", {
351
329
  acked: pending?.acked,
352
- status: pending?.status,
353
330
  uploadTime: pending?.uploadTime,
354
331
  });
355
332
  }
356
333
  /**
357
334
  * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
358
335
  */
359
- public async onConnected() {
336
+ public async processStashedChanges() {
360
337
  this.retryThrottler.cancel();
361
- const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);
338
+ const pendingUploads = Array.from(this.pendingBlobs.values())
339
+ .filter((e) => e.uploading === true)
340
+ .map(async (e) => e.uploadP);
362
341
  await PerformanceEvent.timedExecAsync(
363
342
  this.mc.logger,
364
343
  {
365
- eventName: "BlobUploadOnConnected",
344
+ eventName: "BlobUploadProcessStashedChanges",
366
345
  count: pendingUploads.length,
367
346
  },
368
347
  async () => Promise.all(pendingUploads),
@@ -370,30 +349,12 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
370
349
  );
371
350
  }
372
351
 
373
- /**
374
- * Transition online blobs waiting for BlobAttach op round-trip since we will not see the op until we are connected
375
- * again
376
- */
377
- private onDisconnected() {
378
- for (const [localId, entry] of this.pendingBlobs) {
379
- if (entry.status === PendingBlobStatus.OnlinePendingOp) {
380
- // This will submit another BlobAttach op for this blob. This is necessary because the one we sent
381
- // already didn't have the local ID.
382
- this.transitionToOffline(localId);
383
- }
384
- }
385
- }
386
-
387
- private async shutdownPendingBlobs(): Promise<void> {
352
+ private async stashPendingBlobs(): Promise<void> {
388
353
  for (const [localId, entry] of this.pendingBlobs) {
389
- if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
354
+ if (!entry.opsent) {
390
355
  this.sendBlobAttachOp(localId, entry.storageId);
391
- entry.status = PendingBlobStatus.OfflinePendingUpload;
392
- entry.handleP.resolve(this.getBlobHandle(localId));
393
- } else if (entry.status === PendingBlobStatus.OnlinePendingOp) {
394
- entry.status = PendingBlobStatus.OfflinePendingOp;
395
- entry.handleP.resolve(this.getBlobHandle(localId));
396
356
  }
357
+ entry.handleP.resolve(this.getBlobHandle(localId));
397
358
  }
398
359
  return new Promise<void>((resolve) => {
399
360
  if (this.allBlobsAttached) {
@@ -521,7 +482,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
521
482
  const localId = uuid();
522
483
  const pendingEntry: PendingBlob = {
523
484
  blob,
524
- status: PendingBlobStatus.OnlinePendingUpload,
485
+ uploading: true,
525
486
  handleP: new Deferred(),
526
487
  uploadP: this.uploadBlob(localId, blob),
527
488
  attached: false,
@@ -589,50 +550,37 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
589
550
  return;
590
551
  }
591
552
  assert(
592
- entry.status === PendingBlobStatus.OnlinePendingUpload ||
593
- entry.status === PendingBlobStatus.OfflinePendingUpload,
553
+ entry.uploading === true,
594
554
  0x386 /* Must have pending blob entry for uploaded blob */,
595
555
  );
596
556
  entry.storageId = response.id;
597
557
  entry.uploadTime = Date.now();
598
558
  entry.minTTLInSeconds = response.minTTLInSeconds;
599
- if (this.runtime.connected) {
600
- if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
601
- // Send a blob attach op. This serves two purposes:
602
- // 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op
603
- // until its storage ID is added to the next summary.
604
- // 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the
605
- // blob from the server via the storage ID.
606
- this.sendBlobAttachOp(localId, response.id);
607
- if (this.storageIds.has(response.id)) {
608
- // The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
609
- // an existing blob, we don't have to wait for the op to be ack'd since this step has already
610
- // happened before and so, the server won't delete it.
611
- this.setRedirection(localId, response.id);
612
- entry.handleP.resolve(this.getBlobHandle(localId));
613
- this.deletePendingBlobMaybe(localId);
614
- } else {
615
- // If there is already an op for this storage ID, append the local ID to the list. Once any op for
616
- // this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
617
- // blob alive in storage.
618
- this.opsInFlight.set(
619
- response.id,
620
- (this.opsInFlight.get(response.id) ?? []).concat(localId),
621
- );
622
- entry.status = PendingBlobStatus.OnlinePendingOp;
623
- }
624
- } else if (entry.status === PendingBlobStatus.OfflinePendingUpload) {
625
- // We already submitted a BlobAttach op for this blob when it was transitioned to offline flow
626
- entry.status = PendingBlobStatus.OfflinePendingOp;
627
- }
559
+ // Send a blob attach op. This serves two purposes:
560
+ // 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op
561
+ // until its storage ID is added to the next summary.
562
+ // 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the
563
+ // blob from the server via the storage ID.
564
+ if (!entry.opsent) {
565
+ this.sendBlobAttachOp(localId, response.id);
566
+ }
567
+ if (this.storageIds.has(response.id)) {
568
+ // The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is
569
+ // an existing blob, we don't have to wait for the op to be ack'd since this step has already
570
+ // happened before and so, the server won't delete it.
571
+ this.setRedirection(localId, response.id);
572
+ entry.handleP.resolve(this.getBlobHandle(localId));
573
+ this.deletePendingBlobMaybe(localId);
628
574
  } else {
629
- // connected to storage but not ordering service?
630
- this.mc.logger.sendTelemetryEvent({ eventName: "BlobUploadSuccessWhileDisconnected" });
631
- if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
632
- this.transitionToOffline(localId);
633
- }
634
- entry.status = PendingBlobStatus.OfflinePendingOp;
575
+ // If there is already an op for this storage ID, append the local ID to the list. Once any op for
576
+ // this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the
577
+ // blob alive in storage.
578
+ this.opsInFlight.set(
579
+ response.id,
580
+ (this.opsInFlight.get(response.id) ?? []).concat(localId),
581
+ );
635
582
  }
583
+
636
584
  return response;
637
585
  }
638
586
 
@@ -644,9 +592,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
644
592
  return;
645
593
  }
646
594
  if (!this.runtime.connected) {
647
- if (entry.status === PendingBlobStatus.OnlinePendingUpload) {
648
- this.transitionToOffline(localId);
649
- }
650
595
  // we are probably not connected to storage but start another upload request in case we are
651
596
  entry.uploadP = this.retryThrottler
652
597
  .getDelay()
@@ -658,39 +603,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
658
603
  }
659
604
  }
660
605
 
661
- private transitionToOffline(localId: string) {
662
- assert(
663
- !this.runtime.connected,
664
- 0x388 /* Must only transition to offline flow while runtime is disconnected */,
665
- );
666
- const entry = this.pendingBlobs.get(localId);
667
- assert(!!entry, 0x389 /* No pending blob entry */);
668
- assert(
669
- [PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(
670
- entry.status,
671
- ),
672
- 0x38a /* Blob must be in online flow to transition to offline flow */,
673
- );
674
-
675
- /**
676
- * If we haven't already submitted a BlobAttach op for this entry, send it before returning the blob handle.
677
- * This will make sure that the BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise,
678
- * an invalid handle could be added to the document.
679
- * storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()
680
- * is called on reconnection.
681
- */
682
- if (entry.status !== PendingBlobStatus.OnlinePendingOp) {
683
- this.sendBlobAttachOp(localId, entry.storageId);
684
- }
685
-
686
- entry.status =
687
- entry.status === PendingBlobStatus.OnlinePendingUpload
688
- ? PendingBlobStatus.OfflinePendingUpload
689
- : PendingBlobStatus.OfflinePendingOp;
690
-
691
- entry.handleP.resolve(this.getBlobHandle(localId));
692
- }
693
-
694
606
  /**
695
607
  * Resubmit a BlobAttach op. Used to add storage IDs to ops that were
696
608
  * submitted to runtime while disconnected.
@@ -705,8 +617,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
705
617
  if (!blobId) {
706
618
  // We submitted this op while offline. The blob should have been uploaded by now.
707
619
  assert(
708
- pendingEntry?.status === PendingBlobStatus.OfflinePendingOp &&
709
- !!pendingEntry?.storageId,
620
+ pendingEntry?.opsent === true && !!pendingEntry?.storageId,
710
621
  0x38d /* blob must be uploaded before resubmitting BlobAttach op */,
711
622
  );
712
623
  return this.sendBlobAttachOp(localId, pendingEntry?.storageId);
@@ -750,22 +661,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
750
661
  entry !== undefined,
751
662
  0x38f /* local online BlobAttach op with no pending blob entry */,
752
663
  );
753
-
754
- // It's possible we transitioned to offline flow while waiting for this op.
755
- if (entry.status === PendingBlobStatus.OnlinePendingOp) {
756
- this.setRedirection(pendingLocalId, blobId);
757
- entry.acked = true;
758
- entry.handleP.resolve(this.getBlobHandle(pendingLocalId));
759
- this.deletePendingBlobMaybe(pendingLocalId);
760
- }
664
+ this.setRedirection(pendingLocalId, blobId);
665
+ entry.acked = true;
666
+ entry.handleP.resolve(this.getBlobHandle(pendingLocalId));
667
+ this.deletePendingBlobMaybe(pendingLocalId);
761
668
  });
762
669
  this.opsInFlight.delete(blobId);
763
670
  }
764
- // offline flow does not resolve the handle (since it was already resolved)
765
- // but we still need to delete the entry in case is acked and attached.
766
671
  const localEntry = this.pendingBlobs.get(localId);
767
672
  if (localEntry) {
768
673
  localEntry.acked = true;
674
+ localEntry.handleP.resolve(this.getBlobHandle(localId));
769
675
  this.deletePendingBlobMaybe(localId);
770
676
  }
771
677
  }
@@ -1037,10 +943,15 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
1037
943
  }
1038
944
  }
1039
945
 
1040
- public async getPendingBlobs(waitBlobsToAttach?: boolean): Promise<IPendingBlobs> {
946
+ public async getPendingBlobs(waitBlobsToAttach?: boolean): Promise<IPendingBlobs | undefined> {
1041
947
  if (waitBlobsToAttach) {
1042
- await this.shutdownPendingBlobs();
948
+ await this.stashPendingBlobs();
949
+ }
950
+
951
+ if (this.pendingBlobs.size === 0) {
952
+ return;
1043
953
  }
954
+
1044
955
  const blobs = {};
1045
956
  for (const [key, entry] of this.pendingBlobs) {
1046
957
  blobs[key] = {