pub struct RetryTracker {
pub task_id: String,
pub policy: RetryPolicy,
pub history: Vec<AttemptRecord>,
pub exhausted: bool,
pub succeeded: bool,
}Expand description
Tracks the retry state for a single task.
Fields§
§task_id: StringThe task identifier.
policy: RetryPolicyRetry policy in use.
history: Vec<AttemptRecord>History of attempts.
exhausted: boolWhether the task has been exhausted (no more retries).
succeeded: boolWhether the task ultimately succeeded.
Implementations§
Source§impl RetryTracker
impl RetryTracker
Sourcepub fn new(task_id: &str, policy: RetryPolicy) -> Self
pub fn new(task_id: &str, policy: RetryPolicy) -> Self
Create a new retry tracker for a task.
Sourcepub fn record_attempt(
&mut self,
outcome: AttemptOutcome,
duration_ms: u64,
) -> RetryDecision
pub fn record_attempt( &mut self, outcome: AttemptOutcome, duration_ms: u64, ) -> RetryDecision
Record an attempt and determine the next action.
Sourcepub fn attempt_count(&self) -> usize
pub fn attempt_count(&self) -> usize
Number of attempts made.
Sourcepub fn total_attempt_duration_ms(&self) -> u64
pub fn total_attempt_duration_ms(&self) -> u64
Total duration across all attempts (excluding delays).
Sourcepub fn total_delay_ms(&self) -> u64
pub fn total_delay_ms(&self) -> u64
Total delay time waited across all attempts.
Trait Implementations§
Source§impl Clone for RetryTracker
impl Clone for RetryTracker
Source§fn clone(&self) -> RetryTracker
fn clone(&self) -> RetryTracker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RetryTracker
impl RefUnwindSafe for RetryTracker
impl Send for RetryTracker
impl Sync for RetryTracker
impl Unpin for RetryTracker
impl UnsafeUnpin for RetryTracker
impl UnwindSafe for RetryTracker
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request