gitx.do 0.1.1 → 0.1.2

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 (356) hide show
  1. package/README.md +40 -353
  2. package/dist/do/logger.d.ts +50 -0
  3. package/dist/do/logger.d.ts.map +1 -0
  4. package/dist/do/logger.js +122 -0
  5. package/dist/do/logger.js.map +1 -0
  6. package/dist/{durable-object → do}/schema.d.ts +3 -3
  7. package/dist/do/schema.d.ts.map +1 -0
  8. package/dist/{durable-object → do}/schema.js +4 -3
  9. package/dist/do/schema.js.map +1 -0
  10. package/dist/do/types.d.ts +267 -0
  11. package/dist/do/types.d.ts.map +1 -0
  12. package/dist/do/types.js +62 -0
  13. package/dist/do/types.js.map +1 -0
  14. package/dist/index.d.ts +14 -469
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +31 -483
  17. package/dist/index.js.map +1 -1
  18. package/package.json +13 -21
  19. package/dist/cli/commands/add.d.ts +0 -176
  20. package/dist/cli/commands/add.d.ts.map +0 -1
  21. package/dist/cli/commands/add.js +0 -979
  22. package/dist/cli/commands/add.js.map +0 -1
  23. package/dist/cli/commands/blame.d.ts +0 -259
  24. package/dist/cli/commands/blame.d.ts.map +0 -1
  25. package/dist/cli/commands/blame.js +0 -609
  26. package/dist/cli/commands/blame.js.map +0 -1
  27. package/dist/cli/commands/branch.d.ts +0 -249
  28. package/dist/cli/commands/branch.d.ts.map +0 -1
  29. package/dist/cli/commands/branch.js +0 -693
  30. package/dist/cli/commands/branch.js.map +0 -1
  31. package/dist/cli/commands/checkout.d.ts +0 -73
  32. package/dist/cli/commands/checkout.d.ts.map +0 -1
  33. package/dist/cli/commands/checkout.js +0 -725
  34. package/dist/cli/commands/checkout.js.map +0 -1
  35. package/dist/cli/commands/commit.d.ts +0 -182
  36. package/dist/cli/commands/commit.d.ts.map +0 -1
  37. package/dist/cli/commands/commit.js +0 -457
  38. package/dist/cli/commands/commit.js.map +0 -1
  39. package/dist/cli/commands/diff.d.ts +0 -464
  40. package/dist/cli/commands/diff.d.ts.map +0 -1
  41. package/dist/cli/commands/diff.js +0 -959
  42. package/dist/cli/commands/diff.js.map +0 -1
  43. package/dist/cli/commands/log.d.ts +0 -239
  44. package/dist/cli/commands/log.d.ts.map +0 -1
  45. package/dist/cli/commands/log.js +0 -535
  46. package/dist/cli/commands/log.js.map +0 -1
  47. package/dist/cli/commands/merge.d.ts +0 -106
  48. package/dist/cli/commands/merge.d.ts.map +0 -1
  49. package/dist/cli/commands/merge.js +0 -852
  50. package/dist/cli/commands/merge.js.map +0 -1
  51. package/dist/cli/commands/review.d.ts +0 -457
  52. package/dist/cli/commands/review.d.ts.map +0 -1
  53. package/dist/cli/commands/review.js +0 -558
  54. package/dist/cli/commands/review.js.map +0 -1
  55. package/dist/cli/commands/stash.d.ts +0 -157
  56. package/dist/cli/commands/stash.d.ts.map +0 -1
  57. package/dist/cli/commands/stash.js +0 -655
  58. package/dist/cli/commands/stash.js.map +0 -1
  59. package/dist/cli/commands/status.d.ts +0 -269
  60. package/dist/cli/commands/status.d.ts.map +0 -1
  61. package/dist/cli/commands/status.js +0 -492
  62. package/dist/cli/commands/status.js.map +0 -1
  63. package/dist/cli/commands/web.d.ts +0 -199
  64. package/dist/cli/commands/web.d.ts.map +0 -1
  65. package/dist/cli/commands/web.js +0 -697
  66. package/dist/cli/commands/web.js.map +0 -1
  67. package/dist/cli/fs-adapter.d.ts +0 -656
  68. package/dist/cli/fs-adapter.d.ts.map +0 -1
  69. package/dist/cli/fs-adapter.js +0 -1177
  70. package/dist/cli/fs-adapter.js.map +0 -1
  71. package/dist/cli/fsx-cli-adapter.d.ts +0 -359
  72. package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
  73. package/dist/cli/fsx-cli-adapter.js +0 -619
  74. package/dist/cli/fsx-cli-adapter.js.map +0 -1
  75. package/dist/cli/index.d.ts +0 -387
  76. package/dist/cli/index.d.ts.map +0 -1
  77. package/dist/cli/index.js +0 -579
  78. package/dist/cli/index.js.map +0 -1
  79. package/dist/cli/ui/components/DiffView.d.ts +0 -12
  80. package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
  81. package/dist/cli/ui/components/DiffView.js +0 -11
  82. package/dist/cli/ui/components/DiffView.js.map +0 -1
  83. package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -10
  84. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
  85. package/dist/cli/ui/components/ErrorDisplay.js +0 -11
  86. package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
  87. package/dist/cli/ui/components/FuzzySearch.d.ts +0 -15
  88. package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
  89. package/dist/cli/ui/components/FuzzySearch.js +0 -12
  90. package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
  91. package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -10
  92. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
  93. package/dist/cli/ui/components/LoadingSpinner.js +0 -10
  94. package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
  95. package/dist/cli/ui/components/NavigationList.d.ts +0 -14
  96. package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
  97. package/dist/cli/ui/components/NavigationList.js +0 -11
  98. package/dist/cli/ui/components/NavigationList.js.map +0 -1
  99. package/dist/cli/ui/components/ScrollableContent.d.ts +0 -13
  100. package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
  101. package/dist/cli/ui/components/ScrollableContent.js +0 -11
  102. package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
  103. package/dist/cli/ui/components/index.d.ts +0 -7
  104. package/dist/cli/ui/components/index.d.ts.map +0 -1
  105. package/dist/cli/ui/components/index.js +0 -9
  106. package/dist/cli/ui/components/index.js.map +0 -1
  107. package/dist/cli/ui/terminal-ui.d.ts +0 -85
  108. package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
  109. package/dist/cli/ui/terminal-ui.js +0 -121
  110. package/dist/cli/ui/terminal-ui.js.map +0 -1
  111. package/dist/do/BashModule.d.ts +0 -871
  112. package/dist/do/BashModule.d.ts.map +0 -1
  113. package/dist/do/BashModule.js +0 -1143
  114. package/dist/do/BashModule.js.map +0 -1
  115. package/dist/do/FsModule.d.ts +0 -612
  116. package/dist/do/FsModule.d.ts.map +0 -1
  117. package/dist/do/FsModule.js +0 -1120
  118. package/dist/do/FsModule.js.map +0 -1
  119. package/dist/do/GitModule.d.ts +0 -635
  120. package/dist/do/GitModule.d.ts.map +0 -1
  121. package/dist/do/GitModule.js +0 -784
  122. package/dist/do/GitModule.js.map +0 -1
  123. package/dist/do/GitRepoDO.d.ts +0 -281
  124. package/dist/do/GitRepoDO.d.ts.map +0 -1
  125. package/dist/do/GitRepoDO.js +0 -479
  126. package/dist/do/GitRepoDO.js.map +0 -1
  127. package/dist/do/bash-ast.d.ts +0 -246
  128. package/dist/do/bash-ast.d.ts.map +0 -1
  129. package/dist/do/bash-ast.js +0 -888
  130. package/dist/do/bash-ast.js.map +0 -1
  131. package/dist/do/container-executor.d.ts +0 -491
  132. package/dist/do/container-executor.d.ts.map +0 -1
  133. package/dist/do/container-executor.js +0 -731
  134. package/dist/do/container-executor.js.map +0 -1
  135. package/dist/do/index.d.ts +0 -53
  136. package/dist/do/index.d.ts.map +0 -1
  137. package/dist/do/index.js +0 -91
  138. package/dist/do/index.js.map +0 -1
  139. package/dist/do/tiered-storage.d.ts +0 -403
  140. package/dist/do/tiered-storage.d.ts.map +0 -1
  141. package/dist/do/tiered-storage.js +0 -689
  142. package/dist/do/tiered-storage.js.map +0 -1
  143. package/dist/do/withBash.d.ts +0 -231
  144. package/dist/do/withBash.d.ts.map +0 -1
  145. package/dist/do/withBash.js +0 -244
  146. package/dist/do/withBash.js.map +0 -1
  147. package/dist/do/withFs.d.ts +0 -237
  148. package/dist/do/withFs.d.ts.map +0 -1
  149. package/dist/do/withFs.js +0 -387
  150. package/dist/do/withFs.js.map +0 -1
  151. package/dist/do/withGit.d.ts +0 -180
  152. package/dist/do/withGit.d.ts.map +0 -1
  153. package/dist/do/withGit.js +0 -271
  154. package/dist/do/withGit.js.map +0 -1
  155. package/dist/durable-object/object-store.d.ts +0 -633
  156. package/dist/durable-object/object-store.d.ts.map +0 -1
  157. package/dist/durable-object/object-store.js +0 -1164
  158. package/dist/durable-object/object-store.js.map +0 -1
  159. package/dist/durable-object/schema.d.ts.map +0 -1
  160. package/dist/durable-object/schema.js.map +0 -1
  161. package/dist/durable-object/wal.d.ts +0 -416
  162. package/dist/durable-object/wal.d.ts.map +0 -1
  163. package/dist/durable-object/wal.js +0 -445
  164. package/dist/durable-object/wal.js.map +0 -1
  165. package/dist/mcp/adapter.d.ts +0 -772
  166. package/dist/mcp/adapter.d.ts.map +0 -1
  167. package/dist/mcp/adapter.js +0 -895
  168. package/dist/mcp/adapter.js.map +0 -1
  169. package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
  170. package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
  171. package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
  172. package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
  173. package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
  174. package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
  175. package/dist/mcp/sandbox/object-store-proxy.js +0 -30
  176. package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
  177. package/dist/mcp/sandbox/template.d.ts +0 -17
  178. package/dist/mcp/sandbox/template.d.ts.map +0 -1
  179. package/dist/mcp/sandbox/template.js +0 -71
  180. package/dist/mcp/sandbox/template.js.map +0 -1
  181. package/dist/mcp/sandbox.d.ts +0 -764
  182. package/dist/mcp/sandbox.d.ts.map +0 -1
  183. package/dist/mcp/sandbox.js +0 -1362
  184. package/dist/mcp/sandbox.js.map +0 -1
  185. package/dist/mcp/sdk-adapter.d.ts +0 -835
  186. package/dist/mcp/sdk-adapter.d.ts.map +0 -1
  187. package/dist/mcp/sdk-adapter.js +0 -974
  188. package/dist/mcp/sdk-adapter.js.map +0 -1
  189. package/dist/mcp/tools/do.d.ts +0 -32
  190. package/dist/mcp/tools/do.d.ts.map +0 -1
  191. package/dist/mcp/tools/do.js +0 -117
  192. package/dist/mcp/tools/do.js.map +0 -1
  193. package/dist/mcp/tools.d.ts +0 -548
  194. package/dist/mcp/tools.d.ts.map +0 -1
  195. package/dist/mcp/tools.js +0 -3170
  196. package/dist/mcp/tools.js.map +0 -1
  197. package/dist/ops/blame.d.ts +0 -551
  198. package/dist/ops/blame.d.ts.map +0 -1
  199. package/dist/ops/blame.js +0 -1037
  200. package/dist/ops/blame.js.map +0 -1
  201. package/dist/ops/branch.d.ts +0 -766
  202. package/dist/ops/branch.d.ts.map +0 -1
  203. package/dist/ops/branch.js +0 -950
  204. package/dist/ops/branch.js.map +0 -1
  205. package/dist/ops/commit-traversal.d.ts +0 -349
  206. package/dist/ops/commit-traversal.d.ts.map +0 -1
  207. package/dist/ops/commit-traversal.js +0 -821
  208. package/dist/ops/commit-traversal.js.map +0 -1
  209. package/dist/ops/commit.d.ts +0 -555
  210. package/dist/ops/commit.d.ts.map +0 -1
  211. package/dist/ops/commit.js +0 -826
  212. package/dist/ops/commit.js.map +0 -1
  213. package/dist/ops/merge-base.d.ts +0 -397
  214. package/dist/ops/merge-base.d.ts.map +0 -1
  215. package/dist/ops/merge-base.js +0 -691
  216. package/dist/ops/merge-base.js.map +0 -1
  217. package/dist/ops/merge.d.ts +0 -855
  218. package/dist/ops/merge.d.ts.map +0 -1
  219. package/dist/ops/merge.js +0 -1551
  220. package/dist/ops/merge.js.map +0 -1
  221. package/dist/ops/tag.d.ts +0 -247
  222. package/dist/ops/tag.d.ts.map +0 -1
  223. package/dist/ops/tag.js +0 -649
  224. package/dist/ops/tag.js.map +0 -1
  225. package/dist/ops/tree-builder.d.ts +0 -178
  226. package/dist/ops/tree-builder.d.ts.map +0 -1
  227. package/dist/ops/tree-builder.js +0 -271
  228. package/dist/ops/tree-builder.js.map +0 -1
  229. package/dist/ops/tree-diff.d.ts +0 -291
  230. package/dist/ops/tree-diff.d.ts.map +0 -1
  231. package/dist/ops/tree-diff.js +0 -705
  232. package/dist/ops/tree-diff.js.map +0 -1
  233. package/dist/pack/delta.d.ts +0 -248
  234. package/dist/pack/delta.d.ts.map +0 -1
  235. package/dist/pack/delta.js +0 -740
  236. package/dist/pack/delta.js.map +0 -1
  237. package/dist/pack/format.d.ts +0 -446
  238. package/dist/pack/format.d.ts.map +0 -1
  239. package/dist/pack/format.js +0 -572
  240. package/dist/pack/format.js.map +0 -1
  241. package/dist/pack/full-generation.d.ts +0 -612
  242. package/dist/pack/full-generation.d.ts.map +0 -1
  243. package/dist/pack/full-generation.js +0 -1378
  244. package/dist/pack/full-generation.js.map +0 -1
  245. package/dist/pack/generation.d.ts +0 -441
  246. package/dist/pack/generation.d.ts.map +0 -1
  247. package/dist/pack/generation.js +0 -707
  248. package/dist/pack/generation.js.map +0 -1
  249. package/dist/pack/index.d.ts +0 -502
  250. package/dist/pack/index.d.ts.map +0 -1
  251. package/dist/pack/index.js +0 -833
  252. package/dist/pack/index.js.map +0 -1
  253. package/dist/refs/branch.d.ts +0 -683
  254. package/dist/refs/branch.d.ts.map +0 -1
  255. package/dist/refs/branch.js +0 -881
  256. package/dist/refs/branch.js.map +0 -1
  257. package/dist/refs/storage.d.ts +0 -833
  258. package/dist/refs/storage.d.ts.map +0 -1
  259. package/dist/refs/storage.js +0 -1023
  260. package/dist/refs/storage.js.map +0 -1
  261. package/dist/refs/tag.d.ts +0 -860
  262. package/dist/refs/tag.d.ts.map +0 -1
  263. package/dist/refs/tag.js +0 -996
  264. package/dist/refs/tag.js.map +0 -1
  265. package/dist/storage/backend.d.ts +0 -425
  266. package/dist/storage/backend.d.ts.map +0 -1
  267. package/dist/storage/backend.js +0 -41
  268. package/dist/storage/backend.js.map +0 -1
  269. package/dist/storage/fsx-adapter.d.ts +0 -204
  270. package/dist/storage/fsx-adapter.d.ts.map +0 -1
  271. package/dist/storage/fsx-adapter.js +0 -518
  272. package/dist/storage/fsx-adapter.js.map +0 -1
  273. package/dist/storage/lru-cache.d.ts +0 -691
  274. package/dist/storage/lru-cache.d.ts.map +0 -1
  275. package/dist/storage/lru-cache.js +0 -813
  276. package/dist/storage/lru-cache.js.map +0 -1
  277. package/dist/storage/object-index.d.ts +0 -585
  278. package/dist/storage/object-index.d.ts.map +0 -1
  279. package/dist/storage/object-index.js +0 -532
  280. package/dist/storage/object-index.js.map +0 -1
  281. package/dist/storage/r2-pack.d.ts +0 -1257
  282. package/dist/storage/r2-pack.d.ts.map +0 -1
  283. package/dist/storage/r2-pack.js +0 -1773
  284. package/dist/storage/r2-pack.js.map +0 -1
  285. package/dist/tiered/cdc-pipeline.d.ts +0 -1888
  286. package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
  287. package/dist/tiered/cdc-pipeline.js +0 -1880
  288. package/dist/tiered/cdc-pipeline.js.map +0 -1
  289. package/dist/tiered/migration.d.ts +0 -1104
  290. package/dist/tiered/migration.d.ts.map +0 -1
  291. package/dist/tiered/migration.js +0 -1217
  292. package/dist/tiered/migration.js.map +0 -1
  293. package/dist/tiered/parquet-writer.d.ts +0 -1145
  294. package/dist/tiered/parquet-writer.d.ts.map +0 -1
  295. package/dist/tiered/parquet-writer.js +0 -1183
  296. package/dist/tiered/parquet-writer.js.map +0 -1
  297. package/dist/tiered/read-path.d.ts +0 -835
  298. package/dist/tiered/read-path.d.ts.map +0 -1
  299. package/dist/tiered/read-path.js +0 -487
  300. package/dist/tiered/read-path.js.map +0 -1
  301. package/dist/types/capability.d.ts +0 -1385
  302. package/dist/types/capability.d.ts.map +0 -1
  303. package/dist/types/capability.js +0 -36
  304. package/dist/types/capability.js.map +0 -1
  305. package/dist/types/index.d.ts +0 -13
  306. package/dist/types/index.d.ts.map +0 -1
  307. package/dist/types/index.js +0 -18
  308. package/dist/types/index.js.map +0 -1
  309. package/dist/types/interfaces.d.ts +0 -673
  310. package/dist/types/interfaces.d.ts.map +0 -1
  311. package/dist/types/interfaces.js +0 -26
  312. package/dist/types/interfaces.js.map +0 -1
  313. package/dist/types/objects.d.ts +0 -692
  314. package/dist/types/objects.d.ts.map +0 -1
  315. package/dist/types/objects.js +0 -837
  316. package/dist/types/objects.js.map +0 -1
  317. package/dist/types/storage.d.ts +0 -603
  318. package/dist/types/storage.d.ts.map +0 -1
  319. package/dist/types/storage.js +0 -191
  320. package/dist/types/storage.js.map +0 -1
  321. package/dist/types/worker-loader.d.ts +0 -60
  322. package/dist/types/worker-loader.d.ts.map +0 -1
  323. package/dist/types/worker-loader.js +0 -62
  324. package/dist/types/worker-loader.js.map +0 -1
  325. package/dist/utils/hash.d.ts +0 -198
  326. package/dist/utils/hash.d.ts.map +0 -1
  327. package/dist/utils/hash.js +0 -272
  328. package/dist/utils/hash.js.map +0 -1
  329. package/dist/utils/sha1.d.ts +0 -325
  330. package/dist/utils/sha1.d.ts.map +0 -1
  331. package/dist/utils/sha1.js +0 -635
  332. package/dist/utils/sha1.js.map +0 -1
  333. package/dist/wire/capabilities.d.ts +0 -1044
  334. package/dist/wire/capabilities.d.ts.map +0 -1
  335. package/dist/wire/capabilities.js +0 -941
  336. package/dist/wire/capabilities.js.map +0 -1
  337. package/dist/wire/path-security.d.ts +0 -157
  338. package/dist/wire/path-security.d.ts.map +0 -1
  339. package/dist/wire/path-security.js +0 -307
  340. package/dist/wire/path-security.js.map +0 -1
  341. package/dist/wire/pkt-line.d.ts +0 -345
  342. package/dist/wire/pkt-line.d.ts.map +0 -1
  343. package/dist/wire/pkt-line.js +0 -381
  344. package/dist/wire/pkt-line.js.map +0 -1
  345. package/dist/wire/receive-pack.d.ts +0 -1059
  346. package/dist/wire/receive-pack.d.ts.map +0 -1
  347. package/dist/wire/receive-pack.js +0 -1414
  348. package/dist/wire/receive-pack.js.map +0 -1
  349. package/dist/wire/smart-http.d.ts +0 -799
  350. package/dist/wire/smart-http.d.ts.map +0 -1
  351. package/dist/wire/smart-http.js +0 -945
  352. package/dist/wire/smart-http.js.map +0 -1
  353. package/dist/wire/upload-pack.d.ts +0 -727
  354. package/dist/wire/upload-pack.d.ts.map +0 -1
  355. package/dist/wire/upload-pack.js +0 -1141
  356. package/dist/wire/upload-pack.js.map +0 -1
