scanstate — Scan checkpointing and progress primitives
Why
Long-running scanners are interrupted by crashes, deploy rollouts, and rate limits. scanstate is the reliability layer that prevents rescanning already finished targets and preserves progress state between runs.
It provides checkpoint persistence, write-ahead journaling, and live progress metrics so scan orchestrators can resume safely and stay observable.
Use it anywhere you need at-least-once progress semantics with deterministic resume behavior.
Quick Start
use ;
Features
- Atomic checkpoint persistence with crash-safe save/reload.
- Write-ahead journal append/replay model for robust resume.
- Progress counters with rate + ETA computation.
- Marker-based trait
Checkpointablefor custom state objects. - Merge support for combining checkpoints from multiple workers.
TOML Configuration
scanstate supports checkpoint settings in TOML.
= "my-scan"
= "/var/run/scan-checkpoint.json"
= 1000
= true
= 5
use CheckpointSettings;
let settings = from_toml.unwrap;
assert_eq!;
API Overview
ScanCheckpoint: completed target registry withmark_complete,is_complete, persistence.WriteAheadJournal: append-only recovery log for target events.Entry: journal record shape.ScanProgress: completed/skipped/findings counters + rate + ETA (serde serializable).Checkpointable: adapter trait for custom scan states.load_or_new: one call resume helper.
Examples
1) Persist and restore completion state
use ;
let path = new;
let mut ck = load_or_new;
ck.mark_complete;
ck.save.unwrap;
let restored = load.unwrap;
assert!;
2) Log target transitions with write-ahead journal
use ;
use ;
let journal = new;
journal
.append
.unwrap;
let = journal.replay_lenient.unwrap;
println!;
3) Implement Checkpointable on a custom state
use Checkpointable;
Traits
scanstate exposes Checkpointable for your own resume-ready state type. Implementing it lets you reuse the same checkpoint merge/persist patterns without adapting everything manually.
Related Crates
License
MIT, Corum Collective LLC
Docs: https://docs.rs/scanstate
Santh ecosystem: https://santh.io