Expand description
Mecha10 Core Runtime
This crate provides the foundational runtime for the Mecha10 framework, including node lifecycle management, health monitoring, and orchestration.
§Features
- Node lifecycle management (start, stop, restart)
- Health monitoring and automatic recovery
- Process management for node execution
- Integration with config and messaging systems
- Graceful shutdown handling
- Type-safe topics system
- Comprehensive error handling
- Shared message types
§Quick Start
use mecha10::prelude::*;
#[derive(Node)]
#[subscribe(topics::sensor::CAMERA_RGB)]
#[publish(topics::perception::DETECTIONS)]
struct MyNode {
config: MyConfig,
}
#[derive(Config)]
struct MyConfig {
#[validate(range = "0.0..=1.0")]
threshold: f32,
}
#[async_trait]
impl NodeImpl for MyNode {
type Config = MyConfig;
async fn init(config: Self::Config) -> Result<Self> {
Ok(Self { config })
}
async fn run(&mut self, ctx: &Context) -> Result<()> {
let mut images = ctx.subscribe(topics::sensor::CAMERA_RGB).await?;
while let Some(image) = images.recv().await {
// Process image
ctx.publish(&result).await?;
}
Ok(())
}
}Re-exports§
pub use context::Context;pub use context::Receiver;pub use error::Mecha10Error;pub use error::Result;pub use messages::Message;pub use types::*;
Modules§
- actuator
- Shared actuator message types
- aggregated
- Aggregated Topics - Multi-topic subscription with pattern matching
- auth
- Authorization and Access Control
- behavior_
interrupt - Behavior Interrupt Trigger
- circuit_
breaker - Circuit Breaker Pattern for Fault Tolerance
- config
- config_
watcher - Configuration Hot-Reload Support
- context
- Node execution context
- dead_
letter - Dead Letter Queue (DLQ) for Failed Message Processing
- dependency
- Dependency Resolution for Node Startup/Shutdown Ordering
- discovery
- Service Discovery
- error
- health
- Centralized Health Monitoring
- lifecycle
- Lifecycle event schemas for mode-based node management
- macros
- Mecha10 Framework Macros
- messages
- metrics
- Metrics Collection
- model
- Model configuration utilities for AI nodes
- node
- prelude
- priority_
queue - Priority queue for message processing
- profiling
- Performance Profiling Helpers
- publish
- Conditional publishing for declarative message publishing
- rate_
limit - Rate Limiting
- recorder
- Bag File Recording and Replay (ROS bag-like)
- recovery
- Graceful Degradation and Automatic Recovery Policies
- redis_
bridge - Redis Bridge
- rpc
- Request/Response (RPC) Pattern
- rpc_
breaker - RPC with Circuit Breaker Integration
- rpc_
streaming - Streaming RPC for Long-Running Operations
- schema
- Schema Registry
- schema_
validation - JSON Schema Validation for Mecha10 Configuration
- secrets
- Secrets Management
- sensor
- Shared sensor message types
- service
- Service Pattern for Infrastructure Components
- service_
manager - Service Manager for Lifecycle Management
- state
- Persistent State Storage Abstraction for Nodes
- stream
- Stream combinators for declarative message processing
- teleop
- Teleoperation message types
- topic_
registry - Topic Registry for Runtime Introspection and Validation
- topic_
utils - Topic utility functions
- topics
- Type-Safe Topics System
- tracing_
otel - Distributed Tracing with OpenTelemetry
- types
- Core type definitions shared across the Mecha10 framework
Macros§
- in_
node_ context - Macro to execute code within a node’s logging context
- run_
node_ simple - Run a node with automatic config loading and context creation
- run_
node_ with_ instance - Run a node with instance support for multi-instance deployments
- topic_
group - Macro to define topic groups
Structs§
- Runtime
- Runtime orchestrator for managing nodes
Enums§
- Runtime
Error - Core runtime errors
Type Aliases§
- Runtime
Result - Result type for runtime operations