Trait Controller

Source
pub trait Controller:
    Send
    + Sync
    + 'static {
    type WorkerConnectStream: Stream<Item = Result<Task, Status>> + Send + 'static;
    type DoMeasurementStream: Stream<Item = Result<TaskResult, Status>> + Send + 'static;

    // Required methods
    fn measurement_finished<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Finished>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn worker_connect<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Worker>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::WorkerConnectStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn do_measurement<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ScheduleMeasurement>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::DoMeasurementStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_workers<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Empty>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Status>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_result<'life0, 'async_trait>(
        &'life0 self,
        request: Request<TaskResult>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with ControllerServer.

Required Associated Types§

Source

type WorkerConnectStream: Stream<Item = Result<Task, Status>> + Send + 'static

Server streaming response type for the WorkerConnect method.

Source

type DoMeasurementStream: Stream<Item = Result<TaskResult, Status>> + Send + 'static

Server streaming response type for the DoMeasurement method.

Required Methods§

Source

fn measurement_finished<'life0, 'async_trait>( &'life0 self, request: Request<Finished>, ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Worker lets the orchestrator know the measurement is finished

Source

fn worker_connect<'life0, 'async_trait>( &'life0 self, request: Request<Worker>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::WorkerConnectStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Worker announces itself, and starts its connection with the orchestrator. The orchestrator sends a stream of tasks

Source

fn do_measurement<'life0, 'async_trait>( &'life0 self, request: Request<ScheduleMeasurement>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::DoMeasurementStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CLI instructs orchestrator to perform a measurement

Source

fn list_workers<'life0, 'async_trait>( &'life0 self, request: Request<Empty>, ) -> Pin<Box<dyn Future<Output = Result<Response<Status>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

CLI asks orchestrator its current status (list of connected workers and measurements)

Source

fn send_result<'life0, 'async_trait>( &'life0 self, request: Request<TaskResult>, ) -> Pin<Box<dyn Future<Output = Result<Response<Ack>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Worker sends TaskResult to orchestrator

Implementors§

Source§

impl Controller for ControllerService

Implementation of the Controller trait for the ControllerService Handles communication with the workers and the CLI