pub trait Routing: Send {
// Required methods
fn find_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>, TransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_providers<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, TransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn provide<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn box_clone(&self) -> IRouting;
}
Expand description
routing
trait for finding a peer.
Required Methods§
Sourcefn find_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the addresses of a remote peer.
Any types supporting this trait can be used to search network for the addresses, f.g., Kad-DHT.
Sourcefn find_providers<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_providers<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the providers for the given key.
Sourcefn provide<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn provide<'life0, 'async_trait>(
&'life0 mut self,
key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Starts announcing the given key to the content routing network.