api::v1::meta::heartbeat_server

Trait Heartbeat

pub trait Heartbeat:
    Send
    + Sync
    + 'static {
    type HeartbeatStream: Stream<Item = Result<HeartbeatResponse, Status>> + Send + 'static;

    // Required methods
    fn heartbeat<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<HeartbeatRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::HeartbeatStream>, Status>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn ask_leader<'life0, 'async_trait>(
        &'life0 self,
        request: Request<AskLeaderRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<AskLeaderResponse>, Status>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

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

Required Associated Types§

type HeartbeatStream: Stream<Item = Result<HeartbeatResponse, Status>> + Send + 'static

Server streaming response type for the Heartbeat method.

Required Methods§

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

Heartbeat, there may be many contents of the heartbeat, such as:

  1. Metadata to be registered to meta server and discoverable by other nodes.
  2. Some performance metrics, such as Load, CPU usage, etc.
  3. The number of computing tasks being executed.

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

Ask leader’s endpoint.

Implementors§