@milaboratories/pl-drivers 1.11.59 → 1.11.60

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 (330) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/clients/constructors.cjs +28 -28
  3. package/dist/clients/constructors.cjs.map +1 -1
  4. package/dist/clients/constructors.d.ts +17 -13
  5. package/dist/clients/constructors.js +28 -26
  6. package/dist/clients/constructors.js.map +1 -1
  7. package/dist/clients/crc32c.cjs +8 -13
  8. package/dist/clients/crc32c.cjs.map +1 -1
  9. package/dist/clients/crc32c.js +8 -12
  10. package/dist/clients/crc32c.js.map +1 -1
  11. package/dist/clients/download.cjs +119 -160
  12. package/dist/clients/download.cjs.map +1 -1
  13. package/dist/clients/download.d.ts +45 -41
  14. package/dist/clients/download.js +115 -137
  15. package/dist/clients/download.js.map +1 -1
  16. package/dist/clients/logs.cjs +78 -82
  17. package/dist/clients/logs.cjs.map +1 -1
  18. package/dist/clients/logs.d.ts +34 -24
  19. package/dist/clients/logs.js +77 -80
  20. package/dist/clients/logs.js.map +1 -1
  21. package/dist/clients/ls_api.cjs +62 -68
  22. package/dist/clients/ls_api.cjs.map +1 -1
  23. package/dist/clients/ls_api.d.ts +15 -11
  24. package/dist/clients/ls_api.js +61 -66
  25. package/dist/clients/ls_api.js.map +1 -1
  26. package/dist/clients/progress.cjs +49 -59
  27. package/dist/clients/progress.cjs.map +1 -1
  28. package/dist/clients/progress.d.ts +27 -20
  29. package/dist/clients/progress.js +48 -57
  30. package/dist/clients/progress.js.map +1 -1
  31. package/dist/clients/upload.cjs +189 -250
  32. package/dist/clients/upload.cjs.map +1 -1
  33. package/dist/clients/upload.d.ts +44 -34
  34. package/dist/clients/upload.js +187 -229
  35. package/dist/clients/upload.js.map +1 -1
  36. package/dist/drivers/download_blob/blob_key.cjs +9 -26
  37. package/dist/drivers/download_blob/blob_key.cjs.map +1 -1
  38. package/dist/drivers/download_blob/blob_key.js +7 -5
  39. package/dist/drivers/download_blob/blob_key.js.map +1 -1
  40. package/dist/drivers/download_blob/download_blob.cjs +395 -478
  41. package/dist/drivers/download_blob/download_blob.cjs.map +1 -1
  42. package/dist/drivers/download_blob/download_blob.d.ts +102 -100
  43. package/dist/drivers/download_blob/download_blob.js +388 -453
  44. package/dist/drivers/download_blob/download_blob.js.map +1 -1
  45. package/dist/drivers/download_blob/download_blob_task.cjs +128 -163
  46. package/dist/drivers/download_blob/download_blob_task.cjs.map +1 -1
  47. package/dist/drivers/download_blob/download_blob_task.js +125 -141
  48. package/dist/drivers/download_blob/download_blob_task.js.map +1 -1
  49. package/dist/drivers/download_blob/sparse_cache/cache.cjs +166 -195
  50. package/dist/drivers/download_blob/sparse_cache/cache.cjs.map +1 -1
  51. package/dist/drivers/download_blob/sparse_cache/cache.js +164 -193
  52. package/dist/drivers/download_blob/sparse_cache/cache.js.map +1 -1
  53. package/dist/drivers/download_blob/sparse_cache/file.cjs +29 -50
  54. package/dist/drivers/download_blob/sparse_cache/file.cjs.map +1 -1
  55. package/dist/drivers/download_blob/sparse_cache/file.js +28 -29
  56. package/dist/drivers/download_blob/sparse_cache/file.js.map +1 -1
  57. package/dist/drivers/download_blob/sparse_cache/ranges.cjs +48 -76
  58. package/dist/drivers/download_blob/sparse_cache/ranges.cjs.map +1 -1
  59. package/dist/drivers/download_blob/sparse_cache/ranges.js +47 -54
  60. package/dist/drivers/download_blob/sparse_cache/ranges.js.map +1 -1
  61. package/dist/drivers/download_blob_url/driver.cjs +125 -165
  62. package/dist/drivers/download_blob_url/driver.cjs.map +1 -1
  63. package/dist/drivers/download_blob_url/driver.d.ts +45 -42
  64. package/dist/drivers/download_blob_url/driver.js +123 -144
  65. package/dist/drivers/download_blob_url/driver.js.map +1 -1
  66. package/dist/drivers/download_blob_url/driver_id.cjs +4 -4
  67. package/dist/drivers/download_blob_url/driver_id.cjs.map +1 -1
  68. package/dist/drivers/download_blob_url/driver_id.js +4 -3
  69. package/dist/drivers/download_blob_url/driver_id.js.map +1 -1
  70. package/dist/drivers/download_blob_url/snapshot.cjs +7 -11
  71. package/dist/drivers/download_blob_url/snapshot.cjs.map +1 -1
  72. package/dist/drivers/download_blob_url/snapshot.d.ts +10 -5
  73. package/dist/drivers/download_blob_url/snapshot.js +5 -8
  74. package/dist/drivers/download_blob_url/snapshot.js.map +1 -1
  75. package/dist/drivers/download_blob_url/task.cjs +147 -194
  76. package/dist/drivers/download_blob_url/task.cjs.map +1 -1
  77. package/dist/drivers/download_blob_url/task.d.ts +55 -57
  78. package/dist/drivers/download_blob_url/task.js +140 -170
  79. package/dist/drivers/download_blob_url/task.js.map +1 -1
  80. package/dist/drivers/download_url/driver.cjs +109 -146
  81. package/dist/drivers/download_url/driver.cjs.map +1 -1
  82. package/dist/drivers/download_url/driver.d.ts +59 -57
  83. package/dist/drivers/download_url/driver.js +107 -125
  84. package/dist/drivers/download_url/driver.js.map +1 -1
  85. package/dist/drivers/download_url/task.cjs +104 -137
  86. package/dist/drivers/download_url/task.cjs.map +1 -1
  87. package/dist/drivers/download_url/task.d.ts +33 -37
  88. package/dist/drivers/download_url/task.js +99 -113
  89. package/dist/drivers/download_url/task.js.map +1 -1
  90. package/dist/drivers/helpers/download_local_handle.cjs +13 -14
  91. package/dist/drivers/helpers/download_local_handle.cjs.map +1 -1
  92. package/dist/drivers/helpers/download_local_handle.js +13 -13
  93. package/dist/drivers/helpers/download_local_handle.js.map +1 -1
  94. package/dist/drivers/helpers/download_remote_handle.cjs +23 -24
  95. package/dist/drivers/helpers/download_remote_handle.cjs.map +1 -1
  96. package/dist/drivers/helpers/download_remote_handle.js +22 -22
  97. package/dist/drivers/helpers/download_remote_handle.js.map +1 -1
  98. package/dist/drivers/helpers/files_cache.cjs +53 -64
  99. package/dist/drivers/helpers/files_cache.cjs.map +1 -1
  100. package/dist/drivers/helpers/files_cache.js +52 -62
  101. package/dist/drivers/helpers/files_cache.js.map +1 -1
  102. package/dist/drivers/helpers/helpers.cjs +24 -28
  103. package/dist/drivers/helpers/helpers.cjs.map +1 -1
  104. package/dist/drivers/helpers/helpers.d.ts +10 -7
  105. package/dist/drivers/helpers/helpers.js +24 -27
  106. package/dist/drivers/helpers/helpers.js.map +1 -1
  107. package/dist/drivers/helpers/logs_handle.cjs +24 -33
  108. package/dist/drivers/helpers/logs_handle.cjs.map +1 -1
  109. package/dist/drivers/helpers/logs_handle.js +24 -29
  110. package/dist/drivers/helpers/logs_handle.js.map +1 -1
  111. package/dist/drivers/helpers/ls_remote_import_handle.cjs +20 -20
  112. package/dist/drivers/helpers/ls_remote_import_handle.cjs.map +1 -1
  113. package/dist/drivers/helpers/ls_remote_import_handle.js +20 -18
  114. package/dist/drivers/helpers/ls_remote_import_handle.js.map +1 -1
  115. package/dist/drivers/helpers/ls_storage_entry.cjs +36 -40
  116. package/dist/drivers/helpers/ls_storage_entry.cjs.map +1 -1
  117. package/dist/drivers/helpers/ls_storage_entry.js +36 -37
  118. package/dist/drivers/helpers/ls_storage_entry.js.map +1 -1
  119. package/dist/drivers/helpers/polling_ops.d.ts +6 -5
  120. package/dist/drivers/helpers/read_file.cjs +34 -57
  121. package/dist/drivers/helpers/read_file.cjs.map +1 -1
  122. package/dist/drivers/helpers/read_file.js +30 -34
  123. package/dist/drivers/helpers/read_file.js.map +1 -1
  124. package/dist/drivers/logs.cjs +94 -112
  125. package/dist/drivers/logs.cjs.map +1 -1
  126. package/dist/drivers/logs.d.ts +35 -32
  127. package/dist/drivers/logs.js +93 -110
  128. package/dist/drivers/logs.js.map +1 -1
  129. package/dist/drivers/logs_stream.cjs +210 -242
  130. package/dist/drivers/logs_stream.cjs.map +1 -1
  131. package/dist/drivers/logs_stream.d.ts +55 -53
  132. package/dist/drivers/logs_stream.js +209 -240
  133. package/dist/drivers/logs_stream.js.map +1 -1
  134. package/dist/drivers/ls.cjs +151 -238
  135. package/dist/drivers/ls.cjs.map +1 -1
  136. package/dist/drivers/ls.d.ts +53 -49
  137. package/dist/drivers/ls.js +148 -216
  138. package/dist/drivers/ls.js.map +1 -1
  139. package/dist/drivers/types.cjs +25 -53
  140. package/dist/drivers/types.cjs.map +1 -1
  141. package/dist/drivers/types.d.ts +91 -106
  142. package/dist/drivers/types.js +23 -50
  143. package/dist/drivers/types.js.map +1 -1
  144. package/dist/drivers/upload.cjs +127 -153
  145. package/dist/drivers/upload.cjs.map +1 -1
  146. package/dist/drivers/upload.d.ts +52 -50
  147. package/dist/drivers/upload.js +126 -151
  148. package/dist/drivers/upload.js.map +1 -1
  149. package/dist/drivers/upload_task.cjs +223 -260
  150. package/dist/drivers/upload_task.cjs.map +1 -1
  151. package/dist/drivers/upload_task.d.ts +54 -52
  152. package/dist/drivers/upload_task.js +221 -258
  153. package/dist/drivers/upload_task.js.map +1 -1
  154. package/dist/drivers/urls/url.cjs +30 -35
  155. package/dist/drivers/urls/url.cjs.map +1 -1
  156. package/dist/drivers/urls/url.js +28 -33
  157. package/dist/drivers/urls/url.js.map +1 -1
  158. package/dist/drivers/virtual_storages.cjs +36 -48
  159. package/dist/drivers/virtual_storages.cjs.map +1 -1
  160. package/dist/drivers/virtual_storages.d.ts +6 -2
  161. package/dist/drivers/virtual_storages.js +32 -46
  162. package/dist/drivers/virtual_storages.js.map +1 -1
  163. package/dist/helpers/download.cjs +72 -95
  164. package/dist/helpers/download.cjs.map +1 -1
  165. package/dist/helpers/download.d.ts +13 -9
  166. package/dist/helpers/download.js +71 -93
  167. package/dist/helpers/download.js.map +1 -1
  168. package/dist/helpers/download_errors.cjs +28 -27
  169. package/dist/helpers/download_errors.cjs.map +1 -1
  170. package/dist/helpers/download_errors.d.ts +16 -13
  171. package/dist/helpers/download_errors.js +28 -26
  172. package/dist/helpers/download_errors.js.map +1 -1
  173. package/dist/helpers/validate.cjs +8 -7
  174. package/dist/helpers/validate.cjs.map +1 -1
  175. package/dist/helpers/validate.d.ts +4 -1
  176. package/dist/helpers/validate.js +6 -5
  177. package/dist/helpers/validate.js.map +1 -1
  178. package/dist/index.cjs +75 -79
  179. package/dist/index.d.ts +22 -22
  180. package/dist/index.js +22 -21
  181. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs +238 -249
  182. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs.map +1 -1
  183. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs +27 -27
  184. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs.map +1 -1
  185. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +25 -23
  186. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js +26 -25
  187. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js.map +1 -1
  188. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +51 -87
  189. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js +238 -245
  190. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js.map +1 -1
  191. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs +295 -289
  192. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs.map +1 -1
  193. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs +30 -30
  194. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs.map +1 -1
  195. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js +29 -28
  196. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js.map +1 -1
  197. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +86 -150
  198. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js +295 -285
  199. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js.map +1 -1
  200. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs +385 -393
  201. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs.map +1 -1
  202. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs +34 -34
  203. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs.map +1 -1
  204. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +33 -34
  205. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js +33 -32
  206. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js.map +1 -1
  207. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +78 -129
  208. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js +385 -387
  209. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js.map +1 -1
  210. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs +570 -468
  211. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs.map +1 -1
  212. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs +82 -82
  213. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs.map +1 -1
  214. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +109 -112
  215. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js +81 -80
  216. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js.map +1 -1
  217. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +243 -264
  218. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js +569 -460
  219. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js.map +1 -1
  220. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs +751 -729
  221. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs.map +1 -1
  222. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs +67 -67
  223. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs.map +1 -1
  224. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js +66 -65
  225. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js.map +1 -1
  226. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts +15 -381
  227. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js +749 -718
  228. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js.map +1 -1
  229. package/dist/proto-grpc/google/protobuf/duration.cjs +92 -100
  230. package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -1
  231. package/dist/proto-grpc/google/protobuf/duration.d.ts +38 -43
  232. package/dist/proto-grpc/google/protobuf/duration.js +91 -98
  233. package/dist/proto-grpc/google/protobuf/duration.js.map +1 -1
  234. package/dist/proto-grpc/google/protobuf/timestamp.cjs +117 -128
  235. package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -1
  236. package/dist/proto-grpc/google/protobuf/timestamp.d.ts +50 -55
  237. package/dist/proto-grpc/google/protobuf/timestamp.js +116 -126
  238. package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -1
  239. package/dist/proto-rest/downloadapi.d.ts +85 -91
  240. package/dist/proto-rest/index.d.ts +11 -16
  241. package/dist/proto-rest/progressapi.d.ts +130 -140
  242. package/dist/proto-rest/streamingapi.d.ts +413 -434
  243. package/package.json +12 -12
  244. package/dist/clients/constructors.d.ts.map +0 -1
  245. package/dist/clients/crc32c.d.ts +0 -2
  246. package/dist/clients/crc32c.d.ts.map +0 -1
  247. package/dist/clients/download.d.ts.map +0 -1
  248. package/dist/clients/logs.d.ts.map +0 -1
  249. package/dist/clients/ls_api.d.ts.map +0 -1
  250. package/dist/clients/progress.d.ts.map +0 -1
  251. package/dist/clients/upload.d.ts.map +0 -1
  252. package/dist/drivers/download_blob/blob_key.d.ts +0 -5
  253. package/dist/drivers/download_blob/blob_key.d.ts.map +0 -1
  254. package/dist/drivers/download_blob/download_blob.d.ts.map +0 -1
  255. package/dist/drivers/download_blob/download_blob_task.d.ts +0 -56
  256. package/dist/drivers/download_blob/download_blob_task.d.ts.map +0 -1
  257. package/dist/drivers/download_blob/sparse_cache/cache.d.ts +0 -82
  258. package/dist/drivers/download_blob/sparse_cache/cache.d.ts.map +0 -1
  259. package/dist/drivers/download_blob/sparse_cache/file.d.ts +0 -8
  260. package/dist/drivers/download_blob/sparse_cache/file.d.ts.map +0 -1
  261. package/dist/drivers/download_blob/sparse_cache/ranges.d.ts +0 -46
  262. package/dist/drivers/download_blob/sparse_cache/ranges.d.ts.map +0 -1
  263. package/dist/drivers/download_blob_url/driver.d.ts.map +0 -1
  264. package/dist/drivers/download_blob_url/driver_id.d.ts +0 -6
  265. package/dist/drivers/download_blob_url/driver_id.d.ts.map +0 -1
  266. package/dist/drivers/download_blob_url/snapshot.d.ts.map +0 -1
  267. package/dist/drivers/download_blob_url/task.d.ts.map +0 -1
  268. package/dist/drivers/download_url/driver.d.ts.map +0 -1
  269. package/dist/drivers/download_url/task.d.ts.map +0 -1
  270. package/dist/drivers/helpers/download_local_handle.d.ts +0 -11
  271. package/dist/drivers/helpers/download_local_handle.d.ts.map +0 -1
  272. package/dist/drivers/helpers/download_remote_handle.d.ts +0 -13
  273. package/dist/drivers/helpers/download_remote_handle.d.ts.map +0 -1
  274. package/dist/drivers/helpers/files_cache.d.ts +0 -29
  275. package/dist/drivers/helpers/files_cache.d.ts.map +0 -1
  276. package/dist/drivers/helpers/helpers.d.ts.map +0 -1
  277. package/dist/drivers/helpers/logs_handle.d.ts +0 -15
  278. package/dist/drivers/helpers/logs_handle.d.ts.map +0 -1
  279. package/dist/drivers/helpers/ls_remote_import_handle.d.ts +0 -8
  280. package/dist/drivers/helpers/ls_remote_import_handle.d.ts.map +0 -1
  281. package/dist/drivers/helpers/ls_storage_entry.d.ts +0 -23
  282. package/dist/drivers/helpers/ls_storage_entry.d.ts.map +0 -1
  283. package/dist/drivers/helpers/polling_ops.d.ts.map +0 -1
  284. package/dist/drivers/helpers/read_file.d.ts +0 -12
  285. package/dist/drivers/helpers/read_file.d.ts.map +0 -1
  286. package/dist/drivers/helpers/test_helpers.d.ts +0 -2
  287. package/dist/drivers/helpers/test_helpers.d.ts.map +0 -1
  288. package/dist/drivers/logs.d.ts.map +0 -1
  289. package/dist/drivers/logs_stream.d.ts.map +0 -1
  290. package/dist/drivers/ls.d.ts.map +0 -1
  291. package/dist/drivers/types.d.ts.map +0 -1
  292. package/dist/drivers/upload.d.ts.map +0 -1
  293. package/dist/drivers/upload_task.d.ts.map +0 -1
  294. package/dist/drivers/urls/url.d.ts +0 -13
  295. package/dist/drivers/urls/url.d.ts.map +0 -1
  296. package/dist/drivers/virtual_storages.d.ts.map +0 -1
  297. package/dist/helpers/download.d.ts.map +0 -1
  298. package/dist/helpers/download_errors.d.ts.map +0 -1
  299. package/dist/helpers/validate.d.ts.map +0 -1
  300. package/dist/index.cjs.map +0 -1
  301. package/dist/index.d.ts.map +0 -1
  302. package/dist/index.js.map +0 -1
  303. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
  304. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
  305. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +0 -46
  306. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
  307. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
  308. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
  309. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
  310. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
  311. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
  312. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts +0 -108
  313. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +0 -1
  314. package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +0 -1
  315. package/dist/proto-grpc/google/api/http.d.ts +0 -460
  316. package/dist/proto-grpc/google/api/http.d.ts.map +0 -1
  317. package/dist/proto-grpc/google/protobuf/descriptor.d.ts +0 -2340
  318. package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +0 -1
  319. package/dist/proto-grpc/google/protobuf/duration.d.ts.map +0 -1
  320. package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +0 -1
  321. package/dist/proto-rest/downloadapi.d.ts.map +0 -1
  322. package/dist/proto-rest/index.d.ts.map +0 -1
  323. package/dist/proto-rest/lsapi.d.ts +0 -148
  324. package/dist/proto-rest/lsapi.d.ts.map +0 -1
  325. package/dist/proto-rest/progressapi.d.ts.map +0 -1
  326. package/dist/proto-rest/streamingapi.d.ts.map +0 -1
  327. package/dist/proto-rest/uploadapi.d.ts +0 -355
  328. package/dist/proto-rest/uploadapi.d.ts.map +0 -1
  329. package/dist/test_env.d.ts +0 -6
  330. package/dist/test_env.d.ts.map +0 -1
