diff --git a/binaries/runtime/src/main.rs b/binaries/runtime/src/main.rs index b7a73fdf..0838d644 100644 --- a/binaries/runtime/src/main.rs +++ b/binaries/runtime/src/main.rs @@ -107,7 +107,7 @@ async fn main() -> eyre::Result<()> { .ok_or_else(|| eyre!("received event from unknown operator {id}"))?; match event { OperatorEvent::Output { id: data_id, value } => { - if !operator.config().config.outputs.contains(&data_id) { + if !operator.definition().config.outputs.contains(&data_id) { eyre::bail!("unknown output {data_id} for operator {id}"); } publish(&node_id, id, data_id, &value, communication.as_ref()) diff --git a/binaries/runtime/src/operator/mod.rs b/binaries/runtime/src/operator/mod.rs index 60f7da78..299347e2 100644 --- a/binaries/runtime/src/operator/mod.rs +++ b/binaries/runtime/src/operator/mod.rs @@ -9,28 +9,31 @@ mod shared_lib; pub struct Operator { operator_task: Sender, - config: OperatorDefinition, + definition: OperatorDefinition, } impl Operator { pub async fn init( - operator_config: OperatorDefinition, + operator_definition: OperatorDefinition, events_tx: Sender, ) -> eyre::Result { let (operator_task, operator_rx) = mpsc::channel(10); - match &operator_config.config.source { + match &operator_definition.config.source { OperatorSource::SharedLibrary(path) => { shared_lib::spawn(path, events_tx, operator_rx).wrap_err_with(|| { format!( "failed ot spawn shared library operator for {}", - operator_config.id + operator_definition.id ) })?; } OperatorSource::Python(path) => { python::spawn(path, events_tx, operator_rx).wrap_err_with(|| { - format!("failed ot spawn Python operator for {}", operator_config.id) + format!( + "failed ot spawn Python operator for {}", + operator_definition.id + ) })?; } OperatorSource::Wasm(path) => { @@ -39,7 +42,7 @@ impl Operator { } Ok(Self { operator_task, - config: operator_config, + definition: operator_definition, }) } @@ -52,10 +55,10 @@ impl Operator { }) } - /// Get a reference to the operator's config. + /// Get a reference to the operator's definition. #[must_use] - pub fn config(&self) -> &OperatorDefinition { - &self.config + pub fn definition(&self) -> &OperatorDefinition { + &self.definition } }