Skip to content

Commit bdf95ad

Browse files
authored
splits out gossip Protocol out of cluster_info.rs (#3488)
Reorganizing this code in preparation of upcoming changes to gossip Protocol (de)serialization.
1 parent 4e7f7f7 commit bdf95ad

10 files changed

+757
-699
lines changed

gossip/src/cluster_info.rs

Lines changed: 14 additions & 691 deletions
Large diffs are not rendered by default.

gossip/src/crds_data.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use {
22
crate::{
3-
cluster_info::MAX_ACCOUNTS_HASHES,
43
contact_info::ContactInfo,
54
deprecated,
65
duplicate_shred::{DuplicateShred, DuplicateShredIndex, MAX_DUPLICATE_SHREDS},
@@ -24,6 +23,10 @@ use {
2423

2524
pub(crate) const MAX_WALLCLOCK: u64 = 1_000_000_000_000_000;
2625
pub(crate) const MAX_SLOT: u64 = 1_000_000_000_000_000;
26+
/// Maximum number of hashes in AccountsHashes a node publishes
27+
/// such that the serialized size of the push/pull message stays below
28+
/// PACKET_DATA_SIZE.
29+
const MAX_ACCOUNTS_HASHES: usize = 16;
2730

2831
pub(crate) type VoteIndex = u8;
2932
// TODO: Remove this in favor of vote_state::MAX_LOCKOUT_HISTORY once

gossip/src/crds_gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
use {
88
crate::{
9-
cluster_info::Ping,
109
cluster_info_metrics::GossipStats,
1110
contact_info::ContactInfo,
1211
crds::{Crds, GossipRoute},
@@ -17,6 +16,7 @@ use {
1716
crds_value::CrdsValue,
1817
duplicate_shred::{self, DuplicateShredIndex, MAX_DUPLICATE_SHREDS},
1918
ping_pong::PingCache,
19+
protocol::Ping,
2020
},
2121
itertools::Itertools,
2222
rand::{CryptoRng, Rng},

gossip/src/crds_gossip_pull.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
1414
use {
1515
crate::{
16-
cluster_info::Ping,
1716
cluster_info_metrics::GossipStats,
1817
contact_info::ContactInfo,
1918
crds::{Crds, GossipRoute, VersionedCrdsValue},
2019
crds_gossip,
2120
crds_gossip_error::CrdsGossipError,
2221
crds_value::CrdsValue,
2322
ping_pong::PingCache,
23+
protocol::Ping,
2424
},
2525
itertools::Itertools,
2626
rand::{
@@ -655,9 +655,9 @@ pub(crate) mod tests {
655655
use {
656656
super::*,
657657
crate::{
658-
cluster_info::Protocol,
659658
crds_data::{CrdsData, Vote},
660659
legacy_contact_info::LegacyContactInfo,
660+
protocol::Protocol,
661661
},
662662
itertools::Itertools,
663663
rand::{seq::SliceRandom, SeedableRng},

gossip/src/crds_gossip_push.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
1414
use {
1515
crate::{
16-
cluster_info::{Ping, CRDS_UNIQUE_PUBKEY_CAPACITY},
16+
cluster_info::CRDS_UNIQUE_PUBKEY_CAPACITY,
1717
crds::{Crds, CrdsError, Cursor, GossipRoute},
1818
crds_gossip,
1919
crds_value::CrdsValue,
2020
ping_pong::PingCache,
21+
protocol::Ping,
2122
push_active_set::PushActiveSet,
2223
received_cache::ReceivedCache,
2324
},

gossip/src/duplicate_shred_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ mod tests {
227227
use {
228228
super::*,
229229
crate::{
230-
cluster_info::DUPLICATE_SHRED_MAX_PAYLOAD_SIZE,
231230
duplicate_shred::{from_shred, tests::new_rand_shred},
231+
protocol::DUPLICATE_SHRED_MAX_PAYLOAD_SIZE,
232232
},
233233
crossbeam_channel::unbounded,
234234
itertools::Itertools,

gossip/src/epoch_slots.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use {
22
crate::{
3-
cluster_info::MAX_CRDS_OBJECT_SIZE,
43
crds_data::{self, MAX_SLOT, MAX_WALLCLOCK},
4+
protocol::MAX_CRDS_OBJECT_SIZE,
55
},
66
bincode::serialized_size,
77
bv::BitVec,

gossip/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub mod gossip_service;
2323
#[macro_use]
2424
mod legacy_contact_info;
2525
pub mod ping_pong;
26+
mod protocol;
2627
mod push_active_set;
2728
mod received_cache;
2829
pub mod restart_crds_values;

0 commit comments

Comments
 (0)