pub struct FailureTracker { /* private fields */ }Expand description
Tracks persistently-failing items so they don’t permanently consume
batch slots. After [FAILURE_THRESHOLD] consecutive failures for the
same key, the item is skipped for [BACKOFF_CYCLES] scan cycles.
Implementations§
Source§impl FailureTracker
impl FailureTracker
pub fn new() -> Self
Sourcepub fn advance_cycle(&self)
pub fn advance_cycle(&self)
Call once per full scan cycle (e.g., when partition == 0).
Sourcepub fn should_skip(&self, key: &str) -> bool
pub fn should_skip(&self, key: &str) -> bool
Returns true if this item should be skipped (in backoff). Also resets the entry when backoff expires, giving it another chance.
Sourcepub fn record_failure(&self, key: &str, scanner_name: &str)
pub fn record_failure(&self, key: &str, scanner_name: &str)
Record a failure. After [FAILURE_THRESHOLD] consecutive failures,
logs an error and puts the item into backoff.
Sourcepub fn record_success(&self, key: &str)
pub fn record_success(&self, key: &str)
Record a success — clears any tracked failure state.
Trait Implementations§
Source§impl Default for FailureTracker
impl Default for FailureTracker
Source§fn default() -> FailureTracker
fn default() -> FailureTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for FailureTracker
impl RefUnwindSafe for FailureTracker
impl Send for FailureTracker
impl Sync for FailureTracker
impl Unpin for FailureTracker
impl UnsafeUnpin for FailureTracker
impl UnwindSafe for FailureTracker
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> 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 more