Expand description
Mecha10 Runtime - Node supervision and lifecycle management
This crate provides a runtime supervisor for Mecha10 nodes, handling:
- Node launching and supervision
- Health checking and monitoring
- Graceful shutdown
- Restart policies
- Logging configuration
§Example
use mecha10_runtime::prelude::*;
use async_trait::async_trait;
struct MyNode;
#[async_trait]
impl NodeRunner for MyNode {
fn name(&self) -> &str {
"my_node"
}
async fn run(&mut self) -> anyhow::Result<()> {
// Node logic here
Ok(())
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut runtime = Runtime::builder().build();
runtime.run_node("my_node", Box::new(MyNode)).await?;
Ok(())
}Re-exports§
pub use config::LogFormat;pub use config::RestartPolicy;pub use config::RuntimeConfig;pub use health::HealthChecker;pub use health::HealthStatus;pub use lifecycle::LifecycleManager;pub use lifecycle::ModeConfig;pub use lifecycle::ModeTransitionResult;pub use lifecycle::SupervisorTrait;pub use node::NodeRunner;pub use process::ProcessInfo;pub use process::ProcessManager;pub use process::ProcessStatus;pub use runtime::Runtime;pub use runtime::RuntimeBuilder;pub use shutdown::ShutdownHandle;pub use supervisor::NodeHandle;pub use supervisor::NodeStatus;pub use supervisor::Supervisor;
Modules§
- config
- Runtime configuration types
- health
- Health checking infrastructure
- launcher
- Launcher service integration for dynamic node launching
- lifecycle
- Lifecycle management for mode-based dynamic node control
- logging
- Logging initialization and configuration
- node
- Node runner trait and types
- prelude
- Prelude module for convenient imports
- process
- External process management for node lifecycle
- runtime
- Main runtime for Mecha10 nodes
- shutdown
- Graceful shutdown handling
- supervisor
- Node supervision and lifecycle management