Skip to main content

spacedb_durability/
lib.rs

1#![forbid(unsafe_code)]
2//! # spacedb-durability — SpaceDB Layer 2 (cold path)
3//!
4//! Durability that survives any home dying: a dataset is sealed into a
5//! content-addressed, Reed-Solomon erasure-coded snapshot whose shards spread
6//! across diverse homes, so losing homes is recoverable rather than fatal.
7//!
8//! **M4-S1 (here)** is the foundation — the erasure math and the verifiable
9//! manifest, over opaque (already-encrypted) snapshot bytes:
10//! [`encode_snapshot`] → `(Manifest, shards)`, and [`reconstruct_snapshot`] from
11//! any `k`-of-`n` survivors with full integrity checking. Higher slices add the
12//! placement and shard-store seams (M4-S2) and the repair loop (M4-S3); MATA
13//! implements those over `maestro-disco`.
14//!
15//! Open-core (MIT): no MATA dependency. Erasure operates on ciphertext, so a
16//! hosting home stores shards it cannot read.
17
18mod error;
19pub use error::{DurabilityError, DurabilityResult};
20
21mod erasure;
22pub use erasure::{encode_snapshot, reconstruct_snapshot, Manifest, Shard, ShardRef};
23
24mod shard_store;
25pub use shard_store::{MemShardStore, ShardStore};
26
27mod placement;
28pub use placement::{allocate, Placement, TargetId, TargetInfo};
29
30mod fleet;
31pub use fleet::{Fleet, Node};
32
33mod distribute;
34pub use distribute::{distribute, recover};
35
36mod health;
37pub use health::{health, reachable_shard_count, surplus_shard_count, HealthStatus, ReplicaHealth};
38
39mod repair;
40pub use repair::{repair, RepairReport};
41
42mod reclaim;
43pub use reclaim::{reclaim, ReclaimReport, ReclaimedCopy};
44
45/// Compiles the README's examples as doctests, so the documented API can never
46/// drift from the real one. Not part of the public API, and not rendered into
47/// the crate docs — it exists only under `cargo test --doc`.
48#[cfg(doctest)]
49#[doc = include_str!("../README.md")]
50pub struct ReadmeDoctests;