@@ -1,208 +1,179 @@
1
- 'use strict';
2
-
3
- var tsHelpers = require('@milaboratories/ts-helpers');
4
- var fs = require('node:fs');
5
- var path = require('node:path');
6
- var ranges = require('./ranges.cjs');
7
- var file = require('./file.cjs');
8
- var helpers = require('@milaboratories/helpers');
1
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
2
+ const require_ranges = require('./ranges.cjs');
3
+ const require_file = require('./file.cjs');
4
+ let _milaboratories_ts_helpers = require("@milaboratories/ts-helpers");
5
+ let _milaboratories_helpers = require("@milaboratories/helpers");
6
+ let node_fs = require("node:fs");
7
+ let node_path = require("node:path");
8
+ node_path = require_runtime.__toESM(node_path);
9
9
 
10
+ //#region src/drivers/download_blob/sparse_cache/cache.ts
10
11
  /** The implementer of SparseCacheRanges could throw it if ranges were corrupted. */
11
- class CorruptedRangesError extends Error {
12
- name = "CorruptedRangesError";
13
- }
12
+ var CorruptedRangesError = class extends Error {
13
+ name = "CorruptedRangesError";
14
+ };
14
15
  /** Stores ranges in a directory as JSON files (the default implementation). */
15
- class SparseCacheFsRanges {
16
- logger;
17
- cacheDir;
18
- constructor(logger, cacheDir) {
19
- this.logger = logger;
20
- this.cacheDir = cacheDir;
21
- }
22
- fPath(key) {
23
- return path.join(this.cacheDir, ranges.rangesFileName(key));
24
- }
25
- async get(key) {
26
- return await ranges.readRangesFile(this.logger, this.fPath(key));
27
- }
28
- async set(key, ranges$1) {
29
- return await ranges.writeRangesFile(this.logger, this.fPath(key), ranges$1);
30
- }
31
- async delete(key) {
32
- await fs.promises.rm(this.fPath(key));
33
- }
34
- }
16
+ var SparseCacheFsRanges = class {
17
+ constructor(logger, cacheDir) {
18
+ this.logger = logger;
19
+ this.cacheDir = cacheDir;
20
+ }
21
+ fPath(key) {
22
+ return node_path.default.join(this.cacheDir, require_ranges.rangesFileName(key));
23
+ }
24
+ async get(key) {
25
+ return await require_ranges.readRangesFile(this.logger, this.fPath(key));
26
+ }
27
+ async set(key, ranges) {
28
+ return await require_ranges.writeRangesFile(this.logger, this.fPath(key), ranges);
29
+ }
30
+ async delete(key) {
31
+ await node_fs.promises.rm(this.fPath(key));
32
+ }
33
+ };
35
34
  /** Stores sparse files in a directory (the default implementation). */
