pub struct Barrier { /* private fields */ }Expand description
A rendezvous barrier holding flights until its condition is met.
Implementations§
Source§impl Barrier
impl Barrier
Sourcepub fn from_spec(spec: &JoinSpec) -> Self
pub fn from_spec(spec: &JoinSpec) -> Self
Creates a barrier from a route’s rendezvous condition.
Sourcepub fn deliver(&mut self, flight: Flight) -> Delivery
pub fn deliver(&mut self, flight: Flight) -> Delivery
Delivers a flight to the barrier.
A flight from a sender the barrier does not name is returned as Delivery::Direct and
leaves parked state untouched, so an agent behind a join can still be triggered by a human
or by an unjoined peer.
A second delivery from an upstream that has already reported starts a new dispatch wave: partial state is discarded and every upstream must deliver again. This is what stops a stale verdict from before a failure loop-back being combined with a fresh one, and it is also what lets a loop re-run: the barrier is reusable, but only deliberately.
Within one wave the agent is woken at most once. An upstream arriving after an any
barrier has fired is Delivery::Late.
Sourcepub fn has_released(&self) -> bool
pub fn has_released(&self) -> bool
Returns true when this wave has already woken the agent.
Sourcepub fn waiting_for(&self) -> Vec<AgentName>
pub fn waiting_for(&self) -> Vec<AgentName>
Upstreams that have not yet delivered.
Sourcepub fn is_reachable(
&self,
graph: &RouteGraph,
live: &BTreeSet<AgentName>,
) -> bool
pub fn is_reachable( &self, graph: &RouteGraph, live: &BTreeSet<AgentName>, ) -> bool
Returns true if any live run could still satisfy this barrier.
When this is false the barrier is dead: no process remains that could deliver the
missing upstreams, so the itinerary should be marked stalled rather than left parked.
Sourcepub fn parked_count(&self) -> usize
pub fn parked_count(&self) -> usize
Number of upstreams currently parked.