laminar_storage/incremental/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum IncrementalCheckpointError {
8 #[error("I/O 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("WAL error: {0}")]
22 Wal(String),
23
24 #[error("Checkpoint not found: {0}")]
26 NotFound(String),
27
28 #[error("Checkpoint corruption: {0}")]
30 Corruption(String),
31
32 #[error("Recovery failed: {0}")]
34 Recovery(String),
35
36 #[error("Changelog buffer overflow at epoch {epoch}")]
38 BufferOverflow {
39 epoch: u64,
41 },
42
43 #[error("Invalid configuration: {0}")]
45 InvalidConfig(String),
46
47 #[error("Checkpoint already exists for epoch {0}")]
49 AlreadyExists(u64),
50
51 #[error("Epoch mismatch: expected {expected}, found {found}")]
53 EpochMismatch {
54 expected: u64,
56 found: u64,
58 },
59
60 #[error("CRC mismatch at offset {offset}: expected {expected:#x}, computed {computed:#x}")]
62 CrcMismatch {
63 offset: u64,
65 expected: u32,
67 computed: u32,
69 },
70}
71
72impl IncrementalCheckpointError {
73 #[must_use]
75 pub fn is_transient(&self) -> bool {
76 matches!(self, Self::Io(_) | Self::BufferOverflow { .. })
77 }
78
79 #[must_use]
81 pub fn is_corruption(&self) -> bool {
82 matches!(self, Self::Corruption(_) | Self::CrcMismatch { .. })
83 }
84}