Trait bonsaidb_server::HttpService
source · [−]pub trait HttpService: Clone + Send + Sync + 'static {
fn handle_connection<'life0, 'life1, 'async_trait, S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&'life0 self,
connection: S,
peer: &'life1 Peer
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>
where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
fn handle_connection<'life0, 'life1, 'async_trait, S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&'life0 self,
connection: S,
peer: &'life1 Peer
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn handle_connection<'life0, 'life1, 'async_trait, S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&'life0 self,
connection: S,
peer: &'life1 Peer
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Handle an incoming connection for peer. Return Err(connection) to
have BonsaiDb handle the connection internally.