spec_stream_cache/
error.rs1use thiserror::Error;
2
3#[derive(Error, Debug, Clone, PartialEq)]
4pub enum CacheError {
5 #[error(
6 "Out of memory: No physical KV-cache blocks available in pool (capacity: {total_blocks})"
7 )]
8 OutOfMemory { total_blocks: usize },
9
10 #[error("Block {0} not found in allocator")]
11 BlockNotFound(usize),
12
13 #[error(
14 "Invalid sequence state: requested token index {index} exceeds sequence length {length}"
15 )]
16 IndexOutOfBounds { index: usize, length: usize },
17
18 #[error("Rollback error: target length {target_len} exceeds current length {current_len}")]
19 InvalidRollback {
20 target_len: usize,
21 current_len: usize,
22 },
23
24 #[error("Sequence {0} not registered in cache manager")]
25 SequenceNotFound(u64),
26
27 #[error("Serialization / Snapshot error: {0}")]
28 SerializationError(String),
29}