#[non_exhaustive]pub enum WalError {
Io {
context: &'static str,
source: Error,
},
RecordTooLarge {
len: usize,
max: u32,
},
Corruption {
offset: u64,
reason: &'static str,
},
Encoding {
detail: String,
},
}Expand description
Everything that can go wrong while appending to, syncing, or recovering a log.
The type is #[non_exhaustive]:
future versions may add variants without a major bump, so a match over it
must include a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
An underlying I/O operation failed.
context names the operation that was attempted (for example
"open log file" or "flush to stable storage") so the message is
actionable without a backtrace. The original io::Error is preserved
as the source; inspect it when the OS
error kind (disk full, permission denied, interrupted) drives recovery.
Fields
RecordTooLarge
An append was rejected because the record is larger than the configured limit.
Records are bounded by WalConfig::max_record_size
so that a single oversized — or maliciously crafted — record cannot force
an unbounded allocation on the recovery path. The append makes no change
to the log; the caller may split the payload or raise the limit.
Fields
Corruption
Recovery reached a record that is not intact.
Either the record’s checksum did not match its bytes, or its length
prefix is implausible. In an append-only log a damaged record means
everything after it is untrustworthy, so iteration surfaces this once and
then stops. offset is the byte position of the record where the break
was detected.
Fields
Encoding
A typed record could not be encoded or decoded.
Produced only by the typed-record API (the pack-io feature):
Wal::append_typed when a value fails to serialise, or Record::decode
when a record’s bytes do not deserialise into the requested type.
detail carries the underlying codec error’s message.
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()
Source§impl ForgeError for WalError
impl ForgeError for WalError
Source§fn is_fatal(&self) -> bool
fn is_fatal(&self) -> bool
Corruption is unrecoverable by retry: the bytes on disk are already damaged. I/O and size errors are left non-fatal for the caller to judge.