pub struct FlowDefinition {
pub name: String,
pub version: Option<String>,
pub description: Option<String>,
pub triggers: Vec<TriggerDefinition>,
pub nodes: HashMap<String, NodeDefinition>,
pub edges: Vec<EdgeDefinition>,
pub settings: FlowSettings,
}Expand description
A complete flow definition from YAML.
This is the top-level structure representing a XERV flow document.
§Example
name: order_processing
version: "1.0"
description: Process incoming orders with fraud detection
triggers:
- id: api_webhook
type: webhook
params:
port: 8080
path: /orders
nodes:
validate:
type: std::json_parse
config:
strict: true
fraud_check:
type: std::switch
config:
condition:
type: greater_than
field: risk_score
value: 0.8
process_order:
type: plugins::order_processor
flag_fraud:
type: plugins::fraud_handler
edges:
- from: api_webhook
to: validate
- from: validate
to: fraud_check
- from: fraud_check.true
to: flag_fraud
- from: fraud_check.false
to: process_order
settings:
max_concurrent_executions: 100
execution_timeout_ms: 30000Fields§
§name: StringFlow name (required).
version: Option<String>Flow version (optional, defaults to “1.0”).
description: Option<String>Human-readable description.
triggers: Vec<TriggerDefinition>Triggers that start this flow.
nodes: HashMap<String, NodeDefinition>Nodes in the flow, keyed by node ID.
edges: Vec<EdgeDefinition>Edges connecting nodes.
settings: FlowSettingsRuntime settings.
Implementations§
Source§impl FlowDefinition
impl FlowDefinition
Sourcepub fn from_file(path: &Path) -> Result<Self, FlowLoadError>
pub fn from_file(path: &Path) -> Result<Self, FlowLoadError>
Parse a flow definition from YAML file.
Sourcepub fn validate(&self) -> ValidationResult
pub fn validate(&self) -> ValidationResult
Validate the flow definition.
Sourcepub fn from_yaml_validated(yaml: &str) -> Result<Self, FlowLoadError>
pub fn from_yaml_validated(yaml: &str) -> Result<Self, FlowLoadError>
Parse and validate in one step.
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set version.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set description.
Sourcepub fn with_trigger(self, trigger: TriggerDefinition) -> Self
pub fn with_trigger(self, trigger: TriggerDefinition) -> Self
Add a trigger.
Sourcepub fn with_node(self, id: impl Into<String>, node: NodeDefinition) -> Self
pub fn with_node(self, id: impl Into<String>, node: NodeDefinition) -> Self
Add a node.
Sourcepub fn with_edge(self, edge: EdgeDefinition) -> Self
pub fn with_edge(self, edge: EdgeDefinition) -> Self
Add an edge.
Sourcepub fn with_settings(self, settings: FlowSettings) -> Self
pub fn with_settings(self, settings: FlowSettings) -> Self
Set settings.
Sourcepub fn effective_version(&self) -> &str
pub fn effective_version(&self) -> &str
Get the effective version (defaults to “1.0”).
Sourcepub fn trigger_ids(&self) -> impl Iterator<Item = &str>
pub fn trigger_ids(&self) -> impl Iterator<Item = &str>
Get all trigger IDs.
Sourcepub fn get_node(&self, id: &str) -> Option<&NodeDefinition>
pub fn get_node(&self, id: &str) -> Option<&NodeDefinition>
Get a node by ID.
Sourcepub fn get_trigger(&self, id: &str) -> Option<&TriggerDefinition>
pub fn get_trigger(&self, id: &str) -> Option<&TriggerDefinition>
Get a trigger by ID.
Sourcepub fn has_trigger(&self, id: &str) -> bool
pub fn has_trigger(&self, id: &str) -> bool
Check if a trigger with the given ID exists.
Sourcepub fn enabled_triggers(&self) -> impl Iterator<Item = &TriggerDefinition>
pub fn enabled_triggers(&self) -> impl Iterator<Item = &TriggerDefinition>
Get enabled triggers.
Sourcepub fn enabled_nodes(&self) -> impl Iterator<Item = (&str, &NodeDefinition)>
pub fn enabled_nodes(&self) -> impl Iterator<Item = (&str, &NodeDefinition)>
Get enabled nodes.
Sourcepub fn edges_from(&self, node_id: &str) -> impl Iterator<Item = &EdgeDefinition>
pub fn edges_from(&self, node_id: &str) -> impl Iterator<Item = &EdgeDefinition>
Find edges from a given node.
Sourcepub fn edges_to(&self, node_id: &str) -> impl Iterator<Item = &EdgeDefinition>
pub fn edges_to(&self, node_id: &str) -> impl Iterator<Item = &EdgeDefinition>
Find edges to a given node.
Trait Implementations§
Source§impl Clone for FlowDefinition
impl Clone for FlowDefinition
Source§fn clone(&self) -> FlowDefinition
fn clone(&self) -> FlowDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlowDefinition
impl Debug for FlowDefinition
Source§impl<'de> Deserialize<'de> for FlowDefinition
impl<'de> Deserialize<'de> for FlowDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FlowDefinition
impl RefUnwindSafe for FlowDefinition
impl Send for FlowDefinition
impl Sync for FlowDefinition
impl Unpin for FlowDefinition
impl UnwindSafe for FlowDefinition
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.