mecha10_runtime/
lib.rs

1//! Mecha10 Runtime - Node supervision and lifecycle management
2//!
3//! This crate provides a runtime supervisor for Mecha10 nodes, handling:
4//! - Node launching and supervision
5//! - Health checking and monitoring
6//! - Graceful shutdown
7//! - Restart policies
8//! - Logging configuration
9//!
10//! # Example
11//!
12//! ```rust,no_run
13//! use mecha10_runtime::prelude::*;
14//! use async_trait::async_trait;
15//!
16//! struct MyNode;
17//!
18//! #[async_trait]
19//! impl NodeRunner for MyNode {
20//!     fn name(&self) -> &str {
21//!         "my_node"
22//!     }
23//!
24//!     async fn run(&mut self) -> anyhow::Result<()> {
25//!         // Node logic here
26//!         Ok(())
27//!     }
28//! }
29//!
30//! #[tokio::main]
31//! async fn main() -> anyhow::Result<()> {
32//!     let mut runtime = Runtime::builder().build();
33//!     runtime.run_node("my_node", Box::new(MyNode)).await?;
34//!     Ok(())
35//! }
36//! ```
37
38pub mod config;
39pub mod health;
40pub mod launcher;
41pub mod lifecycle;
42pub mod logging;
43pub mod node;
44pub mod process;
45pub mod runtime;
46pub mod shutdown;
47pub mod supervisor;
48
49// Re-exports for convenience
50pub use config::{LogFormat, RestartPolicy, RuntimeConfig};
51pub use health::{HealthChecker, HealthStatus};
52pub use lifecycle::{LifecycleManager, ModeConfig, ModeTransitionResult, SupervisorTrait};
53pub use node::NodeRunner;
54pub use process::{ProcessInfo, ProcessManager, ProcessStatus};
55pub use runtime::{Runtime, RuntimeBuilder};
56pub use shutdown::ShutdownHandle;
57pub use supervisor::{NodeHandle, NodeStatus, Supervisor};
58
59/// Prelude module for convenient imports
60pub mod prelude {
61    pub use crate::config::{LogFormat, RestartPolicy, RuntimeConfig};
62    pub use crate::health::{HealthChecker, HealthStatus};
63    pub use crate::lifecycle::{LifecycleManager, ModeConfig, ModeTransitionResult, SupervisorTrait};
64    pub use crate::node::NodeRunner;
65    pub use crate::process::{ProcessInfo, ProcessManager, ProcessStatus};
66    pub use crate::runtime::{Runtime, RuntimeBuilder};
67    pub use crate::shutdown::ShutdownHandle;
68    pub use crate::supervisor::{NodeHandle, NodeStatus, Supervisor};
69    pub use async_trait::async_trait;
70}