pub struct LinearBackoff {
pub max_attempts: u32,
pub base_delay: Duration,
pub max_delay: Duration,
pub jitter: JitterStrategy,
}Expand description
Linear backoff retry strategy.
Delays increase linearly with each attempt: base_delay * attempt.
§Example
use durable_execution_sdk::config::LinearBackoff;
use durable_execution_sdk::Duration;
// Retry up to 5 times: 2s, 4s, 6s, 8s, 10s
let strategy = LinearBackoff::new(5, Duration::from_seconds(2));Fields§
§max_attempts: u32Maximum number of retry attempts.
base_delay: DurationBase delay that is multiplied by the attempt number.
max_delay: DurationMaximum delay between retries.
jitter: JitterStrategyJitter strategy applied to computed delays.
Implementations§
Source§impl LinearBackoff
impl LinearBackoff
Sourcepub fn new(max_attempts: u32, base_delay: Duration) -> Self
pub fn new(max_attempts: u32, base_delay: Duration) -> Self
Creates a new linear backoff retry strategy.
§Arguments
max_attempts- Maximum number of retry attemptsbase_delay- Base delay multiplied by attempt number
Sourcepub fn with_max_delay(self, max_delay: Duration) -> Self
pub fn with_max_delay(self, max_delay: Duration) -> Self
Sets the maximum delay between retries.
Sourcepub fn with_jitter(self, jitter: JitterStrategy) -> Self
pub fn with_jitter(self, jitter: JitterStrategy) -> Self
Sets the jitter strategy for retry delays.
Trait Implementations§
Source§impl Clone for LinearBackoff
impl Clone for LinearBackoff
Source§fn clone(&self) -> LinearBackoff
fn clone(&self) -> LinearBackoff
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearBackoff
impl Debug for LinearBackoff
Source§impl RetryStrategy for LinearBackoff
impl RetryStrategy for LinearBackoff
Auto Trait Implementations§
impl Freeze for LinearBackoff
impl RefUnwindSafe for LinearBackoff
impl Send for LinearBackoff
impl Sync for LinearBackoff
impl Unpin for LinearBackoff
impl UnsafeUnpin for LinearBackoff
impl UnwindSafe for LinearBackoff
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.