Free up the name 'tpu'

This commit is contained in:
Greg Fitzgerald 2018-05-12 10:53:25 -06:00
parent 898f4971a2
commit 421d9aa501
4 changed files with 17 additions and 18 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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<AccountingStage>,
request_processor: Arc<RequestProcessor>,
}
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<W: Write + Send + 'static>(

View File

@ -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 = {