pub struct ArticleAvailability { /* private fields */ }Expand description
Track which backends are known not to have a specific article.
Uses a usize bitset to track which backends returned authoritative 430.
§Example with 2 backends
- Initial state:
missing=00(no backend is known missing) - After backend 0 returns 430:
missing=01(backend 0 doesn’t have it) - If both return 430:
missing=11(all backends exhausted)
§Usage Pattern
This type serves two critical purposes:
-
Cache persistence - Track availability across requests (long-lived)
- Store authoritative negative facts in cache entries
- Avoid querying backends known to be missing
- Updated only after 430 responses
-
430 retry loop - Track which backends tried during single request (transient)
- Create fresh instance for each ARTICLE request
- Mark backends as missing when they return 430
- Stop when all backends exhausted or one succeeds
§Concurrency
Cache entries store this value directly. Memory-cache updates use atomic per-key merge operations, and hybrid-cache updates use per-key locks before replacing an entry. Request-local retry state owns a separate copy, then records each 430 fact directly to the cache.
Implementations§
Source§impl ArticleAvailability
impl ArticleAvailability
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create empty availability - assume all backends have article until proven otherwise
Sourcepub fn record_missing(&mut self, backend_id: BackendId) -> &mut Self
pub fn record_missing(&mut self, backend_id: BackendId) -> &mut Self
Record that a backend returned 430 (doesn’t have the article).
Once marked missing, the backend should not be retried for this cache entry. Later positive observations do not clear the missing bit.
Sourcepub fn is_missing(&self, backend_id: BackendId) -> bool
pub fn is_missing(&self, backend_id: BackendId) -> bool
Check if a backend is known to be missing (returned 430)
Sourcepub const fn missing_bits(&self) -> usize
pub const fn missing_bits(&self) -> usize
Get the raw missing bitset for debugging
Sourcepub fn all_exhausted(&self, backend_count: BackendCount) -> bool
pub fn all_exhausted(&self, backend_count: BackendCount) -> bool
Check if all backends in the pool have been tried and returned 430
Check if all backends have been tried and returned 430
Sourcepub const fn has_availability_info(&self) -> bool
pub const fn has_availability_info(&self) -> bool
Check if we have any authoritative backend-missing information.
Returns true if at least one backend is known missing.
Sourcepub fn status(&self, backend_id: BackendId) -> BackendStatus
pub fn status(&self, backend_id: BackendId) -> BackendStatus
Query backend availability status
Trait Implementations§
Source§impl Clone for ArticleAvailability
impl Clone for ArticleAvailability
Source§fn clone(&self) -> ArticleAvailability
fn clone(&self) -> ArticleAvailability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ArticleAvailability
Source§impl Debug for ArticleAvailability
impl Debug for ArticleAvailability
Source§impl Default for ArticleAvailability
impl Default for ArticleAvailability
impl Eq for ArticleAvailability
Source§impl PartialEq for ArticleAvailability
impl PartialEq for ArticleAvailability
impl StructuralPartialEq for ArticleAvailability
Auto Trait Implementations§
impl Freeze for ArticleAvailability
impl RefUnwindSafe for ArticleAvailability
impl Send for ArticleAvailability
impl Sync for ArticleAvailability
impl Unpin for ArticleAvailability
impl UnsafeUnpin for ArticleAvailability
impl UnwindSafe for ArticleAvailability
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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