walogs 0.1.0

A crash-safe write-ahead log library with multi-segment rotation and configurable durability.
Documentation
use std::io;

/// Errors returned by [`crate::Wal`] operations.
#[derive(Debug, thiserror::Error)]
pub enum WalError {
    /// An OS-level I/O error (disk full, permission denied, hardware fault, etc.).
    #[error("io error: {0}")]
    Io(#[from] io::Error),

    /// The `data` slice passed to [`crate::Wal::append`] exceeds [`crate::MAX_ENTRY_SIZE`].
    #[error("entry too large: {size} bytes, max is {max}")]
    EntryTooLarge { size: usize, max: usize },

    /// Unrecoverable corruption detected during [`crate::Wal::open`].
    ///
    /// Covers: corruption in a completed (non-last) segment, LSN discontinuities
    /// across segments, a gap in segment sequence numbers, and a mixed v1/v2 state.
    ///
    /// Note: corruption in the **last** segment's tail is NOT this variant — it is
    /// expected after a crash, handled by automatic truncation, and reported as
    /// [`crate::TailState::TruncatedAt`] instead.
    #[error("wal corrupt: {reason}")]
    Corrupt { reason: String },
}