Trait bonsaidb_server::TcpService
source · [−]pub trait TcpService: Clone + Send + Sync + 'static {
type ApplicationProtocols: ApplicationProtocols;
fn available_protocols(&self) -> &[Self::ApplicationProtocols];
fn handle_connection<'life0, 'life1, 'async_trait, S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&'life0 self,
connection: S,
peer: &'life1 Peer<Self::ApplicationProtocols>
) -> 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 TCP connections.
Associated Types
The application layer protocols that this service supports.
Required methods
fn available_protocols(&self) -> &[Self::ApplicationProtocols]
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.
fn handle_connection<'life0, 'life1, 'async_trait, S: AsyncRead + AsyncWrite + Unpin + Send + 'static>(
&'life0 self,
connection: S,
peer: &'life1 Peer<Self::ApplicationProtocols>
) -> 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<Self::ApplicationProtocols>
) -> 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.