Skip to content

Commit

Permalink
refactor: query filters (#4833)
Browse files Browse the repository at this point in the history
* refactor(queries): remove the PredicateSymbol trait
* refactor(queries): make the predicates always accept input by reference
* feat(queries): add a type-checked predicate construction dsl
* feat(queries)!: add a new set of query types to support the new dsl, integrate into the client
* feat(queries)!: add the rest of the queries to IterableQueryBox and SingularQueryBox
* feat(queries)!: implement the execution logic for the new queries
* feat(queries)!: implement the new query execution in wasm
* feat(queries)!: validate the new queries in the executor
* feat(queries)!: allow a simplistic type-erased query execution in client cli
* feat(queries)!: remove the old query system
* refactor(queries)!: remove "All" from the names of the queries
* refactor!: `Pagination`'s `start` field -> `offset`
* fix(queries): fix more clippy warns

Signed-off-by: ⭐️NINIKA⭐️ <[email protected]>
  • Loading branch information
DCNick3 authored Aug 14, 2024
1 parent 19687dc commit edf2311
Show file tree
Hide file tree
Showing 127 changed files with 6,463 additions and 6,294 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions client/benches/torii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use iroha::{
};
use iroha_genesis::GenesisBuilder;
use iroha_primitives::unique_vec;
use iroha_version::Encode;
use irohad::samples::get_config;
use test_network::{
construct_executor, get_chain_id, get_key_pair, Peer as TestPeer, PeerBuilder, TestRuntime,
Expand Down Expand Up @@ -82,15 +81,17 @@ fn query_requests(criterion: &mut Criterion) {
])
.expect("Failed to prepare state");

let request = asset::by_account_id(account_id);
let query = iroha
.query(asset::all())
.filter_with(|asset| asset.id.account.eq(account_id));
thread::sleep(std::time::Duration::from_millis(1500));
let mut success_count = 0;
let mut failures_count = 0;
let _dropable = group.throughput(Throughput::Bytes(request.encode().len() as u64));
// reporting elements and not bytes here because the new query builder doesn't easily expose the box type used in transport
let _dropable = group.throughput(Throughput::Elements(1));
let _dropable2 = group.bench_function("query", |b| {
b.iter(|| {
let iter: Result<Vec<_>, _> =
iroha.request(request.clone()).and_then(Iterator::collect);
let iter = query.clone().execute_all();

match iter {
Ok(assets) => {
Expand Down
Loading

0 comments on commit edf2311

Please sign in to comment.