Skip to main content

Module storage

Module storage 

Source
Expand description

Storage backend trait and implementations.

The StorageBackend trait abstracts over where narinfo metadata and compressed NAR blobs are persisted. Three implementations are provided:

  • LocalStorage — local filesystem (default)
  • S3Storage — S3-compatible object storage (AWS, MinIO, R2, RustFS)
  • RedisBackend — Redis L1 hot cache (sub-ms, TTL/eviction-aware)
  • PgStorageBackend — Postgres L2 durable cache tier (shared, authoritative)
  • TieredBackend — L1→L2→L3 read-through/write-through resolver
  • StorageIndex — redb ephemeral metadata index (accelerates S3 lookups)

build_backend is the typed config-select factory: it dispatches a BackendConfig to its concrete backend (recursing for the tiered arm), so a deployment picks {disk | s3 | redis | pg | tiered} by configuration — never a silent hard-coded constructor.

Re-exports§

pub use index::StorageIndex;
pub use local::LocalStorage;
pub use pg::PgCacheConn;
pub use pg::PgStorageBackend;
pub use pg::PgTable;
pub use redis::RedisBackend;
pub use redis::RedisConn;
pub use s3::S3Storage;
pub use tiered::TieredBackend;
pub use tiered::TieredTier;
pub use tiered::WritePolicy;
pub use tiered::TIERED_BACKEND_TIER;

Modules§

index
redb metadata index — ephemeral local cache for S3 narinfo lookups.
local
Local filesystem storage backend.
pg
Postgres-backed L2 durable cache tier StorageBackend.
redis
Redis-backed L1 hot cache StorageBackend.
s3
S3-compatible object storage backend.
tiered
Tiered StorageBackend — the Redis L1 → Postgres L2 → object L3 read-through / write-through cache resolver.

Traits§

StorageBackend
Abstraction over binary cache storage.

Functions§

build_backend
Config-select factory: build the concrete StorageBackend a BackendConfig names.