Struct solana_gossip::cluster_info::ClusterInfo [−][src]
pub struct ClusterInfo {
pub gossip: RwLock<CrdsGossip>,
pub keypair: Arc<Keypair>,
// some fields omitted
}
Fields
gossip: RwLock<CrdsGossip>
The network
keypair: Arc<Keypair>
set the keypair that will be used to sign crds values generated. It is unset only in tests.
Implementations
pub fn new(
contact_info: ContactInfo,
keypair: Arc<Keypair>,
socket_addr_space: SocketAddrSpace
) -> Self
pub fn lookup_contact_info<F, Y>(&self, id: &Pubkey, map: F) -> Option<Y> where
F: FnOnce(&ContactInfo) -> Y,
pub fn lookup_contact_info_by_gossip_addr(
&self,
gossip_addr: &SocketAddr
) -> Option<ContactInfo>
pub fn send_vote(
&self,
vote: &Transaction,
tpu: Option<SocketAddr>
) -> Result<(), GossipError>
Returns votes inserted since the given cursor.
pub fn push_duplicate_shred(
&self,
shred: &Shred,
other_payload: &[u8]
) -> Result<(), GossipError>
pub fn get_accounts_hash_for_node<F, Y>(
&self,
pubkey: &Pubkey,
map: F
) -> Option<Y> where
F: FnOnce(&Vec<(Slot, Hash)>) -> Y,
pub fn get_snapshot_hash_for_node<F, Y>(
&self,
pubkey: &Pubkey,
map: F
) -> Option<Y> where
F: FnOnce(&Vec<(Slot, Hash)>) -> Y,
Returns epoch-slots inserted since the given cursor. Excludes entries from nodes with unkown or different shred version.
pub fn all_rpc_peers(&self) -> Vec<ContactInfo>ⓘ
pub fn all_rpc_peers(&self) -> Vec<ContactInfo>ⓘ
all validators that have a valid rpc port regardless of shred_version
.
pub fn gossip_peers(&self) -> Vec<ContactInfo>ⓘ
pub fn all_tvu_peers(&self) -> Vec<ContactInfo>ⓘ
pub fn all_tvu_peers(&self) -> Vec<ContactInfo>ⓘ
all validators that have a valid tvu port regardless of shred_version
.
all validators that have a valid tvu port and are on the same shred_version
.
pub fn repair_peers(&self, slot: Slot) -> Vec<ContactInfo>ⓘ
pub fn repair_peers(&self, slot: Slot) -> Vec<ContactInfo>ⓘ
all tvu peers with valid gossip addrs that likely have the slot being requested
compute broadcast table
pub fn retransmit_to(
peers: &[&ContactInfo],
data: &[u8],
s: &UdpSocket,
forwarded: bool,
socket_addr_space: &SocketAddrSpace
)
pub fn retransmit_to(
peers: &[&ContactInfo],
data: &[u8],
s: &UdpSocket,
forwarded: bool,
socket_addr_space: &SocketAddrSpace
)
retransmit messages to a list of nodes
Remarks
We need to avoid having obj locked while doing a io, such as the send_to
pub fn gossip(
self: Arc<Self>,
bank_forks: Option<Arc<RwLock<BankForks>>>,
sender: PacketSender,
gossip_validators: Option<HashSet<Pubkey>>,
exit: Arc<AtomicBool>
) -> JoinHandle<()>
pub fn gossip(
self: Arc<Self>,
bank_forks: Option<Arc<RwLock<BankForks>>>,
sender: PacketSender,
gossip_validators: Option<HashSet<Pubkey>>,
exit: Arc<AtomicBool>
) -> JoinHandle<()>
randomly pick a node and ask them for updates asynchronously
pub fn gossip_contact_info(
id: &Pubkey,
gossip: SocketAddr,
shred_version: u16
) -> ContactInfo
pub fn gossip_node(
id: &Pubkey,
gossip_addr: &SocketAddr,
shred_version: u16
) -> (ContactInfo, UdpSocket, Option<TcpListener>)
pub fn gossip_node(
id: &Pubkey,
gossip_addr: &SocketAddr,
shred_version: u16
) -> (ContactInfo, UdpSocket, Option<TcpListener>)
An alternative to Spy Node that has a valid gossip address and fully participate in Gossip.
pub fn spy_node(
id: &Pubkey,
shred_version: u16
) -> (ContactInfo, UdpSocket, Option<TcpListener>)
pub fn spy_node(
id: &Pubkey,
shred_version: u16
) -> (ContactInfo, UdpSocket, Option<TcpListener>)
A Node with dummy ports to spy on gossip via pull requests
Auto Trait Implementations
impl RefUnwindSafe for ClusterInfo
impl Send for ClusterInfo
impl Sync for ClusterInfo
impl Unpin for ClusterInfo
impl UnwindSafe for ClusterInfo
Blanket Implementations
Mutably borrows from an owned value. Read more
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more