pub trait TcpService: Clone + Send + Sync + 'static {
    type ApplicationProtocols: ApplicationProtocols;

    // Required methods
    fn available_protocols(&self) -> &[Self::ApplicationProtocols];
    fn handle_connection<'life0, 'life1, 'async_trait, S>(
        &'life0 self,
        connection: S,
        peer: &'life1 Peer<Self::ApplicationProtocols>
    ) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
             Self: 'async_trait;
}
Expand description

A service that can handle incoming TCP connections.

Required Associated Types§

source

type ApplicationProtocols: ApplicationProtocols

The application layer protocols that this service supports.

Required Methods§

source

fn available_protocols(&self) -> &[Self::ApplicationProtocols]

Returns all available protocols for this service. The first will be the default used if a connection is made without negotiating the application protocol.

source

fn handle_connection<'life0, 'life1, 'async_trait, S>( &'life0 self, connection: S, peer: &'life1 Peer<Self::ApplicationProtocols> ) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static, Self: 'async_trait,

Handle an incoming connection for peer. Return Err(connection) to have BonsaiDb handle the connection internally.

Object Safety§

This trait is not object safe.

Implementors§