jobq: drop the append_unchecked redirect (mara review)
`Scheduler::append_unchecked` was a one-line pass-through to `Graph::insert_unchecked` with a single caller. `insert_job` is already a method on `Scheduler`, so it can borrow `self.graph` and call the graph directly — the wrapper bought nothing but a name. Also fixes `insert_job`'s doc, which still claimed every node goes through `Scheduler::append`; it goes straight to the graph's unchecked insert, and the reason belongs in that doc rather than on a wrapper.
This commit is contained in:
parent
a2edad715f
commit
9ab950d767
1 changed files with 8 additions and 20 deletions
|
|
@ -100,21 +100,6 @@ impl<N, R: Clone + Eq + Hash> Scheduler<N, R> {
|
|||
self.graph.insert(payload, deps, parent)
|
||||
}
|
||||
|
||||
/// [`Scheduler::append`] for a node the builder has already validated —
|
||||
/// infallible, so the insert loop cannot abandon a half-built job.
|
||||
///
|
||||
/// Not public: the only caller is [`Scheduler::insert_job`], feeding nodes
|
||||
/// that [`crate::builder::check_job_shape`] has already proved
|
||||
/// well-formed. See [`Graph::insert_unchecked`].
|
||||
pub(crate) fn append_unchecked(
|
||||
&mut self,
|
||||
payload: N,
|
||||
deps: Vec<Dep<R>>,
|
||||
parent: Option<NodeId>,
|
||||
) -> NodeId {
|
||||
self.graph.insert_unchecked(payload, deps, parent)
|
||||
}
|
||||
|
||||
/// Insert a whole job under `root_parent`, returning the id each handle's
|
||||
/// node was minted as.
|
||||
///
|
||||
|
|
@ -125,10 +110,12 @@ impl<N, R: Clone + Eq + Hash> Scheduler<N, R> {
|
|||
/// insert one itself, so there is no way to end up with a job-shaped value
|
||||
/// being passed around as a spec.
|
||||
///
|
||||
/// The one insertion entry point: every node goes through
|
||||
/// [`Scheduler::append`], so a caller never has to reach past the scheduler
|
||||
/// at the graph underneath. Call [`Scheduler::settle`] afterwards to start
|
||||
/// whatever became runnable.
|
||||
/// The one insertion entry point for a job. Nodes go straight into
|
||||
/// [`Graph::insert_unchecked`]: [`crate::builder::check_job_shape`] has
|
||||
/// already decided every rejection the graph could raise, so re-validating
|
||||
/// per node could only report a problem *after* the earlier nodes were
|
||||
/// inserted. Call [`Scheduler::settle`] afterwards to start whatever became
|
||||
/// runnable.
|
||||
///
|
||||
/// **Atomic in the job's own shape.** A forward edge, a forward parent, or
|
||||
/// a request for a handle this job never declared is rejected *before* the
|
||||
|
|
@ -145,8 +132,9 @@ impl<N, R: Clone + Eq + Hash> Scheduler<N, R> {
|
|||
) -> Result<Vec<NodeId>, BuildError> {
|
||||
let job = JobBuilder::new();
|
||||
let wanted = declare(&job);
|
||||
let graph = &mut self.graph;
|
||||
job.insert_with(root_parent, &wanted, |payload, deps, parent| {
|
||||
self.append_unchecked(payload, deps, parent)
|
||||
graph.insert_unchecked(payload, deps, parent)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue