pub struct KNodeTable<Id, Info> { /* private fields */ }Expand description
KNodeTable Implementation This uses a flattened approach whereby buckets are pre-allocated and indexed by their distance from the local Id as a simplification of the allocation based branching approach introduced in the paper.
Implementations§
Source§impl<Id, Info> KNodeTable<Id, Info>
impl<Id, Info> KNodeTable<Id, Info>
Sourcepub fn new(id: Id, bucket_size: usize, hash_size: usize) -> KNodeTable<Id, Info>
pub fn new(id: Id, bucket_size: usize, hash_size: usize) -> KNodeTable<Id, Info>
Create a new KNodeTable with the provded bucket and hash sizes
Trait Implementations§
Source§impl<Id, Info> NodeTable<Id, Info> for KNodeTable<Id, Info>
impl<Id, Info> NodeTable<Id, Info> for KNodeTable<Id, Info>
Source§fn create_or_update(&mut self, node: &Entry<Id, Info>) -> bool
fn create_or_update(&mut self, node: &Entry<Id, Info>) -> bool
Create or update a node in the NodeTable
Source§fn nearest(&self, id: &Id, range: Range<usize>) -> Vec<Entry<Id, Info>>
fn nearest(&self, id: &Id, range: Range<usize>) -> Vec<Entry<Id, Info>>
Find the nearest nodes to the provided Id in the given range
Source§fn contains(&self, id: &Id) -> Option<Entry<Id, Info>>
fn contains(&self, id: &Id) -> Option<Entry<Id, Info>>
Check if the node NodeTable contains a given node by Id This returns the node object if found
Source§fn oldest<'a>(&'a self, index: usize) -> Option<Entry<Id, Info>>
fn oldest<'a>(&'a self, index: usize) -> Option<Entry<Id, Info>>
Fetch the oldest node in the specified bucket
Source§fn update_entry<F>(&mut self, id: &Id, f: F) -> bool
fn update_entry<F>(&mut self, id: &Id, f: F) -> bool
Update an entry by ID
Source§fn remove_entry(&mut self, id: &Id)
fn remove_entry(&mut self, id: &Id)
Remove an entry by ID
Source§fn bucket_info(&self) -> Vec<BucketInfo>
fn bucket_info(&self) -> Vec<BucketInfo>
Fetch information from each bucket
Auto Trait Implementations§
impl<Id, Info> Freeze for KNodeTable<Id, Info>where
Id: Freeze,
impl<Id, Info> RefUnwindSafe for KNodeTable<Id, Info>where
Id: RefUnwindSafe,
Info: RefUnwindSafe,
impl<Id, Info> Send for KNodeTable<Id, Info>
impl<Id, Info> Sync for KNodeTable<Id, Info>
impl<Id, Info> Unpin for KNodeTable<Id, Info>
impl<Id, Info> UnsafeUnpin for KNodeTable<Id, Info>where
Id: UnsafeUnpin,
impl<Id, Info> UnwindSafe for KNodeTable<Id, Info>where
Id: UnwindSafe,
Info: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more