///
/// When the Executor finishes executing a Node it calls back to store the result value.
/// Entry::complete uses the run_token to determine whether the Node changed while we were busy
/// executing it, so that it can discard the work.
///
When the Executor finishes executing a Node it calls back to store the result value.
Entry::complete uses the run_token to determine whether the Node changed while we were busy
executing it, so that it can discard the work.
When the Executor finishes executing a Node it calls back to store the result value . Entry :: complete uses the run_token to determine whether the Node changed while we were busy executing it so that it can discard the work .
fn complete(
    &self,
    context: &N::Context,
    entry_id: EntryId,
    run_token: RunToken,
    result: Option<Result<N::Item, N::Error>>,
  ) {
    let (entry, has_uncacheable_deps, has_weak_deps, dep_generations) = {
      let inner = self.inner.lock();
      let mut has_uncacheable_deps = false;
      let mut has_weak_deps = false;
      // Get the Generations of all dependencies of the Node. We can trust that these have not changed
      // since we began executing, as long as the entry's RunToken is still valid (confirmed in
      // Entry::complete).
      let dep_generations = inner
        .pg
        .edges_directed(entry_id, Direction::Outgoing)
        .filter_map(|edge_ref| {
          if edge_ref.weight().1 == run_token {
            if edge_ref.weight().0 == EdgeType::Weak {
              has_weak_deps = true;
            }
            // If a dependency is itself uncacheable or has uncacheable deps, this Node should
            // also complete as having uncacheable deps, independent of matching Generation values.
            // This is to allow for the behaviour that an uncacheable Node should always have "dirty"
            // (marked as UncacheableDependencies) dependents, transitively.
            let entry = inner.entry_for_id(edge_ref.target()).unwrap();
            if !entry.node().cacheable() || entry.has_uncacheable_deps() {
              has_uncacheable_deps = true;
            }
            Some(entry.generation())
          } else {
            None
          }
        })
        .collect();
      let entry = inner.entry_for_id(entry_id).unwrap().clone();
      (entry, has_uncacheable_deps, has_weak_deps, dep_generations)
    };
    // Attempt to complete the Node outside the graph lock.
    entry.complete(
      context,
      run_token,
      dep_generations,
      result,
      has_uncacheable_deps,
      has_weak_deps,
    );
  }
fn complete ( & self , context : & N :: Context , entry_id : EntryId , run_token : RunToken , result : Option < Result < N :: Item , N :: Error > > , ) { let ( entry , has_uncacheable_deps , has_weak_deps , dep_generations ) = { let inner = self . inner . lock ( ) ; let mut has_uncacheable_deps = false ; let mut has_weak_deps = false ; // Get the Generations of all dependencies of the Node. We can trust that these have not changed // since we began executing, as long as the entry's RunToken is still valid (confirmed in // Entry::complete). let dep_generations = inner . pg . edges_directed ( entry_id , Direction :: Outgoing ) . filter_map ( | edge_ref | { if edge_ref . weight ( ) . 1 == run_token { if edge_ref . weight ( ) . 0 == EdgeType :: Weak { has_weak_deps = true ; } // If a dependency is itself uncacheable or has uncacheable deps, this Node should // also complete as having uncacheable deps, independent of matching Generation values. // This is to allow for the behaviour that an uncacheable Node should always have "dirty" // (marked as UncacheableDependencies) dependents, transitively. let entry = inner . entry_for_id ( edge_ref . target ( ) ) . unwrap ( ) ; if ! entry . node ( ) . cacheable ( ) || entry . has_uncacheable_deps ( ) { has_uncacheable_deps = true ; } Some ( entry . generation ( ) ) } else { None } } ) . collect ( ) ; let entry = inner . entry_for_id ( entry_id ) . unwrap ( ) . clone ( ) ; ( entry , has_uncacheable_deps , has_weak_deps , dep_generations ) } ; // Attempt to complete the Node outside the graph lock. entry . complete ( context , run_token , dep_generations , result , has_uncacheable_deps , has_weak_deps , ) ; }
When the Executor finishes executing a Node it calls back to store the result value.
When the Executor finishes executing a Node it calls back to store the result value .
&self
context
&N::Context
entry_id
EntryId
run_token
RunToken
result
Option<Result<N::Item, N::Error>>