darkfi::rpc::server

Trait RequestHandler

Source
pub trait RequestHandler<T>: Sync + Send {
    // Required methods
    fn handle_request<'life0, 'async_trait>(
        &'life0 self,
        req: JsonRequest,
    ) -> Pin<Box<dyn Future<Output = JsonResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn connections_mut<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = MutexGuard<'life0, HashSet<StoppableTaskPtr>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn pong<'life0, 'async_trait>(
        &'life0 self,
        id: u16,
        _params: JsonValue,
    ) -> Pin<Box<dyn Future<Output = JsonResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn connections<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<StoppableTaskPtr>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn mark_connection<'life0, 'async_trait>(
        &'life0 self,
        task: StoppableTaskPtr,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn unmark_connection<'life0, 'async_trait>(
        &'life0 self,
        task: StoppableTaskPtr,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn active_connections<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn stop_connections<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Asynchronous trait implementing a handler for incoming JSON-RPC requests.

Required Methods§

Source

fn handle_request<'life0, 'async_trait>( &'life0 self, req: JsonRequest, ) -> Pin<Box<dyn Future<Output = JsonResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn connections_mut<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = MutexGuard<'life0, HashSet<StoppableTaskPtr>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Implementors§