Operation

Trait Operation 

Source
pub trait Operation: Send + Sync {
    // Required methods
    fn descriptor(&self) -> OperationDescriptor;
    fn resolve(&self, params: Value) -> Result<Value, String>;
    fn run(&self, params: &Value, inputs: &Inputs) -> Result<Outputs, String>;

    // Provided methods
    fn output_kind(
        &self,
        port: &Port,
        _inputs: &BTreeMap<String, ArtifactKind>,
    ) -> ArtifactKind { ... }
    fn summary(&self) -> &'static str { ... }
    fn params_schema(&self) -> Value { ... }
}
Expand description

One kind of pipeline step, for example a decomposition method.

Required Methods§

Source

fn descriptor(&self) -> OperationDescriptor

Source

fn resolve(&self, params: Value) -> Result<Value, String>

Checks parameters and fills in defaults. The result is what gets cached and recorded.

Source

fn run(&self, params: &Value, inputs: &Inputs) -> Result<Outputs, String>

Runs on parameters that resolve returned.

Provided Methods§

Source

fn output_kind( &self, port: &Port, _inputs: &BTreeMap<String, ArtifactKind>, ) -> ArtifactKind

The kind an output will have, given the kinds bound to each input. By default the first kind the port lists; operations whose output follows their input override this.

Source

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

One sentence on what the operation does, for modewise ops and the generated reference.

Source

fn params_schema(&self) -> Value

JSON Schema of the parameters: types, descriptions from doc comments, and defaults. The generated reference (docs/reference/operations.md) and tools read it.

Implementors§