Skip to main content

Queue

Trait Queue 

Source
pub trait Queue {
    // Required method
    fn close(
        &mut self,
        unit: &Unit,
        evidence: &Evidence,
    ) -> Result<CloseOutcome, LoopError>;

    // Provided methods
    fn next(&mut self) -> Result<Option<Unit>, LoopError> { ... }
    fn next_step(&mut self) -> Result<NextStep, LoopError> { ... }
}
Expand description

Source of work units. Each call to next either returns the next unit to dispatch or None to signal that the walk is complete.

§Why &mut self (F8 rationale)

Group-2 megawalk Queue carries real cursor state (current position in the backlog, consecutive-failure counters, etc.). Using &self would force pointless Mutex-wrapping for state that is inherently sequential in the single-threaded walk loop. No threading requirement exists at this seam: run_loop is always called from a single thread. &mut self is the natural fit and avoids unnecessary interior-mutability noise.

Required Methods§

Source

fn close( &mut self, unit: &Unit, evidence: &Evidence, ) -> Result<CloseOutcome, LoopError>

Mark a unit as closed (done/parked/refused) given the termination evidence extracted from the journal.

Provided Methods§

Source

fn next(&mut self) -> Result<Option<Unit>, LoopError>

Return the next unit, or None if the queue is empty.

Queues that implement walk policy (e.g. MegawalkPolicyQueue) should use next_step() instead. This default impl calls next_step() and maps Dispatch->Some, Drained->None, Pause->Err(LoopError::Pause{..}).

Source

fn next_step(&mut self) -> Result<NextStep, LoopError>

Richer variant of next() that can signal a walk-level pause. Policy-aware queues override this; simple queues (TargetQueue) can leave the default which panics (they override next() directly instead).

The default panics to make missing overrides detectable at test time.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§