36
- class SparseCacheFsFile {
37
- logger;
38
- cacheDir;
39
- suffix = ".sparse.bin";
40
- constructor(logger, cacheDir) {
41
- this.logger = logger;
42
- this.cacheDir = cacheDir;
43
- }
44
- async all() {
45
- await tsHelpers.ensureDirExists(this.cacheDir);
46
- const files = await fs.promises.readdir(this.cacheDir);
47
- return files.filter((f) => f.endsWith(this.suffix));
48
- }
49
- async exists(key) {
50
- return await tsHelpers.fileExists(this.path(key));
51
- }
52
- path(key) {
53
- return path.join(this.cacheDir, key + this.suffix);
54
- }
55
- async write(key, data, from) {
56
- await tsHelpers.ensureDirExists(this.cacheDir);
57
- await file.writeToSparseFile(this.logger, process.platform, this.path(key), data, from);
58
- }
59
- async delete(key) {
60
- await fs.promises.rm(this.path(key));
61
- }
62
- }
35
+ var SparseCacheFsFile = class {
36
+ suffix = ".sparse.bin";
37
+ constructor(logger, cacheDir) {
38
+ this.logger = logger;
39
+ this.cacheDir = cacheDir;
40
+ }
41
+ async all() {
42
+ await (0, _milaboratories_ts_helpers.ensureDirExists)(this.cacheDir);
43
+ return (await node_fs.promises.readdir(this.cacheDir)).filter((f) => f.endsWith(this.suffix));
44
+ }
45
+ async exists(key) {
46
+ return await (0, _milaboratories_ts_helpers.fileExists)(this.path(key));
47
+ }
48
+ path(key) {
49
+ return node_path.default.join(this.cacheDir, key + this.suffix);
50
+ }
51
+ async write(key, data, from) {
52
+ await (0, _milaboratories_ts_helpers.ensureDirExists)(this.cacheDir);
53
+ await require_file.writeToSparseFile(this.logger, process.platform, this.path(key), data, from);
54
+ }
55
+ async delete(key) {
56
+ await node_fs.promises.rm(this.path(key));
57
+ }
58
+ };
63
59
  /** LRU cache for ranges of sparse files. */
