frp_persistence/lib.rs
1//! `frp-persistence` — durable storage backend for infinite-db frp.
2//!
3//! Implements the [`AtomStore`], [`BlockStore`], and [`EdgeStore`] traits from
4//! `frp-loom` using [`infinite-db`](https://crates.io/crates/infinite-db)
5//! as the on-disk storage engine.
6//!
7//! # Quick-start
8//!
9//! ```rust,no_run
10//! use frp_persistence::InfiniteDbStore;
11//! use frp_loom::store::AtomStore;
12//!
13//! let mut store = InfiniteDbStore::open("./data").unwrap();
14//! // put / get / delete atoms, blocks, edges through the store traits…
15//! store.flush().unwrap();
16//! ```
17//!
18//! # Design notes
19//!
20//! * **Write-through cache** — the store traits return `&Self::Atom` borrowed
21//! references, so deserialized values must live inside the struct. All reads
22//! are served from in-memory `HashMap`s; writes go to both the cache and the
23//! WAL.
24//! * **`EdgeTransform::Inline` closures** are not serializable and round-trip
25//! as `PassThrough`. Re-attach closures after loading a graph from the store.
26//! * Call [`InfiniteDbStore::flush`] before process exit to seal WAL records
27//! into on-disk blocks.
28
29pub mod error;
30pub mod spaces;
31pub mod store;
32
33pub use error::PersistenceError;
34pub use store::InfiniteDbStore;