Introduce a two-tier cache for blob payloads backed by the foyer crate
(memory + disk). The cache is configured via CacheConfig and exposed
through src/cache/{mod,global}.rs.
Why foyer:
- HybridCache gives us bounded RAM plus disk overflow without bringing
in our own eviction / spill logic.
- The runtime-tokio feature plays cleanly with the existing tokio stack.
Touches:
- src/cache/mod.rs: CacheConfig, CacheStore, CacheKey/Value aliases,
default-into-disk fallback (CacheConfig::default)
- src/cache/global.rs: process-wide singleton accessor for the default
cache
- src/error.rs: new BabyError::Cache { op, source } variant wrapping
foyer::Error so cache failures share the existing error pipeline
- Cargo.toml: add foyer = "0.22.3" with runtime-tokio feature
- src/lib.rs: pub mod cache; (wiring only — no public API on GitBaby
changes yet)
- src/tree/types.rs: drive-by import reorder (serde before std::path)
to match rustfmt
CI: cargo build + cargo test (38 passed) green.
Skipped intentionally: no git/lfs protocol logic is added here; this
commit is purely the storage substrate.
14 lines
489 B
TOML
14 lines
489 B
TOML
[package]
|
|
name = "gitbaby"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
|
|
[dependencies]
|
|
tokio = { version = "1.53.1", features = ["process", "io-util", "sync", "macros", "rt-multi-thread", "time", "fs"] }
|
|
serde = { version = "1.0.229", features = ["derive"] }
|
|
serde_json = { version = "1.0.151", features = [] }
|
|
gix = { version = "0.86.0", features = ["serde"] }
|
|
time = { version = "0.3.55", features = ["serde"] }
|
|
async-trait = "0.1.92"
|
|
|
|
foyer = { version = "0.22.3", features = ["runtime-tokio"] } |