pub struct StubPeerManager { /* private fields */ }Expand description
Stub P2P peer manager implementation
A lightweight stub suitable for testing and development when actual network connectivity is not needed.
Implementations§
Source§impl StubPeerManager
impl StubPeerManager
Sourcepub async fn peer_count(&self) -> usize
pub async fn peer_count(&self) -> usize
Get count of connected peers
Trait Implementations§
Source§impl Default for StubPeerManager
impl Default for StubPeerManager
Source§impl PeerManager for StubPeerManager
impl PeerManager for StubPeerManager
Source§fn connect_peer<'life0, 'async_trait>(
&'life0 self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<u64, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect_peer<'life0, 'async_trait>(
&'life0 self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<u64, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initiates a connection to a peer. Read more
Source§fn disconnect_peer<'life0, 'async_trait>(
&'life0 self,
peer_id: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect_peer<'life0, 'async_trait>(
&'life0 self,
peer_id: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnects from a peer. Read more
Source§fn ban_peer<'life0, 'async_trait>(
&'life0 self,
addr: SocketAddr,
ban_time: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ban_peer<'life0, 'async_trait>(
&'life0 self,
addr: SocketAddr,
ban_time: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Bans a peer, preventing further connections. Read more
Source§fn get_connected_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_connected_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets information about all connected peers. Read more
Source§fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
_tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<usize, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
_tx: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<usize, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Broadcasts a transaction to all connected peers. Read more
Source§fn broadcast_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block: &'life1 Block,
) -> Pin<Box<dyn Future<Output = Result<usize, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn broadcast_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block: &'life1 Block,
) -> Pin<Box<dyn Future<Output = Result<usize, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Broadcasts a block to all connected peers. Read more
Auto Trait Implementations§
impl Freeze for StubPeerManager
impl !RefUnwindSafe for StubPeerManager
impl Send for StubPeerManager
impl Sync for StubPeerManager
impl Unpin for StubPeerManager
impl UnsafeUnpin for StubPeerManager
impl !UnwindSafe for StubPeerManager
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