pub struct ReplicationQueues { /* private fields */ }Expand description
Central queue manager for the replication pipeline.
Maintains three stages of the pipeline with global dedup:
PendingVerify– keys awaiting quorum verification.FetchQueue– quorum-passed keys waiting for a fetch slot.InFlightFetch– keys actively being downloaded.
Implementations§
Source§impl ReplicationQueues
impl ReplicationQueues
Sourcepub fn add_pending_verify(
&mut self,
key: XorName,
entry: VerificationEntry,
) -> bool
pub fn add_pending_verify( &mut self, key: XorName, entry: VerificationEntry, ) -> bool
Add a key to pending verification if not already present in any queue.
Returns true if the key was newly added (Rule 8: cross-queue dedup).
Sourcepub fn get_pending(&self, key: &XorName) -> Option<&VerificationEntry>
pub fn get_pending(&self, key: &XorName) -> Option<&VerificationEntry>
Get a reference to a pending verification entry.
Sourcepub fn get_pending_mut(
&mut self,
key: &XorName,
) -> Option<&mut VerificationEntry>
pub fn get_pending_mut( &mut self, key: &XorName, ) -> Option<&mut VerificationEntry>
Get a mutable reference to a pending verification entry.
Sourcepub fn remove_pending(&mut self, key: &XorName) -> Option<VerificationEntry>
pub fn remove_pending(&mut self, key: &XorName) -> Option<VerificationEntry>
Remove a key from pending verification.
Sourcepub fn pending_keys(&self) -> Vec<XorName> ⓘ
pub fn pending_keys(&self) -> Vec<XorName> ⓘ
Collect all pending verification keys (for batch processing).
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of keys in pending verification.
Sourcepub fn enqueue_fetch(
&mut self,
key: XorName,
distance: XorName,
sources: Vec<PeerId>,
)
pub fn enqueue_fetch( &mut self, key: XorName, distance: XorName, sources: Vec<PeerId>, )
Enqueue a key for fetch with its distance and verified sources.
No-op if the key is already in any pipeline stage (Rule 8: cross-queue dedup).
Sourcepub fn dequeue_fetch(&mut self) -> Option<FetchCandidate>
pub fn dequeue_fetch(&mut self) -> Option<FetchCandidate>
Dequeue the nearest fetch candidate.
Returns None when the queue is empty. Silently skips candidates
that are somehow already in-flight. Concurrency is enforced by the
fetch worker, not by this method.
Sourcepub fn fetch_queue_count(&self) -> usize
pub fn fetch_queue_count(&self) -> usize
Number of keys waiting in the fetch queue.
Sourcepub fn start_fetch(
&mut self,
key: XorName,
source: PeerId,
all_sources: Vec<PeerId>,
)
pub fn start_fetch( &mut self, key: XorName, source: PeerId, all_sources: Vec<PeerId>, )
Mark a key as in-flight (actively being fetched from source).
Sourcepub fn complete_fetch(&mut self, key: &XorName) -> Option<InFlightEntry>
pub fn complete_fetch(&mut self, key: &XorName) -> Option<InFlightEntry>
Mark a fetch as completed (success or permanent failure).
Sourcepub fn retry_fetch(&mut self, key: &XorName) -> Option<PeerId>
pub fn retry_fetch(&mut self, key: &XorName) -> Option<PeerId>
Mark the current fetch attempt as failed and try the next untried source.
Returns the next source peer if one is available, or None if all
sources have been exhausted.
Sourcepub fn in_flight_count(&self) -> usize
pub fn in_flight_count(&self) -> usize
Number of in-flight fetches.
Sourcepub fn contains_key(&self, key: &XorName) -> bool
pub fn contains_key(&self, key: &XorName) -> bool
Check if a key is present in any pipeline stage.
Sourcepub fn is_bootstrap_work_empty(&self, bootstrap_keys: &HashSet<XorName>) -> bool
pub fn is_bootstrap_work_empty(&self, bootstrap_keys: &HashSet<XorName>) -> bool
Check if all bootstrap-related work is done.
Returns true when none of the given bootstrap keys remain in any queue.
Sourcepub fn evict_stale(&mut self, max_age: Duration)
pub fn evict_stale(&mut self, max_age: Duration)
Evict stale pending-verification entries older than max_age.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplicationQueues
impl RefUnwindSafe for ReplicationQueues
impl Send for ReplicationQueues
impl Sync for ReplicationQueues
impl Unpin for ReplicationQueues
impl UnsafeUnpin for ReplicationQueues
impl UnwindSafe for ReplicationQueues
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> 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