nerve/integration/
plugin_traits.rs1use nerve_core_traits::NerveComponent;
7
8pub trait PluginMemoryComponent: NerveComponent {
10 fn memory_usage(&self) -> u64;
12
13 fn memory_utilization(&self) -> f64;
15
16 fn is_memory_critical(&self) -> bool;
18}
19
20pub trait PluginThreadComponent: NerveComponent {
22 fn thread_count(&self) -> usize;
24
25 fn max_threads(&self) -> usize;
27
28 fn thread_utilization(&self) -> f64;
30}
31
32pub trait PluginNodeComponent: NerveComponent {
34 fn node_count(&self) -> usize;
36
37 fn node_count_by_type(&self, node_type: nerve_core_types::NodeType) -> usize;
39
40 fn node_health_summary(&self) -> PluginNodeHealthSummary;
42}
43
44pub trait PluginCommunicationComponent: NerveComponent {
46 fn message_throughput(&self) -> f64;
48
49 fn error_rate(&self) -> f64;
51}
52
53#[derive(Debug, Clone)]
55pub struct PluginNodeHealthSummary {
56 pub overall_health: PluginNodeHealth,
58 pub health_by_type: std::collections::HashMap<nerve_core_types::NodeType, PluginNodeStatistics>,
60}
61
62#[derive(Debug, Clone, Copy, PartialEq, Eq)]
64pub enum PluginNodeHealth {
65 Healthy,
67 Warning,
69 Unhealthy,
71}
72
73#[derive(Debug, Clone, Default)]
75pub struct PluginNodeStatistics {
76 pub total_nodes: usize,
78 pub healthy_nodes: usize,
80 pub warning_nodes: usize,
82 pub unhealthy_nodes: usize,
84}
85
86impl Default for PluginNodeHealthSummary {
87 fn default() -> Self {
88 Self {
89 overall_health: PluginNodeHealth::Healthy,
90 health_by_type: std::collections::HashMap::new(),
91 }
92 }
93}