pub struct Budget { /* private fields */ }retry only.Expand description
Represents a “budget” for retrying requests.
This is useful for limiting the amount of retries a service can perform over a period of time, or per a certain number of requests attempted.
Implementations§
source§impl Budget
impl Budget
sourcepub fn new(ttl: Duration, min_per_sec: u32, retry_percent: f32) -> Self
pub fn new(ttl: Duration, min_per_sec: u32, retry_percent: f32) -> Self
Create a Budget that allows for a certain percent of the total
requests to be retried.
-
The
ttlis the duration of how long a singledepositshould be considered. Must be between 1 and 60 seconds. -
The
min_per_secis the minimum rate of retries allowed to accomodate clients that have just started issuing requests, or clients that do not issue many requests per window. -
The
retry_percentis the percentage of calls todepositthat can be retried. This is in addition to any retries allowed for viamin_per_sec. Must be between 0 and 1000.As an example, if
0.1is used, then for every 10 calls todeposit, 1 retry will be allowed. If2.0is used, then everydepositallows for 2 retries.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnwindSafe for Budget
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 96 bytes