[package]
name = "sui-cache"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
description = "Built-in binary cache server and push pipeline for the sui Rust-native Nix runtime"
keywords = ["nix", "binary-cache", "cache", "store"]
categories = ["caching", "web-programming::http-server"]

[dependencies]
sui-compat.workspace = true
axum = { workspace = true }
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
sha2 = { workspace = true }
xz2 = "0.1"
ed25519-dalek = { workspace = true, features = ["rand_core"] }
rand_core = { version = "0.6", features = ["getrandom"] }
base64 = { workspace = true }
async-trait = { workspace = true }
object_store = { version = "0.12", features = ["aws"] }
redb = "2"
bytes = "1"
futures = "0.3"
# L1 hot-cache transport. Optional so the default build + unit tests pull zero
# redis dependency surface — the RedisBackend core is proven against an in-memory
# mock (the RedisConn Environment seam); the real ConnectionManager transport
# compiles only under `--features redis-client`.
redis = { version = "0.27", default-features = false, features = ["tokio-comp", "connection-manager"], optional = true }
# L2 durable-cache-tier transport (Postgres). Optional, same rationale as redis:
# the PgStorageBackend core is proven against an in-memory mock (the PgCacheConn
# Environment seam); the real sqlx pool compiles only under `--features postgres`.
# Runtime query API only (no `query!` macro) so it builds offline without a
# DATABASE_URL — matching sui-store's `PgStore` adapter.
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio-rustls", "postgres"], optional = true }

[features]
default = []
# Enable the production Redis transport (`RedisConnectionManager`).
redis-client = ["dep:redis"]
# Enable the production Postgres L2 transport (`SqlxPgCacheConn`).
postgres = ["dep:sqlx"]

[dev-dependencies]
tempfile = { workspace = true }
tokio = { workspace = true, features = ["test-util", "macros"] }
reqwest = { workspace = true }
tower = { workspace = true }
http-body-util = "0.1"

[lints.clippy]
pedantic = "warn"
