Trait snarkos_node_router::Outbound
source · pub trait Outbound<N: Network>: Writing<Message = Message<N>> {
// Required methods
fn router(&self) -> &Router<N>;
fn is_block_synced(&self) -> bool;
fn num_blocks_behind(&self) -> u32;
// 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_validators(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr],
) { ... }
fn can_send(&self, peer_ip: SocketAddr, message: &Message<N>) -> bool { ... }
}
Required Methods§
sourcefn is_block_synced(&self) -> bool
fn is_block_synced(&self) -> bool
Returns true
if the node is synced up to the latest block (within the given tolerance).
sourcefn num_blocks_behind(&self) -> u32
fn num_blocks_behind(&self) -> u32
Returns the number of blocks this node is behind the greatest peer height.
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_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.
Object Safety§
This trait is not object safe.