iridis_node/
node.rs

1//! This module defines the `Node` trait that must be implemented
2//! by all nodes in the `iridis` runtime.
3
4use crate::prelude::*;
5
6/// The `Node` trait defines the interface for all nodes in the `iridis` runtime.
7pub trait Node: Send + Sync {
8    /// The `new` function is used to create a new instance of the node.
9    #[allow(clippy::new_ret_no_self)]
10    fn new(
11        inputs: Inputs,
12        outputs: Outputs,
13        queries: Queries,
14        queryables: Queryables,
15        configuration: serde_yml::Value,
16    ) -> tokio::task::JoinHandle<Result<Box<dyn Node>>>
17    where
18        Self: Sized;
19
20    /// The `start` function is used to start the node's execution
21    fn start(self: Box<Self>) -> tokio::task::JoinHandle<Result<()>>;
22}
23
24/// The `DynamicallyLinkedNodeInstance` type is used for the `C` symbolic function
25pub type DynamicallyLinkedNodeInstance = fn(
26    Inputs,
27    Outputs,
28    Queries,
29    Queryables,
30    serde_yml::Value,
31) -> tokio::task::JoinHandle<Result<Box<dyn Node>>>;