Skip to main content

io_pimdir/
lib.rs

1#![no_std]
2#![deny(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4
5//! A [pimdir](https://github.com/pimalaya/pimdir) store: an
6//! [`io_replica`] [`ReplicaStorage`] backed by a SQLite index plus a
7//! content-addressed blob directory.
8//!
9//! The crate is split so the logic stays I/O-free and the I/O sits
10//! behind a feature gate. [`sql`] inlines the canonical pimdir schema,
11//! migrations and statements from the spec's migrations/ and queries/.
12//! [`codec`] holds the I/O-free encodings between the [`io_replica`]
13//! model and the store columns: the flag JSON, the detail-level integer
14//! map and the action queue's versioned payload JSON. [`conventions`]
15//! derives a writer's `link_id`, `meta` and `sort_key` from an item's
16//! bytes, and [`hash`] names a body. [`client`] (feature `client`) holds
17//! the three roles the format defines (spec ยง8), one handle each:
18//! [`PimdirStore`] is the owner, which runs the statements against SQLite
19//! and the blob files to service the storage seam; [`PimdirProducer`] is
20//! the enqueue-only handle for a process that does not own the store; and
21//! [`PimdirReader`] is the read surface both of them share, which takes
22//! no lock and carries no write at all.
23//!
24//! The crate is `no_std` with `alloc`; `std` only enters behind the
25//! `client` feature, where the SQLite driver lives.
26//!
27//! [`ReplicaStorage`]: io_replica::client::ReplicaStorage
28
29extern crate alloc;
30#[cfg(feature = "client")]
31extern crate std;
32
33pub mod codec;
34pub mod conventions;
35pub mod hash;
36pub mod sql;
37
38#[cfg(feature = "client")]
39pub mod client;
40
41#[cfg(feature = "client")]
42pub use client::{
43    PimdirBlobFile, PimdirBlobWriter, PimdirBlobs, PimdirCollection, PimdirConflict,
44    PimdirDrainReport, PimdirError, PimdirGcReport, PimdirItem, PimdirParkedAction,
45    PimdirPendingAction, PimdirProducer, PimdirPurgeReport, PimdirRetention, PimdirSourceStore,
46    PimdirStore,
47    diagnostics::{PimdirDangling, PimdirMinted, PimdirObjectStats, PimdirRefcountDrift},
48    reader::PimdirReader,
49};