Trait snarkos_node_router::Outbound
source · pub trait Outbound<N: Network>: Writing<Message = Message<N>> {
// Required method
fn router(&self) -> &Router<N>;
// Provided methods
fn send_ping(
&self,
peer_ip: SocketAddr,
block_locators: Option<BlockLocators<N>>
) { ... }
fn send(
&self,
peer_ip: SocketAddr,
message: Message<N>
) -> Option<Receiver<Result<()>>> { ... }
fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr]) { ... }
fn propagate_to_beacons(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
) { ... }
fn propagate_to_validators(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
) { ... }
fn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool { ... }
}
Required Methods§
Provided Methods§
sourcefn send_ping(
&self,
peer_ip: SocketAddr,
block_locators: Option<BlockLocators<N>>
)
fn send_ping( &self, peer_ip: SocketAddr, block_locators: Option<BlockLocators<N>> )
Sends a “Ping” message to the given peer.
sourcefn send(
&self,
peer_ip: SocketAddr,
message: Message<N>
) -> Option<Receiver<Result<()>>>
fn send( &self, peer_ip: SocketAddr, message: Message<N> ) -> Option<Receiver<Result<()>>>
Sends the given message to specified peer.
This function returns as soon as the message is queued to be sent,
without waiting for the actual delivery; instead, the caller is provided with a oneshot::Receiver
which can be used to determine when and whether the message has been delivered.
sourcefn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr])
fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr])
Sends the given message to every connected peer, excluding the sender and any specified peer IPs.
sourcefn propagate_to_beacons(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
)
fn propagate_to_beacons( &self, message: Message<N>, excluded_peers: &[SocketAddr] )
Sends the given message to every connected beacon, excluding the sender and any specified IPs.
sourcefn propagate_to_validators(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
)
fn propagate_to_validators( &self, message: Message<N>, excluded_peers: &[SocketAddr] )
Sends the given message to every connected validator, excluding the sender and any specified IPs.
sourcefn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool
fn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool
Returns true
if the message can be sent.