@@ -1,835 +0,0 @@
1
- /**
2
- * @fileoverview Tiered Read Path Module
3
- *
4
- * @description
5
- * Implements reading objects from a multi-tier storage system designed for
6
- * Git object storage. The tiered approach optimizes for both performance and
7
- * cost by organizing data across multiple storage layers with different
8
- * characteristics:
9
- *
10
- * **Storage Tiers:**
11
- * - **Hot tier**: Durable Object SQLite (fastest, local, highest cost)
12
- * - **Warm tier**: R2 object storage (medium latency, packed objects)
13
- * - **Cold tier**: Analytics/Parquet (highest latency, lowest cost)
14
- *
15
- * **Features:**
16
- * - Automatic tier fallback on cache miss
17
- * - Read-through caching with promotion to hotter tiers
18
- * - Configurable promotion policies (aggressive, conservative, none)
19
- * - Latency tracking for performance monitoring
20
- *
21
- * **Architecture:**
22
- * The TieredReader orchestrates reads across all tiers, attempting to serve
23
- * data from the fastest available tier while optionally promoting frequently
24
- * accessed objects to faster tiers.
25
- *
26
- * @example
27
- * ```typescript
28
- * // Create a tiered reader with all backends
29
- * const reader = new TieredReader(
30
- * hotBackend,
31
- * warmBackend,
32
- * coldBackend,
33
- * {
34
- * hot: { enabled: true, maxSize: 1024 * 1024 },
35
- * warm: { enabled: true },
36
- * cold: { enabled: true },
37
- * promotionPolicy: 'aggressive'
38
- * }
39
- * )
40
- *
41
- * // Read an object - will try hot -> warm -> cold
42
- * const result = await reader.read('abc123...')
43
- * if (result.object) {
44
- * console.log(`Found in ${result.tier} tier`)
45
- * console.log(`Latency: ${result.latencyMs}ms`)
46
- * if (result.promoted) {
47
- * console.log('Object was promoted to hot tier')
48
- * }
49
- * }
50
- * ```
51
- *
52
- * @module tiered/read-path
53
- * @see {@link TieredReader} - Main implementation class
54
- * @see {@link TieredStorageConfig} - Configuration options
55
- */
56
- import { ObjectType } from '../types/objects';
57
- /**
58
- * Represents a Git object stored in the tiered storage system.
59
- *
60
- * @description
61
- * StoredObject is the common representation of a Git object across all storage
62
- * tiers. It contains the object's content, metadata, and timing information
63
- * needed for cache management and analytics.
64
- *
65
- * @example
66
- * ```typescript
67
- * const blobObject: StoredObject = {
68
- * sha: 'a1b2c3d4e5f6...',
69
- * type: 'blob',
70
- * size: 1024,
71
- * data: new Uint8Array([...]),
72
- * createdAt: Date.now()
73
- * }
74
- * ```
75
- *
76
- * @interface StoredObject
77
- */
78
- export interface StoredObject {
79
- /**
80
- * SHA-1 hash of the object content.
81
- * Must be a 40-character hexadecimal string.
82
- *
83
- * @example 'a1b2c3d4e5f678901234567890abcdef12345678'
84
- */
85
- sha: string;
86
- /**
87
- * Git object type (blob, tree, commit, or tag).
88
- *
89
- * @see {@link ObjectType}
90
- */
91
- type: ObjectType;
92
- /**
93
- * Size of the uncompressed object data in bytes.
94
- */
95
- size: number;
96
- /**
97
- * Raw object data as a byte array.
98
- * This is the uncompressed content of the Git object.
99
- */
100
- data: Uint8Array;
101
- /**
102
- * Unix timestamp (milliseconds) when the object was first stored.
103
- * Used for TTL calculations and analytics.
104
- */
105
- createdAt: number;
106
- }
107
- /**
108
- * Configuration options for a single storage tier.
109
- *
110
- * @description
111
- * Each tier can be individually enabled/disabled and configured with
112
- * size limits and TTL (time-to-live) settings. This allows fine-grained
113
- * control over which objects are stored in each tier.
114
- *
115
- * @example
116
- * ```typescript
117
- * // Hot tier with size limit and TTL
118
- * const hotConfig: TierConfig = {
119
- * enabled: true,
120
- * maxSize: 1024 * 1024, // 1MB max object size
121
- * ttl: 3600 * 1000 // 1 hour TTL
122
- * }
123
- *
124
- * // Disabled tier
125
- * const disabledConfig: TierConfig = {
126
- * enabled: false
127
- * }
128
- * ```
129
- *
130
- * @interface TierConfig
131
- */
132
- export interface TierConfig {
133
- /**
134
- * Whether this tier is enabled for reads and writes.
135
- * Disabled tiers are skipped during read operations.
136
- */
137
- enabled: boolean;
138
- /**
139
- * Maximum object size in bytes that can be stored in this tier.
140
- * Objects larger than this size will not be promoted to this tier.
141
- * If undefined, no size limit is enforced.
142
- *
143
- * @example 1048576 // 1MB
144
- */
145
- maxSize?: number;
146
- /**
147
- * Time-to-live in milliseconds for objects in this tier.
148
- * Objects older than TTL may be evicted or migrated to colder tiers.
149
- * If undefined, objects persist indefinitely.
150
- *
151
- * @example 3600000 // 1 hour
152
- */
153
- ttl?: number;
154
- }
155
- /**
156
- * Complete configuration for the tiered storage system.
157
- *
158
- * @description
159
- * Defines the behavior of all three storage tiers (hot, warm, cold) and
160
- * the promotion policy that determines when objects are moved to faster tiers.
161
- *
162
- * **Promotion Policies:**
163
- * - `aggressive`: Immediately promote objects to hot tier on first access
164
- * - `conservative`: Only promote on repeated access (not yet implemented)
165
- * - `none`: Never automatically promote objects
166
- *
167
- * @example
168
- * ```typescript
169
- * const config: TieredStorageConfig = {
170
- * hot: {
171
- * enabled: true,
172
- * maxSize: 1024 * 1024, // 1MB max
173
- * ttl: 3600 * 1000 // 1 hour
174
- * },
175
- * warm: {
176
- * enabled: true,
177
- * maxSize: 10 * 1024 * 1024 // 10MB max
178
- * },
179
- * cold: {
180
- * enabled: true
181
- * // No size limit for cold storage
182
- * },
183
- * promotionPolicy: 'aggressive'
184
- * }
185
- * ```
186
- *
187
- * @interface TieredStorageConfig
188
- */
189
- export interface TieredStorageConfig {
190
- /**
191
- * Configuration for the hot tier (Durable Object SQLite).
192
- * Hot tier provides the fastest access but has limited capacity.
193
- */
194
- hot: TierConfig;
195
- /**
196
- * Configuration for the warm tier (R2 object storage).
197
- * Warm tier provides moderate latency with larger capacity.
198
- */
199
- warm: TierConfig;
200
- /**
201
- * Configuration for the cold tier (Analytics/Parquet).
202
- * Cold tier provides lowest cost storage for archival.
203
- */
204
- cold: TierConfig;
205
- /**
206
- * Policy for promoting objects to hotter tiers.
207
- *
208
- * - `aggressive`: Promote on first read from colder tier
209
- * - `conservative`: Promote only on repeated access
210
- * - `none`: Never automatically promote
211
- */
212
- promotionPolicy: 'aggressive' | 'conservative' | 'none';
213
- }
214
- /**
215
- * Result of a read operation from the tiered storage system.
216
- *
217
- * @description
218
- * ReadResult provides complete information about a read operation, including
219
- * the retrieved object (if found), which tier served the request, whether
220
- * the object was promoted, and latency metrics.
221
- *
222
- * @example
223
- * ```typescript
224
- * const result = await reader.read(sha)
225
- *
226
- * if (result.object) {
227
- * console.log(`Object found in ${result.tier} tier`)
228
- * console.log(`Size: ${result.object.size} bytes`)
229
- * console.log(`Latency: ${result.latencyMs}ms`)
230
- *
231
- * if (result.promoted) {
232
- * console.log('Object was promoted to hot tier for faster future access')
233
- * }
234
- * } else {
235
- * console.log('Object not found in any tier')
236
- * console.log(`Search took ${result.latencyMs}ms`)
237
- * }
238
- * ```
239
- *
240
- * @interface ReadResult
241
- */
242
- export interface ReadResult {
243
- /**
244
- * The retrieved object, or null if not found in any tier.
245
- */
246
- object: StoredObject | null;
247
- /**
248
- * The tier that served the request, or null if object was not found.
249
- */
250
- tier: 'hot' | 'warm' | 'cold' | null;
251
- /**
252
- * Whether the object was promoted to a hotter tier during this read.
253
- * Only true if the object was found in warm/cold tier and successfully
254
- * copied to the hot tier.
255
- */
256
- promoted: boolean;
257
- /**
258
- * Total latency of the read operation in milliseconds.
259
- * Includes time spent checking all tiers and any promotion overhead.
260
- */
261
- latencyMs: number;
262
- }
263
- /**
264
- * Interface for the tiered object store.
265
- *
266
- * @description
267
- * Defines the public API for interacting with the tiered storage system.
268
- * Implementations must provide methods for reading from any tier,
269
- * manual promotion, and configuration access.
270
- *
271
- * @example
272
- * ```typescript
273
- * class MyTieredStore implements TieredObjectStore {
274
- * async read(sha: string): Promise<ReadResult> {
275
- * // Implementation
276
- * }
277
- * // ... other methods
278
- * }
279
- * ```
280
- *
281
- * @interface TieredObjectStore
282
- */
283
- export interface TieredObjectStore {
284
- /**
285
- * Reads an object from the tiered storage system.
286
- *
287
- * @description
288
- * Attempts to read the object from each enabled tier in order
289
- * (hot -> warm -> cold), returning as soon as the object is found.
290
- * May promote the object to the hot tier based on the promotion policy.
291
- *
292
- * @param sha - The 40-character SHA-1 hash of the object to read
293
- * @returns Promise resolving to the read result
294
- *
295
- * @example
296
- * ```typescript
297
- * const result = await store.read('abc123...')
298
- * if (result.object) {
299
- * // Process the object data
300
- * }
301
- * ```
302
- */
303
- read(sha: string): Promise<ReadResult>;
304
- /**
305
- * Reads an object directly from the hot tier only.
306
- *
307
- * @description
308
- * Bypasses the tier fallback logic to read directly from the hot tier.
309
- * Useful for checking if an object is already cached.
310
- *
311
- * @param sha - The 40-character SHA-1 hash of the object
312
- * @returns Promise resolving to the object or null if not in hot tier
313
- */
314
- readFromHot(sha: string): Promise<StoredObject | null>;
315
- /**
316
- * Reads an object directly from the warm tier only.
317
- *
318
- * @description
319
- * Bypasses the tier fallback logic to read directly from the warm tier.
320
- * Does not trigger promotion to the hot tier.
321
- *
322
- * @param sha - The 40-character SHA-1 hash of the object
323
- * @returns Promise resolving to the object or null if not in warm tier
324
- */
325
- readFromWarm(sha: string): Promise<StoredObject | null>;
326
- /**
327
- * Reads an object directly from the cold tier only.
328
- *
329
- * @description
330
- * Bypasses the tier fallback logic to read directly from the cold tier.
331
- * Does not trigger promotion to hotter tiers.
332
- *
333
- * @param sha - The 40-character SHA-1 hash of the object
334
- * @returns Promise resolving to the object or null if not in cold tier
335
- */
336
- readFromCold(sha: string): Promise<StoredObject | null>;
337
- /**
338
- * Manually promotes an object to the hot tier.
339
- *
340
- * @description
341
- * Copies the provided object to the hot tier storage. This is useful for
342
- * pre-warming the cache or manually controlling tier placement.
343
- *
344
- * @param sha - The 40-character SHA-1 hash of the object
345
- * @param object - The complete stored object to promote
346
- * @returns Promise that resolves when promotion is complete
347
- *
348
- * @example
349
- * ```typescript
350
- * // Pre-warm the cache with frequently accessed objects
351
- * for (const obj of frequentObjects) {
352
- * await store.promoteToHot(obj.sha, obj)
353
- * }
354
- * ```
355
- */
356
- promoteToHot(sha: string, object: StoredObject): Promise<void>;
357
- /**
358
- * Returns the current storage configuration.
359
- *
360
- * @returns The tiered storage configuration
361
- */
362
- getConfig(): TieredStorageConfig;
363
- }
364
- /**
365
- * Backend interface for the hot tier (Durable Object SQLite).
366
- *
367
- * @description
368
- * The hot tier backend provides fast, local storage using Durable Object
369
- * SQLite. It supports full CRUD operations for Git objects.
370
- *
371
- * @example
372
- * ```typescript
373
- * class SqliteHotBackend implements HotTierBackend {
374
- * async get(sha: string): Promise<StoredObject | null> {
375
- * const row = await this.db.get('SELECT * FROM objects WHERE sha = ?', sha)
376
- * return row ? this.rowToObject(row) : null
377
- * }
378
- *
379
- * async put(sha: string, object: StoredObject): Promise<void> {
380
- * await this.db.run(
381
- * 'INSERT OR REPLACE INTO objects VALUES (?, ?, ?, ?, ?)',
382
- * sha, object.type, object.size, object.data, object.createdAt
383
- * )
384
- * }
385
- *
386
- * async delete(sha: string): Promise<boolean> {
387
- * const result = await this.db.run('DELETE FROM objects WHERE sha = ?', sha)
388
- * return result.changes > 0
389
- * }
390
- *
391
- * async has(sha: string): Promise<boolean> {
392
- * const row = await this.db.get('SELECT 1 FROM objects WHERE sha = ?', sha)
393
- * return !!row
394
- * }
395
- * }
396
- * ```
397
- *
398
- * @interface HotTierBackend
399
- */
400
- export interface HotTierBackend {
401
- /**
402
- * Retrieves an object from the hot tier.
403
- *
404
- * @param sha - The 40-character SHA-1 hash of the object
405
- * @returns Promise resolving to the object or null if not found
406
- */
407
- get(sha: string): Promise<StoredObject | null>;
408
- /**
409
- * Stores an object in the hot tier.
410
- *
411
- * @param sha - The 40-character SHA-1 hash of the object
412
- * @param object - The complete stored object to write
413
- * @returns Promise that resolves when the write is complete
414
- */
415
- put(sha: string, object: StoredObject): Promise<void>;
416
- /**
417
- * Deletes an object from the hot tier.
418
- *
419
- * @param sha - The 40-character SHA-1 hash of the object
420
- * @returns Promise resolving to true if object was deleted, false if not found
421
- */
422
- delete(sha: string): Promise<boolean>;
423
- /**
424
- * Checks if an object exists in the hot tier.
425
- *
426
- * @param sha - The 40-character SHA-1 hash of the object
427
- * @returns Promise resolving to true if object exists
428
- */
429
- has(sha: string): Promise<boolean>;
430
- }
431
- /**
432
- * Backend interface for the warm tier (R2 object storage).
433
- *
434
- * @description
435
- * The warm tier backend provides access to objects stored in R2, either
436
- * as individual objects or within packfiles. Packfile access allows
437
- * efficient retrieval of objects that have been packed together.
438
- *
439
- * @example
440
- * ```typescript
441
- * class R2WarmBackend implements WarmTierBackend {
442
- * async get(sha: string): Promise<StoredObject | null> {
443
- * // Try direct object first
444
- * const obj = await this.r2.get(`objects/${sha}`)
445
- * if (obj) return this.parseObject(obj)
446
- *
447
- * // Fall back to pack lookup
448
- * const location = await this.index.findInPack(sha)
449
- * if (location) {
450
- * return this.getFromPack(location.packId, location.offset)
451
- * }
452
- * return null
453
- * }
454
- *
455
- * async getFromPack(packId: string, offset: number): Promise<StoredObject | null> {
456
- * const pack = await this.r2.get(`packs/${packId}`)
457
- * return pack ? this.extractFromPack(pack, offset) : null
458
- * }
459
- * }
460
- * ```
461
- *
462
- * @interface WarmTierBackend
463
- */
464
- export interface WarmTierBackend {
465
- /**
466
- * Retrieves an object from the warm tier.
467
- *
468
- * @description
469
- * May retrieve the object either directly or from a packfile,
470
- * depending on how it was stored.
471
- *
472
- * @param sha - The 40-character SHA-1 hash of the object
473
- * @returns Promise resolving to the object or null if not found
474
- */
475
- get(sha: string): Promise<StoredObject | null>;
476
- /**
477
- * Retrieves an object from a specific packfile at a given offset.
478
- *
479
- * @description
480
- * Used when the exact location of an object within a packfile is known,
481
- * typically from an index lookup.
482
- *
483
- * @param packId - The identifier of the packfile
484
- * @param offset - Byte offset of the object within the pack
485
- * @returns Promise resolving to the object or null if not found
486
- */
487
- getFromPack(packId: string, offset: number): Promise<StoredObject | null>;
488
- }
489
- /**
490
- * Backend interface for the cold tier (Analytics/Parquet).
491
- *
492
- * @description
493
- * The cold tier backend provides access to objects stored in analytical
494
- * formats like Parquet. It supports both direct lookups and filtered
495
- * queries for analytics purposes.
496
- *
497
- * @example
498
- * ```typescript
499
- * class ParquetColdBackend implements ColdTierBackend {
500
- * async get(sha: string): Promise<StoredObject | null> {
501
- * const rows = await this.parquet.query(`
502
- * SELECT * FROM objects WHERE sha = '${sha}'
503
- * `)
504
- * return rows[0] ? this.rowToObject(rows[0]) : null
505
- * }
506
- *
507
- * async query(filter: { type?: ObjectType }): Promise<StoredObject[]> {
508
- * const conditions = []
509
- * if (filter.type) conditions.push(`type = '${filter.type}'`)
510
- * if (filter.minSize) conditions.push(`size >= ${filter.minSize}`)
511
- *
512
- * const sql = `SELECT * FROM objects WHERE ${conditions.join(' AND ')}`
513
- * const rows = await this.parquet.query(sql)
514
- * return rows.map(this.rowToObject)
515
- * }
516
- * }
517
- * ```
518
- *
519
- * @interface ColdTierBackend
520
- */
521
- export interface ColdTierBackend {
522
- /**
523
- * Retrieves an object from the cold tier by SHA.
524
- *
525
- * @param sha - The 40-character SHA-1 hash of the object
526
- * @returns Promise resolving to the object or null if not found
527
- */
528
- get(sha: string): Promise<StoredObject | null>;
529
- /**
530
- * Queries the cold tier for objects matching the given filter.
531
- *
532
- * @description
533
- * Performs a filtered query against the analytical storage, returning
534
- * all objects that match the specified criteria. Useful for analytics
535
- * and batch processing operations.
536
- *
537
- * @param filter - Filter criteria for the query
538
- * @param filter.type - Filter by Git object type
539
- * @param filter.minSize - Minimum object size in bytes
540
- * @param filter.maxSize - Maximum object size in bytes
541
- * @returns Promise resolving to array of matching objects
542
- *
543
- * @example
544
- * ```typescript
545
- * // Find all large blobs
546
- * const largeBlobs = await coldBackend.query({
547
- * type: 'blob',
548
- * minSize: 1024 * 1024 // > 1MB
549
- * })
550
- * ```
551
- */
552
- query(filter: {
553
- type?: ObjectType;
554
- minSize?: number;
555
- maxSize?: number;
556
- }): Promise<StoredObject[]>;
557
- }
558
- /**
559
- * TieredReader - Main implementation of the tiered read path.
560
- *
561
- * @description
562
- * TieredReader orchestrates reads across multiple storage tiers (hot, warm, cold),
563
- * implementing automatic fallback and optional promotion to hotter tiers. It provides
564
- * a unified interface for reading Git objects regardless of which tier they reside in.
565
- *
566
- * **Read Algorithm:**
567
- * 1. Validate the SHA-1 hash
568
- * 2. If hot tier enabled, attempt to read from hot tier
569
- * 3. If not found and warm tier enabled, attempt warm tier
570
- * 4. If not found and cold tier enabled, attempt cold tier
571
- * 5. If found in warm/cold, optionally promote to hot tier
572
- * 6. Return result with object, source tier, and metrics
573
- *
574
- * **Promotion Policies:**
575
- * - `aggressive`: Immediately promote any object read from warm/cold to hot
576
- * - `conservative`: Reserved for future implementation (repeated access tracking)
577
- * - `none`: Never automatically promote objects
578
- *
579
- * **Error Handling:**
580
- * Individual tier failures are silently caught and the next tier is tried.
581
- * This ensures graceful degradation when a tier is temporarily unavailable.
582
- *
583
- * @example
584
- * ```typescript
585
- * // Create backends for each tier
586
- * const hotBackend = new SqliteHotBackend(db)
587
- * const warmBackend = new R2WarmBackend(r2)
588
- * const coldBackend = new ParquetColdBackend(parquet)
589
- *
590
- * // Configure the tiered storage
591
- * const config: TieredStorageConfig = {
592
- * hot: { enabled: true, maxSize: 1024 * 1024 },
593
- * warm: { enabled: true },
594
- * cold: { enabled: true },
595
- * promotionPolicy: 'aggressive'
596
- * }
597
- *
598
- * // Create the reader
599
- * const reader = new TieredReader(hotBackend, warmBackend, coldBackend, config)
600
- *
601
- * // Read an object
602
- * const result = await reader.read('a1b2c3d4e5f678901234567890abcdef12345678')
603
- *
604
- * if (result.object) {
605
- * console.log(`Object type: ${result.object.type}`)
606
- * console.log(`Size: ${result.object.size} bytes`)
607
- * console.log(`Served from: ${result.tier} tier`)
608
- * console.log(`Latency: ${result.latencyMs}ms`)
609
- *
610
- * if (result.promoted) {
611
- * console.log('Object was promoted to hot tier')
612
- * }
613
- * } else {
614
- * console.log('Object not found in any tier')
615
- * }
616
- *
617
- * // Direct tier access
618
- * const hotOnly = await reader.readFromHot(sha)
619
- * const warmOnly = await reader.readFromWarm(sha)
620
- * const coldOnly = await reader.readFromCold(sha)
621
- *
622
- * // Manual promotion
623
- * if (warmOnly) {
624
- * await reader.promoteToHot(sha, warmOnly)
625
- * }
626
- * ```
627
- *
628
- * @class TieredReader
629
- * @implements {TieredObjectStore}
630
- */
631
- export declare class TieredReader implements TieredObjectStore {
632
- /**
633
- * Backend for the hot storage tier (Durable Object SQLite).
634
- * @private
635
- */
636
- private hotBackend;
637
- /**
638
- * Backend for the warm storage tier (R2 object storage).
639
- * @private
640
- */
641
- private warmBackend;
642
- /**
643
- * Backend for the cold storage tier (Analytics/Parquet).
644
- * @private
645
- */
646
- private coldBackend;
647
- /**
648
- * Configuration for all tiers and promotion policy.
649
- * @private
650
- */
651
- private config;
652
- /**
653
- * Creates a new TieredReader instance.
654
- *
655
- * @param hotBackend - Backend for the hot tier (Durable Object SQLite)
656
- * @param warmBackend - Backend for the warm tier (R2)
657
- * @param coldBackend - Backend for the cold tier (Parquet)
658
- * @param config - Configuration for all tiers and promotion policy
659
- *
660
- * @example
661
- * ```typescript
662
- * const reader = new TieredReader(
663
- * hotBackend,
664
- * warmBackend,
665
- * coldBackend,
666
- * {
667
- * hot: { enabled: true, maxSize: 1024 * 1024 },
668
- * warm: { enabled: true },
669
- * cold: { enabled: true },
670
- * promotionPolicy: 'aggressive'
671
- * }
672
- * )
673
- * ```
674
- */
675
- constructor(hotBackend: HotTierBackend, warmBackend: WarmTierBackend, coldBackend: ColdTierBackend, config: TieredStorageConfig);
676
- /**
677
- * Reads an object from the tiered storage system.
678
- *
679
- * @description
680
- * Attempts to read the object from each enabled tier in order
681
- * (hot -> warm -> cold), returning as soon as the object is found.
682
- * Objects found in warm or cold tiers may be promoted to hot tier
683
- * based on the configured promotion policy.
684
- *
685
- * **Invalid SHA Handling:**
686
- * If the SHA is invalid (not 40 hex characters), returns immediately
687
- * with null object and no tier lookup is performed.
688
- *
689
- * **Error Handling:**
690
- * If a tier fails (throws an error), the error is caught silently
691
- * and the next tier is attempted. This provides graceful degradation.
692
- *
693
- * @param sha - The 40-character SHA-1 hash of the object to read
694
- * @returns Promise resolving to the read result with object, tier, and metrics
695
- *
696
- * @example
697
- * ```typescript
698
- * const result = await reader.read('a1b2c3d4e5f678901234567890abcdef12345678')
699
- *
700
- * if (result.object) {
701
- * // Object found
702
- * console.log(`Type: ${result.object.type}`)
703
- * console.log(`Tier: ${result.tier}`)
704
- * console.log(`Promoted: ${result.promoted}`)
705
- * } else {
706
- * // Object not found
707
- * console.log(`Search took ${result.latencyMs}ms`)
708
- * }
709
- * ```
710
- */
711
- read(sha: string): Promise<ReadResult>;
712
- /**
713
- * Reads an object directly from the hot tier only.
714
- *
715
- * @description
716
- * Bypasses the tier fallback logic to read directly from the hot tier.
717
- * Useful for checking if an object is already in the hot cache.
718
- * Errors are caught and null is returned.
719
- *
720
- * @param sha - The 40-character SHA-1 hash of the object
721
- * @returns Promise resolving to the object or null if not in hot tier
722
- *
723
- * @example
724
- * ```typescript
725
- * const cached = await reader.readFromHot(sha)
726
- * if (cached) {
727
- * console.log('Object is in hot cache')
728
- * } else {
729
- * console.log('Object not in hot cache')
730
- * }
731
- * ```
732
- */
733
- readFromHot(sha: string): Promise<StoredObject | null>;
734
- /**
735
- * Reads an object directly from the warm tier only.
736
- *
737
- * @description
738
- * Bypasses the tier fallback logic to read directly from the warm tier.
739
- * Does not trigger automatic promotion to hot tier.
740
- * Errors are caught and null is returned.
741
- *
742
- * @param sha - The 40-character SHA-1 hash of the object
743
- * @returns Promise resolving to the object or null if not in warm tier
744
- *
745
- * @example
746
- * ```typescript
747
- * const warm = await reader.readFromWarm(sha)
748
- * if (warm) {
749
- * // Manually promote if desired
750
- * await reader.promoteToHot(sha, warm)
751
- * }
752
- * ```
753
- */
754
- readFromWarm(sha: string): Promise<StoredObject | null>;
755
- /**
756
- * Reads an object directly from the cold tier only.
757
- *
758
- * @description
759
- * Bypasses the tier fallback logic to read directly from the cold tier.
760
- * Does not trigger automatic promotion to hotter tiers.
761
- * Errors are caught and null is returned.
762
- *
763
- * @param sha - The 40-character SHA-1 hash of the object
764
- * @returns Promise resolving to the object or null if not in cold tier
765
- *
766
- * @example
767
- * ```typescript
768
- * const cold = await reader.readFromCold(sha)
769
- * if (cold) {
770
- * console.log(`Found in cold storage, created at: ${cold.createdAt}`)
771
- * }
772
- * ```
773
- */
774
- readFromCold(sha: string): Promise<StoredObject | null>;
775
- /**
776
- * Manually promotes an object to the hot tier.
777
- *
778
- * @description
779
- * Copies the provided object to the hot tier storage. This is useful for
780
- * pre-warming the cache or manually controlling tier placement. No size
781
- * or policy checks are performed - the object is always written.
782
- *
783
- * @param sha - The 40-character SHA-1 hash of the object
784
- * @param object - The complete stored object to promote
785
- * @returns Promise that resolves when promotion is complete
786
- * @throws Error if the hot tier write fails
787
- *
788
- * @example
789
- * ```typescript
790
- * // Pre-warm the hot cache
791
- * const objects = await reader.query({ type: 'commit' })
792
- * for (const obj of objects) {
793
- * await reader.promoteToHot(obj.sha, obj)
794
- * }
795
- * ```
796
- */
797
- promoteToHot(sha: string, object: StoredObject): Promise<void>;
798
- /**
799
- * Returns the current storage configuration.
800
- *
801
- * @description
802
- * Returns the configuration object passed to the constructor.
803
- * Useful for inspecting current settings or debugging.
804
- *
805
- * @returns The tiered storage configuration
806
- *
807
- * @example
808
- * ```typescript
809
- * const config = reader.getConfig()
810
- * console.log(`Promotion policy: ${config.promotionPolicy}`)
811
- * console.log(`Hot tier enabled: ${config.hot.enabled}`)
812
- * ```
813
- */
814
- getConfig(): TieredStorageConfig;
815
- /**
816
- * Attempts to promote an object to the hot tier based on policy.
817
- *
818
- * @description
819
- * Called internally when an object is found in warm or cold tier.
820
- * Decides whether to promote based on:
821
- * 1. Hot tier being enabled
822
- * 2. Promotion policy (aggressive promotes, conservative/none don't)
823
- * 3. Object size being within hot tier's maxSize limit
824
- *
825
- * @param sha - The object's SHA-1 hash
826
- * @param object - The object to potentially promote
827
- * @param _sourceTier - The tier the object was read from (for future use)
828
- * @returns true if promotion was successful, false otherwise
829
- *
830
- * @private
831
- */
832
- private tryPromote;
833
- }
834
- export { TieredReader as TieredObjectStoreStub };
835
- //# sourceMappingURL=read-path.d.ts.map