laminar_storage/per_core_wal/
error.rs1use std::path::PathBuf;
4
5#[derive(Debug, thiserror::Error)]
7pub enum PerCoreWalError {
8 #[error("IO error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("Serialization error: {0}")]
14 Serialization(String),
15
16 #[error("Deserialization error: {0}")]
18 Deserialization(String),
19
20 #[error("CRC32 checksum mismatch at position {position} in segment {core_id}: expected {expected:#010x}, got {actual:#010x}")]
22 ChecksumMismatch {
23 core_id: usize,
25 position: u64,
27 expected: u32,
29 actual: u32,
31 },
32
33 #[error("Torn write detected at position {position} in segment {core_id}: {reason}")]
35 TornWrite {
36 core_id: usize,
38 position: u64,
40 reason: String,
42 },
43
44 #[error("Corrupted WAL entry at position {position} in segment {core_id}: {reason}")]
46 Corrupted {
47 core_id: usize,
49 position: u64,
51 reason: String,
53 },
54
55 #[error("Invalid core ID {core_id}: max is {max_core_id}")]
57 InvalidCoreId {
58 core_id: usize,
60 max_core_id: usize,
62 },
63
64 #[error("Segment file not found for core {core_id}: {path}")]
66 SegmentNotFound {
67 core_id: usize,
69 path: PathBuf,
71 },
72
73 #[error("Checkpoint not found at {path}")]
75 CheckpointNotFound {
76 path: PathBuf,
78 },
79
80 #[error("Recovery failed: {0}")]
82 RecoveryFailed(String),
83
84 #[error("Writer for core {0} not initialized")]
86 WriterNotInitialized(usize),
87
88 #[error("Epoch mismatch: expected {expected}, got {actual}")]
90 EpochMismatch {
91 expected: u64,
93 actual: u64,
95 },
96
97 #[error("Incremental checkpoint error: {0}")]
99 IncrementalCheckpoint(#[from] crate::incremental::IncrementalCheckpointError),
100}