Skip to main content

Executor

Struct Executor 

Source
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>

Source

pub fn new(catalog: &'a Catalog) -> Self

An executor over this catalog, with nothing else said yet.

Source

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”.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for Executor<'a>

§

impl<'a> !RefUnwindSafe for Executor<'a>

§

impl<'a> Send for Executor<'a>

§

impl<'a> Sync for Executor<'a>

§

impl<'a> Unpin for Executor<'a>

§

impl<'a> UnsafeUnpin for Executor<'a>

§

impl<'a> !UnwindSafe for Executor<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.