Trait bonsaidb::server::TcpService
source · 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, Global>>
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§
sourcetype ApplicationProtocols: ApplicationProtocols
type ApplicationProtocols: ApplicationProtocols
The application layer protocols that this service supports.
Required Methods§
sourcefn 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.
sourcefn 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, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
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, Global>>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.