pub struct OverlaydClient { /* private fields */ }Expand description
A connected overlayd client.
Implementations§
Source§impl OverlaydClient
impl OverlaydClient
Sourcepub async fn connect_with_backoff(endpoint: &Path) -> Result<Self>
pub async fn connect_with_backoff(endpoint: &Path) -> Result<Self>
Connect with exponential backoff (100ms → 1s, ~20 attempts) so the main daemon can start before overlayd has finished binding its socket.
Use this on the path that has just spawned overlayd and legitimately
needs to wait for it to bind (the supervisor). On hot paths where a dead
overlayd must degrade fast (overlay setup is non-fatal), prefer
Self::connect_with_attempts with a small budget so daemon startup is
not held hostage by an unreachable overlayd.
§Errors
Returns the last connect error if every attempt fails.
Sourcepub async fn connect_with_attempts(
endpoint: &Path,
max_attempts: u32,
) -> Result<Self>
pub async fn connect_with_attempts( endpoint: &Path, max_attempts: u32, ) -> Result<Self>
Connect with bounded exponential backoff (100ms → 1s) for at most
max_attempts attempts. Sleeps only between attempts (never after the
final one), so the worst-case wall time for a dead endpoint is bounded
and predictable: max_attempts = 6 ≈ 100+200+400+800+1000 = ~2.5s.
§Errors
Returns the last connect error if every attempt fails.
Sourcepub async fn request(
&mut self,
request: OverlaydRequest,
) -> Result<OverlaydResponse>
pub async fn request( &mut self, request: OverlaydRequest, ) -> Result<OverlaydResponse>
Send a request and await its matching response. Event frames that arrive while waiting are logged and skipped (a request/response client does not subscribe to events).
§Errors
Propagates transport errors. The returned OverlaydResponse may itself
be OverlaydResponse::Err; use Self::call to fold that into an
error.
Sourcepub async fn call(
&mut self,
request: OverlaydRequest,
) -> Result<OverlaydResponse>
pub async fn call( &mut self, request: OverlaydRequest, ) -> Result<OverlaydResponse>
Like Self::request but maps an Err response into
OverlaydError::Overlay, so callers get a single Result.
§Errors
Transport errors, or OverlaydError::Overlay if overlayd returned an
error response.
Auto Trait Implementations§
impl !Freeze for OverlaydClient
impl RefUnwindSafe for OverlaydClient
impl Send for OverlaydClient
impl Sync for OverlaydClient
impl Unpin for OverlaydClient
impl UnsafeUnpin for OverlaydClient
impl UnwindSafe for OverlaydClient
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
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>
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>
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