Snapshots & Time Travel¶
Uni supports point-in-time snapshots and time-travel queries. Snapshots are durable checkpoints; time travel lets you query historical versions without mutating state.
What It Provides¶
- Create, list, and restore snapshots.
VERSION AS OFandTIMESTAMP AS OFqueries for historical reads.- Read-only time-travel safety checks.
Example¶
use uni_db::Uni;
# async fn demo() -> Result<(), uni_db::UniError> {
let db = Uni::open("./my_db").build().await?;
let snap_id = db.create_snapshot(Some("daily")).await?;
let rows = db.query(&format!(
"MATCH (n) RETURN count(n) AS c VERSION AS OF '{}'",
snap_id
)).await?;
println!("{:?}", rows);
# Ok(())
# }
Use Cases¶
- Auditing and reproducible analytics.
- Debugging or regression analysis.
- Checkpointing before bulk operations.
When To Use¶
Use snapshots and time travel when you need historical reads or safe rollbacks without exporting or duplicating data.