Skip to content

Commit

Permalink
add get_multiple_accounts to BenchTpsClient (solana-labs#27379)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill lykov authored Aug 25, 2022
1 parent 1ccfc65 commit 8c81ed0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bench-tps/src/bench_tps_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ pub trait BenchTpsClient {
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account>;

fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>>;
}

mod bank_client;
Expand Down
4 changes: 4 additions & 0 deletions bench-tps/src/bench_tps_client/bank_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,8 @@ impl BenchTpsClient for BankClient {
})
})
}

fn get_multiple_accounts(&self, _pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>> {
unimplemented!("BankClient doesn't support get_multiple_accounts");
}
}
4 changes: 4 additions & 0 deletions bench-tps/src/bench_tps_client/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@ impl BenchTpsClient for RpcClient {
})
})
}

fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>> {
RpcClient::get_multiple_accounts(self, pubkeys).map_err(|err| err.into())
}
}
6 changes: 6 additions & 0 deletions bench-tps/src/bench_tps_client/thin_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,10 @@ impl BenchTpsClient for ThinClient {
})
})
}

fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>> {
self.rpc_client()
.get_multiple_accounts(pubkeys)
.map_err(|err| err.into())
}
}
6 changes: 6 additions & 0 deletions bench-tps/src/bench_tps_client/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ impl BenchTpsClient for TpuClient {
})
})
}

fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>> {
self.rpc_client()
.get_multiple_accounts(pubkeys)
.map_err(|err| err.into())
}
}

0 comments on commit 8c81ed0

Please sign in to comment.