pub struct Daemon {
pub runtime: Arc<RwLock<Arc<Runtime<ProviderManager, 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<ProviderManager, DaemonHook>>>>The walrus runtime, swappable via Daemon::reload.
Implementations§
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: SendRequest) -> Result<SendResponse>
async fn send(&self, req: SendRequest) -> Result<SendResponse>
Handle
Send — run agent and return complete response.Source§fn stream(
&self,
req: StreamRequest,
) -> impl Stream<Item = Result<StreamEvent>> + Send
fn stream( &self, req: StreamRequest, ) -> impl Stream<Item = Result<StreamEvent>> + Send
Handle
Stream — run agent and stream response events.Source§fn download(
&self,
req: DownloadRequest,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn download( &self, req: DownloadRequest, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
Handle
Download — download model files with progress.Source§fn hub(
&self,
package: CompactString,
action: HubAction,
) -> impl Stream<Item = Result<HubEvent>> + Send
fn hub( &self, package: CompactString, action: HubAction, ) -> impl Stream<Item = Result<HubEvent>> + Send
Handle
Hub — install or uninstall a hub package.Source§fn dispatch(
&self,
msg: ClientMessage,
) -> impl Stream<Item = ServerMessage> + Send
fn dispatch( &self, msg: ClientMessage, ) -> impl Stream<Item = ServerMessage> + Send
Dispatch a
ClientMessage to the appropriate handler method. Read moreAuto Trait Implementations§
impl Freeze for Daemon
impl !RefUnwindSafe for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnsafeUnpin for Daemon
impl !UnwindSafe for Daemon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T> Erasable for T
impl<T> Erasable for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more