Skip to main content

ssh_mcp/background/
mod.rs

1//! Local background job state and log spooling.
2//!
3//! The core types are:
4//! - [`JobState`]: per-job state (pid, local log path, exit code, status)
5//! - [`JobRegistry`]: thread-safe registry for active + recently completed jobs
6//! - [`LocalLogSpooler`]: configured or per-user local spool directory management
7
8pub mod job;
9pub(crate) mod marker;
10pub mod registry;
11pub(crate) mod response;
12pub mod spooler;
13pub mod stream;
14pub(crate) mod transfer;
15pub(crate) mod wrapper;
16
17pub use job::{JobState, JobStatus, SharedJobState};
18pub use registry::JobRegistry;
19pub use spooler::LocalLogSpooler;
20pub use stream::OutputStreamer;
21
22use thiserror::Error;
23
24/// Background subsystem errors.
25#[derive(Debug, Error)]
26pub enum BackgroundError {
27    #[error("io error: {0}")]
28    Io(#[from] std::io::Error),
29
30    #[error("invalid job id: {job_id}")]
31    InvalidJobId { job_id: String },
32
33    #[error("job not found: {job_id}")]
34    JobNotFound { job_id: String },
35
36    #[error("invalid job state: {message}")]
37    InvalidState { message: &'static str },
38
39    #[error("time error: {0}")]
40    Time(#[from] std::time::SystemTimeError),
41}
42
43pub type Result<T> = std::result::Result<T, BackgroundError>;