Remove 'Compute' from name ComputeLeaderConfirmationService
struct names should be a noun
This commit is contained in:
parent
8080063024
commit
d850f67979
|
@ -3,10 +3,10 @@
|
|||
//! can do its processing in parallel with signature verification on the GPU.
|
||||
|
||||
use crate::bank::{self, Bank, BankError};
|
||||
use crate::compute_leader_confirmation_service::ComputeLeaderConfirmationService;
|
||||
use crate::counter::Counter;
|
||||
use crate::entry::Entry;
|
||||
use crate::last_id_queue::MAX_ENTRY_IDS;
|
||||
use crate::leader_confirmation_service::LeaderConfirmationService;
|
||||
use crate::packet::Packets;
|
||||
use crate::packet::SharedPackets;
|
||||
use crate::poh_recorder::{PohRecorder, PohRecorderError};
|
||||
|
@ -37,7 +37,7 @@ pub const NUM_THREADS: u32 = 10;
|
|||
pub struct BankingStage {
|
||||
bank_thread_hdls: Vec<JoinHandle<UnprocessedPackets>>,
|
||||
poh_service: PohService,
|
||||
compute_confirmation_service: ComputeLeaderConfirmationService,
|
||||
leader_confirmation_service: LeaderConfirmationService,
|
||||
}
|
||||
|
||||
impl BankingStage {
|
||||
|
@ -62,11 +62,8 @@ impl BankingStage {
|
|||
let poh_service = PohService::new(poh_recorder.clone(), config);
|
||||
|
||||
// Single thread to compute confirmation
|
||||
let compute_confirmation_service = ComputeLeaderConfirmationService::new(
|
||||
bank.clone(),
|
||||
leader_id,
|
||||
poh_service.poh_exit.clone(),
|
||||
);
|
||||
let leader_confirmation_service =
|
||||
LeaderConfirmationService::new(bank.clone(), leader_id, poh_service.poh_exit.clone());
|
||||
|
||||
// Many banks that process transactions in parallel.
|
||||
let bank_thread_hdls: Vec<JoinHandle<UnprocessedPackets>> = (0..Self::num_threads())
|
||||
|
@ -103,7 +100,7 @@ impl BankingStage {
|
|||
Self {
|
||||
bank_thread_hdls,
|
||||
poh_service,
|
||||
compute_confirmation_service,
|
||||
leader_confirmation_service,
|
||||
},
|
||||
entry_receiver,
|
||||
)
|
||||
|
@ -331,7 +328,7 @@ impl Service for BankingStage {
|
|||
for bank_thread_hdl in self.bank_thread_hdls {
|
||||
bank_thread_hdl.join()?;
|
||||
}
|
||||
self.compute_confirmation_service.join()?;
|
||||
self.leader_confirmation_service.join()?;
|
||||
let _ = self.poh_service.join()?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! The `compute_leader_confirmation_service` module implements the tools necessary
|
||||
//! The `leader_confirmation_service` module implements the tools necessary
|
||||
//! to generate a thread which regularly calculates the last confirmation times
|
||||
//! observed by the leader
|
||||
|
||||
|
@ -22,11 +22,11 @@ pub enum ConfirmationError {
|
|||
|
||||
pub const COMPUTE_CONFIRMATION_MS: u64 = 100;
|
||||
|
||||
pub struct ComputeLeaderConfirmationService {
|
||||
compute_confirmation_thread: JoinHandle<()>,
|
||||
pub struct LeaderConfirmationService {
|
||||
thread_hdl: JoinHandle<()>,
|
||||
}
|
||||
|
||||
impl ComputeLeaderConfirmationService {
|
||||
impl LeaderConfirmationService {
|
||||
fn get_last_supermajority_timestamp(
|
||||
bank: &Arc<Bank>,
|
||||
leader_id: Pubkey,
|
||||
|
@ -99,9 +99,9 @@ impl ComputeLeaderConfirmationService {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new ComputeLeaderConfirmationService for computing confirmation.
|
||||
/// Create a new LeaderConfirmationService for computing confirmation.
|
||||
pub fn new(bank: Arc<Bank>, leader_id: Pubkey, exit: Arc<AtomicBool>) -> Self {
|
||||
let compute_confirmation_thread = Builder::new()
|
||||
let thread_hdl = Builder::new()
|
||||
.name("solana-leader-confirmation-stage".to_string())
|
||||
.spawn(move || {
|
||||
let mut last_valid_validator_timestamp = 0;
|
||||
|
@ -119,24 +119,22 @@ impl ComputeLeaderConfirmationService {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
(ComputeLeaderConfirmationService {
|
||||
compute_confirmation_thread,
|
||||
})
|
||||
Self { thread_hdl }
|
||||
}
|
||||
}
|
||||
|
||||
impl Service for ComputeLeaderConfirmationService {
|
||||
impl Service for LeaderConfirmationService {
|
||||
type JoinReturnType = ();
|
||||
|
||||
fn join(self) -> thread::Result<()> {
|
||||
self.compute_confirmation_thread.join()
|
||||
self.thread_hdl.join()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use crate::bank::Bank;
|
||||
use crate::compute_leader_confirmation_service::ComputeLeaderConfirmationService;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
|
||||
use crate::genesis_block::GenesisBlock;
|
||||
|
@ -191,7 +189,7 @@ pub mod tests {
|
|||
|
||||
// There isn't 2/3 consensus, so the bank's confirmation value should be the default
|
||||
let mut last_confirmation_time = 0;
|
||||
ComputeLeaderConfirmationService::compute_confirmation(
|
||||
LeaderConfirmationService::compute_confirmation(
|
||||
&bank,
|
||||
genesis_block.bootstrap_leader_id,
|
||||
&mut last_confirmation_time,
|
||||
|
@ -202,7 +200,7 @@ pub mod tests {
|
|||
let vote_tx = VoteTransaction::new_vote(voting_keypair, 7, ids[6], 0);
|
||||
bank.process_transaction(&vote_tx).unwrap();
|
||||
|
||||
ComputeLeaderConfirmationService::compute_confirmation(
|
||||
LeaderConfirmationService::compute_confirmation(
|
||||
&bank,
|
||||
genesis_block.bootstrap_leader_id,
|
||||
&mut last_confirmation_time,
|
|
@ -33,7 +33,6 @@ pub mod contact_info;
|
|||
pub mod blocktree;
|
||||
pub mod blocktree_processor;
|
||||
pub mod cluster_info;
|
||||
pub mod compute_leader_confirmation_service;
|
||||
pub mod db_window;
|
||||
pub mod entry;
|
||||
pub mod entry_stream;
|
||||
|
@ -46,6 +45,7 @@ pub mod gen_keys;
|
|||
pub mod genesis_block;
|
||||
pub mod gossip_service;
|
||||
pub mod last_id_queue;
|
||||
pub mod leader_confirmation_service;
|
||||
pub mod leader_scheduler;
|
||||
pub mod local_vote_signer_service;
|
||||
pub mod packet;
|
||||
|
|
Loading…
Reference in New Issue