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]
&'_ mut self,
peer_id: PeerId,
addrs: Vec<Multiaddr, Global>
)
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]
&'_ mut self
) -> Result<Vec<KBucketView, Global>, KadError>
pub async fn dump_statistics(&'_ mut self) -> Result<KademliaStats, KadError>
[src]
pub async fn dump_messengers(
&'_ mut self
) -> Result<Vec<KadMessengerView, Global>, KadError>
[src]
&'_ mut self
) -> Result<Vec<KadMessengerView, Global>, KadError>
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]
&'_ mut self,
boot: Vec<(PeerId, Multiaddr), Global>
) -> Result<(), KadError>
Initiates bootstrapping and waits for the result.
pub async fn lookup(
&'_ mut self,
key: Key
) -> Result<Vec<KadPeer, Global>, KadError>
[src]
&'_ mut self,
key: Key
) -> Result<Vec<KadPeer, Global>, KadError>
Lookup the closer peers with the given key.
pub async fn find_peer(
&'_ mut self,
peer_id: &'_ PeerId
) -> Result<KadPeer, KadError>
[src]
&'_ mut self,
peer_id: &'_ PeerId
) -> Result<KadPeer, KadError>
pub async fn put_value(
&'_ mut self,
key: Vec<u8, Global>,
value: Vec<u8, Global>
) -> Result<(), KadError>
[src]
&'_ mut self,
key: Vec<u8, Global>,
value: Vec<u8, Global>
) -> Result<(), KadError>
pub async fn get_value(
&'_ mut self,
key: Vec<u8, Global>
) -> Result<Vec<u8, Global>, KadError>
[src]
&'_ mut self,
key: Vec<u8, Global>
) -> Result<Vec<u8, Global>, KadError>
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]
&'_ mut self,
key: Vec<u8, Global>
) -> Result<(), KadError>
pub async fn find_providers(
&'_ mut self,
key: Vec<u8, Global>,
count: usize
) -> Result<Vec<KadPeer, Global>, KadError>
[src]
&'_ mut self,
key: Vec<u8, Global>,
count: usize
) -> Result<Vec<KadPeer, Global>, KadError>
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.
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,
Control: 'async_trait,
[src]
&'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,
Control: 'async_trait,
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,
Control: 'async_trait,
[src]
&'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,
Control: 'async_trait,
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,
Control: 'async_trait,
[src]
&'life0 mut self,
key: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
Control: 'async_trait,
pub fn box_clone(&self) -> Box<dyn Routing + 'static, Global>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,