pub struct WatchClient<S> { /* private fields */ }Expand description
A negotiated lifecycle subscription. A peer without WATCH returns None
during setup so the application may retain discovery polling. An error
after advertising WATCH is terminal; it never triggers a protocol downgrade.
Authenticate the OS peer before connecting and compare snapshot().process_id
with the peer PID the kernel reports for this connection. Agreement checks the
protocol’s claim against transport evidence; it does not authenticate the
executable or any discovery record. Cancelling changed poisons the
underlying framed session; drop it and reconnect rather than continuing from
a partial frame.
Implementations§
Source§impl<S: AsyncRead + AsyncWrite + Unpin> WatchClient<S>
impl<S: AsyncRead + AsyncWrite + Unpin> WatchClient<S>
Sourcepub async fn connect(
stream: S,
offer: &Hello,
deadline: Instant,
) -> Result<Option<Self>>
pub async fn connect( stream: S, offer: &Hello, deadline: Instant, ) -> Result<Option<Self>>
Negotiate, subscribe, and receive the initial snapshot under one deadline.
Sourcepub fn snapshot(&self) -> &LifecycleEvent
pub fn snapshot(&self) -> &LifecycleEvent
Most recently received state, including the initial snapshot.
Sourcepub async fn changed(&mut self) -> Result<&LifecycleEvent>
pub async fn changed(&mut self) -> Result<&LifecycleEvent>
Wait for new state. There is no background polling or idle timeout.