chainHead_storage: Iterate over keys (#14628)

* chainHead: Iterate over key,values and key,hashes

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* chainHead/tests: Multi query with iteration over keys

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* chainHead/events: Fix typo in StorageQuery

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* chainHead: Take 10 from key iterator

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: parity-processbot <>
This commit is contained in:
Alexandru Vasile
2023-07-25 18:43:04 +03:00
committed by GitHub
parent 59d8b86450
commit 00787a10e9
4 changed files with 217 additions and 67 deletions
@@ -300,9 +300,7 @@ where
let items = items
.into_iter()
.map(|query| {
if query.queue_type != StorageQueryType::Value &&
query.queue_type != StorageQueryType::Hash
{
if query.query_type == StorageQueryType::ClosestDescendantMerkleValue {
// Note: remove this once all types are implemented.
let _ = sink.reject(ChainHeadRpcError::InvalidParam(
"Storage query type not supported".into(),
@@ -312,7 +310,7 @@ where
Ok(StorageQuery {
key: StorageKey(parse_hex_param(&mut sink, query.key)?),
queue_type: query.queue_type,
query_type: query.query_type,
})
})
.collect::<Result<Vec<_>, _>>()?;