Struct libp2p_rs::kad::Control[][src]

pub struct Control { /* fields omitted */ }

Implementations

impl Control[src]

pub 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, Global>
)
[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_storage(&'_ mut self) -> Result<StorageStats, KadError>[src]

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

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

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

pub async fn bootstrap(&'_ mut self, boot: Vec<(PeerId, Multiaddr), Global>)[src]

Initiates bootstrapping.

Most likely it should be invoked once upon Kad startup.

pub async fn bootstrap_wait(
    &'_ mut self,
    boot: Vec<(PeerId, Multiaddr), Global>
) -> Result<(), KadError>
[src]

Initiates bootstrapping and waits for the result.

pub async fn lookup(
    &'_ mut self,
    key: Key
) -> Result<Vec<KadPeer, Global>, 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, Global>,
    value: Vec<u8, Global>
) -> Result<(), KadError>
[src]

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

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

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

pub async fn find_providers(
    &'_ mut self,
    key: Vec<u8, Global>,
    count: usize
) -> Result<Vec<KadPeer, Global>, KadError>
[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

impl !RefUnwindSafe for Control

impl Send for Control

impl Sync for Control

impl Unpin for Control

impl !UnwindSafe for Control

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>,