pub struct CuConfig {
pub graph: StableGraph<Node, Cnx>,
pub monitor: Option<MonitorConfig>,
pub logging: Option<LoggingConfig>,
}
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§
§graph: StableGraph<Node, Cnx>
§monitor: Option<MonitorConfig>
§logging: Option<LoggingConfig>
Implementations§
Source§impl CuConfig
The implementation has a lot of conveinence methods to manipulate
the configuration to give some flexibility into programmatically creating the configuration.
impl CuConfig
The implementation has a lot of conveinence methods to manipulate the configuration to give some flexibility into programmatically creating the configuration.
Sourcepub fn get_node_mut(&mut self, node_id: u32) -> Option<&mut Node>
pub fn get_node_mut(&mut self, node_id: u32) -> Option<&mut Node>
Get the node with the given id mutably.
Sourcepub fn get_node_output_msg_type(&self, node_id: &str) -> Option<String>
pub fn get_node_output_msg_type(&self, node_id: &str) -> Option<String>
this is more like infer from the connections of this node.
Sourcepub fn get_node_input_msg_type(&self, node_id: &str) -> Option<String>
pub fn get_node_input_msg_type(&self, node_id: &str) -> Option<String>
this is more like infer from the connections of this node.
Sourcepub fn get_src_edges(&self, node_id: u32) -> Vec<usize>
pub fn get_src_edges(&self, node_id: u32) -> Vec<usize>
Get the list of edges that are connected to the given node as a source.
Sourcepub fn get_dst_edges(&self, node_id: u32) -> Vec<usize>
pub fn get_dst_edges(&self, node_id: u32) -> 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) -> Option<Cnx>
Sourcepub fn get_all_nodes(&self) -> Vec<(u32, &Node)>
pub fn get_all_nodes(&self) -> Vec<(u32, &Node)>
Convenience method to get all nodes in the configuration graph.
Sourcepub fn connect_ext(
&mut self,
source: u32,
target: u32,
msg_type: &str,
batch: Option<u32>,
store: Option<bool>,
)
pub fn connect_ext( &mut self, source: u32, target: u32, msg_type: &str, batch: Option<u32>, store: Option<bool>, )
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: u32, target: u32, msg_type: &str)
pub fn connect(&mut self, source: u32, target: u32, msg_type: &str)
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) -> CuConfig
pub fn get_all_instances_configs(&self) -> Vec<Option<&ComponentConfig>>
pub fn get_monitor_config(&self) -> Option<&MonitorConfig>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CuConfig
impl<'de> Deserialize<'de> for CuConfig
Source§fn deserialize<D>(
deserializer: D,
) -> Result<CuConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<CuConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
This is a custom serialization to make this implementation independent of petgraph.
Source§impl Serialize for CuConfig
impl Serialize for CuConfig
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
This is a custom serialization to make this implementation independent of petgraph.