pub trait DescriptorExt {
// Required methods
fn resolve_aliases_and_set_defaults(
&self,
) -> Result<BTreeMap<NodeId, ResolvedNode>>;
fn visualize_as_mermaid_with_boundaries(
&self,
boundaries: &ModuleBoundaries,
) -> Result<String>;
fn apply_exit_when_nodes_finish(&mut self, over: Option<bool>);
fn blocking_read(path: &Path) -> Result<Descriptor>;
fn parse(buf: Vec<u8>) -> Result<Descriptor>;
fn check(&self, working_dir: &Path) -> Result<()>;
fn expand(&self, working_dir: &Path) -> Result<Descriptor>;
fn expand_with_boundaries(
&self,
working_dir: &Path,
) -> Result<(Descriptor, ModuleBoundaries)>;
}Expand description
Operations on a parsed Descriptor.
These live on an extension trait rather than inherent methods because
Descriptor is defined in dora-message (the wire-format crate), while
the parsing, validation, resolution, and visualization logic belongs to
dora-core. Import the trait to turn a descriptor into the resolved node
map dora runs, validate it, or render it as a mermaid graph.
§Example
use dora_core::descriptor::{Descriptor, DescriptorExt};
let yaml = b"
nodes:
- id: source
path: ./source
outputs: [data]
- id: sink
path: ./sink
inputs:
value: source/data
";
// Parse the YAML into a descriptor...
let descriptor = Descriptor::parse(yaml.to_vec())?;
assert_eq!(descriptor.nodes.len(), 2);
// ...then resolve aliases and fill in defaults to get the node map dora runs.
let resolved = descriptor.resolve_aliases_and_set_defaults()?;
assert_eq!(resolved.len(), 2);Required Methods§
Sourcefn resolve_aliases_and_set_defaults(
&self,
) -> Result<BTreeMap<NodeId, ResolvedNode>>
fn resolve_aliases_and_set_defaults( &self, ) -> Result<BTreeMap<NodeId, ResolvedNode>>
Resolve the descriptor into the map of nodes dora runs.
Fills in defaults, rewrites single-operator input references to the
operator-qualified output name, and returns the nodes keyed by id. The
descriptor must already be module-expanded (see expand)
if it contains module: references.
Sourcefn visualize_as_mermaid_with_boundaries(
&self,
boundaries: &ModuleBoundaries,
) -> Result<String>
fn visualize_as_mermaid_with_boundaries( &self, boundaries: &ModuleBoundaries, ) -> Result<String>
Render the resolved dataflow as a mermaid flowchart, annotated with the
given module boundaries (from expand_with_boundaries).
Sourcefn apply_exit_when_nodes_finish(&mut self, over: Option<bool>)
fn apply_exit_when_nodes_finish(&mut self, over: Option<bool>)
Apply a command-line override to the dataflow’s completion policy.
None leaves the descriptor’s own exit_when_nodes_finish
alone, so a setting written in the YAML stands; Some(v)
overrides it in either direction, so --exit-when-nodes-finish
can force the policy on and =false can force it off for a
descriptor that asks for it (dora-rs/dora#2920).
Shared rather than spelled out at each call site: dora run,
dora start and the daemon all have to agree, and three copies
of the same three lines is how one of them ends up not being
updated.
Sourcefn blocking_read(path: &Path) -> Result<Descriptor>
fn blocking_read(path: &Path) -> Result<Descriptor>
Read a descriptor from a YAML file at path and parse it.
Sourcefn parse(buf: Vec<u8>) -> Result<Descriptor>
fn parse(buf: Vec<u8>) -> Result<Descriptor>
Parse a descriptor from raw YAML bytes.
This only deserializes; it does not expand modules or validate the
dataflow — use check for that.
Sourcefn check(&self, working_dir: &Path) -> Result<()>
fn check(&self, working_dir: &Path) -> Result<()>
Expand modules and validate the whole dataflow (node ids, input wiring,
field combinations, …), resolving relative paths against working_dir.
Sourcefn expand(&self, working_dir: &Path) -> Result<Descriptor>
fn expand(&self, working_dir: &Path) -> Result<Descriptor>
Expand all module references into flat nodes.
Module nodes are replaced by the inner nodes defined in their module
file. Internal IDs are prefixed with {module_id}. and input/output
wiring is rewritten accordingly.
Sourcefn expand_with_boundaries(
&self,
working_dir: &Path,
) -> Result<(Descriptor, ModuleBoundaries)>
fn expand_with_boundaries( &self, working_dir: &Path, ) -> Result<(Descriptor, ModuleBoundaries)>
Like expand but also returns module boundary metadata
for visualization.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".