1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! 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.)
// `http` and `s3` are feature-gated (A4, standalone-first partitions,
// 2026-09-22): both cloud transports pull in real network-client
// dependencies (`reqwest`, `aws-sdk-s3`/`aws-config`), so a local-only
// consumer can build with `default-features = false` and link neither.
// `local` stays unconditional — it has no cloud dependency and is the
// default, no-network reference backend.
pub use HttpBackend;
pub use LocalBackend;
pub use S3Backend;
use crate;
use crateStorageError;
use async_trait;
/// 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
/// over `async fn` so remote transports don't have to fake synchrony.