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:
chemeandAlexander Popiak authored and GitHub committed 2021-07-07 07:22:13 +00:00
1 parent fc1199b6a1
commit d80e1bc978
7 files changed
+151 -9

No files matched your search

@@ -34,6 +34,7 @@ pub trait ChildStateApi<Hash> {
/// RPC Metadata
type Metadata;
/// DEPRECATED: Please use `childstate_getKeysPaged` with proper paging support.
/// Returns the keys with prefix from a child storage, leave empty to get all the keys
#[rpc(name = "childstate_getKeys")]
fn storage_keys(
@@ -43,6 +44,19 @@ pub trait ChildStateApi<Hash> {
hash: Option<Hash>
) -> FutureResult<Vec<StorageKey>>;
/// Returns the keys with prefix from a child storage with pagination support.
/// Up to `count` keys will be returned.
/// If `start_key` is passed, return next keys in storage in lexicographic order.
#[rpc(name = "childstate_getKeysPaged", alias("childstate_getKeysPagedAt"))]
fn storage_keys_paged(
&self,
child_storage_key: PrefixedStorageKey,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>,
hash: Option<Hash>,
) -> FutureResult<Vec<StorageKey>>;
/// Returns a child storage entry at a specific block's state.
#[rpc(name = "childstate_getStorage")]
fn storage(