Trait libp2p_rs::core::routing::Routing[][src]

pub trait Routing: Send {
    #[must_use]
    pub fn find_peer<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        peer_id: &'life1 PeerId
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr, Global>, TransportError>> + 'async_trait + Send, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn find_providers<'life0, 'async_trait>(
        &'life0 mut self,
        key: Vec<u8, Global>,
        count: usize
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId, Global>, TransportError>> + 'async_trait + Send, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn provide<'life0, 'async_trait>(
        &'life0 mut self,
        key: Vec<u8, Global>
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + 'async_trait + Send, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
pub fn box_clone(&self) -> Box<dyn Routing + 'static, Global>; }

routing trait for finding a peer.

Required methods

#[must_use]
pub fn find_peer<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    peer_id: &'life1 PeerId
) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr, Global>, TransportError>> + 'async_trait + Send, Global>> 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]
pub fn find_providers<'life0, 'async_trait>(
    &'life0 mut self,
    key: Vec<u8, Global>,
    count: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId, Global>, TransportError>> + 'async_trait + Send, Global>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Retrieves the providers for the given key.

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

Starts announcing the given key to the content routing network.

pub fn box_clone(&self) -> Box<dyn Routing + 'static, Global>[src]

Loading content...

Implementors

impl Routing for Control[src]

Implements Routing for Kad Control. Therefore, Kad control can be used by Swarm to find peers.

Loading content...