Enum tor_error::retriable::RetryTimeDiscriminants

source ·
enum RetryTimeDiscriminants {
    Immediate,
    AfterWaiting,
    After,
    At,
    Never,
}
Expand description

Auto-generated discriminant enum variants

Variants§

§

Immediate

The operation can be retried immediately, and no delay is needed.

The recipient of this RetryTime variant may retry the operation immediately without waiting.

This case should be used cautiously: it risks making code retry in a loop without delay. It should only be used for error conditions that are necessarily produced via a process that itself introduces a delay. (For example, this case is suitable for errors caused by a remote timeout.)

§

AfterWaiting

The operation can be retried after a short delay, to prevent overloading the network.

The recipient of this RetryTime variant should delay a short amount of time before retrying. The amount of time to delay should be randomized, and should tend to grow larger the more failures there have been recently for the given operation. (The RetryDelay type from tor-basic-utils is suitable for managing this calculation.)

This case should be used for problems that tend to be “self correcting”, such as remote server failures (the server might come back up).

§

After

The operation can be retried after a particular delay.

The recipient of this RetryTime variant should wait for at least the given duration before retrying the operation.

This case should only be used if there is some reason not to return AfterWaiting: for example, if the implementor is providing their own back-off algorithm instead of using RetryDelay.

(This is a separate variant from At, since the constructor may not have convenient access to (a mocked view of) the current time. If you know that the current time is now, then After(d) is equivalent to At(now + d).)

§

At

The operation can be retried at some particular time in the future.

The recipient of this this RetryTime variant should wait until the current time (as returned by Instant::now or SleepProvider::now as appropriate) is at least this given instant.

This case is appropriate for when we have a failure condition caused by waiting for multiple other timeouts. (For example, if we believe that all our guards are down, then we won’t be able to try getting a guard until the next time guard is scheduled to be marked as retriable.)

§

Never

Retrying is unlikely to make this operation succeed, unless something else is fixed first.

The recipient of this RetryTime variant should generally give up, and stop retrying the given operation.

We don’t mean “literally” that the operation will never succeed: only that retrying it in the near future without fixing the underlying cause is unlikely to help.

This case is appropriate for issues like misconfiguration, internal errors, and requests for operations that the network doesn’t support.

This case is also appropriate for a problem that is “technically” retriable, but where any resolution is likelier to take days or weeks instead of minutes or hours.

Trait Implementations§

source§

impl Clone for RetryTimeDiscriminants

source§

fn clone(&self) -> RetryTimeDiscriminants

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RetryTimeDiscriminants

source§

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

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

impl<'_enum> From<&'_enum RetryTime> for RetryTimeDiscriminants

source§

fn from(val: &'_enum RetryTime) -> RetryTimeDiscriminants

Converts to this type from the input type.
source§

impl From<RetryTime> for RetryTimeDiscriminants

source§

fn from(val: RetryTime) -> RetryTimeDiscriminants

Converts to this type from the input type.
source§

impl Ord for RetryTimeDiscriminants

source§

fn cmp(&self, other: &RetryTimeDiscriminants) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for RetryTimeDiscriminants

source§

fn eq(&self, other: &RetryTimeDiscriminants) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for RetryTimeDiscriminants

source§

fn partial_cmp(&self, other: &RetryTimeDiscriminants) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for RetryTimeDiscriminants

source§

impl Eq for RetryTimeDiscriminants

source§

impl StructuralPartialEq for RetryTimeDiscriminants

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more