Skip to main content

RouteGraph

Struct RouteGraph 

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

The route map, indexed for traversal.

Implementations§

Source§

impl RouteGraph

Source

pub fn from_config(config: &Config) -> Self

Builds a graph from a factory definition.

Routes that name several senders and several receivers expand to the full cross product, which is what makes from = ["a", "b"] with to = "c" a rendezvous and from = "a" with to = ["b", "c"] a fan-out.

Source

pub fn is_spawn(&self, from: &AgentName, to: &AgentName) -> bool

Returns true when this edge opens a new itinerary rather than continuing one.

Source

pub fn permits(&self, from: &AgentName, to: &AgentName) -> bool

Returns true if from is permitted to send to to.

Source

pub fn successors(&self, from: &AgentName) -> impl Iterator<Item = &AgentName>

Returns the agents from may send to.

Source

pub fn spawn_targets(&self) -> impl Iterator<Item = &AgentName>

Every agent reached by a spawn edge.

These begin chains of their own, so for any question about hop depth they are entry points rather than destinations.

Source

pub fn workflow_from(&self, entry: &AgentName) -> BTreeSet<AgentName>

Every agent belonging to the workflow that starts at entry.

Unlike RouteGraph::reachable_from this does cross spawn edges. The two questions are different: reachability asks what could still deliver into this itinerary, and a spawned chain never can. Workflow membership asks what this way in sets in motion, and a reviewer spawned by a sweep is unarguably part of the sweep.

Agents shared between workflows appear in both, which is the honest answer — the developer really is in the triage pipeline and the follow-up pipeline.

Source

pub fn spawn_edges(&self) -> impl Iterator<Item = (&AgentName, &AgentName)>

Every spawn edge, as a sender/receiver pair.

Source

pub fn join_for(&self, agent: &AgentName) -> Option<&JoinSpec>

Returns the rendezvous condition guarding agent, if any.

Source

pub fn reachable_from<'a>( &self, sources: impl IntoIterator<Item = &'a AgentName>, ) -> BTreeSet<AgentName>

Returns every agent reachable from sources, including the sources themselves.

Hops are deliberately ignored, which makes the answer conservative: an agent that Hops would actually prevent from being reached is still reported as reachable. A barrier is therefore never abandoned prematurely, and timeout_sec remains the backstop.

Source

pub fn distances_from<'a>( &self, sources: impl IntoIterator<Item = &'a AgentName>, ) -> BTreeMap<AgentName, u32>

Returns every agent reachable from sources, each with its distance in edges.

The sources sit at distance zero. An agent at distance d is therefore woken by flight d + 1 of a chain that began at a source, which is what makes the figure directly comparable against max_hops — see crate::validate.

Shortest paths are an optimistic bound. A factory whose agents loop will spend far more hops than the distance suggests, so this proves an agent can be reached, never that a particular itinerary will get there.

Trait Implementations§

Source§

impl Clone for RouteGraph

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RouteGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RouteGraph

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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