pub struct BackendTracker { /* private fields */ }parallel_backends only.Expand description
Tracks per-backend performance across a crawl session.
Fully lock-free — uses atomics only. Index 0 is the primary backend, 1..N are the alternatives in the order they appear in the config.
Implementations§
Source§impl BackendTracker
impl BackendTracker
Sourcepub fn new(count: usize, max_consecutive_errors: u16) -> Self
pub fn new(count: usize, max_consecutive_errors: u16) -> Self
Create a new tracker for count backends (primary + alternatives).
Sourcepub fn record_win(&self, idx: usize)
pub fn record_win(&self, idx: usize)
Record a win for backend at idx.
Sourcepub fn record_race(&self, idx: usize)
pub fn record_race(&self, idx: usize)
Record that backend idx participated in a race.
Sourcepub fn record_duration(&self, idx: usize, dur: Duration)
pub fn record_duration(&self, idx: usize, dur: Duration)
Record a fetch duration for backend idx (EMA with alpha ~0.2).
Sourcepub fn record_error(&self, idx: usize)
pub fn record_error(&self, idx: usize)
Record a retryable error for backend idx.
The first request to each backend acts as a probe: if the backend
has never succeeded (zero prior successes / zero wins), the first
error disables it immediately so a down backend is never retried.
After at least one success, the normal max_consecutive_errors
threshold applies.
Sourcepub fn record_success(&self, idx: usize)
pub fn record_success(&self, idx: usize)
Record a successful fetch — resets the consecutive error counter.
Sourcepub fn is_disabled(&self, idx: usize) -> bool
pub fn is_disabled(&self, idx: usize) -> bool
Check whether backend idx has been auto-disabled.
Sourcepub fn consecutive_errors(&self, idx: usize) -> u64
pub fn consecutive_errors(&self, idx: usize) -> u64
Get the consecutive error count for backend idx.
Sourcepub fn win_rate_pct(&self, idx: usize) -> u64
pub fn win_rate_pct(&self, idx: usize) -> u64
Win rate percentage (0–100) for backend idx. Returns 0 if no races.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BackendTracker
impl RefUnwindSafe for BackendTracker
impl Send for BackendTracker
impl Sync for BackendTracker
impl Unpin for BackendTracker
impl UnsafeUnpin for BackendTracker
impl UnwindSafe for BackendTracker
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
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>
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>
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