use a3s_box_core::scale::{InstanceHealth, InstanceState};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
mod manager;
mod registry;
#[cfg(test)]
mod tests;
pub use manager::ScaleManager;
pub use registry::InstanceRegistry;
#[derive(Debug, Clone)]
pub(super) struct ServiceInstances {
pub(super) target_replicas: u32,
pub(super) instances: Vec<TrackedInstance>,
}
#[derive(Debug, Clone)]
pub(super) struct TrackedInstance {
pub(super) id: String,
pub(super) state: InstanceState,
pub(super) created_at: DateTime<Utc>,
pub(super) ready_at: Option<DateTime<Utc>>,
pub(super) endpoint: Option<String>,
pub(super) health: InstanceHealth,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ServiceHealth {
pub active_instances: u32,
pub ready_instances: u32,
pub busy_instances: u32,
pub avg_cpu_percent: Option<f32>,
pub total_memory_bytes: u64,
pub total_inflight_requests: u32,
pub unhealthy_instances: u32,
}