Router

Trait Router 

Source
pub trait Router {
    // Required methods
    fn route_request<'life0, 'async_trait>(
        &'life0 self,
        request: Request,
    ) -> Pin<Box<dyn Future<Output = Result<Receiver<Response>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn register_service<'life0, 'async_trait>(
        &'life0 self,
        service_id: String,
    ) -> Pin<Box<dyn Future<Output = Result<ResponseHandler>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn drop_service<'life0, 'async_trait>(
        &'life0 self,
        service_id: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Request to response transport abstraction

// > Clients
// send request ------------------> Received response
// --------------------------------------
// > Connection to Router
// tx                               rx
//  |                                |
// rx                               tx
// --------------------------------------
// > Router: We're here
// Find responder tx by id         Find requester by id
// --------------------------------------
// > Connection to service providers
// tx                              rx
//  |                               |
// rx                              tx
// --------------------------------------
// > Service providers
// responder -----> process -----> Response

Required Methods§

Source

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

Source

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

Source

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

Implementors§