Expand description
Blocking and relates dependency graph built from CRDT item states.
§Overview
This module materializes a scheduling dependency graph from WorkItemState
OR-Sets. Two orthogonal link types are supported:
- Blocking (
blocked_by): scheduling dependency. An item with non-emptyblocked_byis considered blocked and will not appear in “ready” work. - Relates (
related_to): informational link. Has no effect on scheduling.
§Data Model
Both link types are stored in WorkItemState as OR-Sets of item IDs:
blocked_by: OrSet<String>— items that must complete before this onerelated_to: OrSet<String>— items informationally related to this one
The OR-Set semantics ensure convergent behavior under concurrent
item.link / item.unlink events: concurrent add+remove resolves
as add-wins (the link survives).
§Cross-Goal Dependencies
An item’s blocked_by set may reference items from any goal, not just
the parent goal. BlockingGraph treats all item IDs uniformly.
§Causation
The causation field on item.link events captures audit provenance
(which event caused this link). It is stored in the event stream and
queryable via the event DAG — it is NOT a graph edge in the blocking
graph.
§Usage
use std::collections::HashMap;
use bones_core::graph::blocking::BlockingGraph;
use bones_core::crdt::item_state::WorkItemState;
let states: HashMap<String, WorkItemState> = /* ... */;
let graph = BlockingGraph::from_states(&states);
if graph.is_blocked("bn-task1") {
let blockers = graph.get_blockers("bn-task1");
println!("bn-task1 is blocked by: {blockers:?}");
}
let ready = graph.ready_items();
println!("Ready items: {ready:?}");Structs§
- Blocking
Graph - A blocking/relates dependency graph materialized from CRDT item states.
Functions§
- get_
blockers - Return the set of item IDs blocking the given item.
- is_
blocked - Check if an item is blocked given a map of states.
- ready_
items - Return item IDs that have no active blocking dependencies.