Trait libp2prs_core::routing::Routing[][src]

pub trait Routing: Send {
    #[must_use]
    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
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] 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
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn provide<'life0, 'async_trait>(
        &'life0 mut self,
        key: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn box_clone(&self) -> IRouting; }

routing trait for finding a peer.

Required methods

#[must_use]
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
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

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.

#[must_use]
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
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Retrieves the providers for the given key.

#[must_use]
fn provide<'life0, 'async_trait>(
    &'life0 mut self,
    key: Vec<u8>
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Starts announcing the given key to the content routing network.

fn box_clone(&self) -> IRouting[src]

Loading content...

Implementors

Loading content...