64
- class SparseCache {
65
- logger;
66
- maxSize;
67
- ranges;
68
- storage;
69
- /** Fields are public for tests. */
70
- /** The lock to make sure cache requests are done one by one. */
71
- lock = new helpers.functions.AwaitLock();
72
- keyToLastAccessTime = new Map();
73
- size = 0;
74
- constructor(logger,
75
- /** The hard limit in bytes. */
76
- maxSize, ranges, storage) {
77
- this.logger = logger;
78
- this.maxSize = maxSize;
79
- this.ranges = ranges;
80
- this.storage = storage;
81
- }
82
- /** Resets a cache's size by rereading everything we already store.
83
- * Safe for concurrent use. */
84
- async reset() {
85
- await withLock(this.lock, async () => {
86
- await this.resetUnsafe();
87
- });
88
- }
89
- /** Returns a path to the key if the range exists in a cache, otherwise returns undefined.
90
- * Safe for concurrent use. */
91
- async get(key, range) {
92
- return await withLock(this.lock, async () => {
93
- return await this.getUnsafe(key, range);
94
- });
95
- }
96
- /** Sets data to the cache's file and clear the cache if it's needed.
97
- * Safe for concurrent use. */
98
- async set(key, range, data) {
99
- await withLock(this.lock, async () => {
100
- await this.setUnsafe(key, range, data);
101
- });
102
- }
103
- async resetUnsafe() {
104
- this.size = 0;
105
- this.keyToLastAccessTime = new Map();
106
- const now = new Date();
107
- // In rmKey method we first deletes the key from a storage and only then from ranges,
108
- // so if something goes wrong between 2 operations,
109
- // on reset the logic will be correct.
110
- for (const key of await this.storage.all()) {
111
- const ranges$1 = await this.ranges.get(key);
112
- this.size += ranges.rangesSize(ranges$1);
113
- this.keyToLastAccessTime.set(key, now);
114
- }
115
- }
116
- async getUnsafe(key, range) {
117
- // It first checks the storage, and then the ranges.
118
- // In another method, when we remove a key, it first deletes a key from a storage and then from ranges,
119
- // so if we don't have a key in storage but have it in ranges, the logic here is correct.
120
- // We probably could reverse the operations here and there, and everywhere we work with both storage and ranges.
121
- if (await this.storage.exists(key)) {
122
- this.keyToLastAccessTime.set(key, new Date());
123
- const ranges$1 = await this.getRanges(key);
124
- if (ranges.doesRangeExist(ranges$1, range)) {
125
- return this.storage.path(key);
126
- }
127
- return undefined;
128
- }
129
- return undefined;
130
- }
131
- async setUnsafe(key, range, data) {
132
- await this.setWithoutEviction(key, range, data);
133
- await this.ensureEvicted();
134
- }
135
- /** Sets a key and recalculates a size, but doesn't ensures that the size is less than the hard limit. */
136
- async setWithoutEviction(key, range, data) {
137
- if (range.to - range.from !== data.length) {
138
- throw new Error(`SparseCache.set: trying to set ${key} with wrong range length: ` +
139
- `range: ${JSON.stringify(range)}, data: ${data.length}`);
140
- }
141
- this.keyToLastAccessTime.set(key, new Date());
142
- const ranges$1 = await this.getRanges(key);
143
- this.size -= ranges.rangesSize(ranges$1);
144
- await this.storage.write(key, data, range.from);
145
- const newRanges = ranges.addRange(ranges$1, range);
146
- this.size += ranges.rangesSize(newRanges);
147
- await this.ranges.set(key, newRanges);
148
- }
149
- /** Ensures the size is less than hard limit by deleting the oldest keys. */
150
- async ensureEvicted() {
151
- const byTime = tsHelpers.mapEntries(this.keyToLastAccessTime);
152
- byTime.sort(([_, aDate], [__, bDate]) => bDate.getTime() - aDate.getTime());
153
- while (this.size > this.maxSize) {
154
- const keyAndDate = byTime.pop(); // removes the oldest
155
- if (!keyAndDate) {
156
- break;
157
- }
158
- const [key, _] = keyAndDate;
159
- const ranges$1 = await this.getRanges(key);
160
- this.size -= ranges.rangesSize(ranges$1);
161
- this.rmKey(key);
162
- }
163
- }
164
- /** Gets ranges and if they were corrupted, then remove the file from the cache and reset the cache's size. */
165
- async getRanges(key) {
166
- try {
167
- return await this.ranges.get(key);
168
- }
169
- catch (e) {
170
- if (e instanceof CorruptedRangesError) {
171
- // We need to reset a state of the cache and update current size,
172
- // it's the only way to calculate the real size when one of the ranges were corrupted.
173
- await this.rmKey(key);
174
- await this.resetUnsafe();
175
- return await this.ranges.get(key);
176
- }
177
- throw e;
178
- }
179
- }
180
- /** Removes a key the state of the cache. The size should be updated. */
181
- async rmKey(key) {
182
- await this.storage.delete(key);
183
- await this.ranges.delete(key);
184
- this.keyToLastAccessTime.delete(key);
185
- }
186
- async dispose() {
187
- await this.lock.acquireAsync();
188
- }
189
- async [Symbol.asyncDispose]() {
190
- await this.dispose();
191
- }
192
- }
60
+ var SparseCache = class {
61
+ /** Fields are public for tests. */
62
+ /** The lock to make sure cache requests are done one by one. */
63
+ lock = new _milaboratories_helpers.functions.AwaitLock();
64
+ keyToLastAccessTime = /* @__PURE__ */ new Map();
65
+ size = 0;
66
+ constructor(logger, maxSize, ranges, storage) {
67
+ this.logger = logger;
68
+ this.maxSize = maxSize;
69
+ this.ranges = ranges;
70
+ this.storage = storage;
71
+ }
72
+ /** Resets a cache's size by rereading everything we already store.
73
+ * Safe for concurrent use. */
74
+ async reset() {
75
+ await withLock(this.lock, async () => {
76
+ await this.resetUnsafe();
77
+ });
78
+ }
79
+ /** Returns a path to the key if the range exists in a cache, otherwise returns undefined.
80
+ * Safe for concurrent use. */
81
+ async get(key, range) {
82
+ return await withLock(this.lock, async () => {
83
+ return await this.getUnsafe(key, range);
84
+ });
85
+ }
86
+ /** Sets data to the cache's file and clear the cache if it's needed.
87
+ * Safe for concurrent use. */
88
+ async set(key, range, data) {
89
+ await withLock(this.lock, async () => {
90
+ await this.setUnsafe(key, range, data);
91
+ });
92
+ }
93
+ async resetUnsafe() {
94
+ this.size = 0;
95
+ this.keyToLastAccessTime = /* @__PURE__ */ new Map();
96
+ const now = /* @__PURE__ */ new Date();
97
+ for (const key of await this.storage.all()) {
98
+ const ranges = await this.ranges.get(key);
99
+ this.size += require_ranges.rangesSize(ranges);
100
+ this.keyToLastAccessTime.set(key, now);
101
+ }
102
+ }
103
+ async getUnsafe(key, range) {
104
+ if (await this.storage.exists(key)) {
105
+ this.keyToLastAccessTime.set(key, /* @__PURE__ */ new Date());
106
+ if (require_ranges.doesRangeExist(await this.getRanges(key), range)) return this.storage.path(key);
107
+ return;
108
+ }
109
+ }
110
+ async setUnsafe(key, range, data) {
111
+ await this.setWithoutEviction(key, range, data);
112
+ await this.ensureEvicted();
113
+ }
114
+ /** Sets a key and recalculates a size, but doesn't ensures that the size is less than the hard limit. */
115
+ async setWithoutEviction(key, range, data) {
116
+ if (range.to - range.from !== data.length) throw new Error(`SparseCache.set: trying to set ${key} with wrong range length: range: ${JSON.stringify(range)}, data: ${data.length}`);
117
+ this.keyToLastAccessTime.set(key, /* @__PURE__ */ new Date());
118
+ const ranges = await this.getRanges(key);
119
+ this.size -= require_ranges.rangesSize(ranges);
120
+ await this.storage.write(key, data, range.from);
121
+ const newRanges = require_ranges.addRange(ranges, range);
122
+ this.size += require_ranges.rangesSize(newRanges);
123
+ await this.ranges.set(key, newRanges);
124
+ }
125
+ /** Ensures the size is less than hard limit by deleting the oldest keys. */
126
+ async ensureEvicted() {
127
+ const byTime = (0, _milaboratories_ts_helpers.mapEntries)(this.keyToLastAccessTime);
128
+ byTime.sort(([_, aDate], [__, bDate]) => bDate.getTime() - aDate.getTime());
129
+ while (this.size > this.maxSize) {
130
+ const keyAndDate = byTime.pop();
131
+ if (!keyAndDate) break;
132
+ const [key, _] = keyAndDate;
133
+ const ranges = await this.getRanges(key);
134
+ this.size -= require_ranges.rangesSize(ranges);
135
+ this.rmKey(key);
136
+ }
137
+ }
138
+ /** Gets ranges and if they were corrupted, then remove the file from the cache and reset the cache's size. */
139
+ async getRanges(key) {
140
+ try {
141
+ return await this.ranges.get(key);
142
+ } catch (e) {
143
+ if (e instanceof CorruptedRangesError) {
144
+ await this.rmKey(key);
145
+ await this.resetUnsafe();
146
+ return await this.ranges.get(key);
147
+ }
148
+ throw e;
149
+ }
150
+ }
151
+ /** Removes a key the state of the cache. The size should be updated. */
152
+ async rmKey(key) {
153
+ await this.storage.delete(key);
154
+ await this.ranges.delete(key);
155
+ this.keyToLastAccessTime.delete(key);
156
+ }
157
+ async dispose() {
158
+ await this.lock.acquireAsync();
159
+ }
160
+ async [Symbol.asyncDispose]() {
161
+ await this.dispose();
162
+ }
163
+ };
193
164
  /** Acquires the lock and executes a callback. */
