seerdb/db/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DBError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("WAL error: {0}")]
9    Wal(#[from] crate::wal::WALError),
10
11    #[error("SSTable error: {0}")]
12    SSTable(#[from] crate::sstable::SSTableError),
13
14    #[error("Compaction error: {0}")]
15    Compaction(#[from] crate::compaction::CompactionError),
16
17    #[error("VLog error: {0}")]
18    VLog(#[from] crate::vlog::VLogError),
19
20    #[error("Database not opened")]
21    NotOpened,
22
23    #[error("Insufficient disk space: {available} bytes available, {required} bytes required")]
24    DiskSpaceFull { available: u64, required: u64 },
25
26    #[error("Background thread panic: {thread_name} - database may be in inconsistent state")]
27    BackgroundThreadPanic { thread_name: String },
28
29    #[error("Object store error: {0}")]
30    ObjectStore(String),
31
32    #[error("Transaction aborted or already committed")]
33    TransactionAborted,
34
35    #[error("WAL corruption: {0}")]
36    WalCorruption(String),
37
38    #[error("Transaction conflict: {0}")]
39    TransactionConflict(crate::transaction::TransactionConflict),
40}
41
42pub type Result<T> = std::result::Result<T, DBError>;
43
44/// Result of full database integrity verification.
45#[derive(Debug, Clone, Default)]
46pub struct VerifyResult {
47    pub sstables_verified: u64,
48    pub blocks_verified: u64,
49    pub sstable_bytes_verified: u64,
50    pub vlog_records_verified: u64,
51    pub vlog_bytes_verified: u64,
52    pub vlog_verified: bool,
53}