Skip to main content

ReplicationQueues

Struct ReplicationQueues 

Source
pub struct ReplicationQueues { /* private fields */ }
Expand description

Central queue manager for the replication pipeline.

Maintains three stages of the pipeline with global dedup:

  1. PendingVerify – keys awaiting quorum verification.
  2. FetchQueue – quorum-passed keys waiting for a fetch slot.
  3. InFlightFetch – keys actively being downloaded.

Implementations§

Source§

impl ReplicationQueues

Source

pub fn new() -> Self

Create new empty queues.

Source

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).

Source

pub fn get_pending(&self, key: &XorName) -> Option<&VerificationEntry>

Get a reference to a pending verification entry.

Source

pub fn get_pending_mut( &mut self, key: &XorName, ) -> Option<&mut VerificationEntry>

Get a mutable reference to a pending verification entry.

Source

pub fn remove_pending(&mut self, key: &XorName) -> Option<VerificationEntry>

Remove a key from pending verification.

Source

pub fn pending_keys(&self) -> Vec<XorName>

Collect all pending verification keys (for batch processing).

Source

pub fn pending_count(&self) -> usize

Number of keys in pending verification.

Source

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).

Source

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.

Source

pub fn fetch_queue_count(&self) -> usize

Number of keys waiting in the fetch queue.

Source

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).

Source

pub fn complete_fetch(&mut self, key: &XorName) -> Option<InFlightEntry>

Mark a fetch as completed (success or permanent failure).

Source

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.

Source

pub fn in_flight_count(&self) -> usize

Number of in-flight fetches.

Source

pub fn contains_key(&self, key: &XorName) -> bool

Check if a key is present in any pipeline stage.

Source

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.

Source

pub fn evict_stale(&mut self, max_age: Duration)

Evict stale pending-verification entries older than max_age.

Trait Implementations§

Source§

impl Default for ReplicationQueues

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more