pub struct CuConfig {
pub monitor: Option<MonitorConfig>,
pub logging: Option<LoggingConfig>,
pub graphs: ConfigGraphs,
}
Expand description
CuConfig is the programmatic representation of the configuration graph. It is a directed graph where nodes are tasks and edges are connections between tasks.
Fields§
§monitor: Option<MonitorConfig>
§logging: Option<LoggingConfig>
§graphs: ConfigGraphs
Implementations§
Source§impl CuConfig
The implementation has a lot of convenience methods to manipulate
the configuration to give some flexibility into programmatically creating the configuration.
impl CuConfig
The implementation has a lot of convenience methods to manipulate the configuration to give some flexibility into programmatically creating the configuration.
pub fn new_simple_type() -> Self
pub fn new_mission_type() -> Self
Sourcepub fn add_node(
&mut self,
node: Node,
mission_id: Option<&str>,
) -> CuResult<NodeId>
pub fn add_node( &mut self, node: Node, mission_id: Option<&str>, ) -> CuResult<NodeId>
Add a new node to the simple configuration graph. Add a new node to the configuration graph. If mission_id is provided, adds the node to that mission’s graph. Otherwise adds it to the simple graph.
pub fn get_node( &self, node_id: NodeId, mission_id: Option<&str>, ) -> Option<&Node>
Sourcepub fn get_node_mut(
&mut self,
node_id: NodeId,
mission_id: Option<&str>,
) -> Option<&mut Node>
pub fn get_node_mut( &mut self, node_id: NodeId, mission_id: Option<&str>, ) -> Option<&mut Node>
Get the node with the given id mutably.
pub fn get_node_output_msg_type( &self, node_id: &str, mission_id: Option<&str>, ) -> Option<String>
pub fn get_node_input_msg_type( &self, node_id: &str, mission_id: Option<&str>, ) -> Option<String>
pub fn get_src_edges( &self, node_id: NodeId, mission_id: Option<&str>, ) -> CuResult<Vec<usize>>
Sourcepub fn get_dst_edges(
&self,
node_id: NodeId,
mission_id: Option<&str>,
) -> CuResult<Vec<usize>>
pub fn get_dst_edges( &self, node_id: NodeId, mission_id: Option<&str>, ) -> CuResult<Vec<usize>>
Get the list of edges that are connected to the given node as a destination.
pub fn get_edge_weight( &self, index: usize, mission_id: Option<&str>, ) -> Option<Cnx>
Sourcepub fn get_all_nodes(&self, mission_id: Option<&str>) -> Vec<(NodeId, &Node)>
pub fn get_all_nodes(&self, mission_id: Option<&str>) -> Vec<(NodeId, &Node)>
Convenience method to get all nodes in the configuration graph. If mission_id is provided, gets nodes from that mission’s graph. Otherwise gets nodes from the simple graph.
Sourcepub fn connect_ext(
&mut self,
source: NodeId,
target: NodeId,
msg_type: &str,
store: Option<bool>,
mission_id: Option<&str>,
missions: Option<Vec<String>>,
) -> CuResult<()>
pub fn connect_ext( &mut self, source: NodeId, target: NodeId, msg_type: &str, store: Option<bool>, mission_id: Option<&str>, missions: Option<Vec<String>>, ) -> CuResult<()>
Adds an edge between two nodes/tasks in the configuration graph. msg_type is the type of message exchanged between the two nodes/tasks. batch is the number of messages to batch before sending the buffer. store tells Copper if it needs to log the messages.
Sourcepub fn connect(
&mut self,
source: NodeId,
target: NodeId,
msg_type: &str,
) -> CuResult<()>
pub fn connect( &mut self, source: NodeId, target: NodeId, msg_type: &str, ) -> CuResult<()>
Adds an edge between two nodes/tasks in the configuration graph. msg_type is the type of message exchanged between the two nodes/tasks.
pub fn serialize_ron(&self) -> String
pub fn deserialize_ron(ron: &str) -> Self
Sourcepub fn render(
&self,
output: &mut dyn Write,
mission_id: Option<&str>,
) -> CuResult<()>
pub fn render( &self, output: &mut dyn Write, mission_id: Option<&str>, ) -> CuResult<()>
Render the configuration graph in the dot format.
pub fn get_all_instances_configs( &self, mission_id: Option<&str>, ) -> Vec<Option<&ComponentConfig>>
pub fn get_graph(&self, mission_id: Option<&str>) -> CuResult<&CuGraph>
pub fn get_graph_mut( &mut self, mission_id: Option<&str>, ) -> CuResult<&mut CuGraph>
pub fn get_monitor_config(&self) -> Option<&MonitorConfig>
Sourcepub fn validate_logging_config(&self) -> CuResult<()>
pub fn validate_logging_config(&self) -> CuResult<()>
Validate the logging configuration to ensure section pre-allocation sizes do not exceed slab sizes. This method is wrapper around LoggingConfig::validate
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CuConfig
impl<'de> Deserialize<'de> for CuConfig
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>,
This is a custom serialization to make this implementation independent of petgraph.