[][src]Struct tower::hedge::Hedge

pub struct Hedge<S, P>(_);
This is supported on crate feature hedge only.

A middleware that pre-emptively retries requests which have been outstanding for longer than a given latency percentile. If either of the original future or the retry future completes, that value is used.

Implementations

impl<S, P> Hedge<S, P>[src]

pub fn new<Request>(
    service: S,
    policy: P,
    min_data_points: u64,
    latency_percentile: f32,
    period: Duration
) -> Hedge<S, P> where
    S: Service<Request> + Clone,
    S::Error: Into<BoxError>,
    P: Policy<Request> + Clone
[src]

Create a new hedge middleware.

pub fn new_with_mock_latencies<Request>(
    service: S,
    policy: P,
    min_data_points: u64,
    latency_percentile: f32,
    period: Duration,
    latencies_ms: &[u64]
) -> Hedge<S, P> where
    S: Service<Request> + Clone,
    S::Error: Into<BoxError>,
    P: Policy<Request> + Clone
[src]

A hedge middleware with a prepopulated latency histogram. This is usedful for integration tests.

Trait Implementations

impl<S: Debug, P: Debug> Debug for Hedge<S, P>[src]

impl<S, P, Request> Service<Request> for Hedge<S, P> where
    S: Service<Request> + Clone,
    S::Error: Into<BoxError>,
    P: Policy<Request> + Clone
[src]

type Response = S::Response

Responses given by the service.

type Error = BoxError

Errors produced by the service.

type Future = Future<Select<SelectPolicy<P>, Latency<Arc<Mutex<RotatingHistogram>>, S>, Delay<DelayPolicy, AsyncFilter<Latency<Arc<Mutex<RotatingHistogram>>, S>, PolicyPredicate<P>>>>, Request>

The future response value.

Auto Trait Implementations

impl<S, P> RefUnwindSafe for Hedge<S, P> where
    P: RefUnwindSafe,
    S: RefUnwindSafe
[src]

impl<S, P> Send for Hedge<S, P> where
    P: Send,
    S: Send
[src]

impl<S, P> Sync for Hedge<S, P> where
    P: Sync,
    S: Sync
[src]

impl<S, P> Unpin for Hedge<S, P> where
    P: Unpin,
    S: Unpin
[src]

impl<S, P> UnwindSafe for Hedge<S, P> where
    P: UnwindSafe,
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Request> ServiceExt<Request> for T where
    T: Service<Request> + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,