Tutorial: Building with CleaveDB
Time Travel & Undo — Overview
In traditional relational and document stores, an accidental UPDATE or bad script permanently overwrites data unless an engineer restores a backup snapshot. CleaveDB solves this with temporal versioning and native Time Travel built directly into the storage engine.
Three Pillars of Temporal Operations
1. AS OF (Historical Reads)
Query documents and graph bonds as they existed at a specific timestamp or relative moment (e.g. AS OF yesterday) without modifying current state.
2. REWIND (Document Restore)
Revert an individual document to an earlier snapshot (e.g. REWIND "staff:a" TO "10 minutes ago") while keeping graph bonds intact.
3. UNDO (Global Rollback)
Inspect the global operation ledger with UNDO SHOW and roll back operations down to a specific transaction ID without prior transaction locks.
Prerequisites for Time Travel
To enable temporal snapshots, configure target buckets with version tracking:
- SHAPE BUCKET <bucket> VERSIONED: Automatically maintains previous versions of documents on every write or update.
- SHAPE BUCKET <bucket> AUDITED: Logs full audit diffs (author, before/after payloads, timestamps) to enable
REWIND.
Explore Time Travel Topics
Select a guide below to learn how to query and restore past data in CleaveQL:
- AS OF — historical reads: execute point-in-time document and graph queries across relative and absolute timestamps.
- REWIND — restore a document: revert an altered document back to a past state using MVCC history snapshots.
- UNDO — global rollback: audit recent writes via UNDO SHOW and revert accidental mutations instantly.
