Skip to main content

BlockingGraph

Struct BlockingGraph 

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

A blocking/relates dependency graph materialized from CRDT item states.

Constructed from a snapshot of WorkItemState values keyed by item ID. The graph is immutable once built — call BlockingGraph::from_states again if states change.

§Scheduling Semantics

An item is blocked if its blocked_by OR-Set is non-empty (at least one blocking link is present). Blocked items are excluded from “ready” work.

An item is ready if it is not blocked (its blocked_by OR-Set is empty).

§Relates Semantics

Relates links are informational only. They do not affect the blocked/ready computation.

Implementations§

Source§

impl BlockingGraph

Source

pub fn from_states(states: &HashMap<String, WorkItemState>) -> Self

Build a BlockingGraph from a map of item states.

Iterates every state and extracts blocked_by and related_to OR-Set values. Deleted items are included — callers may filter them with WorkItemState::is_deleted before passing states to this function.

§Complexity

O(N * L) where N is the number of items and L is the average number of links per item.

Source

pub fn is_blocked(&self, item_id: &str) -> bool

Return true if the item has at least one blocking dependency.

An item is blocked if its blocked_by OR-Set is non-empty. To unblock, submit an item.unlink event which removes the link from the OR-Set.

Source

pub fn get_blockers(&self, item_id: &str) -> HashSet<&str>

Return the set of item IDs that block the given item.

Returns an empty set if the item is not blocked or not known.

Return the set of item IDs related to the given item.

Relates links are informational — they do not affect scheduling. Returns an empty set if the item has no relates links or is not known.

Source

pub fn ready_items(&self) -> HashSet<&str>

Return all item IDs that have no active blocking dependencies.

An item is “ready” if its blocked_by OR-Set is empty. Items with no known state entries are not included — only items present in the source states map appear here.

For scheduling purposes, callers typically filter deleted and done/archived items before calling BlockingGraph::from_states.

Source

pub fn blocked_items(&self) -> HashSet<&str>

Return all item IDs that have at least one active blocking dependency.

Source

pub fn len(&self) -> usize

Return the total number of items in the graph.

Source

pub fn is_empty(&self) -> bool

Return true if the graph has no items.

Source

pub fn all_item_ids(&self) -> impl Iterator<Item = &str>

Return an iterator over all item IDs in the graph.

Used by cycle detection to enumerate all nodes for full-graph DFS.

Trait Implementations§

Source§

impl Clone for BlockingGraph

Source§

fn clone(&self) -> BlockingGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockingGraph

Source§

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

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

impl Default for BlockingGraph

Source§

fn default() -> BlockingGraph

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> 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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = 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<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