Expand description
Backend traits and implementations — the transport layer over this
crate’s own format-v3 storage engine (crate::store).
Why this trait is async and crate::store::ImmutableStore is not:
ImmutableStore is deliberately synchronous — it models local, blocking
disk I/O, which is the honest cost of the local-first reference backend.
S3Backend/HttpBackend are inherently network-bound; forcing them
through a sync trait would mean either blocking a runtime thread on
every call or silently spinning up a throwaway executor per call.
Neither is acceptable for a Kit meant to be embedded in async host
applications (Refraction, Quickring Courier).
AsyncImmutableStore is the uniform contract all three backends here
implement. LocalBackend is a thin async wrapper over
crate::store::PartitionStore (dispatched via spawn_blocking, since
local disk I/O is legitimately blocking); it does not reimplement
the packfile/fragmentation engine — that lives once, in crate::store
/ crate::fragment, and this module only wraps it. (Prior to
2026-08-23 this engine lived in bitchain and this crate depended on it
cross-org; that dependency inverted when the engine relocated here.)
Re-exports§
pub use http::HttpBackend;pub use local::LocalBackend;pub use s3::S3Backend;
Modules§
- http
HttpBackend— talks to any HTTP(S) server exposing bitchain’s simple per-hash object contract:GET/PUT/HEAD <base_url>/<partition_hex>/<hash_hex>. This is the shape a Refraction server (or any static file host serving a pre-populated bucket) needs to speak to interoperate. Object bodies use the same[codec_byte][payload]framing asS3Backend.- local
LocalBackend— the default, no-network backend. A thin async wrapper overcrate::store::PartitionStore; all packfile/fragmentation logic lives once, incrate::store/crate::fragment, and this module never reimplements it.- s3
S3Backend— S3 / S3-compatible (Wasabi, B2, R2, MinIO) object storage.
Traits§
- Async
Immutable Store - The uniform async storage contract every backend in this crate honors.
Mirrors
crate::store::ImmutableStore’s semantics (content-addressed, partition-scoped, hash-verified-on-read, dedup-by-hash-on-write) but overasync fnso remote transports don’t have to fake synchrony.