1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Error types for OxiRS TDB storage engine
use thiserror::Error;
/// TDB error type
#[derive(Error, Debug)]
pub enum TdbError {
/// I/O error
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
/// Page not found
#[error("Page not found: {0}")]
PageNotFound(u64),
/// Buffer pool full
#[error("Buffer pool full, cannot evict any page")]
BufferPoolFull,
/// Invalid page size
#[error("Invalid page size: expected {expected}, got {got}")]
InvalidPageSize {
/// Expected page size
expected: usize,
/// Actual page size received
got: usize,
},
/// Transaction error
#[error("Transaction error: {0}")]
Transaction(String),
/// Deadlock detected
#[error("Deadlock detected for transaction {txn_id}")]
Deadlock {
/// Transaction ID that encountered deadlock
txn_id: u64,
},
/// Transaction not active
#[error("Transaction {txn_id} is not active")]
TransactionNotActive {
/// Transaction ID that is not active
txn_id: u64,
},
/// Invalid node ID
#[error("Invalid node ID: {0}")]
InvalidNodeId(u64),
/// Serialization error
#[error("Serialization error: {0}")]
Serialization(String),
/// Deserialization error
#[error("Deserialization error: {0}")]
Deserialization(String),
/// Node too large to fit in page
#[error("Node too large: {size} bytes exceeds maximum {max} bytes")]
NodeTooLarge {
/// Actual node size in bytes
size: usize,
/// Maximum allowed size in bytes
max: usize,
},
/// Index error
#[error("Index error: {0}")]
Index(String),
/// WAL error
#[error("WAL error: {0}")]
Wal(String),
/// Invalid input
#[error("Invalid input: {0}")]
InvalidInput(String),
/// Invalid configuration
#[error("Invalid configuration: {0}")]
InvalidConfiguration(String),
/// Unsupported feature or operation
#[error("Unsupported: {0}")]
Unsupported(String),
/// Generic error
#[error("{0}")]
Other(String),
}
/// Result type for TDB operations
pub type Result<T> = std::result::Result<T, TdbError>;