#[non_exhaustive]pub enum RecoveryPolicy {
StopAtFirstError,
SkipBadRecords,
}Expand description
How Wal::iter reacts to a damaged record.
This governs iteration, not what Wal::open does with
damage it finds while opening; that is OpenPolicy. It matters when a
record in the middle of an already-recovered log is damaged — bit rot, say —
and you are reading the log back.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StopAtFirstError
Stop at the first damaged record: yield it as a single
WalError::Corruption, then end.
The default, and the right choice for an append-only log, where a damaged record means everything after it is untrustworthy.
SkipBadRecords
Skip past a damaged record and keep going, for forensic or partial recovery.
Each damaged record is still yielded as a
WalError::Corruption — the loss is never
silent — but iteration then resumes at the next record. This is only
possible while a damaged record’s length prefix is intact enough to locate
the next one; a record whose length itself is unreadable (a short read, or
a length past the maximum) still stops iteration, because there is no way
to know where the following record begins.