[−][src]Struct libp2p_kad::kbucket::KBucketsTable
Table of k-buckets.
Methods
impl<Id, Val> KBucketsTable<Id, Val> where
Id: KBucketsPeerId,
[src]
impl<Id, Val> KBucketsTable<Id, Val> where
Id: KBucketsPeerId,
pub fn new(my_id: Id, ping_timeout: Duration) -> Self | [src] |
Builds a new routing table.
ⓘImportant traits for BucketsIter<'a, Id, Val>
ⓘImportant traits for BucketsIter<'a, Id, Val>
pub fn buckets(&mut self) -> BucketsIter<Id, Val> | [src] |
Returns an iterator to all the buckets of this table.
Ordered by proximity to the local node. Closest bucket (with max. one node in it) comes first.
pub fn my_id(&self) -> &Id | [src] |
Returns the ID of the local node.
pub fn find_closest(&mut self, id: &Id) -> VecIntoIter<Id> where | [src] |
Finds the num
nodes closest to id
, ordered by distance.
pub fn find_closest_with_self(&mut self, id: &Id) -> VecIntoIter<Id> where | [src] |
Same as find_closest
, but includes the local peer as well.
pub fn update(&mut self, id: Id, value: Val) -> UpdateOutcome<Id, Val> | [src] |
Marks the node as "most recent" in its bucket and modifies the value associated to it. This function should be called whenever we receive a communication from a node.
Trait Implementations
impl<Id: Clone, Val: Clone> Clone for KBucketsTable<Id, Val>
[src]
impl<Id: Clone, Val: Clone> Clone for KBucketsTable<Id, Val>
fn clone(&self) -> KBucketsTable<Id, Val> | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl<Id: Debug, Val: Debug> Debug for KBucketsTable<Id, Val>
[src]
impl<Id: Debug, Val: Debug> Debug for KBucketsTable<Id, Val>
Auto Trait Implementations
impl<Id, Val> Send for KBucketsTable<Id, Val> where
Id: Send,
Val: Send,
impl<Id, Val> Send for KBucketsTable<Id, Val> where
Id: Send,
Val: Send,
impl<Id, Val> Sync for KBucketsTable<Id, Val> where
Id: Sync,
Val: Sync,
impl<Id, Val> Sync for KBucketsTable<Id, Val> where
Id: Sync,
Val: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self
impl<T> Erased for T
impl<T> Erased for T