worker_autoscaler_director - OmniCloudOrg/OmniOrchestrator GitHub Wiki

director (src/worker_autoscaler)

Path: src/worker_autoscaler/director.rs

Table of Contents

Public Items

trait Director

Definition

pub trait Director: Send + Sync + std::fmt::Debug {
    /// Get the unique ID of this director
    async fn id(&self) -> String;
    
    /// Get the nodes managed by this director
    async fn get_nodes(&self) -> Result<Vec<Node>, AutoscalerError>;
    
    /// Get information about a specific node
    async fn get_node(&self, node_id: &str) -> Result<Node, AutoscalerError>;
    
    /// Create a new VM on a specific node
    async fn create_vm(&self, node_id: &str, name: &str, cpu: u32, memory: u32, storage: u32) 
        -> Result<VM, AutoscalerError>;
    
    /// Terminate a VM
    async fn terminate_vm(&self, vm_id: &str) -> Result<(), AutoscalerError>;
    
    /// Get information about a specific VM
    async fn get_vm(&self, vm_id: &str) -> Result<VM, AutoscalerError>;
    
    /// Get all VMs managed by this director
    async fn get_vms(&self) -> Result<Vec<VM>, AutoscalerError>;
    
    /// Get metrics for a specific VM
    async fn get_vm_metrics(&self, vm_id: &str) -> Result<HashMap<String, f32>, AutoscalerError>;
}

Documentation

Interface for a director that manages VM operations on nodes

struct CloudDirector

Definition

pub struct CloudDirector {
    /// Unique ID of this director
    id: String,
    /// Name of the cloud provider
    provider: String,
    /// Region for this cloud provider
    region: String,
    /// Simulated nodes for this director
    nodes: Arc<Mutex<HashMap<String, Node>>>,
    /// Simulated VMs for this director
    vms: Arc<Mutex<HashMap<String, VM>>>,
}

Documentation

Implementation of a cloud director (AWS, Azure, GCP)

fn new

Definition

    pub fn new(id: String, provider: String, region: String) -> Self {
        let mut nodes = HashMap::new();

Documentation

Create a new cloud director

⚠️ **GitHub.com Fallback** ⚠️