use thiserror::Error;
#[derive(Debug, Error)]
pub enum CompactionError {
#[error("No segments eligible for compaction")]
NoEligibleSegments,
#[error("Segment error: {0}")]
Segment(#[from] crate::segment::SegmentError),
#[error("Encoding error: {0}")]
Encoding(#[from] chronix_encoding::EncodingError),
#[error("Index error: {0}")]
Index(#[from] crate::index::IndexError),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Internal compaction error: {0}")]
Internal(String),
#[error("Compaction timeout: task exceeded {0}ms limit")]
TaskTimeout(u64),
#[error("Compaction input too large: {loaded_bytes} bytes exceeds {limit_bytes} byte limit")]
InputTooLarge {
loaded_bytes: u64,
limit_bytes: u64,
},
}
pub type Result<T> = std::result::Result<T, CompactionError>;