pub struct Executor<'a> { /* private fields */ }Expand description
Executes plans. A type and not a bare function because executing needs context: the store, the placement and the transports.
Implementations§
Source§impl<'a> Executor<'a>
impl<'a> Executor<'a>
Sourcepub fn new(catalog: &'a Catalog) -> Self
pub fn new(catalog: &'a Catalog) -> Self
An executor over this catalog, with nothing else said yet.
Sourcepub fn placed(self, placement: &'a Placement) -> Self
pub fn placed(self, placement: &'a Placement) -> Self
The same executor, knowing where each node runs. Without this every
ctx.device is None, which means “wherever it lands”.
Sourcepub fn remembering(self, memory: &'a Memory) -> Self
pub fn remembering(self, memory: &'a Memory) -> Self
The same executor, knowing what is remembered about each node. Declared,
so it travels with a slice — its own call and not half of
keeping, which does not.
Sourcepub fn keeping(self, keeper: &'a dyn Keeper) -> Self
pub fn keeping(self, keeper: &'a dyn Keeper) -> Self
The same executor, with somewhere to keep what it names. Injected.
Without it, or without remembering, no key is
even computed.
Sourcepub fn reaching(
self,
host: impl Into<Host>,
transport: &'a dyn Transport,
) -> Self
pub fn reaching( self, host: impl Into<Host>, transport: &'a dyn Transport, ) -> Self
The same executor, knowing how to reach a host. Called once per host; a
name nobody resolves is RunError::NoTransport, not a slice executed
here just in case.
Sourcepub fn watching(self, watcher: &'a dyn Watcher) -> Self
pub fn watching(self, watcher: &'a dyn Watcher) -> Self
The same executor, telling this one what it sees. Injected, so a slice sent away is watched over there and comes back attributed.
Sourcepub fn stamping(self, stamp: impl IntoIterator<Item = (String, String)>) -> Self
pub fn stamping(self, stamp: impl IntoIterator<Item = (String, String)>) -> Self
The same executor, writing this beside everything it keeps.
Opaque text the core passes through untouched: an environment, a commit, a run are facts about the world outside a graph. Injected, so a slice sent away is stamped by the engine over there.
Sourcepub fn run(&self, plan: &Plan, input: Value) -> Result<Value, RunError>
pub fn run(&self, plan: &Plan, input: Value) -> Result<Value, RunError>
Executes the plan and returns what it produced; the first failure stops
it. The only place a run is said to end — resume says
nothing of the sort, because a slice is not a forward.
Sourcepub fn resume(
&self,
plan: &Plan,
input: Value,
known: Vec<(NodeId, Value)>,
named: Vec<(NodeId, Keys)>,
) -> Result<Outcome, RunError>
pub fn resume( &self, plan: &Plan, input: Value, known: Vec<(NodeId, Value)>, named: Vec<(NodeId, Keys)>, ) -> Result<Outcome, RunError>
Executes a slice that already knows what came before: what a worker does
on receiving one. known and named are fed in as if this run had
produced them; neither comes back, and both are ordered by id because
this crosses a process boundary.
Sourcepub fn foreseen(
&self,
plan: &Plan,
graph_input: &Value,
) -> (HashMap<NodeId, Keys>, HashSet<NodeId>)
pub fn foreseen( &self, plan: &Plan, graph_input: &Value, ) -> (HashMap<NodeId, Keys>, HashSet<NodeId>)
The names the whole plan will produce, and the nodes that will not have to produce them.
Names first, since a key needs nothing to have run;
then present says which answers are already there;
then backwards from the leaves, because a node whose answer is kept does
not need its inputs. Gives up towards keeping a node in two places: a
mapped node, named by its items’ content, and a node with no key.
Public because the answer is worth having without the run: two versions of a graph name a node differently exactly when its recipe changed. Names nothing without a keeper and a memory.