pub struct Supervisor { /* private fields */ }Expand description
Supervisor for managing node lifecycle
Implementations§
Source§impl Supervisor
impl Supervisor
Sourcepub fn new(
health_checker: Arc<HealthChecker>,
shutdown: ShutdownHandle,
restart_policy: RestartPolicy,
) -> Self
pub fn new( health_checker: Arc<HealthChecker>, shutdown: ShutdownHandle, restart_policy: RestartPolicy, ) -> Self
Create a new supervisor
Sourcepub fn launch_node(&self, node: Box<dyn NodeRunner>) -> NodeHandle
pub fn launch_node(&self, node: Box<dyn NodeRunner>) -> NodeHandle
Launch and supervise a node
Sourcepub fn launch_nodes(&self, nodes: Vec<Box<dyn NodeRunner>>) -> Vec<NodeHandle>
pub fn launch_nodes(&self, nodes: Vec<Box<dyn NodeRunner>>) -> Vec<NodeHandle>
Launch multiple nodes
Sourcepub fn health_checker(&self) -> &Arc<HealthChecker>
pub fn health_checker(&self) -> &Arc<HealthChecker>
Get the health checker
Sourcepub fn shutdown(&self) -> &ShutdownHandle
pub fn shutdown(&self) -> &ShutdownHandle
Get the shutdown handle
Sourcepub async fn start_node(&self, name: &str) -> Result<()>
pub async fn start_node(&self, name: &str) -> Result<()>
Sourcepub async fn get_running_nodes(&self) -> Vec<String>
pub async fn get_running_nodes(&self) -> Vec<String>
Get list of currently running nodes
Returns the names of all nodes being supervised
Trait Implementations§
Source§impl SupervisorTrait for Supervisor
Implement the SupervisorTrait for Supervisor
impl SupervisorTrait for Supervisor
Implement the SupervisorTrait for Supervisor
Source§fn start_node<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_node<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start a node by name
Source§fn stop_node<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop_node<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop a node by name
Source§fn get_running_nodes(&self) -> Vec<String>
fn get_running_nodes(&self) -> Vec<String>
Get list of running nodes
Auto Trait Implementations§
impl Freeze for Supervisor
impl !RefUnwindSafe for Supervisor
impl Send for Supervisor
impl Sync for Supervisor
impl Unpin for Supervisor
impl !UnwindSafe for Supervisor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more