use std::sync::Arc; use async_trait::async_trait; use tokio::sync::watch; use crate::ExecServerError; use crate::ProcessId; use crate::protocol::ExecParams; use crate::protocol::ReadResponse; use crate::protocol::WriteResponse; pub struct StartedExecProcess { pub process: Arc, } #[async_trait] pub trait ExecProcess: Send + Sync { fn process_id(&self) -> &ProcessId; fn subscribe_wake(&self) -> watch::Receiver; async fn read( &self, after_seq: Option, max_bytes: Option, wait_ms: Option, ) -> Result; async fn write(&self, chunk: Vec) -> Result; async fn terminate(&self) -> Result<(), ExecServerError>; } #[async_trait] pub trait ExecBackend: Send + Sync { async fn start(&self, params: ExecParams) -> Result; }