Skip to main content

Module resilient

Module resilient 

Source
Expand description

ResilientClient — an async-native HTTP transport.

One client per remote API. Concurrency is bounded by a semaphore; retry, auth refresh, a rate limit and a circuit breaker are inline middleware. Cancellation is structural: drop the future and the in-flight request goes with it.

The pieces live in one file each: builder assembles a client, attempt runs one call’s attempt loop, breaker is the circuit breaker, rate the token bucket, policy the retry knobs, and auth, error and observer the types those exchange.

Structs§

CallPolicy
The policy for one call.
ClientError
ResilientClient
A cheap-to-clone resilient HTTP client. Build via ResilientClient::builder.
ResilientClientBuilder
Builder for ResilientClient.
RetryPolicy
Bounded retry: exponential from base_backoff (doubling per attempt), capped at max_backoff, with jitter added before each sleep.

Enums§

BreakerMode
What an attempt does while the circuit breaker is open.
BreakerState
What a ResilientClient’s breaker is doing right now, for consumers that poll instead of tracking TransportEvents.
ErrorKind
RetryMode
How many times, and how long apart, a failed attempt is repeated.
TransportEvent

Traits§

TransportObserver

Type Aliases§

AuthFuture
Future returned by the auth token refresher.
AuthRefresher
Acquire (or re-acquire) an auth token — called lazily and on 401.