diff --git a/src/bin/testnode.rs b/src/bin/testnode.rs index 4df3e67ca0..68eaca991b 100644 --- a/src/bin/testnode.rs +++ b/src/bin/testnode.rs @@ -11,8 +11,8 @@ use solana::accounting_stage::AccountingStage; use solana::crdt::ReplicatedData; use solana::entry::Entry; use solana::event::Event; +use solana::rpu::Rpu; use solana::signature::{KeyPair, KeyPairUtil}; -use solana::tpu::Tpu; use std::env; use std::io::{stdin, stdout, Read}; use std::net::UdpSocket; @@ -117,7 +117,7 @@ fn main() { let accounting_stage = AccountingStage::new(accountant, &last_id, Some(1000)); let exit = Arc::new(AtomicBool::new(false)); - let tpu = Arc::new(Tpu::new(accounting_stage)); + let rpu = Arc::new(Rpu::new(accounting_stage)); let serve_sock = UdpSocket::bind(&serve_addr).unwrap(); let gossip_sock = UdpSocket::bind(&gossip_addr).unwrap(); let replicate_sock = UdpSocket::bind(&replicate_addr).unwrap(); @@ -130,7 +130,7 @@ fn main() { serve_sock.local_addr().unwrap(), ); eprintln!("starting server..."); - let threads = tpu.serve( + let threads = rpu.serve( d, serve_sock, events_sock, diff --git a/src/lib.rs b/src/lib.rs index 793c21eef8..30f87959fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,12 +18,12 @@ pub mod plan; pub mod recorder; pub mod request_stage; pub mod result; +pub mod rpu; pub mod sig_verify_stage; pub mod signature; pub mod streamer; pub mod thin_client; pub mod timing; -pub mod tpu; pub mod transaction; pub mod tvu; extern crate bincode; diff --git a/src/tpu.rs b/src/rpu.rs similarity index 96% rename from src/tpu.rs rename to src/rpu.rs index 24d499bb13..bccc92f5f5 100644 --- a/src/tpu.rs +++ b/src/rpu.rs @@ -1,4 +1,4 @@ -//! The `tpu` module implements the Transaction Processing Unit, a +//! The `rpu` module implements the Request Processing Unit, a //! 5-stage transaction processing pipeline in software. use accounting_stage::AccountingStage; @@ -16,16 +16,16 @@ use std::sync::{Arc, Mutex, RwLock}; use std::thread::{spawn, JoinHandle}; use streamer; -pub struct Tpu { +pub struct Rpu { accounting_stage: Arc, request_processor: Arc, } -impl Tpu { - /// Create a new Tpu that wraps the given Accountant. +impl Rpu { + /// Create a new Rpu that wraps the given Accountant. pub fn new(accounting_stage: AccountingStage) -> Self { let request_processor = RequestProcessor::new(accounting_stage.accountant.clone()); - Tpu { + Rpu { accounting_stage: Arc::new(accounting_stage), request_processor: Arc::new(request_processor), } @@ -66,7 +66,7 @@ impl Tpu { }) } - /// Create a UDP microservice that forwards messages the given Tpu. + /// Create a UDP microservice that forwards messages the given Rpu. /// This service is the network leader /// Set `exit` to shutdown its threads. pub fn serve( diff --git a/src/thin_client.rs b/src/thin_client.rs index ad2501b55f..ee51860c1a 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -23,7 +23,7 @@ pub struct ThinClient { } impl ThinClient { - /// Create a new ThinClient that will interface with Tpu + /// Create a new ThinClient that will interface with Rpu /// over `requests_socket` and `events_socket`. To receive responses, the caller must bind `socket` /// to a public address before invoking ThinClient methods. pub fn new(addr: SocketAddr, requests_socket: UdpSocket, events_socket: UdpSocket) -> Self { @@ -161,6 +161,7 @@ mod tests { use logger; use mint::Mint; use plan::Plan; + use rpu::Rpu; use signature::{KeyPair, KeyPairUtil}; use std::io::sink; use std::sync::atomic::{AtomicBool, Ordering}; @@ -168,7 +169,6 @@ mod tests { use std::thread::sleep; use std::time::Duration; use std::time::Instant; - use tpu::Tpu; use tvu::{self, Tvu}; #[test] @@ -191,8 +191,8 @@ mod tests { let bob_pubkey = KeyPair::new().pubkey(); let exit = Arc::new(AtomicBool::new(false)); let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30)); - let tpu = Arc::new(Tpu::new(accounting_stage)); - let threads = tpu.serve(d, serve, events_socket, gossip, exit.clone(), sink()) + let rpu = Arc::new(Rpu::new(accounting_stage)); + let threads = rpu.serve(d, serve, events_socket, gossip, exit.clone(), sink()) .unwrap(); sleep(Duration::from_millis(300)); @@ -230,10 +230,9 @@ mod tests { let bob_pubkey = KeyPair::new().pubkey(); let exit = Arc::new(AtomicBool::new(false)); let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30)); - let tpu = Arc::new(Tpu::new(accounting_stage)); + let rpu = Arc::new(Rpu::new(accounting_stage)); let serve_addr = leader_serve.local_addr().unwrap(); - let threads = Tpu::serve( - &tpu, + let threads = rpu.serve( leader_data, leader_serve, leader_events, @@ -302,7 +301,7 @@ mod tests { let leader_acc = { let accountant = Accountant::new(&alice); let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30)); - Arc::new(Tpu::new(accounting_stage)) + Arc::new(Rpu::new(accounting_stage)) }; let replicant_acc = {