Skip to main content

RetryController

Struct RetryController 

Source
pub struct RetryController<'request, 'binding> { /* private fields */ }
Expand description

Non-cloneable owner of one request’s retry state and idempotency intent.

use cloud_sdk::retry::RetryController;

fn duplicate(owner: RetryController<'_, '_>) {
    let _second = owner.clone();
}

Implementations§

Source§

impl<'request, 'binding> RetryController<'request, 'binding>

Source

pub fn new( subject: RetrySubject<'request, 'binding>, idempotency: Option<IdempotencyBinding<'binding>>, policy: RetryPolicy, started: MonotonicInstant, ) -> Result<Self, RetryPolicyError>

Creates the sole retry owner for one initial request attempt.

The moved intent is bound to the initial fingerprint. Mutating requests with more than one admitted attempt require a fresh intent.

Source

pub const fn attempts(&self) -> u16

Returns attempts already consumed, including the initial attempt.

Source

pub const fn cumulative_delay(&self) -> MonotonicDuration

Returns caller-requested delay already charged to this owner.

Source

pub fn decide_retry<'controller, 'replay, 'subject>( &'controller mut self, event: RetryEvent, replay: RetrySubject<'replay, 'subject>, delay: MonotonicDuration, now: MonotonicInstant, ) -> Result<RetryDecision<'controller, 'replay, 'subject>, RetryPolicyError>

Decides whether one exact replay may execute.

delay includes caller-selected backoff and jitter. This function does not read clocks, sleep, execute transport, or classify provider errors.

Trait Implementations§

Source§

impl Debug for RetryController<'_, '_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'request, 'binding> !UnwindSafe for RetryController<'request, 'binding>

§

impl<'request, 'binding> Freeze for RetryController<'request, 'binding>

§

impl<'request, 'binding> RefUnwindSafe for RetryController<'request, 'binding>

§

impl<'request, 'binding> Send for RetryController<'request, 'binding>

§

impl<'request, 'binding> Sync for RetryController<'request, 'binding>

§

impl<'request, 'binding> Unpin for RetryController<'request, 'binding>

§

impl<'request, 'binding> UnsafeUnpin for RetryController<'request, 'binding>

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.