pub struct Runtime { /* private fields */ }Expand description
Main runtime for supervising and running nodes
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn builder() -> RuntimeBuilder
pub fn builder() -> RuntimeBuilder
Create a new runtime builder
Sourcepub async fn run_node(
&mut self,
name: &str,
node: Box<dyn NodeRunner>,
) -> Result<()>
pub async fn run_node( &mut self, name: &str, node: Box<dyn NodeRunner>, ) -> Result<()>
Run a single node until completion or shutdown
Sourcepub async fn run_nodes(&mut self, nodes: Vec<Box<dyn NodeRunner>>) -> Result<()>
pub async fn run_nodes(&mut self, nodes: Vec<Box<dyn NodeRunner>>) -> Result<()>
Run multiple nodes until all complete or shutdown
Sourcepub async fn run_with_launcher(&mut self) -> Result<()>
pub async fn run_with_launcher(&mut self) -> Result<()>
Run with launcher service for dynamic node management
Sourcepub async fn run_with_lifecycle(&mut self) -> Result<()>
pub async fn run_with_lifecycle(&mut self) -> Result<()>
Run with lifecycle management
This starts the runtime with lifecycle management enabled. The lifecycle manager will handle mode transitions and start/stop nodes accordingly.
The runtime will:
- Start nodes for the default mode
- Wait for shutdown signal
- Gracefully shut down all nodes
Mode transitions should be triggered externally via the lifecycle manager’s
change_mode() method.
Sourcepub fn health_checker(&self) -> &Arc<HealthChecker>
pub fn health_checker(&self) -> &Arc<HealthChecker>
Get the health checker
Sourcepub fn supervisor(&self) -> &Arc<Supervisor>
pub fn supervisor(&self) -> &Arc<Supervisor>
Get the supervisor
Sourcepub fn lifecycle(&self) -> Option<&LifecycleManager>
pub fn lifecycle(&self) -> Option<&LifecycleManager>
Get the lifecycle manager (if enabled)
Sourcepub fn lifecycle_mut(&mut self) -> Option<&mut LifecycleManager>
pub fn lifecycle_mut(&mut self) -> Option<&mut LifecycleManager>
Get mutable lifecycle manager (if enabled)
Sourcepub fn shutdown(&self) -> &ShutdownHandle
pub fn shutdown(&self) -> &ShutdownHandle
Get the shutdown handle
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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