pub struct RollbackJournal { /* private fields */ }Expand description
A parsed rollback journal: its header tier plus the ordered, first-wins page images (design §3/§5). The temporal inverse of the WAL overlay — these images are the database as it was BEFORE the last transaction.
Implementations§
Source§impl RollbackJournal
impl RollbackJournal
Sourcepub fn parse(bytes: &[u8], page_size: u32) -> Result<Self, Error>
pub fn parse(bytes: &[u8], page_size: u32) -> Result<Self, Error>
LOWER-LEVEL, UNAUTHENTICATED parse (design §5): interpret bytes as a
rollback journal given an externally-supplied page_size. Does NOT bind
the journal to a particular database — prefer Database::rollback_prior,
which supplies the authoritative page size from the main db.
Tier A (magic present) trusts the header and verifies each checksum. Tier B
(magic absent — PERSIST post-commit) reconstructs the sector size by
candidate scoring and walks records (checksums unverifiable). Robust: a
malformed/truncated journal yields fewer images, never a panic; a page size
that is not a power of two in [512, 65536] is a typed
Error::BadJournalPageSize carrying the offending value.
Sourcepub fn header(&self) -> &JournalHeader
pub fn header(&self) -> &JournalHeader
The parsed (or reconstructed) header.
Sourcepub fn page_images(&self) -> &[JournalPageImage]
pub fn page_images(&self) -> &[JournalPageImage]
The ordered, first-wins pre-transaction page images.
Sourcepub fn has_duplicate_pgno(&self) -> bool
pub fn has_duplicate_pgno(&self) -> bool
Whether a pgno appeared more than once across the parsed segments — the
spec says a page is journaled at most once, so a repeat is consistent with
corruption, a savepoint/super-journal artifact, or tampering (design §3).
Sourcepub fn duplicate_pgnos(&self) -> &[u32]
pub fn duplicate_pgnos(&self) -> &[u32]
The page numbers that appeared more than once (first occurrence kept), each
listed once in first-seen order — the offending values behind
Self::has_duplicate_pgno. Empty for a well-formed journal.
Trait Implementations§
Source§impl Clone for RollbackJournal
impl Clone for RollbackJournal
Source§fn clone(&self) -> RollbackJournal
fn clone(&self) -> RollbackJournal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more