Free up name 'thin_client_service'
This commit is contained in:
parent
7ab3331f01
commit
898f4971a2
|
@ -19,7 +19,7 @@ pub struct AccountingStage {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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<u64>) -> Self {
|
pub fn new(accountant: Accountant, start_hash: &Hash, ms_per_tick: Option<u64>) -> Self {
|
||||||
let (historian_input, event_receiver) = channel();
|
let (historian_input, event_receiver) = channel();
|
||||||
let historian = Historian::new(event_receiver, start_hash, ms_per_tick);
|
let historian = Historian::new(event_receiver, start_hash, ms_per_tick);
|
||||||
|
|
|
@ -137,8 +137,8 @@ mod tests {
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use ecdsa;
|
use ecdsa;
|
||||||
use packet::{Packet, Packets, SharedPackets};
|
use packet::{Packet, Packets, SharedPackets};
|
||||||
|
use request_stage::Request;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use thin_client_service::Request;
|
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
use transaction::test_tx;
|
use transaction::test_tx;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ use accounting_stage::AccountingStage;
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use ledger;
|
use ledger;
|
||||||
use packet;
|
use packet;
|
||||||
|
use request_stage::RequestProcessor;
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
@ -12,7 +13,6 @@ use std::io::sink;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use streamer;
|
use streamer;
|
||||||
use thin_client_service::RequestProcessor;
|
|
||||||
|
|
||||||
pub struct EntryWriter<'a> {
|
pub struct EntryWriter<'a> {
|
||||||
accounting_stage: &'a AccountingStage,
|
accounting_stage: &'a AccountingStage,
|
||||||
|
|
|
@ -16,12 +16,12 @@ pub mod mint;
|
||||||
pub mod packet;
|
pub mod packet;
|
||||||
pub mod plan;
|
pub mod plan;
|
||||||
pub mod recorder;
|
pub mod recorder;
|
||||||
|
pub mod request_stage;
|
||||||
pub mod result;
|
pub mod result;
|
||||||
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 thin_client_service;
|
|
||||||
pub mod timing;
|
pub mod timing;
|
||||||
pub mod tpu;
|
pub mod tpu;
|
||||||
pub mod transaction;
|
pub mod transaction;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
//! The `thin_client_service` sits alongside the TPU and queries it for information
|
//! The `request_stage` processes thin client Request messages.
|
||||||
//! on behalf of thing clients.
|
|
||||||
|
|
||||||
use accountant::Accountant;
|
use accountant::Accountant;
|
||||||
use accounting_stage::AccountingStage;
|
use accounting_stage::AccountingStage;
|
||||||
|
@ -270,12 +269,12 @@ impl RequestProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ThinClientService {
|
pub struct RequestStage {
|
||||||
pub thread_hdl: JoinHandle<()>,
|
pub thread_hdl: JoinHandle<()>,
|
||||||
pub output: streamer::BlobReceiver,
|
pub output: streamer::BlobReceiver,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThinClientService {
|
impl RequestStage {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
request_processor: Arc<RequestProcessor>,
|
request_processor: Arc<RequestProcessor>,
|
||||||
accounting_stage: Arc<AccountingStage>,
|
accounting_stage: Arc<AccountingStage>,
|
||||||
|
@ -299,7 +298,7 @@ impl ThinClientService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ThinClientService { thread_hdl, output }
|
RequestStage { thread_hdl, output }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +327,7 @@ mod tests {
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use ecdsa;
|
use ecdsa;
|
||||||
use packet::{PacketRecycler, NUM_PACKETS};
|
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};
|
use transaction::{memfind, test_tx};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
|
@ -6,11 +6,11 @@
|
||||||
use bincode::{deserialize, serialize};
|
use bincode::{deserialize, serialize};
|
||||||
use futures::future::{ok, FutureResult};
|
use futures::future::{ok, FutureResult};
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
|
use request_stage::{Request, Response, Subscription};
|
||||||
use signature::{KeyPair, PublicKey, Signature};
|
use signature::{KeyPair, PublicKey, Signature};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::net::{SocketAddr, UdpSocket};
|
use std::net::{SocketAddr, UdpSocket};
|
||||||
use thin_client_service::{Request, Response, Subscription};
|
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
pub struct ThinClient {
|
pub struct ThinClient {
|
||||||
|
|
|
@ -5,6 +5,7 @@ use accounting_stage::AccountingStage;
|
||||||
use crdt::{Crdt, ReplicatedData};
|
use crdt::{Crdt, ReplicatedData};
|
||||||
use entry_writer::EntryWriter;
|
use entry_writer::EntryWriter;
|
||||||
use packet;
|
use packet;
|
||||||
|
use request_stage::{RequestProcessor, RequestStage};
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use sig_verify_stage::SigVerifyStage;
|
use sig_verify_stage::SigVerifyStage;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
@ -14,7 +15,6 @@ use std::sync::mpsc::channel;
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
use std::thread::{spawn, JoinHandle};
|
use std::thread::{spawn, JoinHandle};
|
||||||
use streamer;
|
use streamer;
|
||||||
use thin_client_service::{RequestProcessor, ThinClientService};
|
|
||||||
|
|
||||||
pub struct Tpu {
|
pub struct Tpu {
|
||||||
accounting_stage: Arc<AccountingStage>,
|
accounting_stage: Arc<AccountingStage>,
|
||||||
|
@ -98,7 +98,7 @@ impl Tpu {
|
||||||
let sig_verify_stage = SigVerifyStage::new(exit.clone(), packet_receiver);
|
let sig_verify_stage = SigVerifyStage::new(exit.clone(), packet_receiver);
|
||||||
|
|
||||||
let blob_recycler = packet::BlobRecycler::default();
|
let blob_recycler = packet::BlobRecycler::default();
|
||||||
let thin_client_service = ThinClientService::new(
|
let request_stage = RequestStage::new(
|
||||||
self.request_processor.clone(),
|
self.request_processor.clone(),
|
||||||
self.accounting_stage.clone(),
|
self.accounting_stage.clone(),
|
||||||
exit.clone(),
|
exit.clone(),
|
||||||
|
@ -131,13 +131,13 @@ impl Tpu {
|
||||||
respond_socket,
|
respond_socket,
|
||||||
exit.clone(),
|
exit.clone(),
|
||||||
blob_recycler.clone(),
|
blob_recycler.clone(),
|
||||||
thin_client_service.output,
|
request_stage.output,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut threads = vec![
|
let mut threads = vec![
|
||||||
t_receiver,
|
t_receiver,
|
||||||
t_responder,
|
t_responder,
|
||||||
thin_client_service.thread_hdl,
|
request_stage.thread_hdl,
|
||||||
t_write,
|
t_write,
|
||||||
t_gossip,
|
t_gossip,
|
||||||
t_listen,
|
t_listen,
|
||||||
|
|
|
@ -6,6 +6,7 @@ use crdt::{Crdt, ReplicatedData};
|
||||||
use entry_writer::EntryWriter;
|
use entry_writer::EntryWriter;
|
||||||
use ledger;
|
use ledger;
|
||||||
use packet;
|
use packet;
|
||||||
|
use request_stage::{RequestProcessor, RequestStage};
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use sig_verify_stage::SigVerifyStage;
|
use sig_verify_stage::SigVerifyStage;
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
|
@ -15,7 +16,6 @@ use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{spawn, JoinHandle};
|
use std::thread::{spawn, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use streamer;
|
use streamer;
|
||||||
use thin_client_service::{RequestProcessor, ThinClientService};
|
|
||||||
|
|
||||||
pub struct Tvu {
|
pub struct Tvu {
|
||||||
accounting_stage: Arc<AccountingStage>,
|
accounting_stage: Arc<AccountingStage>,
|
||||||
|
@ -170,7 +170,7 @@ impl Tvu {
|
||||||
|
|
||||||
let sig_verify_stage = SigVerifyStage::new(exit.clone(), packet_receiver);
|
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.request_processor.clone(),
|
||||||
obj.accounting_stage.clone(),
|
obj.accounting_stage.clone(),
|
||||||
exit.clone(),
|
exit.clone(),
|
||||||
|
@ -189,7 +189,7 @@ impl Tvu {
|
||||||
respond_socket,
|
respond_socket,
|
||||||
exit.clone(),
|
exit.clone(),
|
||||||
blob_recycler.clone(),
|
blob_recycler.clone(),
|
||||||
thin_client_service.output,
|
request_stage.output,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut threads = vec![
|
let mut threads = vec![
|
||||||
|
@ -203,7 +203,7 @@ impl Tvu {
|
||||||
//serve threads
|
//serve threads
|
||||||
t_packet_receiver,
|
t_packet_receiver,
|
||||||
t_responder,
|
t_responder,
|
||||||
thin_client_service.thread_hdl,
|
request_stage.thread_hdl,
|
||||||
t_write,
|
t_write,
|
||||||
];
|
];
|
||||||
threads.extend(sig_verify_stage.thread_hdls.into_iter());
|
threads.extend(sig_verify_stage.thread_hdls.into_iter());
|
||||||
|
|
Loading…
Reference in New Issue