Struct solana_gossip::crds_gossip::CrdsGossip
source · pub struct CrdsGossip {
pub crds: RwLock<Crds>,
pub push: CrdsGossipPush,
pub pull: CrdsGossipPull,
}
Fields§
§crds: RwLock<Crds>
§push: CrdsGossipPush
§pull: CrdsGossipPull
Implementations§
source§impl CrdsGossip
impl CrdsGossip
sourcepub fn process_push_message(
&self,
messages: Vec<(Pubkey, Vec<CrdsValue>)>,
now: u64
) -> HashSet<Pubkey>
pub fn process_push_message( &self, messages: Vec<(Pubkey, Vec<CrdsValue>)>, now: u64 ) -> HashSet<Pubkey>
Process a push message to the network.
Returns unique origins’ pubkeys of upserted values.
sourcepub fn prune_received_cache<I>(
&self,
self_pubkey: &Pubkey,
origins: I,
stakes: &HashMap<Pubkey, u64>
) -> HashMap<Pubkey, Vec<Pubkey>>where
I: IntoIterator<Item = Pubkey>,
pub fn prune_received_cache<I>( &self, self_pubkey: &Pubkey, origins: I, stakes: &HashMap<Pubkey, u64> ) -> HashMap<Pubkey, Vec<Pubkey>>where I: IntoIterator<Item = Pubkey>,
Remove redundant paths in the network.
pub fn new_push_messages( &self, pending_push_messages: Vec<CrdsValue>, now: u64 ) -> (HashMap<Pubkey, Vec<CrdsValue>>, usize, usize)
sourcepub fn process_prune_msg(
&self,
self_pubkey: &Pubkey,
peer: &Pubkey,
destination: &Pubkey,
origin: &[Pubkey],
wallclock: u64,
now: u64
) -> Result<(), CrdsGossipError>
pub fn process_prune_msg( &self, self_pubkey: &Pubkey, peer: &Pubkey, destination: &Pubkey, origin: &[Pubkey], wallclock: u64, now: u64 ) -> Result<(), CrdsGossipError>
Add the from
to the peer’s filter of nodes.
sourcepub fn refresh_push_active_set(
&self,
self_keypair: &Keypair,
self_shred_version: u16,
stakes: &HashMap<Pubkey, u64>,
gossip_validators: Option<&HashSet<Pubkey>>,
ping_cache: &Mutex<PingCache>,
pings: &mut Vec<(SocketAddr, Ping<[u8; 32]>)>,
socket_addr_space: &SocketAddrSpace
)
pub fn refresh_push_active_set( &self, self_keypair: &Keypair, self_shred_version: u16, stakes: &HashMap<Pubkey, u64>, gossip_validators: Option<&HashSet<Pubkey>>, ping_cache: &Mutex<PingCache>, pings: &mut Vec<(SocketAddr, Ping<[u8; 32]>)>, socket_addr_space: &SocketAddrSpace )
Refresh the push active set.
sourcepub fn new_pull_request(
&self,
thread_pool: &ThreadPool,
self_keypair: &Keypair,
self_shred_version: u16,
now: u64,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
bloom_size: usize,
ping_cache: &Mutex<PingCache>,
pings: &mut Vec<(SocketAddr, Ping<[u8; 32]>)>,
socket_addr_space: &SocketAddrSpace
) -> Result<HashMap<ContactInfo, Vec<CrdsFilter>>, CrdsGossipError>
pub fn new_pull_request( &self, thread_pool: &ThreadPool, self_keypair: &Keypair, self_shred_version: u16, now: u64, gossip_validators: Option<&HashSet<Pubkey>>, stakes: &HashMap<Pubkey, u64>, bloom_size: usize, ping_cache: &Mutex<PingCache>, pings: &mut Vec<(SocketAddr, Ping<[u8; 32]>)>, socket_addr_space: &SocketAddrSpace ) -> Result<HashMap<ContactInfo, Vec<CrdsFilter>>, CrdsGossipError>
Generate a random request.
sourcepub fn mark_pull_request_creation_time(&self, from: Pubkey, now: u64)
pub fn mark_pull_request_creation_time(&self, from: Pubkey, now: u64)
Time when a request to from
was initiated.
This is used for weighted random selection during new_pull_request
It’s important to use the local nodes request creation time as the weight
instead of the response received time otherwise failed nodes will increase their weight.
sourcepub fn process_pull_requests<I>(&self, callers: I, now: u64)where
I: IntoIterator<Item = CrdsValue>,
pub fn process_pull_requests<I>(&self, callers: I, now: u64)where I: IntoIterator<Item = CrdsValue>,
Process a pull request and create a response.
pub fn generate_pull_responses( &self, thread_pool: &ThreadPool, filters: &[(CrdsValue, CrdsFilter)], output_size_limit: usize, now: u64, stats: &GossipStats ) -> Vec<Vec<CrdsValue>>
pub fn filter_pull_responses( &self, timeouts: &HashMap<Pubkey, u64>, response: Vec<CrdsValue>, now: u64, process_pull_stats: &mut ProcessPullStats ) -> (Vec<CrdsValue>, Vec<CrdsValue>, Vec<Hash>)
sourcepub fn process_pull_responses(
&self,
from: &Pubkey,
responses: Vec<CrdsValue>,
responses_expired_timeout: Vec<CrdsValue>,
failed_inserts: Vec<Hash>,
now: u64,
process_pull_stats: &mut ProcessPullStats
)
pub fn process_pull_responses( &self, from: &Pubkey, responses: Vec<CrdsValue>, responses_expired_timeout: Vec<CrdsValue>, failed_inserts: Vec<Hash>, now: u64, process_pull_stats: &mut ProcessPullStats )
Process a pull response.
pub fn make_timeouts( &self, self_pubkey: Pubkey, stakes: &HashMap<Pubkey, u64>, epoch_duration: Duration ) -> HashMap<Pubkey, u64>
pub fn purge( &self, self_pubkey: &Pubkey, thread_pool: &ThreadPool, now: u64, timeouts: &HashMap<Pubkey, u64> ) -> usize
Trait Implementations§
source§impl Default for CrdsGossip
impl Default for CrdsGossip
source§fn default() -> CrdsGossip
fn default() -> CrdsGossip
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for CrdsGossip
impl Send for CrdsGossip
impl Sync for CrdsGossip
impl Unpin for CrdsGossip
impl UnwindSafe for CrdsGossip
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request