diff --git a/src/accounting_stage.rs b/src/accounting_stage.rs index 105d5b667d..20a95b6a33 100644 --- a/src/accounting_stage.rs +++ b/src/accounting_stage.rs @@ -19,7 +19,7 @@ pub struct AccountingStage { } impl AccountingStage { - /// Create a new Tpu that wraps the given Accountant. + /// Create a new stage of the TPU for event and transaction processing pub fn new(accountant: Accountant, start_hash: &Hash, ms_per_tick: Option) -> Self { let (historian_input, event_receiver) = channel(); let historian = Historian::new(event_receiver, start_hash, ms_per_tick); diff --git a/src/ecdsa.rs b/src/ecdsa.rs index ea10be9471..14237e6cb7 100644 --- a/src/ecdsa.rs +++ b/src/ecdsa.rs @@ -137,8 +137,8 @@ mod tests { use bincode::serialize; use ecdsa; use packet::{Packet, Packets, SharedPackets}; + use request_stage::Request; use std::sync::RwLock; - use thin_client_service::Request; use transaction::Transaction; use transaction::test_tx; diff --git a/src/entry_writer.rs b/src/entry_writer.rs index 274e1ac344..48b5d195fa 100644 --- a/src/entry_writer.rs +++ b/src/entry_writer.rs @@ -4,6 +4,7 @@ use accounting_stage::AccountingStage; use entry::Entry; use ledger; use packet; +use request_stage::RequestProcessor; use result::Result; use serde_json; use std::collections::VecDeque; @@ -12,7 +13,6 @@ use std::io::sink; use std::sync::{Arc, Mutex}; use std::time::Duration; use streamer; -use thin_client_service::RequestProcessor; pub struct EntryWriter<'a> { accounting_stage: &'a AccountingStage, diff --git a/src/lib.rs b/src/lib.rs index 6cde272d60..793c21eef8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,12 +16,12 @@ pub mod mint; pub mod packet; pub mod plan; pub mod recorder; +pub mod request_stage; pub mod result; pub mod sig_verify_stage; pub mod signature; pub mod streamer; pub mod thin_client; -pub mod thin_client_service; pub mod timing; pub mod tpu; pub mod transaction; diff --git a/src/thin_client_service.rs b/src/request_stage.rs similarity index 97% rename from src/thin_client_service.rs rename to src/request_stage.rs index ef07bafddf..92ea3fc53e 100644 --- a/src/thin_client_service.rs +++ b/src/request_stage.rs @@ -1,5 +1,4 @@ -//! The `thin_client_service` sits alongside the TPU and queries it for information -//! on behalf of thing clients. +//! The `request_stage` processes thin client Request messages. use accountant::Accountant; use accounting_stage::AccountingStage; @@ -270,12 +269,12 @@ impl RequestProcessor { } } -pub struct ThinClientService { +pub struct RequestStage { pub thread_hdl: JoinHandle<()>, pub output: streamer::BlobReceiver, } -impl ThinClientService { +impl RequestStage { pub fn new( request_processor: Arc, accounting_stage: Arc, @@ -299,7 +298,7 @@ impl ThinClientService { } } }); - ThinClientService { thread_hdl, output } + RequestStage { thread_hdl, output } } } @@ -328,7 +327,7 @@ mod tests { use bincode::serialize; use ecdsa; use packet::{PacketRecycler, NUM_PACKETS}; - use thin_client_service::{to_request_packets, Request}; + use request_stage::{to_request_packets, Request}; use transaction::{memfind, test_tx}; #[test] diff --git a/src/thin_client.rs b/src/thin_client.rs index 82a693a585..ad2501b55f 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -6,11 +6,11 @@ use bincode::{deserialize, serialize}; use futures::future::{ok, FutureResult}; use hash::Hash; +use request_stage::{Request, Response, Subscription}; use signature::{KeyPair, PublicKey, Signature}; use std::collections::HashMap; use std::io; use std::net::{SocketAddr, UdpSocket}; -use thin_client_service::{Request, Response, Subscription}; use transaction::Transaction; pub struct ThinClient { diff --git a/src/tpu.rs b/src/tpu.rs index 0843139ab7..24d499bb13 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -5,6 +5,7 @@ use accounting_stage::AccountingStage; use crdt::{Crdt, ReplicatedData}; use entry_writer::EntryWriter; use packet; +use request_stage::{RequestProcessor, RequestStage}; use result::Result; use sig_verify_stage::SigVerifyStage; use std::io::Write; @@ -14,7 +15,6 @@ use std::sync::mpsc::channel; use std::sync::{Arc, Mutex, RwLock}; use std::thread::{spawn, JoinHandle}; use streamer; -use thin_client_service::{RequestProcessor, ThinClientService}; pub struct Tpu { accounting_stage: Arc, @@ -98,7 +98,7 @@ impl Tpu { let sig_verify_stage = SigVerifyStage::new(exit.clone(), packet_receiver); let blob_recycler = packet::BlobRecycler::default(); - let thin_client_service = ThinClientService::new( + let request_stage = RequestStage::new( self.request_processor.clone(), self.accounting_stage.clone(), exit.clone(), @@ -131,13 +131,13 @@ impl Tpu { respond_socket, exit.clone(), blob_recycler.clone(), - thin_client_service.output, + request_stage.output, ); let mut threads = vec![ t_receiver, t_responder, - thin_client_service.thread_hdl, + request_stage.thread_hdl, t_write, t_gossip, t_listen, diff --git a/src/tvu.rs b/src/tvu.rs index e947d52cfb..37f88e17f9 100644 --- a/src/tvu.rs +++ b/src/tvu.rs @@ -6,6 +6,7 @@ use crdt::{Crdt, ReplicatedData}; use entry_writer::EntryWriter; use ledger; use packet; +use request_stage::{RequestProcessor, RequestStage}; use result::Result; use sig_verify_stage::SigVerifyStage; use std::net::UdpSocket; @@ -15,7 +16,6 @@ use std::sync::{Arc, RwLock}; use std::thread::{spawn, JoinHandle}; use std::time::Duration; use streamer; -use thin_client_service::{RequestProcessor, ThinClientService}; pub struct Tvu { accounting_stage: Arc, @@ -170,7 +170,7 @@ impl Tvu { let sig_verify_stage = SigVerifyStage::new(exit.clone(), packet_receiver); - let thin_client_service = ThinClientService::new( + let request_stage = RequestStage::new( obj.request_processor.clone(), obj.accounting_stage.clone(), exit.clone(), @@ -189,7 +189,7 @@ impl Tvu { respond_socket, exit.clone(), blob_recycler.clone(), - thin_client_service.output, + request_stage.output, ); let mut threads = vec![ @@ -203,7 +203,7 @@ impl Tvu { //serve threads t_packet_receiver, t_responder, - thin_client_service.thread_hdl, + request_stage.thread_hdl, t_write, ]; threads.extend(sig_verify_stage.thread_hdls.into_iter());