use thiserror::Error;
#[derive(Debug, Error)]
pub enum RecoveryError {
#[error("trimmed_count != 0 but WAL recovery tail missing first event")]
WalTailMissingFirst,
#[error("trimmed_count != 0 but WAL recovery tail missing last event")]
WalTailMissingLast,
}
#[derive(Debug, Error)]
pub enum WalError {
#[error("WAL schema mismatch: expected {expected}, found {found} (wipe the WAL directory)")]
SchemaMismatch { expected: u64, found: u64 },
#[error("corrupt WAL record at app_seq={app_seq}: {details}")]
CorruptRecord { app_seq: u64, details: String },
#[error("invalid tx framing at app_seq={app_seq}: tx_id={tx_id} tx_len={tx_len} tx_ix={tx_ix}")]
InvalidTxFraming {
app_seq: u64,
tx_id: u64,
tx_len: u16,
tx_ix: u16,
},
}
#[derive(Debug, Error)]
pub enum SegmentError {
#[error(
"segment contiguity gap: prev_end={prev_end_seq}, next_start={next_start_seq}, expected={expected}"
)]
ContiguityGap {
prev_end_seq: u64,
next_start_seq: u64,
expected: u64,
},
#[error("segment contiguity overlap: prev_end={prev_end_seq}, next_start={next_start_seq}")]
ContiguityOverlap {
prev_end_seq: u64,
next_start_seq: u64,
},
#[error("no segments found in {path}")]
NoSegments { path: String },
}
#[derive(Debug, Error)]
pub enum RuntimeError {
#[error("wal thread panicked")]
WalThreadPanic,
}