Skip to main content

steamroom_cli/daemon/proto/
response.rs

1use super::JobId;
2use super::status::StatusSnapshot;
3use rkyv::Archive;
4use rkyv::Deserialize;
5use rkyv::Serialize;
6
7#[derive(Archive, Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
8#[rkyv(derive(Debug))]
9pub enum ErrorKind {
10    ProtocolMismatch,
11    InvalidRequest,
12    DaemonBusy,
13    JobNotFound,
14    InternalError,
15}
16
17#[derive(Archive, Serialize, Deserialize, Debug, Clone)]
18#[rkyv(derive(Debug))]
19pub enum Response {
20    /// Job submission accepted. `position` is its queue index.
21    JobAccepted { job_id: JobId, position: u32 },
22    /// One-shot snapshot in reply to `Request::Status`.
23    Status(StatusSnapshot),
24    /// Reply to `Request::Stop`; daemon is shutting down.
25    Stopping,
26    /// Control RPC succeeded but produces no payload (`Cancel`, `TogglePriority`).
27    Ack,
28    /// Typed error reply. `kind` is for programmatic handling; `message` is for display.
29    Error { kind: ErrorKind, message: String },
30}