Trait TxImp

Source
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 get_connected_peers(&self) -> BoxFut<'_, K2Result<Vec<Url>>>;
    fn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>;
}
Expand description

A low-level transport implementation.

Required Methods§

Source

fn url(&self) -> Option<Url>

Get the current url if any.

Source

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.

Source

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.

Source

fn get_connected_peers(&self) -> BoxFut<'_, K2Result<Vec<Url>>>

Get the list of connected peers.

Source

fn dump_network_stats(&self) -> BoxFut<'_, K2Result<TransportStats>>

Dump network stats.

Implementors§