Write bench-tps in terms of client (#3904)
* Write bench-tps in terms of client * Add transactions_addr method for logging * Move cluster config outside do_bench_tps * Add BankClient test
This commit is contained in:
@ -16,7 +16,9 @@ use crate::transaction;
|
||||
use crate::transport::Result;
|
||||
use std::io;
|
||||
|
||||
pub trait Client: SyncClient + AsyncClient {}
|
||||
pub trait Client: SyncClient + AsyncClient {
|
||||
fn transactions_addr(&self) -> String;
|
||||
}
|
||||
|
||||
pub trait SyncClient {
|
||||
/// Create a transaction from the given message, and send it to the
|
||||
|
@ -1,4 +1,6 @@
|
||||
use crate::transaction::TransactionError;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -7,6 +9,16 @@ pub enum TransportError {
|
||||
TransactionError(TransactionError),
|
||||
}
|
||||
|
||||
impl error::Error for TransportError {}
|
||||
impl fmt::Display for TransportError {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
TransportError::IoError(err) => write!(formatter, "{:?}", err),
|
||||
TransportError::TransactionError(err) => write!(formatter, "{:?}", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TransportError {
|
||||
pub fn unwrap(&self) -> TransactionError {
|
||||
if let TransportError::TransactionError(err) = self {
|
||||
|
Reference in New Issue
Block a user