pub struct DaemonClient { /* private fields */ }Expand description
A one-shot client over the daemon’s Unix-domain control socket. Each call
opens a fresh connection, sends one DaemonEnvelope, and reads one
DaemonReply.
Implementations§
Source§impl DaemonClient
impl DaemonClient
Sourcepub fn new(socket_path: impl Into<PathBuf>) -> Self
pub fn new(socket_path: impl Into<PathBuf>) -> Self
Creates a client targeting the socket at socket_path.
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
The socket path this client targets.
Sourcepub async fn request(&self, envelope: DaemonEnvelope) -> Result<DaemonReply>
pub async fn request(&self, envelope: DaemonEnvelope) -> Result<DaemonReply>
Sends one envelope and returns the daemon’s reply.
Sourcepub async fn subscribe(
&self,
envelope: DaemonEnvelope,
) -> Result<DaemonSubscription>
pub async fn subscribe( &self, envelope: DaemonEnvelope, ) -> Result<DaemonSubscription>
Opens a streaming subscription: sends envelope once and returns a
handle over which the daemon pushes many replies on the same
connection (an initial snapshot then a fresh one on each change) until the
daemon or the client closes it. Per the control-socket protocol the client
must only read after this — sending any further line is interpreted as an
explicit cancel — so DaemonSubscription exposes reads only.
Sourcepub async fn ping(&self) -> Result<()>
pub async fn ping(&self) -> Result<()>
Probes whether a live daemon is answering on the socket.
Sourcepub async fn version(&self) -> Result<Option<String>>
pub async fn version(&self) -> Result<Option<String>>
Returns the resident daemon’s advertised binary version, or None when it
advertises none (a pre-#1113 daemon whose ping carries no version).
Lets a client warn that it is driving a stale daemon after a binary
upgrade without a separate status round-trip.
Sourcepub async fn status(&self) -> Result<StatusReport>
pub async fn status(&self) -> Result<StatusReport>
Requests aggregated per-service status.
Trait Implementations§
Source§impl Clone for DaemonClient
impl Clone for DaemonClient
Source§fn clone(&self) -> DaemonClient
fn clone(&self) -> DaemonClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more