Reformatting

This commit is contained in:
Michael Vines 2020-02-18 09:46:11 -07:00
parent 3975c7f8c9
commit 7305a1f407
3 changed files with 33 additions and 32 deletions

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),
} }