mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 21:55:47 +00:00
Paged keys rpc for child storage. (#9100)
* childstate_getKeysPaged rpc * Rename `v` to `iter`. * Update client/api/src/backend.rs Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com> * Update client/api/src/backend.rs Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
This commit is contained in:
@@ -296,7 +296,7 @@ impl<BE, Block, Client> StateBackend<Block, Client> for FullState<BE, Block, Cli
|
||||
&BlockId::Hash(block), prefix.as_ref(), start_key.as_ref()
|
||||
)
|
||||
)
|
||||
.map(|v| v.take(count as usize).collect())
|
||||
.map(|iter| iter.take(count as usize).collect())
|
||||
.map_err(client_err)))
|
||||
}
|
||||
|
||||
@@ -618,6 +618,29 @@ impl<BE, Block, Client> ChildStateBackend<Block, Client> for FullState<BE, Block
|
||||
.map_err(client_err)))
|
||||
}
|
||||
|
||||
fn storage_keys_paged(
|
||||
&self,
|
||||
block: Option<Block::Hash>,
|
||||
storage_key: PrefixedStorageKey,
|
||||
prefix: Option<StorageKey>,
|
||||
count: u32,
|
||||
start_key: Option<StorageKey>,
|
||||
) -> FutureResult<Vec<StorageKey>> {
|
||||
Box::new(result(
|
||||
self.block_or_best(block)
|
||||
.and_then(|block| {
|
||||
let child_info = match ChildType::from_prefixed_key(&storage_key) {
|
||||
Some((ChildType::ParentKeyId, storage_key)) => ChildInfo::new_default(storage_key),
|
||||
None => return Err(sp_blockchain::Error::InvalidChildStorageKey),
|
||||
};
|
||||
self.client.child_storage_keys_iter(
|
||||
&BlockId::Hash(block), child_info, prefix.as_ref(), start_key.as_ref(),
|
||||
)
|
||||
})
|
||||
.map(|iter| iter.take(count as usize).collect())
|
||||
.map_err(client_err)))
|
||||
}
|
||||
|
||||
fn storage(
|
||||
&self,
|
||||
block: Option<Block::Hash>,
|
||||
|
||||
Reference in New Issue
Block a user