Skip to main content

RaftListenerHandshake

Trait RaftListenerHandshake 

Source
pub trait RaftListenerHandshake: Send + Sync {
    // Required method
    fn upgrade<'life0, 'life1, 'async_trait>(
        &'life0 self,
        stream: HandshakeStream,
        api_versions: &'life1 dyn ControllerApiVersions,
    ) -> Pin<Box<dyn Future<Output = Result<RaftConnection, RaftHandshakeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Per-connection handshake hook.

Implementors consume the accepted HandshakeStream and return one of two things. On success they return an authenticated Box<dyn ClientDuplex> that carries the raft frames. On failure they return a RaftHandshakeError, and the listener then drops the connection at debug level. The listener closes a handshake that reads and writes nothing for connections.max.idle.ms, so a slow peer that keeps sending is not closed.

Required Methods§

Source

fn upgrade<'life0, 'life1, 'async_trait>( &'life0 self, stream: HandshakeStream, api_versions: &'life1 dyn ControllerApiVersions, ) -> Pin<Box<dyn Future<Output = Result<RaftConnection, RaftHandshakeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upgrades one accepted connection.

A SASL listener answers the ApiVersions requests that arrive before authentication with api_versions, which gives the same answer as the listener gives after authentication. Kafka’s SocketServer hands the same apiVersionSupplier to SaslServerAuthenticator.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§