1use std::path::PathBuf;
4use thiserror::Error;
5
6pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, Error)]
10pub enum Error {
11 #[error("I/O error: {0}")]
13 Io(#[from] std::io::Error),
14
15 #[error("queue is closed")]
17 QueueClosed,
18
19 #[error("invalid index: {0:#x}")]
21 InvalidIndex(u64),
22
23 #[error("cycle not found: {0}")]
25 CycleNotFound(i32),
26
27 #[error("store file missing: {}", .0.display())]
29 StoreFileMissing(PathBuf),
30
31 #[error("corrupted data at position {0}")]
33 CorruptedData(u64),
34
35 #[error("queue is read-only")]
37 ReadOnly,
38
39 #[error("failed to create queue directory: {}", .0.display())]
41 DirectoryCreationFailed(PathBuf),
42
43 #[error("write position {position} exceeds capacity {capacity}")]
45 CapacityExceeded { position: u64, capacity: u64 },
46
47 #[error("failed to acquire lock: {0}")]
49 LockFailed(String),
50
51 #[error("invalid header at position {0}")]
53 InvalidHeader(u64),
54}