Struct xstack::MemoryPeerBook
source · pub struct MemoryPeerBook(/* private fields */);Expand description
An in memory PeerBook implementation
Trait Implementations§
source§impl Default for MemoryPeerBook
impl Default for MemoryPeerBook
source§fn default() -> MemoryPeerBook
fn default() -> MemoryPeerBook
Returns the “default value” for a type. Read more
source§impl DriverPeerBook for MemoryPeerBook
impl DriverPeerBook for MemoryPeerBook
source§fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the peer book size.
source§fn insert<'life0, 'async_trait>(
&'life0 self,
info: PeerInfo,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 self,
info: PeerInfo,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new peer informations. Read more
source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn appear<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
timestamp: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn appear<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
timestamp: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Call this function when the peer is connected.
when the peer is non-existent in the book, returns
Error::PeerNotFoundsource§fn disappear<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
timestamp: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn disappear<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
timestamp: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Call this function when the peer is disconnected.
when the peer is non-existent in the book, returns
Error::PeerNotFoundsource§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 PeerId,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn listen_on<'life0, 'life1, 'async_trait>(
&'life0 self,
raddr: &'life1 Multiaddr,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn listen_on<'life0, 'life1, 'async_trait>(
&'life0 self,
raddr: &'life1 Multiaddr,
) -> Pin<Box<dyn Future<Output = Result<Option<PeerId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn choose_peers<'life0, 'life1, 'async_trait>(
&'life0 self,
protocol_id: &'life1 str,
maximun: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn choose_peers<'life0, 'life1, 'async_trait>(
&'life0 self,
protocol_id: &'life1 str,
maximun: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Randomly select peers by protoco_id.
fn choose_nat_peers<'life0, 'async_trait>(
&'life0 self,
limits: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Multiaddr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for MemoryPeerBook
impl !RefUnwindSafe for MemoryPeerBook
impl Send for MemoryPeerBook
impl Sync for MemoryPeerBook
impl Unpin for MemoryPeerBook
impl UnwindSafe for MemoryPeerBook
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