Supervisor

Trait Supervisor 

Source
pub trait Supervisor:
    Send
    + Sync
    + 'static {
    // Required methods
    fn ssh_keys<'life0, 'async_trait>(
        &'life0 self,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Option<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn network_config<'life0, 'async_trait>(
        &'life0 self,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Option<NetworkConfig>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn parameters<'life0, 'async_trait>(
        &'life0 self,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Option<HashMap<String, ParameterValue>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn puppet_ready<'life0, 'async_trait>(
        &'life0 self,
        puppet_event_id: u64,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn puppet_shutdown<'life0, 'async_trait>(
        &'life0 self,
        puppet_event_id: u64,
        supervisor_event_id: Option<u64>,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn puppet_reboot<'life0, 'async_trait>(
        &'life0 self,
        puppet_event_id: u64,
        supervisor_event_id: Option<u64>,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn terminate_job<'life0, 'async_trait>(
        &'life0 self,
        puppet_event_id: u64,
        supervisor_event_id: Option<u64>,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn handle_request<'life0, 'async_trait>(
        &'life0 self,
        _request_id: u64,
        req: PuppetReq,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = SupervisorResp> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn handle_event<'life0, 'async_trait>(
        &'life0 self,
        puppet_event_id: u64,
        event: PuppetEvent,
        host_id: Uuid,
        job_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Supervisor interface for control socket servers.

A puppet connects to a supervisor through a control socket (e.g., TCP or Unix SeqPacket). These control socket servers will, in turn, deliver requests and events to supervisors. This trait is implemented by supervisors to facilitate the delivery of these events.

Required Methods§

Source

fn ssh_keys<'life0, 'async_trait>( &'life0 self, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = Option<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puppet SSH keys request.

If the supervisor maintains a set of SSH authorized keys that should be deployed on the puppet, it should return with Some(<authorized keys set>).

When a supervisor returns None, it indicates that this request is not supported. A puppet may or may not retry sending SSH keys requests at a later point in time when the supervisor ever returned None. If a supervisor is able to provide SSH authorized keys generally, but currently has none configured, it should instead return Some(vec![]).

Source

fn network_config<'life0, 'async_trait>( &'life0 self, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = Option<NetworkConfig>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puppet network configuration request.

Hosts may obtain their network configuration through various means, such as using DHCP, IPv6 RA, or through static configuration. However, this request endpoint can be used by puppets that do not have another means to obtain their network configuration, and where a network connection is not required to connect to the puppet control socket (such as with UnixSeqpacket for Linux containers or VirtIO channels in a QEMU VM).

If this endpoint is supported by the supervisor, it must at least supply the host’s hostname, and may optionally provide IPv4 and IPv6 addresses, gateways, and a DNS server.

Source

fn parameters<'life0, 'async_trait>( &'life0 self, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = Option<HashMap<String, ParameterValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puppet job parameters request.

If the supervisor deems that this job is currently active, it should respond with the full set of parameters supplied by the coordinator.

Returning None implies that this job id is currently not active. If a job has no parameters defined, the parameters field should be an empty HashMap.

Source

fn puppet_ready<'life0, 'async_trait>( &'life0 self, puppet_event_id: u64, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn puppet_shutdown<'life0, 'async_trait>( &'life0 self, puppet_event_id: u64, supervisor_event_id: Option<u64>, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn puppet_reboot<'life0, 'async_trait>( &'life0 self, puppet_event_id: u64, supervisor_event_id: Option<u64>, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn terminate_job<'life0, 'async_trait>( &'life0 self, puppet_event_id: u64, supervisor_event_id: Option<u64>, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puppet requests job to be terminated.

Provided Methods§

Source

fn handle_request<'life0, 'async_trait>( &'life0 self, _request_id: u64, req: PuppetReq, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = SupervisorResp> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generic request handler.

The default implementation of this method calls out to the other methods of this trait and should normally not need to be overriden. This method is to be used by control socket server implementations.

Source

fn handle_event<'life0, 'async_trait>( &'life0 self, puppet_event_id: u64, event: PuppetEvent, host_id: Uuid, job_id: Uuid, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§