Trait ThreadComponent

pub trait ThreadComponent: NerveComponent {
    // Required methods
    fn create_lifecycle(&self) -> Result<Box<dyn ThreadLifecycle>, NerveError>;
    fn create_watchdog(
        &self,
        heartbeat_interval: Duration,
    ) -> Result<Box<dyn ThreadWatchdog>, NerveError>;
    fn create_coordinator(
        &self,
    ) -> Result<Box<dyn ThreadCoordinator>, NerveError>;
    fn thread_count(&self) -> usize;
    fn max_threads(&self) -> usize;
    fn thread_utilization(&self) -> f64;
}
Expand description

Thread management component interface

Required Methods§

fn create_lifecycle(&self) -> Result<Box<dyn ThreadLifecycle>, NerveError>

Create a new thread lifecycle manager

fn create_watchdog( &self, heartbeat_interval: Duration, ) -> Result<Box<dyn ThreadWatchdog>, NerveError>

Create a thread watchdog

fn create_coordinator(&self) -> Result<Box<dyn ThreadCoordinator>, NerveError>

Create a thread coordinator

fn thread_count(&self) -> usize

Get current thread count

fn max_threads(&self) -> usize

Get maximum allowed threads

fn thread_utilization(&self) -> f64

Get thread utilization percentage

Implementors§