Skip to main content

Crate tpt_archon_core

Crate tpt_archon_core 

Source
Expand description

tpt-archon-core: a no_std, zero-allocation storage engine.

This is Phase 1 of the tpt-archon stack (see the workspace-root spec.txt and TODO.md). It is a single-crate storage engine, embeddable like SQLite’s storage layer, providing:

  • block — the BlockDevice backend abstraction with in-memory and (behind the std feature) file-backed backends.
  • zerocopy — fixed-capacity byte buffers and zero-copy (de)serialization helpers used on the read/write hot path.
  • page — a fixed-size page abstraction and an LRU buffer pool with a Free/Clean/Dirty/Pinned state machine and dirty-page writeback.
  • wal — an append-only, LSN-ordered write-ahead log with crash-recovery replay.
  • btree — a B-Link tree with point lookups, range scans and concurrent inserts.
  • storage — a StorageEngine facade wiring the buffer pool to the WAL, so page writes actually go through the write-ahead log before main storage (not just each piece tested alone).
  • faultsim — a testing tool (not a runtime feature): injects power-loss-shaped corruption (truncated tails, flipped bytes, zeroed records) and asserts StorageEngine::recover always yields a prefix-consistent state.

§Zero-allocation, and the missing tpt-zero-bytes

The zerocopy module exists because there is no tpt-zero-bytes crate anywhere in the TPT ecosystem — it was never built. Do not “helpfully” add a dependency on a crate by that name; the primitives live here on purpose so the read/write hot path allocates nothing.

§no_std

The crate is #![no_std] by default (it uses alloc). The default std feature only adds the file-backed BlockDevice; build with --no-default-features for a fully no_std configuration.

Modules§

block
Block device abstraction: the storage backend the rest of the engine builds on.
btree
A B-Link tree: an ordered u64 -> Vec<u8> index with sibling right-links.
faultsim
Crash / fault simulation for the write-ahead log and the StorageEngine.
page
Fixed-size pages and an LRU buffer pool.
storage
An end-to-end storage facade wiring the BufferPool to the Wal.
wal
Append-only, LSN-ordered write-ahead log with crash-recovery replay.
zerocopy
Zero-allocation primitives for page-sized I/O and record framing.