Trait bonsaidb_server::HttpService
source · pub trait HttpService: Clone + Send + Sync + 'static {
// Required method
fn handle_connection<'life0, 'life1, 'async_trait, S>(
&'life0 self,
connection: S,
peer: &'life1 Peer
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>
where S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
A service that can handle incoming HTTP connections. A convenience
implementation of TcpService
that is useful is you are only serving HTTP
and WebSockets over a service.
Required Methods§
sourcefn handle_connection<'life0, 'life1, 'async_trait, S>(
&'life0 self,
connection: S,
peer: &'life1 Peer
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>where
S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_connection<'life0, 'life1, 'async_trait, S>( &'life0 self, connection: S, peer: &'life1 Peer ) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>where S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Handle an incoming connection
for peer
. Return Err(connection)
to
have BonsaiDb handle the connection internally.