minisnap
Minimal snapshot store for durable state managers
Part of the mini-rs embeddable toolkit
minisnapgives you just enough: atomic, human-readable snapshots with zero hidden machinery.
🎯 Purpose
minisnap provides a simple, reliable way to serialize and restore a full copy of your application state to and from disk. It is designed to complement WAL-based systems like ministore by enabling:
- ✅ Fast recovery (skip replaying a long WAL)
- 🔒 Consistency tracking via logical sequence numbers
- 🧑💻 Human-readable snapshots (plain JSON + text metadata)
- 🔮 Future WAL compaction (truncate log after snapshot)
Snapshots are explicit — you decide when to create them. No background threads. No magic.
📦 Quick Start
[]
= "0.1"
= { = "1.0", = ["derive"] }
use SnapStore;
use ;
let store = new;
// Save
store.create.await?; // seq = 10
// Restore
let : = store.restore.await?;
assert_eq!;
assert_eq!;
💡 Snapshots are stored as two files:
snapshot.json— pretty-printed JSON statesnapshot.seq— plain-text sequence number (e.g.,10)
✅ Guarantees
| Property | Guarantee |
|---|---|
| Durability | After create().await, snapshot is on disk (fsync via tokio::fs::write + atomic rename on POSIX). |
| Atomicity | Temporary files + atomic rename() → no partial/corrupt snapshots. |
| Consistency | Each snapshot is paired with a user-provided sequence number (e.g., last WAL index). |
⚠️ Atomic
rename()requires a POSIX-compliant filesystem (ext4, XFS, APFS). Avoid FAT32.
🧩 Part of mini-rs
ministore— durable WAL engineminisnap— snapshotting & log compaction (this crate)ministate— usesminisnapwhen thesnapshotCargo feature is enabledminiqueue— future WAL compaction
Used in:
📄 License
Dual-licensed under:
- Apache License 2.0
- MIT License
Choose the one that best fits your project.
minisnap— because sometimes, the best state is the one you can trust after a crash.
Part of themini-rsfamily: simple, embeddable, reliable.