@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
package/src/dataStore.ts CHANGED
@@ -3,10 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryLoggerExt, TelemetryDataTag } from "@fluidframework/telemetry-utils";
6
+ import { ITelemetryLoggerExt, TelemetryDataTag, UsageError } from "@fluidframework/telemetry-utils";
7
7
  import { assert, unreachableCase } from "@fluidframework/common-utils";
8
8
  import { AttachState } from "@fluidframework/container-definitions";
9
- import { UsageError } from "@fluidframework/container-utils";
10
9
  import { FluidObject, IFluidHandle, IRequest, IResponse } from "@fluidframework/core-interfaces";
11
10
  import {
12
11
  AliasResult,
@@ -57,6 +57,9 @@ import {
57
57
  import { addBlobToSummary, convertSummaryTreeToITree } from "@fluidframework/runtime-utils";
58
58
  import {
59
59
  createChildMonitoringContext,
60
+ DataCorruptionError,
61
+ DataProcessingError,
62
+ extractSafePropertiesFromMessage,
60
63
  generateStack,
61
64
  ITelemetryLoggerExt,
62
65
  LoggingError,
@@ -64,12 +67,6 @@ import {
64
67
  tagCodeArtifacts,
65
68
  ThresholdCounter,
66
69
  } from "@fluidframework/telemetry-utils";
67
- import {
68
- DataCorruptionError,
69
- DataProcessingError,
70
- extractSafePropertiesFromMessage,
71
- } from "@fluidframework/container-utils";
72
-
73
70
  import {
74
71
  dataStoreAttributesBlobName,
75
72
  hasIsolatedChannels,
@@ -3,10 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
7
6
  import { assert, Deferred } from "@fluidframework/common-utils";
8
7
  import { Lazy } from "@fluidframework/core-utils";
9
- import { IDisposable } from "@fluidframework/core-interfaces";
8
+ import { IDisposable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
10
9
  import { createChildLogger, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
11
10
  import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreContext";
12
11
 
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { UsageError } from "@fluidframework/container-utils";
5
+ import { UsageError } from "@fluidframework/telemetry-utils";
6
6
  import {
7
7
  FluidDataStoreRegistryEntry,
8
8
  IFluidDataStoreRegistry,
package/src/dataStores.ts CHANGED
@@ -3,10 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- DataCorruptionError,
8
- extractSafePropertiesFromMessage,
9
- } from "@fluidframework/container-utils";
10
6
  import {
11
7
  ITelemetryBaseLogger,
12
8
  IDisposable,
@@ -42,9 +38,11 @@ import {
42
38
  unpackChildNodesUsedRoutes,
43
39
  } from "@fluidframework/runtime-utils";
44
40
  import {
41
+ createChildMonitoringContext,
42
+ DataCorruptionError,
43
+ extractSafePropertiesFromMessage,
45
44
  LoggingError,
46
45
  MonitoringContext,
47
- createChildMonitoringContext,
48
46
  tagCodeArtifacts,
49
47
  } from "@fluidframework/telemetry-utils";
50
48
  import { AttachState } from "@fluidframework/container-definitions";
package/src/error.ts ADDED
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { ContainerErrorTypes } from "@fluidframework/container-definitions";
7
+ import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
8
+
9
+ /**
10
+ * Error indicating that a client's session has reached its time limit and is closed.
11
+ */
12
+ export class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {
13
+ readonly errorType = ContainerErrorTypes.clientSessionExpiredError;
14
+
15
+ constructor(message: string, readonly expiryMs: number) {
16
+ super(message, { timeoutMs: expiryMs });
17
+ }
18
+ }
@@ -5,8 +5,7 @@
5
5
 
6
6
  import { Timer } from "@fluidframework/common-utils";
7
7
  import { LazyPromise } from "@fluidframework/core-utils";
8
- import { ClientSessionExpiredError, DataProcessingError } from "@fluidframework/container-utils";
9
- import { IRequestHeader } from "@fluidframework/core-interfaces";
8
+ import { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
10
9
  import {
11
10
  gcTreeKey,
12
11
  IGarbageCollectionData,
@@ -14,16 +13,26 @@ import {
14
13
  ISummarizeResult,
15
14
  ITelemetryContext,
16
15
  } from "@fluidframework/runtime-definitions";
17
- import { ReadAndParseBlob } from "@fluidframework/runtime-utils";
16
+ import {
17
+ ReadAndParseBlob,
18
+ createResponseError,
19
+ responseToException,
20
+ } from "@fluidframework/runtime-utils";
18
21
  import {
19
22
  createChildLogger,
20
23
  createChildMonitoringContext,
24
+ DataProcessingError,
21
25
  ITelemetryLoggerExt,
22
26
  MonitoringContext,
23
27
  PerformanceEvent,
24
28
  } from "@fluidframework/telemetry-utils";
25
29
 
26
- import { RuntimeHeaders } from "../containerRuntime";
30
+ import {
31
+ AllowInactiveRequestHeaderKey,
32
+ InactiveResponseHeaderKey,
33
+ RuntimeHeaders,
34
+ } from "../containerRuntime";
35
+ import { ClientSessionExpiredError } from "../error";
27
36
  import { RefreshSummaryResult } from "../summary";
28
37
  import { generateGCConfigs } from "./gcConfigs";
29
38
  import {
@@ -876,7 +885,7 @@ export class GarbageCollector implements IGarbageCollector {
876
885
 
877
886
  /**
878
887
  * Called when a node with the given id is updated. If the node is inactive, log an error.
879
- * @param nodePath - The id of the node that changed.
888
+ * @param nodePath - The path of the node that changed.
880
889
  * @param reason - Whether the node was loaded or changed.
881
890
  * @param timestampMs - The timestamp when the node changed.
882
891
  * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
@@ -893,6 +902,7 @@ export class GarbageCollector implements IGarbageCollector {
893
902
  return;
894
903
  }
895
904
 
905
+ // This will log if appropriate
896
906
  this.telemetryTracker.nodeUsed({
897
907
  id: nodePath,
898
908
  usageType: reason,
@@ -904,6 +914,29 @@ export class GarbageCollector implements IGarbageCollector {
904
914
  lastSummaryTime: this.getLastSummaryTimestampMs(),
905
915
  viaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],
906
916
  });
917
+
918
+ // Unless this is a Loaded event, we're done after telemetry tracking
919
+ if (reason !== "Loaded") {
920
+ return;
921
+ }
922
+
923
+ // We may throw when loading an Inactive object, depending on these preconditions
924
+ const shouldThrowOnInactiveLoad =
925
+ !this.isSummarizerClient &&
926
+ this.configs.throwOnInactiveLoad === true &&
927
+ requestHeaders?.[AllowInactiveRequestHeaderKey] !== true;
928
+ const state = this.unreferencedNodesState.get(nodePath)?.state;
929
+
930
+ if (shouldThrowOnInactiveLoad && state === "Inactive") {
931
+ const request: IRequest = { url: nodePath };
932
+ const error = responseToException(
933
+ createResponseError(404, "Object is inactive", request, {
934
+ [InactiveResponseHeaderKey]: true,
935
+ }),
936
+ request,
937
+ );
938
+ throw error;
939
+ }
907
940
  }
908
941
 
909
942
  /**
@@ -3,8 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { UsageError } from "@fluidframework/container-utils";
7
- import { MonitoringContext } from "@fluidframework/telemetry-utils";
6
+ import { MonitoringContext, UsageError } from "@fluidframework/telemetry-utils";
8
7
  import { IContainerRuntimeMetadata } from "../summary";
9
8
  import {
10
9
  currentGCVersion,
@@ -153,6 +152,8 @@ export function generateGCConfigs(
153
152
  throw new UsageError("inactive timeout should not be greater than the sweep timeout");
154
153
  }
155
154
 
155
+ const throwOnInactiveLoad: boolean | undefined = createParams.gcOptions.throwOnInactiveLoad;
156
+
156
157
  // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
157
158
  const testMode =
158
159
  mc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;
@@ -172,6 +173,7 @@ export function generateGCConfigs(
172
173
  sessionExpiryTimeoutMs,
173
174
  sweepTimeoutMs,
174
175
  inactiveTimeoutMs,
176
+ throwOnInactiveLoad,
175
177
  persistedGcFeatureMatrix,
176
178
  gcVersionInBaseSnapshot,
177
179
  gcVersionInEffect,
@@ -349,6 +349,8 @@ export interface IGarbageCollectorConfigs {
349
349
  readonly sweepTimeoutMs: number | undefined;
350
350
  /** The time after which an unreferenced node is inactive. */
351
351
  readonly inactiveTimeoutMs: number;
352
+ /** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */
353
+ readonly throwOnInactiveLoad: boolean | undefined;
352
354
  /** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */
353
355
  readonly testMode: boolean;
354
356
  /**
@@ -23,6 +23,7 @@ import {
23
23
  runSweepKey,
24
24
  } from "./gcDefinitions";
25
25
  import { UnreferencedStateTracker } from "./gcUnreferencedStateTracker";
26
+ // eslint-disable-next-line import/no-deprecated
26
27
  import { tagAsCodeArtifact } from "./gcHelpers";
27
28
 
28
29
  type NodeUsageType = "Changed" | "Loaded" | "Revived";
@@ -183,6 +184,7 @@ export class GCTelemetryTracker {
183
184
  {
184
185
  eventName: `GC_Tombstone_${nodeType}_Revived`,
185
186
  category: "generic",
187
+ // eslint-disable-next-line import/no-deprecated
186
188
  url: tagAsCodeArtifact(id),
187
189
  gcTombstoneEnforcementAllowed: this.gcTombstoneEnforcementAllowed,
188
190
  },
@@ -3,10 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ /* eslint-disable tsdoc/syntax */
6
7
  /* eslint-disable no-bitwise */
7
-
8
8
  import { assert } from "@fluidframework/common-utils";
9
- import { fail } from "./utils";
10
9
 
11
10
  /**
12
11
  * A map in which entries are always added in key-sorted order.
@@ -133,7 +132,7 @@ export class AppendOnlySortedMap<K, V> {
133
132
  }
134
133
 
135
134
  /**
136
- * Adds a new key/value pair to the map. `key` must be \> to all keys in the map.
135
+ * Adds a new key/value pair to the map. `key` must be > to all keys in the map.
137
136
  * @param key - the key to add.
138
137
  * @param value - the value to add.
139
138
  */
@@ -141,7 +140,27 @@ export class AppendOnlySortedMap<K, V> {
141
140
  const { elements } = this;
142
141
  const { length } = elements;
143
142
  if (length !== 0 && this.comparator(key, this.maxKey() as K) <= 0) {
144
- fail("Inserted key must be > all others in the map.");
143
+ throw new Error("Inserted key must be > all others in the map.");
144
+ }
145
+ elements.push(key);
146
+ elements.push(value);
147
+ }
148
+
149
+ /**
150
+ * Replaces the last key/value pair with the given one. If the map is empty, it simply appends.
151
+ * `key` must be > to all keys in the map prior to the one replaced.
152
+ * @param key - the key to add.
153
+ * @param value - the value to add.
154
+ */
155
+ public replaceLast(key: K, value: V): void {
156
+ const { elements, comparator } = this;
157
+ const { length } = elements;
158
+ if (length !== 0) {
159
+ elements.pop();
160
+ elements.pop();
161
+ if (comparator(key, this.maxKey() as K) <= 0) {
162
+ throw new Error("Inserted key must be > all others in the map.");
163
+ }
145
164
  }
146
165
  elements.push(key);
147
166
  elements.push(value);
@@ -217,7 +236,7 @@ export class AppendOnlySortedMap<K, V> {
217
236
  if (prev !== undefined) {
218
237
  assert(
219
238
  this.comparator(kv[0], prev[0]) > 0,
220
- 0x47f /* Keys in map must be sorted. */,
239
+ 0x752 /* Keys in map must be sorted. */,
221
240
  );
222
241
  }
223
242
  prev = kv;
@@ -338,90 +357,10 @@ export class AppendOnlySortedMap<K, V> {
338
357
  } else if (c === 0) {
339
358
  return keyIndex;
340
359
  } else {
341
- fail("Invalid comparator.");
360
+ throw new Error("Invalid comparator.");
342
361
  }
343
362
  mid = (low + high) >> 1;
344
363
  }
345
364
  return (mid * 2) ^ AppendOnlySortedMap.failureXor;
346
365
  }
347
366
  }
348
-
349
- /**
350
- * A map in which entries are always added in both key-sorted and value-sorted order.
351
- * Supports appending and searching.
352
- */
353
- export class AppendOnlyDoublySortedMap<K, V, S> extends AppendOnlySortedMap<K, V> {
354
- public constructor(
355
- keyComparator: (a: K, b: K) => number,
356
- private readonly extractSearchValue: (value: V) => S,
357
- private readonly valueComparator: (search: S, value: S) => number,
358
- ) {
359
- super(keyComparator);
360
- }
361
-
362
- public override append(key: K, value: V): void {
363
- if (
364
- this.elements.length !== 0 &&
365
- this.valueComparator(
366
- this.extractSearchValue(value),
367
- this.extractSearchValue(this.maxValue() as V),
368
- ) <= 0
369
- ) {
370
- fail("Inserted value must be > all others in the map.");
371
- }
372
- super.append(key, value);
373
- }
374
-
375
- private readonly compareValues = (search: S, _: K, value: V): number => {
376
- return this.valueComparator(search, this.extractSearchValue(value));
377
- };
378
-
379
- // /**
380
- // * @param value - the value to lookup.
381
- // * @returns the key associated with `value` if such an entry exists, and undefined otherwise.
382
- // */
383
- // public getByValue(value: S): K | undefined {
384
- // const index = AppendOnlySortedMap.keyIndexOf(this.elements, value, this.compareValues);
385
- // return this.elements[index]?.[0];
386
- // }
387
-
388
- /**
389
- * @param searchValue - the search value to lookup.
390
- * @returns the entry who's value, when run through the extractor provided to the constructor, matches
391
- * `searchValue`. If no such entry exists, this method returns the next lower entry as determined by the value
392
- * comparator provided to the constructor. If no such entry exists, this method returns undefined.
393
- */
394
- public getPairOrNextLowerByValue(searchValue: S): readonly [K, V] | undefined {
395
- return this.getPairOrNextLowerBy(searchValue, this.compareValues);
396
- }
397
-
398
- /**
399
- * @param searchValue - the search value to lookup.
400
- * @returns the entry who's value, when run through the extractor provided to the constructor, matches `searchValue`. If no such entry
401
- * exists, this method returns the next higher entry as determined by the value comparator provided to the constructor. If no such entry
402
- * exists, this method returns undefined.
403
- */
404
- public getPairOrNextHigherByValue(searchValue: S): readonly [K, V] | undefined {
405
- return this.getPairOrNextHigherBy(searchValue, this.compareValues);
406
- }
407
-
408
- /**
409
- * Test-only expensive assertions to check the internal validity of the data structure.
410
- */
411
- public override assertValid(): void {
412
- super.assertValid();
413
- let prev: readonly [unknown, V] | undefined;
414
- for (const kv of this.entries()) {
415
- if (prev !== undefined) {
416
- assert(
417
- this.valueComparator(
418
- this.extractSearchValue(kv[1]),
419
- this.extractSearchValue(prev[1]),
420
- ) > 0,
421
- 0x480 /* Values in map must be sorted. */,
422
- );
423
- }
424
- prev = kv;
425
- }
426
- }
427
- }
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { assert } from "@fluidframework/common-utils";
7
+ import { IdCluster, clustersEqual, lastAllocatedFinal, lastFinalizedFinal } from "./sessions";
8
+ import { FinalCompressedId } from "./identifiers";
9
+
10
+ /**
11
+ * All IDs that have been finalized (acked), grouped into clusters sorted by their base final IDs.
12
+ * These clusters span the positive integer space and are not sparse, meaning a cluster's base final
13
+ * ID will always be one greater than the last final ID in the previous cluster (or 0 if there is not one).
14
+ */
15
+ export class FinalSpace {
16
+ private readonly clusterList: IdCluster[] = [];
17
+
18
+ public get clusters(): readonly IdCluster[] {
19
+ return this.clusterList;
20
+ }
21
+
22
+ public getLastCluster(): IdCluster | undefined {
23
+ return this.clusterList[this.clusterList.length - 1];
24
+ }
25
+
26
+ public addCluster(newCluster: IdCluster) {
27
+ const lastCluster = this.getLastCluster();
28
+ assert(
29
+ lastCluster === undefined ||
30
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
31
+ newCluster.baseFinalId === lastCluster.baseFinalId + lastCluster.capacity,
32
+ 0x753 /* Cluster insert to final_space is out of order. */,
33
+ );
34
+ this.clusterList.push(newCluster);
35
+ }
36
+
37
+ /**
38
+ * @returns the upper bound (exclusive) of finalized IDs in final space, i.e. one greater than the last final ID in the last cluster.
39
+ * Note: this does not include allocated but unfinalized space in clusters.
40
+ */
41
+ public getFinalizedIdLimit(): FinalCompressedId {
42
+ const lastCluster = this.getLastCluster();
43
+ return lastCluster === undefined
44
+ ? (0 as FinalCompressedId)
45
+ : (((lastFinalizedFinal(lastCluster) as number) + 1) as FinalCompressedId);
46
+ }
47
+
48
+ /**
49
+ * @returns the upper bound (exclusive) of allocated IDs in final space, i.e. one greater than the last final ID in the last cluster.
50
+ * Note: this does includes all allocated IDs in clusters.
51
+ */
52
+ public getAllocatedIdLimit(): FinalCompressedId {
53
+ const lastCluster = this.getLastCluster();
54
+ return lastCluster === undefined
55
+ ? (0 as FinalCompressedId)
56
+ : (((lastAllocatedFinal(lastCluster) as number) + 1) as FinalCompressedId);
57
+ }
58
+
59
+ public equals(other: FinalSpace): boolean {
60
+ for (let i = 0; i < this.clusterList.length; i++) {
61
+ if (!clustersEqual(this.clusterList[i], other.clusterList[i])) {
62
+ return false;
63
+ }
64
+ }
65
+ return this.clusterList.length === other.clusterList.length;
66
+ }
67
+ }