pub struct Daemon {
pub runtime: Arc<RwLock<Arc<Runtime<ProviderRegistry, DaemonHook>>>>,
/* private fields */
}Expand description
Shared daemon state — holds the runtime. Cheap to clone (Arc-backed).
The runtime is stored behind Arc<RwLock<Arc<Runtime>>> so that
Daemon::reload can swap it atomically while in-flight requests that
already cloned the inner Arc complete normally.
Fields§
§runtime: Arc<RwLock<Arc<Runtime<ProviderRegistry, DaemonHook>>>>The walrus runtime, swappable via Daemon::reload.
Implementations§
Source§impl Daemon
impl Daemon
Sourcepub async fn reload(&self) -> Result<()>
pub async fn reload(&self) -> Result<()>
Rebuild the runtime from disk and swap it in atomically.
In-flight requests that already hold a reference to the old runtime complete normally. New requests after the swap see the new runtime. Note: reload does not restart managed services — that requires a full daemon restart. Services field is cleared to avoid re-spawning.
Source§impl Daemon
impl Daemon
Sourcepub async fn start(config_dir: &Path) -> Result<DaemonHandle>
pub async fn start(config_dir: &Path) -> Result<DaemonHandle>
Load config, build runtime, and start the event loop.
Returns a DaemonHandle with the event sender exposed. The caller
spawns transports (socket, channels) using the handle’s event_tx
and shutdown_tx, then integrates its own channels by cloning
event_tx and sending DaemonEvent::Message variants.
Trait Implementations§
Source§impl Server for Daemon
impl Server for Daemon
Source§async fn send(&self, req: SendMsg) -> Result<SendResponse>
async fn send(&self, req: SendMsg) -> Result<SendResponse>
Send — run agent and return complete response.Source§fn stream(
&self,
req: StreamMsg,
) -> impl Stream<Item = Result<StreamEvent>> + Send
fn stream( &self, req: StreamMsg, ) -> impl Stream<Item = Result<StreamEvent>> + Send
Stream — run agent and stream response events.Source§async fn list_sessions(&self) -> Result<Vec<SessionInfo>>
async fn list_sessions(&self) -> Result<Vec<SessionInfo>>
Sessions — list active sessions.Source§async fn kill_session(&self, session: u64) -> Result<bool>
async fn kill_session(&self, session: u64) -> Result<bool>
Kill — close a session by ID.Source§async fn list_tasks(&self) -> Result<Vec<TaskInfo>>
async fn list_tasks(&self) -> Result<Vec<TaskInfo>>
Tasks — list tasks in the task registry.Source§async fn kill_task(&self, task_id: u64) -> Result<bool>
async fn kill_task(&self, task_id: u64) -> Result<bool>
KillTask — cancel a task by ID.Source§async fn approve_task(&self, _task_id: u64, _response: String) -> Result<bool>
async fn approve_task(&self, _task_id: u64, _response: String) -> Result<bool>
Approve — approve a blocked task’s inbox item.Source§fn hub(
&self,
package: String,
action: HubAction,
filters: Vec<String>,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn hub( &self, package: String, action: HubAction, filters: Vec<String>, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
Hub — install or uninstall a hub package. Read moreSource§fn subscribe_tasks(&self) -> impl Stream<Item = Result<TaskEvent>> + Send
fn subscribe_tasks(&self) -> impl Stream<Item = Result<TaskEvent>> + Send
SubscribeTasks — stream task lifecycle events.Source§async fn list_downloads(&self) -> Result<Vec<DownloadInfo>>
async fn list_downloads(&self) -> Result<Vec<DownloadInfo>>
Downloads — list downloads in the registry.Source§fn subscribe_downloads(
&self,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn subscribe_downloads( &self, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
SubscribeDownloads — stream download lifecycle events.Source§async fn get_config(&self) -> Result<String>
async fn get_config(&self) -> Result<String>
GetConfig — return the full daemon config as JSON.Source§async fn set_config(&self, config: String) -> Result<()>
async fn set_config(&self, config: String) -> Result<()>
SetConfig — replace the daemon config from JSON.Source§async fn service_query(&self, service: String, query: String) -> Result<String>
async fn service_query(&self, service: String, query: String) -> Result<String>
ServiceQuery — route to a named service.Source§async fn get_service_schema(&self, service: String) -> Result<String>
async fn get_service_schema(&self, service: String) -> Result<String>
GetServiceSchema — return JSON Schema for one service’s config.Source§async fn get_all_schemas(&self) -> Result<HashMap<String, String>>
async fn get_all_schemas(&self) -> Result<HashMap<String, String>>
GetAllSchemas — return JSON Schemas for all services.Source§async fn list_services(&self) -> Result<Vec<ServiceInfoMsg>>
async fn list_services(&self) -> Result<Vec<ServiceInfoMsg>>
GetServices — list registered services with status.Source§async fn set_service_config(
&self,
service: String,
config: String,
) -> Result<()>
async fn set_service_config( &self, service: String, config: String, ) -> Result<()>
SetServiceConfig — update a single service’s config.Source§fn dispatch(
&self,
msg: ClientMessage,
) -> impl Stream<Item = ServerMessage> + Send
fn dispatch( &self, msg: ClientMessage, ) -> impl Stream<Item = ServerMessage> + Send
ClientMessage to the appropriate handler method. Read more