Struct Hedge

struct Hedge<S, P>(_)

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>

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

Create a new hedge middleware.

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: tower_service::Service<Request> + Clone,
    <S as >::Error: Into<crate::BoxError>,
    P: Policy<Request> + Clone

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

impl<M, S, Target, Request> MakeService for Hedge<S, P>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future

impl<S, P> Freeze for Hedge<S, P>

impl<S, P> RefUnwindSafe for Hedge<S, P>

impl<S, P> Send for Hedge<S, P>

impl<S, P> Sync for Hedge<S, P>

impl<S, P> Unpin for Hedge<S, P>

impl<S, P> UnwindSafe for Hedge<S, P>

impl<S, P, Request> Service for Hedge<S, P>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn call(self: &mut Self, request: Request) -> <Self as >::Future

impl<S: $crate::fmt::Debug, P: $crate::fmt::Debug> Debug for Hedge<S, P>

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl<T> Any for Hedge<S, P>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Hedge<S, P>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Hedge<S, P>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Hedge<S, P>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Hedge<S, P>

impl<T> WithSubscriber for Hedge<S, P>

impl<T, Request> ServiceExt for Hedge<S, P>

impl<T, U> Into for Hedge<S, P>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Hedge<S, P>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Hedge<S, P>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>