oxirs_tsdb/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in time-series operations
4#[derive(Error, Debug)]
5pub enum TsdbError {
6    /// I/O error during storage operations
7    #[error("I/O error: {0}")]
8    Io(#[from] std::io::Error),
9
10    /// Compression or decompression error
11    #[error("Compression error: {0}")]
12    Compression(String),
13
14    /// Decompression error
15    #[error("Decompression error: {0}")]
16    Decompression(String),
17
18    /// Invalid series ID
19    #[error("Invalid series ID: {0}")]
20    InvalidSeriesId(u64),
21
22    /// Invalid time range
23    #[error("Invalid time range: start={start}, end={end}")]
24    InvalidTimeRange {
25        /// Start timestamp (milliseconds since epoch)
26        start: i64,
27        /// End timestamp (milliseconds since epoch)
28        end: i64,
29    },
30
31    /// Series not found
32    #[error("Series not found: {0}")]
33    SeriesNotFound(u64),
34
35    /// Chunk not found
36    #[error("Chunk not found for series {series_id} at {timestamp}")]
37    ChunkNotFound {
38        /// Series ID
39        series_id: u64,
40        /// Timestamp
41        timestamp: i64,
42    },
43
44    /// Write buffer full
45    #[error("Write buffer full: {0} points pending")]
46    BufferFull(usize),
47
48    /// WAL error
49    #[error("Write-Ahead Log error: {0}")]
50    Wal(String),
51
52    /// Configuration error
53    #[error("Configuration error: {0}")]
54    Config(String),
55
56    /// Query error
57    #[error("Query error: {0}")]
58    Query(String),
59
60    /// Integration error (RDF store integration)
61    #[error("Integration error: {0}")]
62    Integration(String),
63}
64
65/// Result type for time-series operations
66pub type TsdbResult<T> = Result<T, TsdbError>;