Inline Rpu::new
This commit is contained in:
parent
99dc4ea4a9
commit
9026c70952
16
src/rpu.rs
16
src/rpu.rs
|
@ -28,15 +28,6 @@ pub struct Rpu {
|
||||||
|
|
||||||
impl Rpu {
|
impl Rpu {
|
||||||
/// Create a new Rpu that wraps the given Bank.
|
/// Create a new Rpu that wraps the given Bank.
|
||||||
pub fn new(bank: Bank, start_hash: Hash, tick_duration: Option<Duration>) -> Self {
|
|
||||||
Rpu {
|
|
||||||
bank: Arc::new(bank),
|
|
||||||
start_hash,
|
|
||||||
tick_duration,
|
|
||||||
thread_hdls: vec![],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn new1<W: Write + Send + 'static>(
|
pub fn new1<W: Write + Send + 'static>(
|
||||||
bank: Bank,
|
bank: Bank,
|
||||||
start_hash: Hash,
|
start_hash: Hash,
|
||||||
|
@ -49,7 +40,12 @@ impl Rpu {
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
writer: W,
|
writer: W,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut rpu = Self::new(bank, start_hash, tick_duration);
|
let mut rpu = Rpu {
|
||||||
|
bank: Arc::new(bank),
|
||||||
|
start_hash,
|
||||||
|
tick_duration,
|
||||||
|
thread_hdls: vec![],
|
||||||
|
};
|
||||||
let thread_hdls = rpu.serve(
|
let thread_hdls = rpu.serve(
|
||||||
me,
|
me,
|
||||||
requests_socket,
|
requests_socket,
|
||||||
|
|
16
src/tpu.rs
16
src/tpu.rs
|
@ -27,15 +27,6 @@ pub struct Tpu {
|
||||||
|
|
||||||
impl Tpu {
|
impl Tpu {
|
||||||
/// Create a new Tpu that wraps the given Bank.
|
/// Create a new Tpu that wraps the given Bank.
|
||||||
pub fn new(bank: Bank, start_hash: Hash, tick_duration: Option<Duration>) -> Self {
|
|
||||||
Tpu {
|
|
||||||
bank: Arc::new(bank),
|
|
||||||
start_hash,
|
|
||||||
tick_duration,
|
|
||||||
thread_hdls: vec![],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn new1<W: Write + Send + 'static>(
|
pub fn new1<W: Write + Send + 'static>(
|
||||||
bank: Bank,
|
bank: Bank,
|
||||||
start_hash: Hash,
|
start_hash: Hash,
|
||||||
|
@ -47,7 +38,12 @@ impl Tpu {
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
writer: W,
|
writer: W,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut tpu = Tpu::new(bank, start_hash, tick_duration);
|
let mut tpu = Tpu {
|
||||||
|
bank: Arc::new(bank),
|
||||||
|
start_hash,
|
||||||
|
tick_duration,
|
||||||
|
thread_hdls: vec![],
|
||||||
|
};
|
||||||
let thread_hdls = tpu.serve(me, requests_socket, broadcast_socket, gossip, exit, writer);
|
let thread_hdls = tpu.serve(me, requests_socket, broadcast_socket, gossip, exit, writer);
|
||||||
tpu.thread_hdls.extend(thread_hdls);
|
tpu.thread_hdls.extend(thread_hdls);
|
||||||
tpu
|
tpu
|
||||||
|
|
Loading…
Reference in New Issue