pub struct LaneRetryBudget { /* private fields */ }Expand description
One server lane’s shared retry budget (networking doc, Retry Policy Classes: “each server lane holds one shared retry budget”).
Every retry any item on the lane takes spends one token; successes earn tokens back, one per
LANE_SUCCESSES_PER_RETRY, never above the capacity. A server that fails every request
therefore costs at most capacity retries in total, however many items are queued for it,
rather than one full retry ladder per item. A pure value; LaneRetries shares one.
Implementations§
Source§impl LaneRetryBudget
impl LaneRetryBudget
Sourcepub const fn new(capacity: u32) -> Self
pub const fn new(capacity: u32) -> Self
A full budget of capacity retries. Zero is a lane that never retries.
Sourcepub fn try_spend(&mut self) -> bool
pub fn try_spend(&mut self) -> bool
Spend one retry. false means the budget is spent: the caller must not retry, and gives
the item up as the failure it is.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Record one request that succeeded, earning a retry back every
LANE_SUCCESSES_PER_RETRY successes.
Trait Implementations§
Source§impl Clone for LaneRetryBudget
impl Clone for LaneRetryBudget
Source§fn clone(&self) -> LaneRetryBudget
fn clone(&self) -> LaneRetryBudget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LaneRetryBudget
Source§impl Debug for LaneRetryBudget
impl Debug for LaneRetryBudget
Source§impl Default for LaneRetryBudget
impl Default for LaneRetryBudget
impl Eq for LaneRetryBudget
Source§impl PartialEq for LaneRetryBudget
impl PartialEq for LaneRetryBudget
Source§fn eq(&self, other: &LaneRetryBudget) -> bool
fn eq(&self, other: &LaneRetryBudget) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LaneRetryBudget
Auto Trait Implementations§
impl Freeze for LaneRetryBudget
impl RefUnwindSafe for LaneRetryBudget
impl Send for LaneRetryBudget
impl Sync for LaneRetryBudget
impl Unpin for LaneRetryBudget
impl UnsafeUnpin for LaneRetryBudget
impl UnwindSafe for LaneRetryBudget
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more