mecha10-runtime 0.8.0

Runtime supervisor for Mecha10 nodes - launching, monitoring, and lifecycle management
Documentation
//! Node runner trait and types

use crate::health::HealthStatus;
use anyhow::Result;
use async_trait::async_trait;

#[async_trait]
pub trait NodeRunner: Send + Sync {
    /// Get the node name
    fn name(&self) -> &str;

    /// Run the node
    async fn run(&mut self) -> Result<()>;

    /// Perform a health check
    ///
    /// Override this method to provide custom health checking logic.
    /// By default, nodes are considered healthy.
    async fn health_check(&self) -> HealthStatus {
        HealthStatus::Healthy
    }

    /// Handle shutdown signal
    ///
    /// Override this method to perform cleanup before shutdown.
    /// By default, no special cleanup is performed.
    async fn shutdown(&mut self) -> Result<()> {
        Ok(())
    }
}