194
165
  async function withLock(lock, cb) {
195
- try {
196
- await lock.acquireAsync();
197
- return await cb();
198
- }
199
- finally {
200
- lock.release();
201
- }
166
+ try {
167
+ await lock.acquireAsync();
168
+ return await cb();
169
+ } finally {
170
+ lock.release();
171
+ }
202
172
  }
203
173
 
174
+ //#endregion
204
175
  exports.CorruptedRangesError = CorruptedRangesError;
205
176
  exports.SparseCache = SparseCache;
206
177
  exports.SparseCacheFsFile = SparseCacheFsFile;
207
178
  exports.SparseCacheFsRanges = SparseCacheFsRanges;
208
- //# sourceMappingURL=cache.cjs.map
179
+ //# sourceMappingURL=cache.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.cjs","sources":["../../../../src/drivers/download_blob/sparse_cache/cache.ts"],"sourcesContent":["import { RangeBytes } from \"@milaboratories/pl-model-common\";\nimport { ensureDirExists, fileExists, mapEntries, MiLogger } from \"@milaboratories/ts-helpers\";\nimport { promises as fs } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n addRange,\n doesRangeExist,\n Ranges,\n rangesFileName,\n rangesSize,\n readRangesFile,\n writeRangesFile,\n} from \"./ranges\";\nimport { writeToSparseFile } from \"./file\";\nimport { functions } from \"@milaboratories/helpers\";\n\n/** The implementer of SparseCacheRanges could throw it if ranges were corrupted. */\nexport class CorruptedRangesError extends Error {\n name = \"CorruptedRangesError\";\n}\n\n/** Extracted ranges methods to be able to store ranges somewhere else (e.g. in memory for tests). */\nexport interface SparseCacheRanges {\n get(key: string): Promise<Ranges>;\n set(key: string, ranges: Ranges): Promise<void>;\n delete(key: string): Promise<void>;\n}\n\n/** Stores ranges in a directory as JSON files (the default implementation). */\nexport class SparseCacheFsRanges implements SparseCacheRanges {\n constructor(\n private readonly logger: MiLogger,\n private readonly cacheDir: string,\n ) {}\n\n private fPath(key: string): string {\n return path.join(this.cacheDir, rangesFileName(key));\n }\n\n async get(key: string): Promise<Ranges> {\n return await readRangesFile(this.logger, this.fPath(key));\n }\n\n async set(key: string, ranges: Ranges) {\n return await writeRangesFile(this.logger, this.fPath(key), ranges);\n }\n\n async delete(key: string) {\n await fs.rm(this.fPath(key));\n }\n}\n\n/** Extracted interface for storing sparse files. */\nexport interface SparseFileStorage {\n all(): Promise<string[]>;\n exists(key: string): Promise<boolean>;\n path(key: string): string;\n write(key: string, data: Uint8Array, from: number): Promise<void>;\n delete(key: string): Promise<void>;\n}\n\n/** Stores sparse files in a directory (the default implementation). */\nexport class SparseCacheFsFile implements SparseFileStorage {\n private readonly suffix = \".sparse.bin\";\n\n constructor(\n private readonly logger: MiLogger,\n private readonly cacheDir: string,\n ) {}\n\n async all(): Promise<string[]> {\n await ensureDirExists(this.cacheDir);\n const files = await fs.readdir(this.cacheDir);\n return files.filter((f) => f.endsWith(this.suffix));\n }\n\n async exists(key: string): Promise<boolean> {\n return await fileExists(this.path(key));\n }\n\n path(key: string): string {\n return path.join(this.cacheDir, key + this.suffix);\n }\n\n async write(key: string, data: Uint8Array, from: number): Promise<void> {\n await ensureDirExists(this.cacheDir);\n await writeToSparseFile(this.logger, process.platform, this.path(key), data, from);\n }\n\n async delete(key: string): Promise<void> {\n await fs.rm(this.path(key));\n }\n}\n\n/** LRU cache for ranges of sparse files. */\nexport class SparseCache implements AsyncDisposable {\n /** Fields are public for tests. */\n\n /** The lock to make sure cache requests are done one by one. */\n private lock = new functions.AwaitLock();\n\n public keyToLastAccessTime = new Map<string, Date>();\n public size = 0;\n\n constructor(\n public readonly logger: MiLogger,\n /** The hard limit in bytes. */\n public readonly maxSize: number,\n public readonly ranges: SparseCacheRanges,\n public readonly storage: SparseFileStorage,\n ) {}\n\n /** Resets a cache's size by rereading everything we already store.\n * Safe for concurrent use. */\n async reset() {\n await withLock(this.lock, async () => {\n await this.resetUnsafe();\n });\n }\n\n /** Returns a path to the key if the range exists in a cache, otherwise returns undefined.\n * Safe for concurrent use. */\n async get(key: string, range: RangeBytes): Promise<string | undefined> {\n return await withLock(this.lock, async () => {\n return await this.getUnsafe(key, range);\n });\n }\n\n /** Sets data to the cache's file and clear the cache if it's needed.\n * Safe for concurrent use. */\n async set(key: string, range: RangeBytes, data: Uint8Array): Promise<void> {\n await withLock(this.lock, async () => {\n await this.setUnsafe(key, range, data);\n });\n }\n\n private async resetUnsafe() {\n this.size = 0;\n this.keyToLastAccessTime = new Map<string, Date>();\n\n const now = new Date();\n // In rmKey method we first deletes the key from a storage and only then from ranges,\n // so if something goes wrong between 2 operations,\n // on reset the logic will be correct.\n for (const key of await this.storage.all()) {\n const ranges = await this.ranges.get(key);\n this.size += rangesSize(ranges);\n this.keyToLastAccessTime.set(key, now);\n }\n }\n\n private async getUnsafe(key: string, range: RangeBytes): Promise<string | undefined> {\n // It first checks the storage, and then the ranges.\n // In another method, when we remove a key, it first deletes a key from a storage and then from ranges,\n // so if we don't have a key in storage but have it in ranges, the logic here is correct.\n // We probably could reverse the operations here and there, and everywhere we work with both storage and ranges.\n if (await this.storage.exists(key)) {\n this.keyToLastAccessTime.set(key, new Date());\n\n const ranges = await this.getRanges(key);\n if (doesRangeExist(ranges, range)) {\n return this.storage.path(key);\n }\n\n return undefined;\n }\n\n return undefined;\n }\n\n private async setUnsafe(key: string, range: { from: number; to: number }, data: Uint8Array) {\n await this.setWithoutEviction(key, range, data);\n await this.ensureEvicted();\n }\n\n /** Sets a key and recalculates a size, but doesn't ensures that the size is less than the hard limit. */\n async setWithoutEviction(key: string, range: RangeBytes, data: Uint8Array): Promise<void> {\n if (range.to - range.from !== data.length) {\n throw new Error(\n `SparseCache.set: trying to set ${key} with wrong range length: ` +\n `range: ${JSON.stringify(range)}, data: ${data.length}`,\n );\n }\n\n this.keyToLastAccessTime.set(key, new Date());\n\n const ranges = await this.getRanges(key);\n this.size -= rangesSize(ranges);\n\n await this.storage.write(key, data, range.from);\n\n const newRanges = addRange(ranges, range);\n this.size += rangesSize(newRanges);\n\n await this.ranges.set(key, newRanges);\n }\n\n /** Ensures the size is less than hard limit by deleting the oldest keys. */\n async ensureEvicted(): Promise<void> {\n const byTime = mapEntries(this.keyToLastAccessTime);\n byTime.sort(([_, aDate], [__, bDate]) => bDate.getTime() - aDate.getTime());\n\n while (this.size > this.maxSize) {\n const keyAndDate = byTime.pop(); // removes the oldest\n if (!keyAndDate) {\n break;\n }\n const [key, _] = keyAndDate;\n\n const ranges = await this.getRanges(key);\n this.size -= rangesSize(ranges);\n this.rmKey(key);\n }\n }\n\n /** Gets ranges and if they were corrupted, then remove the file from the cache and reset the cache's size. */\n private async getRanges(key: string) {\n try {\n return await this.ranges.get(key);\n } catch (e: unknown) {\n if (e instanceof CorruptedRangesError) {\n // We need to reset a state of the cache and update current size,\n // it's the only way to calculate the real size when one of the ranges were corrupted.\n await this.rmKey(key);\n await this.resetUnsafe();\n\n return await this.ranges.get(key);\n }\n\n throw e;\n }\n }\n\n /** Removes a key the state of the cache. The size should be updated. */\n private async rmKey(key: string) {\n await this.storage.delete(key);\n await this.ranges.delete(key);\n this.keyToLastAccessTime.delete(key);\n }\n\n async dispose(): Promise<void> {\n await this.lock.acquireAsync();\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n await this.dispose();\n }\n}\n\n/** Acquires the lock and executes a callback. */\nasync function withLock<T>(lock: functions.AwaitLock, cb: () => Promise<T>): Promise<T> {\n try {\n await lock.acquireAsync();\n return await cb();\n } finally {\n lock.release();\n }\n}\n"],"names":["rangesFileName","readRangesFile","ranges","writeRangesFile","fs","ensureDirExists","fileExists","writeToSparseFile","functions","rangesSize","doesRangeExist","addRange","mapEntries"],"mappings":";;;;;;;;;AAgBA;AACM,MAAO,oBAAqB,SAAQ,KAAK,CAAA;IAC7C,IAAI,GAAG,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,CAAC;QACT;IACF;;IAGQ,MAAM,KAAK,CAAC,GAAW,EAAA;QAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;QAC9B,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;AAC7B,QAAA,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC;IACtC;AAEA,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;IAChC;AAEA,IAAA,OAAO,MAAM,CAAC,YAAY,CAAC,GAAA;AACzB,QAAA,MAAM,IAAI,CAAC,OAAO,EAAE;IACtB;AACD;AAED;AACA,eAAe,QAAQ,CAAI,IAAyB,EAAE,EAAoB,EAAA;AACxE,IAAA,IAAI;AACF,QAAA,MAAM,IAAI,CAAC,YAAY,EAAE;QACzB,OAAO,MAAM,EAAE,EAAE;IACnB;YAAU;QACR,IAAI,CAAC,OAAO,EAAE;IAChB;AACF;;;;;;;"}
1
+ {"version":3,"file":"cache.cjs","names":["path","rangesFileName","readRangesFile","writeRangesFile","fs","writeToSparseFile","functions","rangesSize","doesRangeExist","addRange"],"sources":["../../../../src/drivers/download_blob/sparse_cache/cache.ts"],"sourcesContent":["import { RangeBytes } from \"@milaboratories/pl-model-common\";\nimport { ensureDirExists, fileExists, mapEntries, MiLogger } from \"@milaboratories/ts-helpers\";\nimport { promises as fs } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n addRange,\n doesRangeExist,\n Ranges,\n rangesFileName,\n rangesSize,\n readRangesFile,\n writeRangesFile,\n} from \"./ranges\";\nimport { writeToSparseFile } from \"./file\";\nimport { functions } from \"@milaboratories/helpers\";\n\n/** The implementer of SparseCacheRanges could throw it if ranges were corrupted. */\nexport class CorruptedRangesError extends Error {\n name = \"CorruptedRangesError\";\n}\n\n/** Extracted ranges methods to be able to store ranges somewhere else (e.g. in memory for tests). */\nexport interface SparseCacheRanges {\n get(key: string): Promise<Ranges>;\n set(key: string, ranges: Ranges): Promise<void>;\n delete(key: string): Promise<void>;\n}\n\n/** Stores ranges in a directory as JSON files (the default implementation). */\nexport class SparseCacheFsRanges implements SparseCacheRanges {\n constructor(\n private readonly logger: MiLogger,\n private readonly cacheDir: string,\n ) {}\n\n private fPath(key: string): string {\n return path.join(this.cacheDir, rangesFileName(key));\n }\n\n async get(key: string): Promise<Ranges> {\n return await readRangesFile(this.logger, this.fPath(key));\n }\n\n async set(key: string, ranges: Ranges) {\n return await writeRangesFile(this.logger, this.fPath(key), ranges);\n }\n\n async delete(key: string) {\n await fs.rm(this.fPath(key));\n }\n}\n\n/** Extracted interface for storing sparse files. */\nexport interface SparseFileStorage {\n all(): Promise<string[]>;\n exists(key: string): Promise<boolean>;\n path(key: string): string;\n write(key: string, data: Uint8Array, from: number): Promise<void>;\n delete(key: string): Promise<void>;\n}\n\n/** Stores sparse files in a directory (the default implementation). */\nexport class SparseCacheFsFile implements SparseFileStorage {\n private readonly suffix = \".sparse.bin\";\n\n constructor(\n private readonly logger: MiLogger,\n private readonly cacheDir: string,\n ) {}\n\n async all(): Promise<string[]> {\n await ensureDirExists(this.cacheDir);\n const files = await fs.readdir(this.cacheDir);\n return files.filter((f) => f.endsWith(this.suffix));\n }\n\n async exists(key: string): Promise<boolean> {\n return await fileExists(this.path(key));\n }\n\n path(key: string): string {\n return path.join(this.cacheDir, key + this.suffix);\n }\n\n async write(key: string, data: Uint8Array, from: number): Promise<void> {\n await ensureDirExists(this.cacheDir);\n await writeToSparseFile(this.logger, process.platform, this.path(key), data, from);\n }\n\n async delete(key: string): Promise<void> {\n await fs.rm(this.path(key));\n }\n}\n\n/** LRU cache for ranges of sparse files. */\nexport class SparseCache implements AsyncDisposable {\n /** Fields are public for tests. */\n\n /** The lock to make sure cache requests are done one by one. */\n private lock = new functions.AwaitLock();\n\n public keyToLastAccessTime = new Map<string, Date>();\n public size = 0;\n\n constructor(\n public readonly logger: MiLogger,\n /** The hard limit in bytes. */\n public readonly maxSize: number,\n public readonly ranges: SparseCacheRanges,\n public readonly storage: SparseFileStorage,\n ) {}\n\n /** Resets a cache's size by rereading everything we already store.\n * Safe for concurrent use. */\n async reset() {\n await withLock(this.lock, async () => {\n await this.resetUnsafe();\n });\n }\n\n /** Returns a path to the key if the range exists in a cache, otherwise returns undefined.\n * Safe for concurrent use. */\n async get(key: string, range: RangeBytes): Promise<string | undefined> {\n return await withLock(this.lock, async () => {\n return await this.getUnsafe(key, range);\n });\n }\n\n /** Sets data to the cache's file and clear the cache if it's needed.\n * Safe for concurrent use. */\n async set(key: string, range: RangeBytes, data: Uint8Array): Promise<void> {\n await withLock(this.lock, async () => {\n await this.setUnsafe(key, range, data);\n });\n }\n\n private async resetUnsafe() {\n this.size = 0;\n this.keyToLastAccessTime = new Map<string, Date>();\n\n const now = new Date();\n // In rmKey method we first deletes the key from a storage and only then from ranges,\n // so if something goes wrong between 2 operations,\n // on reset the logic will be correct.\n for (const key of await this.storage.all()) {\n const ranges = await this.ranges.get(key);\n this.size += rangesSize(ranges);\n this.keyToLastAccessTime.set(key, now);\n }\n }\n\n private async getUnsafe(key: string, range: RangeBytes): Promise<string | undefined> {\n // It first checks the storage, and then the ranges.\n // In another method, when we remove a key, it first deletes a key from a storage and then from ranges,\n // so if we don't have a key in storage but have it in ranges, the logic here is correct.\n // We probably could reverse the operations here and there, and everywhere we work with both storage and ranges.\n if (await this.storage.exists(key)) {\n this.keyToLastAccessTime.set(key, new Date());\n\n const ranges = await this.getRanges(key);\n if (doesRangeExist(ranges, range)) {\n return this.storage.path(key);\n }\n\n return undefined;\n }\n\n return undefined;\n }\n\n private async setUnsafe(key: string, range: { from: number; to: number }, data: Uint8Array) {\n await this.setWithoutEviction(key, range, data);\n await this.ensureEvicted();\n }\n\n /** Sets a key and recalculates a size, but doesn't ensures that the size is less than the hard limit. */\n async setWithoutEviction(key: string, range: RangeBytes, data: Uint8Array): Promise<void> {\n if (range.to - range.from !== data.length) {\n throw new Error(\n `SparseCache.set: trying to set ${key} with wrong range length: ` +\n `range: ${JSON.stringify(range)}, data: ${data.length}`,\n );\n }\n\n this.keyToLastAccessTime.set(key, new Date());\n\n const ranges = await this.getRanges(key);\n this.size -= rangesSize(ranges);\n\n await this.storage.write(key, data, range.from);\n\n const newRanges = addRange(ranges, range);\n this.size += rangesSize(newRanges);\n\n await this.ranges.set(key, newRanges);\n }\n\n /** Ensures the size is less than hard limit by deleting the oldest keys. */\n async ensureEvicted(): Promise<void> {\n const byTime = mapEntries(this.keyToLastAccessTime);\n byTime.sort(([_, aDate], [__, bDate]) => bDate.getTime() - aDate.getTime());\n\n while (this.size > this.maxSize) {\n const keyAndDate = byTime.pop(); // removes the oldest\n if (!keyAndDate) {\n break;\n }\n const [key, _] = keyAndDate;\n\n const ranges = await this.getRanges(key);\n this.size -= rangesSize(ranges);\n this.rmKey(key);\n }\n }\n\n /** Gets ranges and if they were corrupted, then remove the file from the cache and reset the cache's size. */\n private async getRanges(key: string) {\n try {\n return await this.ranges.get(key);\n } catch (e: unknown) {\n if (e instanceof CorruptedRangesError) {\n // We need to reset a state of the cache and update current size,\n // it's the only way to calculate the real size when one of the ranges were corrupted.\n await this.rmKey(key);\n await this.resetUnsafe();\n\n return await this.ranges.get(key);\n }\n\n throw e;\n }\n }\n\n /** Removes a key the state of the cache. The size should be updated. */\n private async rmKey(key: string) {\n await this.storage.delete(key);\n await this.ranges.delete(key);\n this.keyToLastAccessTime.delete(key);\n }\n\n async dispose(): Promise<void> {\n await this.lock.acquireAsync();\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n await this.dispose();\n }\n}\n\n/** Acquires the lock and executes a callback. */\nasync function withLock<T>(lock: functions.AwaitLock, cb: () => Promise<T>): Promise<T> {\n try {\n await lock.acquireAsync();\n return await cb();\n } finally {\n lock.release();\n }\n}\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,OAAO;;;AAWT,IAAa,sBAAb,MAA8D;CAC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