tower_load::peak_ewma

Struct PeakEwmaDiscover

Source
pub struct PeakEwmaDiscover<D, I = NoInstrument> { /* private fields */ }
Expand description

Wraps a D-typed stream of discovery updates with PeakEwma.

Implementations§

Source§

impl<D, I> PeakEwmaDiscover<D, I>

Source

pub fn new<Request>( discover: D, default_rtt: Duration, decay: Duration, instrument: I, ) -> Self
where D: Discover, D::Service: Service<Request>, I: Instrument<Handle, <D::Service as Service<Request>>::Response>,

Wraps a D-typed Discover so that services have a PeakEwma load metric.

The provided default_rtt is used as the default RTT estimate for newly added services.

They decay value determines over what time period a RTT estimate should decay.

Trait Implementations§

Source§

impl<D: Debug, I: Debug> Debug for PeakEwmaDiscover<D, I>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<D, I> Discover for PeakEwmaDiscover<D, I>
where D: Discover, I: Clone,

Source§

type Key = <D as Discover>::Key

NewService key
Source§

type Service = PeakEwma<<D as Discover>::Service, I>

The type of Service yielded by this Discover.
Source§

type Error = <D as Discover>::Error

Error produced during discovery
Source§

fn poll_discover( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Change<D::Key, Self::Service>, D::Error>>

Yields the next discovery change set.
Source§

impl<'pin, D, I> Unpin for PeakEwmaDiscover<D, I>
where __PeakEwmaDiscover<'pin, D, I>: Unpin,

Source§

impl<D, I> UnsafeUnpin for PeakEwmaDiscover<D, I>

Auto Trait Implementations§

§

impl<D, I> Freeze for PeakEwmaDiscover<D, I>
where D: Freeze, I: Freeze,

§

impl<D, I> RefUnwindSafe for PeakEwmaDiscover<D, I>

§

impl<D, I> Send for PeakEwmaDiscover<D, I>
where D: Send, I: Send,

§

impl<D, I> Sync for PeakEwmaDiscover<D, I>
where D: Sync, I: Sync,

§

impl<D, I> UnwindSafe for PeakEwmaDiscover<D, I>
where D: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.