PingHandler

Trait PingHandler 

Source
pub trait PingHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        request: PingRequest,
        ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<PingResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn get_health_status<'life0, 'async_trait>(
        &'life0 self,
        _ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn get_connection_metrics<'life0, 'async_trait>(
        &'life0 self,
        _ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn handle_timeout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _request_id: &'life1 str,
        _ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn include_health_details(&self) -> bool { ... }
    fn response_threshold_ms(&self) -> u64 { ... }
    fn process_ping_payload<'life0, 'life1, 'async_trait>(
        &'life0 self,
        payload: Option<&'life1 Value>,
        _ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Ping handler trait for bidirectional health monitoring

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, request: PingRequest, ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<PingResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle a ping request

Provided Methods§

Source

fn get_health_status<'life0, 'async_trait>( &'life0 self, _ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current health status

Source

fn get_connection_metrics<'life0, 'async_trait>( &'life0 self, _ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get connection metrics if available

Source

fn handle_timeout<'life0, 'life1, 'async_trait>( &'life0 self, _request_id: &'life1 str, _ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle ping timeout

Source

fn include_health_details(&self) -> bool

Check if ping should include detailed health information

Source

fn response_threshold_ms(&self) -> u64

Get expected response time threshold in milliseconds

Source

fn process_ping_payload<'life0, 'life1, 'async_trait>( &'life0 self, payload: Option<&'life1 Value>, _ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process custom ping payload

Implementors§