pub struct C2ReconnectingHandle { /* private fields */ }Expand description
Swappable, never-closing counterpart to C2ControlHandle. Every
accessor clones or reads out of a watch cell a background supervisor
mutates on reconnect; no caller ever holds a handle bound to one
specific physical connection, so a relay restart never permanently
breaks it.
Implementations§
Source§impl C2ReconnectingHandle
impl C2ReconnectingHandle
Sourcepub fn link_state(&self) -> C2LinkState
pub fn link_state(&self) -> C2LinkState
Whether the underlying physical connection is live right now.
Sourcepub fn link_state_receiver(&self) -> Receiver<C2LinkState>
pub fn link_state_receiver(&self) -> Receiver<C2LinkState>
A fresh receiver over the same link-state cell, for a caller that wants to await transitions rather than poll.
pub fn current_topology(&self) -> Arc<C2Topology> ⓘ
pub fn subscribe_topology(&self) -> Receiver<Arc<C2Topology>>
Sourcepub async fn browser_command(
&self,
cmd: BrowserClientCommand,
) -> Result<(), C2ControlError>
pub async fn browser_command( &self, cmd: BrowserClientCommand, ) -> Result<(), C2ControlError>
Validates and synchronously enqueues one typed request against
whichever physical connection is live right now. Returns
Err(C2ControlError::Closed) immediately – never blocks or
waits for a reconnect – while the link is down.
pub fn start_request( &self, route: NodeRoute, request: NodeRequest, ) -> Result<C2PendingRequest, C2ControlError>
pub async fn request( &self, route: NodeRoute, request: NodeRequest, ) -> Result<RoutedNodeResponse, C2ControlError>
pub async fn request_with_correlation( &self, route: NodeRoute, request: NodeRequest, correlation_id: Option<String>, ) -> Result<RoutedNodeResponse, C2ControlError>
Sourcepub async fn request_until(
&self,
route: NodeRoute,
request: NodeRequest,
budget: Duration,
) -> Result<RoutedNodeResponse, C2ControlError>
pub async fn request_until( &self, route: NodeRoute, request: NodeRequest, budget: Duration, ) -> Result<RoutedNodeResponse, C2ControlError>
Self::request, but for a caller willing to wait out a physical
reconnect: on Err(C2ControlError::ConnectionLost { .. }) or
Err(C2ControlError::Closed) for a request
NodeRequest::is_replay_safe admits, awaits the link-state watch
(Self::link_state_receiver) turning C2LinkState::Connected
again – bounded by whatever of budget is left – then resends,
up to [REQUEST_UNTIL_MAX_ATTEMPTS] physical attempts total for
this one logical call. A request is_replay_safe refuses, or any
failure other than those two, returns on the very first attempt
exactly like request does – this method changes nothing about
request’s own behaviour or about control_owner’s pending-request
failure handling; the retry lives here, one layer up.
budget == Duration::ZERO degenerates to exactly one attempt (the
first elapsed-budget check trips before any wait), so a caller that
wants request’s existing all-or-nothing semantics can pass that
instead of calling request directly.