evict/
error.rs

1use crate::FrameId;
2
3/// Page eviction strategy error.
4#[derive(Debug, PartialEq, thiserror::Error)]
5pub enum EvictError<F: FrameId> {
6    /// Invalid frame id.
7    #[error("Invalid frame id: {0}")]
8    InvalidFrameId(F),
9
10    /// Trying to remove pinned frame.
11    #[error("Trying to remove pinned frame: {0}")]
12    PinnedFrameRemoval(F),
13
14    /// Cannot add any more pages to the frame replacer.
15    #[error("Frame replacer is full")]
16    FrameReplacerFull,
17
18    /// Invalid sequence number.
19    #[error("Invalid timestamp")]
20    InvalidTimestamp,
21
22    /// No free frames available.
23    #[error("No free frames available (nor in free list nor in frame replacer)")]
24    NoFramesAvailable,
25
26    /// Sequence generator arrived at maximum value.
27    #[error("Sequence generator exhausted")]
28    SequenceExhausted,
29}
30
31/// Cache eviction policy result type.
32pub type EvictResult<T, F> = Result<T, EvictError<F>>;