1#[derive(Debug, thiserror::Error)]
5pub enum ColumnarError {
6 #[error("codec error: {0}")]
7 Codec(#[from] nodedb_codec::CodecError),
8
9 #[error("segment too short: expected at least {expected} bytes, got {got}")]
10 TruncatedSegment { expected: usize, got: usize },
11
12 #[error("invalid magic bytes: expected NDBS, got {0:?}")]
13 InvalidMagic([u8; 4]),
14
15 #[error(
16 "incompatible segment version: reader {reader_major}.x, segment {segment_major}.{segment_minor}"
17 )]
18 IncompatibleVersion {
19 reader_major: u8,
20 segment_major: u8,
21 segment_minor: u8,
22 },
23
24 #[error("footer CRC32C mismatch: stored {stored:#010x}, computed {computed:#010x}")]
25 FooterCrcMismatch { stored: u32, computed: u32 },
26
27 #[error("column index {index} out of range (segment has {count} columns)")]
28 ColumnOutOfRange { index: usize, count: usize },
29
30 #[error("schema mismatch: expected {expected} columns, memtable has {got}")]
31 SchemaMismatch { expected: usize, got: usize },
32
33 #[error("memtable is empty — nothing to flush")]
34 EmptyMemtable,
35
36 #[error("serialization error: {0}")]
37 Serialization(String),
38
39 #[error("value type mismatch for column '{column}': expected {expected}")]
40 TypeMismatch { column: String, expected: String },
41
42 #[error("null violation: column '{0}' is NOT NULL")]
43 NullViolation(String),
44
45 #[error("duplicate primary key")]
46 DuplicatePrimaryKey,
47
48 #[error("primary key not found")]
49 PrimaryKeyNotFound,
50}