righvalor 0.1.0

RighValor: AI Infrastructure and Applications Framework for the Far Edge
use ractor_cluster::RactorClusterMessage;

use crate::{
    common::task::ValorMasterTask,
    master::{ValorMasterRejectedReason, ValorMasterServiceManagement},
};
/// Messages that Worker can receive from Valor Master and external systems.
///
/// These messages implement the northbound communication protocol where the
/// Valor Master sends task assignments, service management commands, and
/// registration responses to Valor Workers.
///
/// ## Communication Flow
///
/// - **Registration Flow**: Master confirms or rejects worker registration
/// - **Task Assignment**: Master distributes computational tasks to workers
/// - **Service Management**: Master sends service lifecycle commands
/// - **Operational Control**: Master sends operational commands like shutdown
#[derive(Debug, Clone, RactorClusterMessage)]
pub enum ValorWorkerMessage {
    /// Shutdown the worker gracefully
    Shutdown,

    /// Northbound: Master has confirmed worker registration
    ///
    /// Sent by Valor Master to acknowledge successful worker registration
    /// and indicate the worker is now part of the distributed compute cluster.
    NorthboundRegisterMasterConfirmed,

    /// Northbound: Master has rejected worker registration
    ///
    /// Sent by Valor Master when worker registration fails, including
    /// the specific reason for rejection to enable corrective action.
    NorthboundRegisterMasterRejected(ValorMasterRejectedReason),

    /// Northbound: Master task assignment
    ///
    /// Sent by Valor Master to assign a computational task to this worker.
    /// Contains the task to be executed based on worker capabilities.
    NorthboundMasterTask(Box<ValorMasterTask>),

    /// Northbound: Master service management commands
    ///
    /// Sent by Valor Master to manage the lifecycle of services on this worker.
    /// Includes installation, updates, configuration, and removal commands.
    NorthboundMasterServiceManagements(Vec<ValorMasterServiceManagement>),

    /// Northbound: Master confirmed worker unregistration
    NorthboundUnregisterConfirmed,
}