Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Polyakov <[email protected]>
  • Loading branch information
Arjentix committed Oct 7, 2023
1 parent 31df2c0 commit 8d874f0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 4 additions & 2 deletions config/iroha_test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"TELEMETRY_URL": "127.0.0.1:8180",
"MAX_TRANSACTION_SIZE": 32768,
"MAX_CONTENT_LEN": 16384000,
"FETCH_SIZE": 10,
"QUERY_IDLE_TIME_MS": 30000
"FETCH_SIZE": 10
},
"BLOCK_SYNC": {
"GOSSIP_PERIOD_MS": 10000,
Expand Down Expand Up @@ -121,5 +120,8 @@
"CREATE_EVERY_MS": 60000,
"DIR_PATH": "./storage",
"CREATION_ENABLED": true
},
"LIVE_QUERY_STORE": {
"QUERY_IDLE_TIME_MS": 30000
}
}
Binary file modified configs/peer/validator.wasm
Binary file not shown.
6 changes: 6 additions & 0 deletions data_model/src/query/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ pub mod model {
/// Pointer to the next element in the result set
pub cursor: Option<NonZeroU64>,
}

impl ForwardCursor {
pub const fn new(query_id: Option<String>, cursor: Option<NonZeroU64>) -> Self {
Self { query_id, cursor }
}
}
}

mod candidate {
Expand Down
11 changes: 8 additions & 3 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
}
}

#[derive(Debug)]
#[derive(Debug, Encode, PartialEq, Eq)]
pub struct QueryOutputCursor<T> {
batch: T,
cursor: ForwardCursor,
Expand Down Expand Up @@ -297,6 +297,9 @@ impl<T: TryFrom<Value>> Iterator for QueryOutputCursorIterator<T> {

let mut next_iter = match self.next_batch() {
Ok(next_iter) => next_iter,
Err(QueryOutputCursorError::Validation(ValidationFail::QueryFailed(
iroha_data_model::query::error::QueryExecutionFail::UnknownCursor,
))) => return None,
Err(err) => return Some(Err(err)),
};

Expand Down Expand Up @@ -632,8 +635,10 @@ mod tests {

use super::*;

const QUERY_RESULT: Result<Value, ValidationFail> =
Ok(Value::Numeric(NumericValue::U32(1234_u32)));
const QUERY_RESULT: Result<QueryOutputCursor<Value>, ValidationFail> = Ok(QueryOutputCursor {
batch: Value::Numeric(NumericValue::U32(1234_u32)),
cursor: ForwardCursor::new(None, None),
});
const ISI_RESULT: Result<(), ValidationFail> = Ok(());
const EXPRESSION_RESULT: NumericValue = NumericValue::U32(5_u32);

Expand Down

0 comments on commit 8d874f0

Please sign in to comment.