grooming: use cleanup, remove some dead code (bp #8324) (#8326)

automerge
This commit is contained in:
mergify[bot]
2020-02-18 21:06:56 -08:00
committed by GitHub
parent 72cb0b7c9e
commit a008748d9d
5 changed files with 41 additions and 50 deletions

View File

@ -374,19 +374,6 @@ impl ClusterInfo {
.map(|x| (x.value.epoch_slots().unwrap(), x.insert_timestamp)) .map(|x| (x.value.epoch_slots().unwrap(), x.insert_timestamp))
} }
pub fn get_gossiped_root_for_node(&self, pubkey: &Pubkey, since: Option<u64>) -> Option<u64> {
self.gossip
.crds
.table
.get(&CrdsValueLabel::EpochSlots(*pubkey))
.filter(|x| {
since
.map(|since| x.insert_timestamp > since)
.unwrap_or(true)
})
.map(|x| x.value.epoch_slots().unwrap().root)
}
pub fn get_contact_info_for_node(&self, pubkey: &Pubkey) -> Option<&ContactInfo> { pub fn get_contact_info_for_node(&self, pubkey: &Pubkey) -> Option<&ContactInfo> {
self.gossip self.gossip
.crds .crds

View File

@ -3,11 +3,13 @@
//! designed to run with a simulator or over a UDP network connection with messages up to a //! designed to run with a simulator or over a UDP network connection with messages up to a
//! packet::PACKET_DATA_SIZE size. //! packet::PACKET_DATA_SIZE size.
use crate::crds::{Crds, VersionedCrdsValue}; use crate::{
use crate::crds_gossip_error::CrdsGossipError; crds::{Crds, VersionedCrdsValue},
use crate::crds_gossip_pull::{CrdsFilter, CrdsGossipPull}; crds_gossip_error::CrdsGossipError,
use crate::crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}; crds_gossip_pull::{CrdsFilter, CrdsGossipPull},
use crate::crds_value::{CrdsValue, CrdsValueLabel}; crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE},
crds_value::{CrdsValue, CrdsValueLabel},
};
use solana_sdk::pubkey::Pubkey; use solana_sdk::pubkey::Pubkey;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};

View File

@ -8,25 +8,24 @@
//! the local nodes wallclock window they are drooped silently. //! the local nodes wallclock window they are drooped silently.
//! 2. The prune set is stored in a Bloom filter. //! 2. The prune set is stored in a Bloom filter.
use crate::contact_info::ContactInfo; use crate::{
use crate::crds::{Crds, VersionedCrdsValue}; contact_info::ContactInfo,
use crate::crds_gossip::{get_stake, get_weight, CRDS_GOSSIP_DEFAULT_BLOOM_ITEMS}; crds::{Crds, VersionedCrdsValue},
use crate::crds_gossip_error::CrdsGossipError; crds_gossip::{get_stake, get_weight, CRDS_GOSSIP_DEFAULT_BLOOM_ITEMS},
use crate::crds_value::{CrdsValue, CrdsValueLabel}; crds_gossip_error::CrdsGossipError,
use crate::weighted_shuffle::weighted_shuffle; crds_value::{CrdsValue, CrdsValueLabel},
weighted_shuffle::weighted_shuffle,
};
use bincode::serialized_size; use bincode::serialized_size;
use indexmap::map::IndexMap; use indexmap::map::IndexMap;
use itertools::Itertools; use itertools::Itertools;
use rand; use rand::{self, seq::SliceRandom, thread_rng, RngCore};
use rand::seq::SliceRandom;
use rand::{thread_rng, RngCore};
use solana_runtime::bloom::Bloom; use solana_runtime::bloom::Bloom;
use solana_sdk::hash::Hash; use solana_sdk::{hash::Hash, packet::PACKET_DATA_SIZE, pubkey::Pubkey, timing::timestamp};
use solana_sdk::packet::PACKET_DATA_SIZE; use std::{
use solana_sdk::pubkey::Pubkey; cmp,
use solana_sdk::timing::timestamp; collections::{HashMap, HashSet},
use std::cmp; };
use std::collections::{HashMap, HashSet};
pub const CRDS_GOSSIP_NUM_ACTIVE: usize = 30; pub const CRDS_GOSSIP_NUM_ACTIVE: usize = 30;
pub const CRDS_GOSSIP_PUSH_FANOUT: usize = 6; pub const CRDS_GOSSIP_PUSH_FANOUT: usize = 6;

View File

@ -1,14 +1,16 @@
use crate::contact_info::ContactInfo; use crate::contact_info::ContactInfo;
use bincode::{serialize, serialized_size}; use bincode::{serialize, serialized_size};
use solana_sdk::clock::Slot; use solana_sdk::{
use solana_sdk::pubkey::Pubkey; clock::Slot,
use solana_sdk::signature::{Keypair, Signable, Signature}; pubkey::Pubkey,
use solana_sdk::transaction::Transaction; signature::{Keypair, Signable, Signature},
use std::borrow::Borrow; transaction::Transaction,
use std::borrow::Cow; };
use std::collections::BTreeSet; use std::{
use std::collections::HashSet; borrow::{Borrow, Cow},
use std::fmt; collections::{BTreeSet, HashSet},
fmt,
};
pub type VoteIndex = u8; pub type VoteIndex = u8;
pub const MAX_VOTES: VoteIndex = 32; pub const MAX_VOTES: VoteIndex = 32;
@ -50,14 +52,12 @@ impl Signable for CrdsValue {
} }
/// CrdsData that defines the different types of items CrdsValues can hold /// CrdsData that defines the different types of items CrdsValues can hold
/// * Merge Strategy - Latest wallclock is picked
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum CrdsData { pub enum CrdsData {
/// * Merge Strategy - Latest wallclock is picked
ContactInfo(ContactInfo), ContactInfo(ContactInfo),
/// * Merge Strategy - Latest wallclock is picked
Vote(VoteIndex, Vote), Vote(VoteIndex, Vote),
/// * Merge Strategy - Latest wallclock is picked
EpochSlots(EpochSlots), EpochSlots(EpochSlots),
} }

View File

@ -1,9 +1,12 @@
use solana_runtime::accounts_db::AccountStorageEntry; use solana_runtime::{accounts_db::AccountStorageEntry, bank::BankSlotDelta};
use solana_runtime::bank::BankSlotDelta;
use solana_sdk::clock::Slot; use solana_sdk::clock::Slot;
use std::path::PathBuf; use std::{
use std::sync::mpsc::{Receiver, SendError, Sender}; path::PathBuf,
use std::sync::Arc; sync::{
mpsc::{Receiver, SendError, Sender},
Arc,
},
};
use tempfile::TempDir; use tempfile::TempDir;
pub type SnapshotPackageSender = Sender<SnapshotPackage>; pub type SnapshotPackageSender = Sender<SnapshotPackage>;