Free up the name 'tpu'
This commit is contained in:
parent
898f4971a2
commit
421d9aa501
|
@ -11,8 +11,8 @@ use solana::accounting_stage::AccountingStage;
|
||||||
use solana::crdt::ReplicatedData;
|
use solana::crdt::ReplicatedData;
|
||||||
use solana::entry::Entry;
|
use solana::entry::Entry;
|
||||||
use solana::event::Event;
|
use solana::event::Event;
|
||||||
|
use solana::rpu::Rpu;
|
||||||
use solana::signature::{KeyPair, KeyPairUtil};
|
use solana::signature::{KeyPair, KeyPairUtil};
|
||||||
use solana::tpu::Tpu;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::{stdin, stdout, Read};
|
use std::io::{stdin, stdout, Read};
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
|
@ -117,7 +117,7 @@ fn main() {
|
||||||
|
|
||||||
let accounting_stage = AccountingStage::new(accountant, &last_id, Some(1000));
|
let accounting_stage = AccountingStage::new(accountant, &last_id, Some(1000));
|
||||||
let exit = Arc::new(AtomicBool::new(false));
|
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 serve_sock = UdpSocket::bind(&serve_addr).unwrap();
|
||||||
let gossip_sock = UdpSocket::bind(&gossip_addr).unwrap();
|
let gossip_sock = UdpSocket::bind(&gossip_addr).unwrap();
|
||||||
let replicate_sock = UdpSocket::bind(&replicate_addr).unwrap();
|
let replicate_sock = UdpSocket::bind(&replicate_addr).unwrap();
|
||||||
|
@ -130,7 +130,7 @@ fn main() {
|
||||||
serve_sock.local_addr().unwrap(),
|
serve_sock.local_addr().unwrap(),
|
||||||
);
|
);
|
||||||
eprintln!("starting server...");
|
eprintln!("starting server...");
|
||||||
let threads = tpu.serve(
|
let threads = rpu.serve(
|
||||||
d,
|
d,
|
||||||
serve_sock,
|
serve_sock,
|
||||||
events_sock,
|
events_sock,
|
||||||
|
|
|
@ -18,12 +18,12 @@ pub mod plan;
|
||||||
pub mod recorder;
|
pub mod recorder;
|
||||||
pub mod request_stage;
|
pub mod request_stage;
|
||||||
pub mod result;
|
pub mod result;
|
||||||
|
pub mod rpu;
|
||||||
pub mod sig_verify_stage;
|
pub mod sig_verify_stage;
|
||||||
pub mod signature;
|
pub mod signature;
|
||||||
pub mod streamer;
|
pub mod streamer;
|
||||||
pub mod thin_client;
|
pub mod thin_client;
|
||||||
pub mod timing;
|
pub mod timing;
|
||||||
pub mod tpu;
|
|
||||||
pub mod transaction;
|
pub mod transaction;
|
||||||
pub mod tvu;
|
pub mod tvu;
|
||||||
extern crate bincode;
|
extern crate bincode;
|
||||||
|
|
|
@ -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.
|
//! 5-stage transaction processing pipeline in software.
|
||||||
|
|
||||||
use accounting_stage::AccountingStage;
|
use accounting_stage::AccountingStage;
|
||||||
|
@ -16,16 +16,16 @@ use std::sync::{Arc, Mutex, RwLock};
|
||||||
use std::thread::{spawn, JoinHandle};
|
use std::thread::{spawn, JoinHandle};
|
||||||
use streamer;
|
use streamer;
|
||||||
|
|
||||||
pub struct Tpu {
|
pub struct Rpu {
|
||||||
accounting_stage: Arc<AccountingStage>,
|
accounting_stage: Arc<AccountingStage>,
|
||||||
request_processor: Arc<RequestProcessor>,
|
request_processor: Arc<RequestProcessor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tpu {
|
impl Rpu {
|
||||||
/// Create a new Tpu that wraps the given Accountant.
|
/// Create a new Rpu that wraps the given Accountant.
|
||||||
pub fn new(accounting_stage: AccountingStage) -> Self {
|
pub fn new(accounting_stage: AccountingStage) -> Self {
|
||||||
let request_processor = RequestProcessor::new(accounting_stage.accountant.clone());
|
let request_processor = RequestProcessor::new(accounting_stage.accountant.clone());
|
||||||
Tpu {
|
Rpu {
|
||||||
accounting_stage: Arc::new(accounting_stage),
|
accounting_stage: Arc::new(accounting_stage),
|
||||||
request_processor: Arc::new(request_processor),
|
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
|
/// This service is the network leader
|
||||||
/// Set `exit` to shutdown its threads.
|
/// Set `exit` to shutdown its threads.
|
||||||
pub fn serve<W: Write + Send + 'static>(
|
pub fn serve<W: Write + Send + 'static>(
|
|
@ -23,7 +23,7 @@ pub struct ThinClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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`
|
/// over `requests_socket` and `events_socket`. To receive responses, the caller must bind `socket`
|
||||||
/// to a public address before invoking ThinClient methods.
|
/// to a public address before invoking ThinClient methods.
|
||||||
pub fn new(addr: SocketAddr, requests_socket: UdpSocket, events_socket: UdpSocket) -> Self {
|
pub fn new(addr: SocketAddr, requests_socket: UdpSocket, events_socket: UdpSocket) -> Self {
|
||||||
|
@ -161,6 +161,7 @@ mod tests {
|
||||||
use logger;
|
use logger;
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
use plan::Plan;
|
use plan::Plan;
|
||||||
|
use rpu::Rpu;
|
||||||
use signature::{KeyPair, KeyPairUtil};
|
use signature::{KeyPair, KeyPairUtil};
|
||||||
use std::io::sink;
|
use std::io::sink;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
@ -168,7 +169,6 @@ mod tests {
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tpu::Tpu;
|
|
||||||
use tvu::{self, Tvu};
|
use tvu::{self, Tvu};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -191,8 +191,8 @@ mod tests {
|
||||||
let bob_pubkey = KeyPair::new().pubkey();
|
let bob_pubkey = KeyPair::new().pubkey();
|
||||||
let exit = Arc::new(AtomicBool::new(false));
|
let exit = Arc::new(AtomicBool::new(false));
|
||||||
let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30));
|
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 threads = tpu.serve(d, serve, events_socket, gossip, exit.clone(), sink())
|
let threads = rpu.serve(d, serve, events_socket, gossip, exit.clone(), sink())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
sleep(Duration::from_millis(300));
|
sleep(Duration::from_millis(300));
|
||||||
|
|
||||||
|
@ -230,10 +230,9 @@ mod tests {
|
||||||
let bob_pubkey = KeyPair::new().pubkey();
|
let bob_pubkey = KeyPair::new().pubkey();
|
||||||
let exit = Arc::new(AtomicBool::new(false));
|
let exit = Arc::new(AtomicBool::new(false));
|
||||||
let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30));
|
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 serve_addr = leader_serve.local_addr().unwrap();
|
||||||
let threads = Tpu::serve(
|
let threads = rpu.serve(
|
||||||
&tpu,
|
|
||||||
leader_data,
|
leader_data,
|
||||||
leader_serve,
|
leader_serve,
|
||||||
leader_events,
|
leader_events,
|
||||||
|
@ -302,7 +301,7 @@ mod tests {
|
||||||
let leader_acc = {
|
let leader_acc = {
|
||||||
let accountant = Accountant::new(&alice);
|
let accountant = Accountant::new(&alice);
|
||||||
let accounting_stage = AccountingStage::new(accountant, &alice.last_id(), Some(30));
|
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 = {
|
let replicant_acc = {
|
||||||
|
|
Loading…
Reference in New Issue