[][src]Struct libp2prs_kad::Control

pub struct Control { /* fields omitted */ }

Implementations

impl Control[src]

pub async fn close(&mut self)[src]

Closes the Kad main loop and tasks.

pub async fn add_node(&mut self, peer_id: PeerId, addrs: Vec<Multiaddr>)[src]

Add a node and its listening addresses to KBuckets.

pub async fn remove_node(&mut self, peer_id: PeerId)[src]

Add a node and its listening addresses to KBuckets.

pub async fn dump_kbuckets(&mut self) -> Result<Vec<KBucketView>, KadError>[src]

pub async fn dump_statistics(&mut self) -> Result<KademliaStats, KadError>[src]

pub async fn dump_messengers(
    &mut self
) -> Result<Vec<KadMessengerView>, KadError>
[src]

pub async fn bootstrap(&mut self)[src]

Initiate bootstrapping.

In general it should be done only once upon Kad startup.

pub async fn lookup(&mut self, key: Key) -> Result<Vec<KadPeer>, KadError>[src]

Lookup the closer peers with the given key.

pub async fn find_peer(&mut self, peer_id: &PeerId) -> Result<KadPeer, KadError>[src]

pub async fn put_value(
    &mut self,
    key: Vec<u8>,
    value: Vec<u8>
) -> Result<(), KadError>
[src]

pub async fn get_value(&mut self, key: Vec<u8>) -> Result<Vec<u8>, KadError>[src]

pub async fn provide(&mut self, key: Vec<u8>) -> Result<(), KadError>[src]

pub async fn find_providers(
    &mut self,
    key: Vec<u8>,
    count: usize
) -> Option<Vec<KadPeer>>
[src]

Trait Implementations

impl Clone for Control[src]

impl Routing for Control[src]

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,