pub struct FallbackLayer { /* private fields */ }
Expand description
Fallback layer for transparent transport failover. This layer will consume a list of transports to provide better availability and reliability.
The FallbackService
will attempt to make requests to multiple
transports in parallel, and return the first successful response.
If all transports fail, the fallback service will return an error.
§Automatic Transport Ranking
Each transport is automatically ranked based on latency & stability using a weighted algorithm. By default:
- Stability (success rate) is weighted at 70%
- Latency (response time) is weighted at 30%
- The
active_transport_count
parameter controls how many transports are queried at any one time.
Implementations§
Source§impl FallbackLayer
impl FallbackLayer
Sourcepub const fn with_active_transport_count(self, count: NonZeroUsize) -> Self
pub const fn with_active_transport_count(self, count: NonZeroUsize) -> Self
Set the number of active transports to use (must be greater than 0)
Trait Implementations§
Source§impl Clone for FallbackLayer
impl Clone for FallbackLayer
Source§fn clone(&self) -> FallbackLayer
fn clone(&self) -> FallbackLayer
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FallbackLayer
impl Debug for FallbackLayer
Source§impl Default for FallbackLayer
impl Default for FallbackLayer
Source§impl<S> Layer<Vec<S>> for FallbackLayerwhere
S: Service<RequestPacket, Future = TransportFut<'static>, Error = TransportError> + Send + Clone + Debug + 'static,
impl<S> Layer<Vec<S>> for FallbackLayerwhere
S: Service<RequestPacket, Future = TransportFut<'static>, Error = TransportError> + Send + Clone + Debug + 'static,
Auto Trait Implementations§
impl Freeze for FallbackLayer
impl RefUnwindSafe for FallbackLayer
impl Send for FallbackLayer
impl Sync for FallbackLayer
impl Unpin for FallbackLayer
impl UnwindSafe for FallbackLayer
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
Mutably borrows from an owned value. Read more