pub fn carve_rollback_journal(db: &Database, journal: &[u8]) -> JournalRecoveryExpand description
Recover the last transaction’s deletions and modifications from a rollback
-journal by diffing the pre-transaction snapshot against the live database
(design §4) — the temporal inverse of WAL recovery.
For each prior rowid table, the prior rows (read through PriorSnapshot)
are diffed against the current rows by rowid:
- deleted = rowid in prior but not current → a full-fidelity
PriorRow; - modified = rowid in both with different values → a
PriorVersionRecordflaggedreplaced_rowid(identity may differ; never asserted as UPDATE); - inserted (rowid only in current) is a timeline fact, not a recovery target.
WITHOUT ROWID tables are excluded (no integer rowid key; design §4 limit).
Read-only and panic-free: a malformed/truncated journal, or a WAL-applied db
(the modes are exclusive), yields an empty recovery rather than an error or
panic — the journal source is bound to THIS database via
Database::rollback_prior.