| Crates.io | minisnap |
| lib.rs | minisnap |
| version | 0.1.1 |
| created_at | 2025-11-05 17:20:23.625217+00 |
| updated_at | 2025-11-06 06:25:18.584028+00 |
| description | Minimal snapshot store for durable state managers |
| homepage | |
| repository | https://github.com/ArcellaTeam/mini-rs/ |
| max_upload_size | |
| id | 1918284 |
| size | 27,993 |
minisnapMinimal 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.
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:
Snapshots are explicit — you decide when to create them. No background threads. No magic.
[dependencies]
minisnap = "0.1"
serde = { version = "1.0", features = ["derive"] }
use minisnap::SnapStore;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct AppState { counter: u64 }
let store = SnapStore::new("./state");
// Save
store.create(&AppState { counter: 42 }, 10).await?; // seq = 10
// Restore
let (restored, seq): (AppState, u64) = store.restore().await?;
assert_eq!(restored.counter, 42);
assert_eq!(seq, 10);
💡 Snapshots are stored as two files:
snapshot.json— pretty-printed JSON statesnapshot.seq— plain-text sequence number (e.g.,10)
| 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.
mini-rsministore — durable WAL engineminisnap — snapshotting & log compaction (this crate)ministate — uses minisnap when the snapshot Cargo feature is enabledminiqueue — future WAL compactionUsed in:
Dual-licensed under:
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.