Skip to main content

Crate sui_cache

Crate sui_cache 

Source
Expand description

Built-in binary cache server and push pipeline for sui.

Replaces Attic, Cachix, and nix-serve with a single integrated component. Implements the standard Nix binary cache HTTP protocol (narinfo + NAR).

§Architecture

  • sui_castore — pluggable storage backends (shared with sui-registry); re-exported from here for backward compatibility.
  • server — axum HTTP server implementing the cache protocol
  • signing — ed25519 key management and narinfo signing
  • push — pipeline to push store paths to the cache
  • gc — garbage collection of unreferenced cache entries
  • config — cache configuration types (CacheConfig; BackendConfig is in sui-castore)

Re-exports§

pub use config::CacheConfig;
pub use gc::GcResult;
pub use push::PushResult;
pub use server::build_router;
pub use server::serve;
pub use server::AppState;
pub use signing::verify_narinfo_signature;
pub use signing::CacheSigner;

Modules§

config
Cache configuration types.
gc
Garbage collection for the binary cache.
push
Push pipeline — build output to NAR to sign to upload.
server
Axum HTTP server implementing the Nix binary cache protocol.
signing
Ed25519 signing for narinfo metadata.

Structs§

LocalStorage
Filesystem-backed binary cache storage.
PgStorageBackend
L2 durable cache tier: content-addressed key → value over Postgres, shared across pods, survives a roll.
RedisBackend
L1 hot cache: content-addressed key → value, sub-ms hits, TTL/eviction-aware.
S3Storage
S3-compatible object storage backend.
StorageIndex
Ephemeral metadata index backed by redb.
TieredBackend
Three-tier read-through / write-through cache resolver.

Enums§

BackendConfig
Storage backend selection.
CacheError
CacheError is now sui_castore::StoreError (same variants, same derives). This type alias preserves every existing sui_cache::CacheError use site. Error type for content-addressed store operations.
PgTable
The two logical tables the cache tier keeps: narinfo text and NAR blobs.
TieredTier
The honest self-description of what TieredBackend has been proven against — asserted by the honest gate so a claim cannot be silently rounded up.
WritePolicy
How a put propagates across the tiers. See the module docs for the full contract; every policy persists both durable tiers before returning.

Constants§

TIERED_BACKEND_TIER
The shipped tier of TieredBackend. Asserted by the honest gate; bumping it to LiveClusterProven without a live integration test is a build-failing round-up.

Traits§

PgCacheConn
The minimal typed Postgres row-verb surface PgStorageBackend depends on.
RedisConn
The minimal async redis verb surface RedisBackend depends on.
StorageBackend
Abstraction over binary cache storage.

Functions§

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