Less state
This commit is contained in:
15
src/rpu.rs
15
src/rpu.rs
@ -21,8 +21,6 @@ use write_stage::WriteStage;
|
|||||||
|
|
||||||
pub struct Rpu {
|
pub struct Rpu {
|
||||||
bank: Arc<Bank>,
|
bank: Arc<Bank>,
|
||||||
start_hash: Hash,
|
|
||||||
tick_duration: Option<Duration>,
|
|
||||||
pub thread_hdls: Vec<JoinHandle<()>>,
|
pub thread_hdls: Vec<JoinHandle<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,11 +40,11 @@ impl Rpu {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
let mut rpu = Rpu {
|
let mut rpu = Rpu {
|
||||||
bank: Arc::new(bank),
|
bank: Arc::new(bank),
|
||||||
start_hash,
|
|
||||||
tick_duration,
|
|
||||||
thread_hdls: vec![],
|
thread_hdls: vec![],
|
||||||
};
|
};
|
||||||
let thread_hdls = rpu.serve(
|
let thread_hdls = rpu.serve(
|
||||||
|
start_hash,
|
||||||
|
tick_duration,
|
||||||
me,
|
me,
|
||||||
requests_socket,
|
requests_socket,
|
||||||
broadcast_socket,
|
broadcast_socket,
|
||||||
@ -64,6 +62,8 @@ impl Rpu {
|
|||||||
/// 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>(
|
||||||
&self,
|
&self,
|
||||||
|
start_hash: Hash,
|
||||||
|
tick_duration: Option<Duration>,
|
||||||
me: ReplicatedData,
|
me: ReplicatedData,
|
||||||
requests_socket: UdpSocket,
|
requests_socket: UdpSocket,
|
||||||
broadcast_socket: UdpSocket,
|
broadcast_socket: UdpSocket,
|
||||||
@ -93,11 +93,8 @@ impl Rpu {
|
|||||||
blob_recycler.clone(),
|
blob_recycler.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let record_stage = RecordStage::new(
|
let record_stage =
|
||||||
request_stage.signal_receiver,
|
RecordStage::new(request_stage.signal_receiver, &start_hash, tick_duration);
|
||||||
&self.start_hash,
|
|
||||||
self.tick_duration,
|
|
||||||
);
|
|
||||||
|
|
||||||
let write_stage = WriteStage::new(
|
let write_stage = WriteStage::new(
|
||||||
self.bank.clone(),
|
self.bank.clone(),
|
||||||
|
24
src/tpu.rs
24
src/tpu.rs
@ -20,8 +20,6 @@ use write_stage::WriteStage;
|
|||||||
|
|
||||||
pub struct Tpu {
|
pub struct Tpu {
|
||||||
bank: Arc<Bank>,
|
bank: Arc<Bank>,
|
||||||
start_hash: Hash,
|
|
||||||
tick_duration: Option<Duration>,
|
|
||||||
pub thread_hdls: Vec<JoinHandle<()>>,
|
pub thread_hdls: Vec<JoinHandle<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,11 +38,18 @@ impl Tpu {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
let mut tpu = Tpu {
|
let mut tpu = Tpu {
|
||||||
bank: Arc::new(bank),
|
bank: Arc::new(bank),
|
||||||
start_hash,
|
|
||||||
tick_duration,
|
|
||||||
thread_hdls: vec![],
|
thread_hdls: vec![],
|
||||||
};
|
};
|
||||||
let thread_hdls = tpu.serve(me, requests_socket, broadcast_socket, gossip, exit, writer);
|
let thread_hdls = tpu.serve(
|
||||||
|
start_hash,
|
||||||
|
tick_duration,
|
||||||
|
me,
|
||||||
|
requests_socket,
|
||||||
|
broadcast_socket,
|
||||||
|
gossip,
|
||||||
|
exit,
|
||||||
|
writer,
|
||||||
|
);
|
||||||
tpu.thread_hdls.extend(thread_hdls);
|
tpu.thread_hdls.extend(thread_hdls);
|
||||||
tpu
|
tpu
|
||||||
}
|
}
|
||||||
@ -54,6 +59,8 @@ impl Tpu {
|
|||||||
/// 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>(
|
||||||
&self,
|
&self,
|
||||||
|
start_hash: Hash,
|
||||||
|
tick_duration: Option<Duration>,
|
||||||
me: ReplicatedData,
|
me: ReplicatedData,
|
||||||
requests_socket: UdpSocket,
|
requests_socket: UdpSocket,
|
||||||
broadcast_socket: UdpSocket,
|
broadcast_socket: UdpSocket,
|
||||||
@ -80,11 +87,8 @@ impl Tpu {
|
|||||||
packet_recycler.clone(),
|
packet_recycler.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let record_stage = RecordStage::new(
|
let record_stage =
|
||||||
banking_stage.signal_receiver,
|
RecordStage::new(banking_stage.signal_receiver, &start_hash, tick_duration);
|
||||||
&self.start_hash,
|
|
||||||
self.tick_duration,
|
|
||||||
);
|
|
||||||
|
|
||||||
let write_stage = WriteStage::new(
|
let write_stage = WriteStage::new(
|
||||||
self.bank.clone(),
|
self.bank.clone(),
|
||||||
|
Reference in New Issue
Block a user