#[non_exhaustive]pub enum WalError {
Io(Error),
Corruption {
segment: Lsn,
offset: u64,
detail: &'static str,
},
TornMidLog {
segment: Lsn,
offset: u64,
},
RecordTooLarge,
InvalidConfig,
BadSegmentHeader,
Locked,
FsyncFailed,
ContiguityViolation,
Poisoned,
}Expand description
All error conditions surfaced by the WAL.
This is the normative WalError shape from §10. Variants beyond Io carry
enough context (segment base LSN, byte offset) to locate the fault.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
An underlying I/O error that is not itself a durability failure.
Corruption
A record or header failed CRC / structural validation mid-segment.
Fields
TornMidLog
A valid record exists after a bad/torn one — a non-truncatable internal gap. Fatal and loud, never silently truncated (D5).
Fields
RecordTooLarge
An append payload exceeds max_record_size (no silent truncation,
no fragmentation in v1).
InvalidConfig
The supplied WalConfig is invalid (e.g.
max_record_size > segment_size - 91, §5.3).
BadSegmentHeader
A segment header has bad magic or header_crc (§5.2). The header is
written and synced at creation, so it is never a torn tail — always
fatal.
Locked
The directory’s exclusive writer lock is already held.
FsyncFailed
A write/fdatasync/fsync failed. This poisons the handle
(§12); there is no safe resume for a dense-LSN log.
ContiguityViolation
Retained segments do not form a contiguous LSN suffix (§8.1).
Poisoned
The handle was poisoned by a prior durability failure (§12). All
subsequent append/commit calls return this.
Trait Implementations§
Source§impl Error for WalError
impl Error for WalError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()