Skip to main content

sort_governor/
error.rs

1//! Failures the sort governor and its execution engine can surface.
2
3/// An error raised while admitting, spilling, reading, or merging a sort.
4#[derive(Debug, thiserror::Error)]
5pub enum SorterError {
6    /// A spill file or scratch directory could not be created, written,
7    /// read, or removed.
8    #[error("sort I/O error: {0}")]
9    Io(#[from] async_fs_io::FsError),
10    /// A run row could not be encoded for spilling.
11    #[error("sort row encode failed: {0}")]
12    Encode(String),
13    /// A run row could not be decoded from a spill file.
14    #[error("sort row decode failed: {0}")]
15    Decode(String),
16    /// The session has exhausted its checked 64-bit spill counter.
17    #[error("sort exceeds the maximum number of spill runs")]
18    RunLimit,
19    /// An earlier spill failed or was cancelled, invalidating this session.
20    #[error("sort session cannot continue after a failed or cancelled spill")]
21    SessionFailed,
22    /// The governor actor is no longer running (its task ended or every
23    /// handle was dropped), so the sort could not be admitted.
24    #[error("sort governor is not running")]
25    Gone,
26}