tpt_archon_core/lib.rs
1//! `tpt-archon-core`: a `no_std`, zero-allocation storage engine.
2//!
3//! This is Phase 1 of the `tpt-archon` stack (see the workspace-root
4//! `spec.txt` and `TODO.md`). It is a single-crate storage engine, embeddable
5//! like SQLite's storage layer, providing:
6//!
7//! - [`block`] — the [`BlockDevice`](block::BlockDevice) backend abstraction
8//! with in-memory and (behind the `std` feature) file-backed backends.
9//! - [`zerocopy`] — fixed-capacity byte buffers and zero-copy
10//! (de)serialization helpers used on the read/write hot path.
11//! - [`page`] — a fixed-size page abstraction and an LRU buffer pool with a
12//! `Free`/`Clean`/`Dirty`/`Pinned` state machine and dirty-page writeback.
13//! - [`wal`] — an append-only, LSN-ordered write-ahead log with crash-recovery
14//! replay.
15//! - [`btree`] — a B-Link tree with point lookups, range scans and concurrent
16//! inserts.
17//! - [`storage`] — a [`StorageEngine`](storage::StorageEngine) facade wiring
18//! the buffer pool to the WAL, so page writes actually go through the
19//! write-ahead log before main storage (not just each piece tested alone).
20//! - [`faultsim`] — a *testing* tool (not a runtime feature): injects
21//! power-loss-shaped corruption (truncated tails, flipped bytes, zeroed
22//! records) and asserts [`StorageEngine::recover`](storage::StorageEngine::recover)
23//! always yields a prefix-consistent state.
24//!
25//! # Zero-allocation, and the missing `tpt-zero-bytes`
26//!
27//! The [`zerocopy`] module exists *because there is no `tpt-zero-bytes`
28//! crate* anywhere in the TPT ecosystem — it was never built. Do not "helpfully"
29//! add a dependency on a crate by that name; the primitives live here on
30//! purpose so the read/write hot path allocates nothing.
31//!
32//! # `no_std`
33//!
34//! The crate is `#![no_std]` by default (it uses `alloc`). The default `std`
35//! feature only adds the file-backed [`BlockDevice`](block::BlockDevice); build
36//! with `--no-default-features` for a fully `no_std` configuration.
37#![cfg_attr(not(feature = "std"), no_std)]
38#![forbid(unsafe_op_in_unsafe_fn)]
39
40extern crate alloc;
41
42pub mod block;
43pub mod btree;
44pub mod faultsim;
45pub mod page;
46pub mod storage;
47pub mod wal;
48pub mod zerocopy;