Trait Agent

Source
pub trait Agent:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_nodes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_node<'life0, 'life1, 'async_trait>(
        &'life0 self,
        node_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Node, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_instance<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        node_id: &'life1 str,
        name: &'life2 str,
        cpu: u32,
        memory: u32,
        storage: u32,
    ) -> Pin<Box<dyn Future<Output = Result<AppInstance, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn terminate_instance<'life0, 'life1, 'async_trait>(
        &'life0 self,
        instance_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_instance<'life0, 'life1, 'async_trait>(
        &'life0 self,
        instance_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<AppInstance, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_instances<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AppInstance>, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_instance_metrics<'life0, 'life1, 'async_trait>(
        &'life0 self,
        instance_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, f32>, AutoscalerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Interface for an agent that manages app instance operations on nodes

Required Methods§

Source

fn id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the unique ID of this agent

Source

fn get_nodes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Node>, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the nodes managed by this agent

Source

fn get_node<'life0, 'life1, 'async_trait>( &'life0 self, node_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Node, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get information about a specific node

Source

fn create_instance<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, node_id: &'life1 str, name: &'life2 str, cpu: u32, memory: u32, storage: u32, ) -> Pin<Box<dyn Future<Output = Result<AppInstance, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a new app instance on a specific node

Source

fn terminate_instance<'life0, 'life1, 'async_trait>( &'life0 self, instance_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Terminate an app instance

Source

fn get_instance<'life0, 'life1, 'async_trait>( &'life0 self, instance_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<AppInstance, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get information about a specific app instance

Source

fn get_instances<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppInstance>, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all app instances managed by this agent

Source

fn get_instance_metrics<'life0, 'life1, 'async_trait>( &'life0 self, instance_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, f32>, AutoscalerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get metrics for a specific app instance

Implementors§