ministate
Minimal state manager with durable WAL logging
Part of the mini-rs embeddable toolkit
ministategives you just enough: crash-safe, in-memory state with replayable history.
🎯 Purpose
ministate provides a simple yet robust way to maintain mutable application state that survives process restarts, using an append-only Write-Ahead Log (WAL) built on ministore.
Key features:
- ✅ In-memory state — fast reads via
RwLock, fullCloneon demand. - ✅ Durable mutations — every change is
fsynced before being applied. - ✅ Crash recovery — full state restored by replaying WAL on startup.
- ✅ Logical sequencing — each mutation gets a monotonically increasing sequence number.
- ✅ Optional snapshots — enable
snapshotfeature for faster recovery (viaminisnap).
Perfect for:
- Component/deployment registries (e.g., in Arcella)
- Queue metadata (e.g., in walmq)
- Local coordination primitives (leader election, locks)
- Embedded/IoT apps requiring crash-safe state
📦 Quick Start
Basic (WAL-only)
[]
= "0.1"
= { = "1.0", = ["derive"] }
use ;
use ;
let mgr = open.await?;
mgr.apply.await?;
assert_eq!;
With Snapshots (opt-in)
[]
= { = "0.1", = ["snapshot"] }
= "0.1"
mgr.create_snapshot.await?; // saves state + sequence number
✅ Guarantees
| Guarantee | Description |
|---|---|
| Durability | If apply().await returns Ok, the mutation is on disk. |
| Atomicity | In-memory state is updated only after WAL write succeeds. |
| Ordering | Mutations applied in exact WAL order. |
| Recoverability | Full state restored from WAL (or WAL + snapshot). |
🧩 Part of mini-rs
ministore— durable WAL engineminisnap— optional snapshot & log compaction supportministate— state manager (this crate)miniqueue— durable message queue (in development)
Used in:
📄 License
Dual-licensed under:
- Apache License 2.0
- MIT License
Choose the one that best fits your project.
ministate— because state should be simple, durable, and recoverable.
Part of themini-rsfamily: simple, embeddable, reliable.