Enum brane_ast::ast::Edge

source ·
pub enum Edge {
    Node {
        task: usize,
        locs: Locations,
        at: Option<Location>,
        input: HashMap<DataName, Option<AvailabilityKind>>,
        result: Option<String>,
        metadata: HashSet<Metadata>,
        next: usize,
    },
    Linear {
        instrs: Vec<EdgeInstr>,
        next: usize,
    },
    Stop {},
    Branch {
        true_next: usize,
        false_next: Option<usize>,
        merge: Option<usize>,
    },
    Parallel {
        branches: Vec<usize>,
        merge: usize,
    },
    Join {
        merge: MergeStrategy,
        next: usize,
    },
    Loop {
        cond: usize,
        body: usize,
        next: Option<usize>,
    },
    Call {
        input: HashSet<DataName>,
        result: HashSet<DataName>,
        next: usize,
    },
    Return {
        result: HashSet<DataName>,
    },
}
Expand description

Defines an Edge (i.e., an intelligent control-flow operation) in the Workflow graph.

Is also referred to as an ‘Edge’ for historical reasons and because almost all of the elements are edge variants. In fact, the only Node is ‘Node’, which is why the rest doesn’t explicitly mentions it being an edge.

The edges can be thought of as a linked list of statements. However, each statement may secretly group multiple statements (instrucitons) to make reasoning about the graph easier.

Finally, the developers would like to formally apologize for completely butchering the term ‘Edge’.

Variants§

§

Node

A Node is an edge that runs a task. It has one input edge and one output edge.

Fields

§task: usize

The task to call

§locs: Locations

An additional list that may or may not restrict locations.

§at: Option<Location>

Annotation about where the task will be run. This is not meant to be populated by anyone except the planner.

§input: HashMap<DataName, Option<AvailabilityKind>>

Reference to any input datasets/results that might be input to this node together with how they might be accessed. This latter part is populated during planning.

§result: Option<String>

Reference to the result if this call generates one.

§metadata: HashSet<Metadata>

Metadata for this call

§next: usize

The next edge to execute (usually the next one)

§

Linear

A Linear edge is simple a series of instructions that are run, after which is goes to one new edge.

Fields

§instrs: Vec<EdgeInstr>

The series of instructions to execute.

§next: usize

The next edge to execute (usually the next one)

§

Stop

A Stop is an edge that stops execution.

§

Branch

A Branching edge is an edge that branches into two possible (but disjoint) based on the result of a series of instructions.

§Stack layout

  • Requires a boolean to be on top of the stack.

Fields

§true_next: usize

The next edge to run if the condition returned ‘true’. Is not relative to the current program counter (i.e., if 0 is given, the first branch in the program is executed).

§false_next: Option<usize>

The next edge to run if the condition returned ‘false’. Is not relative to the current program counter (i.e., if 0 is given, the first branch in the program is executed).

§merge: Option<usize>

The location where the branches will join together if the Branch does not fully return. This is only here for analysis purposes; it’s not used by the VM.

§

Parallel

A Parallel edge is an edge that branches into multiple branches that are all taken simultaneously.

Fields

§branches: Vec<usize>

The edges that kickoff each branch. Is not relative to the current program counter (i.e., if 0 is given, then the first branch in the program is executed).

§merge: usize

The location where the branches will merge together. This is only here for analysis purposes; it’s not used by the VM.

§

Join

A Join edge is an edge that joins multiple branches into one, waiting until all have been completed.

Note that the execution of the join-edge acts like a fence, so is quite non-trivial.

Fields

§merge: MergeStrategy

Defines the merge strategy of the Join, i.e., how to combine the results of the branches together.

§next: usize

The next edge to execute (usually the next one)

§

Loop

Repeats a given set of edges indefinitely.

Fields

§cond: usize

The edges that compute the condition.

§body: usize

The edges that are repeated for as long as the condition returns ‘true’.

§next: Option<usize>

The next edge to execute after the loop has been completed (usually the next one). Note, however, that this may be empty if the loop fully returns.

§

Call

A Calling edge is one that re-uses edges by executing the given edge instead. When done, the ‘next’ edge is pushed on the frame stack and popped when a Return edge is executed.

§Stack layout

  • Requires a Function object to be on top of the stack which will be called.
  • Requires N arguments of arbitrary type, where N is equal to the function object’s arity. The first argument of the function is at the bottom, the last second-to-top on the stack.

Fields

§input: HashSet<DataName>

Reference to any input datasets/results that might be input to this node.

§result: HashSet<DataName>

Reference to the result (or dataset) if this call generates one.

§next: usize

The next edge to execute (usually the next one)

§

Return

A Returning edge is one that returns from a called edge by popping the next from the call stack.

§Stack layout

  • Optionally requires a value to be on the stack of the called function’s return type. Whether or not this is need and which type that value has is determined by the top value on the frame stack.

Fields

§result: HashSet<DataName>

If this return returns a value and that value is a Data, then this names which it is.

Trait Implementations§

source§

impl Clone for Edge

source§

fn clone(&self) -> Edge

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Edge

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Edge

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl EnumDebug for Edge

source§

fn type_name() -> &'static str

Returns the static name of the type used for EnumDebug-printing. Read more
source§

fn variant_names() -> &'static [&'static str]

Returns all variants in the trait as a list of names. Read more
source§

fn variant_name(&self) -> &'static str

Returns the static name of the variant. Read more
source§

fn variant(&self) -> EnumDebugFormatter<'_, Self>

Returns a formatter for this enum that writes its variant name. Read more
source§

fn variants() -> Copied<Iter<'static, &'static str>>

Returns an iterator over all variants in this enum. Read more
source§

impl Serialize for Edge

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Edge

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl Sync for Edge

§

impl Unpin for Edge

§

impl UnwindSafe for Edge

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T