Skip to main content

FrontendHeartbeatExtension

Trait FrontendHeartbeatExtension 

Source
pub trait FrontendHeartbeatExtension: Send + Sync {
    // Required method
    fn name(&self) -> &str;

    // Provided methods
    fn request_extensions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = FrontendHeartbeatExtensionResult<HashMap<String, Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn response_handler(&self) -> Option<HeartbeatResponseHandlerRef> { ... }
    fn connected<'life0, 'async_trait>(
        &'life0 self,
        _generation: u64,
    ) -> Pin<Box<dyn Future<Output = FrontendHeartbeatExtensionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = FrontendHeartbeatExtensionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

An extension to frontend heartbeat requests, responses, and lifecycle events.

FrontendHeartbeatExtension::request_extensions is called for every heartbeat. A failed call is isolated from the base heartbeat and from other extensions. FrontendHeartbeatExtension::connected is called once for every successfully established connection generation, including reconnects; implementations must therefore be idempotent. FrontendHeartbeatExtension::shutdown is called once during task shutdown after heartbeat I/O has stopped.

Required Methods§

Source

fn name(&self) -> &str

Returns the stable name used to make registration idempotent.

Provided Methods§

Source

fn request_extensions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FrontendHeartbeatExtensionResult<HashMap<String, Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generates request extensions for one heartbeat.

Source

fn response_handler(&self) -> Option<HeartbeatResponseHandlerRef>

Returns a handler to insert into the heartbeat response handler chain.

Errors and [common_meta::heartbeat::handler::HandleControl::Done] are isolated to this extension so they cannot skip later extensions or mandatory OSS handlers.

Source

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

Notifies the extension that a heartbeat connection generation is ready.

Source

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

Stops and joins background work owned by the extension.

Implementors§