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
impl BlockingGraph
Sourcepub fn from_states(states: &HashMap<String, WorkItemState>) -> Self
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.
Sourcepub fn is_blocked(&self, item_id: &str) -> bool
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.
Sourcepub fn get_blockers(&self, item_id: &str) -> HashSet<&str>
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.
Sourcepub fn ready_items(&self) -> HashSet<&str>
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.
Sourcepub fn blocked_items(&self) -> HashSet<&str>
pub fn blocked_items(&self) -> HashSet<&str>
Return all item IDs that have at least one active blocking dependency.
Sourcepub fn all_item_ids(&self) -> impl Iterator<Item = &str>
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
impl Clone for BlockingGraph
Source§fn clone(&self) -> BlockingGraph
fn clone(&self) -> BlockingGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more