rocksdb_fileformat/
error.rs1use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum Error {
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("Invalid magic number: expected 0x88e241b785f4cff7, got {0:#x}")]
12 InvalidMagicNumber(u64),
13
14 #[error("Invalid footer size: expected {}, got {}", crate::types::ROCKSDB_FOOTER_SIZE, .0)]
15 InvalidFooterSize(usize),
16
17 #[error("Invalid block handle: {0}")]
18 InvalidBlockHandle(String),
19
20 #[error("Unsupported compression type: {0}")]
21 UnsupportedCompressionType(u8),
22
23 #[error("Unsupported: {0}")]
24 Unsupported(String),
25
26 #[error("Unsupported checksum type: {0}")]
27 UnsupportedChecksumType(u8),
28
29 #[error("Unsupported format version: {0}")]
30 UnsupportedFormatVersion(u32),
31
32 #[error("Compression error: {0}")]
33 Compression(String),
34
35 #[error("Decompression error: {0}")]
36 Decompression(String),
37
38 #[error("Invalid varint encoding")]
39 InvalidVarint,
40
41 #[error("Data corruption detected: {0}")]
42 DataCorruption(String),
43
44 #[error("Block not found")]
45 BlockNotFound,
46
47 #[error("Key not found")]
48 KeyNotFound,
49
50 #[error("Invalid block format: {0}")]
51 InvalidBlockFormat(String),
52
53 #[error(
54 "File too small: expected at least {} bytes",
55 crate::types::ROCKSDB_FOOTER_SIZE
56 )]
57 FileTooSmall,
58
59 #[error("Invalid argument: {0}")]
60 InvalidArgument(String),
61
62 #[error("Unsupported operation: {0}")]
63 UnsupportedOperation(String),
64}
65
66pub type Result<T> = std::result::Result<T, Error>;