pub struct PlanTree { /* private fields */ }Implementations§
Source§impl PlanTree
impl PlanTree
Sourcepub fn build(rows: Vec<RoadmapRow>) -> Result<PlanTree, AxError>
pub fn build(rows: Vec<RoadmapRow>) -> Result<PlanTree, AxError>
Places every row and works out what each one is worth.
§Errors
Fail-closed, in the same shape as crate::locator: a plan that
cannot be read is refused rather than guessed at, because every
progress figure in the city is divided by it. Five refusals — a
repeated index, a node whose parent is missing, a dependency on a
node that is not there, a dependency in a circle, and a branch
marked done over a child that is not.
pub fn get(&self, id: &NodeId) -> Option<&PlanNode>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn needs_of(&self, id: &NodeId) -> BTreeSet<NodeId>
pub fn needs_of(&self, id: &NodeId) -> BTreeSet<NodeId>
What a node waits for, including everything its ancestors wait
for. A child of a branch that is waiting is waiting too;
answering otherwise would let 2.3.1 start while the reason
2.3 cannot start is still unresolved.
Sourcepub fn ready(&self) -> Vec<NodeId>
pub fn ready(&self) -> Vec<NodeId>
What may be started right now: leaves nobody has taken, whose dependencies — their own and their branch’s — are all done.
Pure, and that is the point: a city with no ready nodes and nothing running has finished, and a stop condition that depended on I/O could not be trusted to say so.
Sourcepub fn claim(&self, id: &NodeId) -> Result<Held, AxError>
pub fn claim(&self, id: &NodeId) -> Result<Held, AxError>
Takes a node to work on.
§Errors
Refuses everything Self::ready leaves out, and says which of
the three reasons applies: the index is not in the table, the
node is a branch or already taken, or it is still waiting on
something. The third names what it waits for, because “no” sends
a model round the loop again while “1.4 is not done” does not.
Sourcepub fn progress(&self) -> Progress
pub fn progress(&self) -> Progress
The plan’s own reading of itself: leaves counted, and the share of the whole those leaves carry.
Both figures travel because they answer different questions and mislead alone. A share says how much of the plan is behind you; a leaf count says how many pieces the plan turned out to have, and it is the figure that does not move when somebody divides their own branch generously.