use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("Invalid footer / Footer 无效")]
InvalidFooter,
#[error("Magic mismatch: expected {expected:#X}, got {actual:#X}")]
MagicMismatch { expected: u32, actual: u32 },
#[error("Invalid index / Index 无效")]
InvalidIndex,
#[error("Empty SST")]
EmptySst,
#[error("File too small: {size} < {min}")]
FileTooSmall { size: u64, min: u64 },
#[error("Key too large for block: {0}")]
KeyTooLarge(usize),
#[error("Index too large: {0}")]
IndexTooLarge(usize),
#[error("IO: {0}")]
Io(#[from] std::io::Error),
#[error("FS: {0}")]
Fs(#[from] jdb_fs::Error),
#[error("Alloc: {0}")]
Alloc(#[from] jdb_alloc::Error),
}