pub trait TxImp:
'static
+ Send
+ Sync
+ Debug {
// Required methods
fn url(&self) -> Option<Url>;
fn disconnect(
&self,
peer: Url,
payload: Option<(String, Bytes)>,
) -> BoxFut<'_, ()>;
fn send(&self, peer: Url, data: Bytes) -> BoxFut<'_, K2Result<()>>;
fn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>;
}Expand description
A low-level transport implementation.
Required Methods§
Sourcefn disconnect(
&self,
peer: Url,
payload: Option<(String, Bytes)>,
) -> BoxFut<'_, ()>
fn disconnect( &self, peer: Url, payload: Option<(String, Bytes)>, ) -> BoxFut<'_, ()>
Indicates that the implementation should close any open connections to the given peer. If a payload is provided, the implementation can make a best effort to send it to the remote first on a short timeout. Regardless of the success of the payload send, the connection should be closed.
Sourcefn send(&self, peer: Url, data: Bytes) -> BoxFut<'_, K2Result<()>>
fn send(&self, peer: Url, data: Bytes) -> BoxFut<'_, K2Result<()>>
Indicates that the implementation should send the payload to the remote peer, opening a connection if needed.
Sourcefn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>
fn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>
Dump network stats.