Module lifecycle

Module lifecycle 

Source
Expand description

Lifecycle management for mode-based dynamic node control

This module provides the lifecycle manager that orchestrates node start/stop based on operational mode changes.

§Architecture

CLI → Redis (mode/request) → LifecycleManager → Supervisor → Nodes

The lifecycle manager:

  • Subscribes to mode change requests
  • Calculates which nodes need to start/stop
  • Uses Supervisor to execute changes
  • Publishes mode changed events

§Example

use mecha10_runtime::lifecycle::LifecycleManager;

let lifecycle = LifecycleManager::new(
    context,
    supervisor,
    mode_config,
    "startup".to_string(),
);

// Run in background
tokio::spawn(async move {
    lifecycle.run().await
});

Structs§

LifecycleManager
Lifecycle manager for mode-based node orchestration
ModeConfig
Configuration for a single mode
ModeDiff
Difference between current and target mode
ModeTransitionResult
Result of a mode transition

Traits§

SupervisorTrait
Trait for supervisor operations