Companion for substrate#13284 (#6653)

* Align iterator use to new substrate

* update lockfile for {"substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Koute
2023-02-22 17:36:16 +09:00
committed by GitHub
parent 2f6e941caf
commit 1b30ce5a9d
2 changed files with 211 additions and 235 deletions
+186 -186
View File
File diff suppressed because it is too large Load Diff
+25 -49
View File
@@ -22,7 +22,9 @@
use polkadot_primitives::{ use polkadot_primitives::{
runtime_api::ParachainHost, AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce, runtime_api::ParachainHost, AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce,
}; };
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider}; use sc_client_api::{
AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, PairsIter, UsageProvider,
};
use sc_executor::NativeElseWasmExecutor; use sc_executor::NativeElseWasmExecutor;
use sp_api::{CallApiAt, Encode, NumberFor, ProvideRuntimeApi}; use sp_api::{CallApiAt, Encode, NumberFor, ProvideRuntimeApi};
use sp_blockchain::{HeaderBackend, HeaderMetadata}; use sp_blockchain::{HeaderBackend, HeaderMetadata};
@@ -438,20 +440,6 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
} }
} }
fn storage_keys(
&self,
hash: <Block as BlockT>::Hash,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
with_client! {
self,
client,
{
client.storage_keys(hash, key_prefix)
}
}
}
fn storage_hash( fn storage_hash(
&self, &self,
hash: <Block as BlockT>::Hash, hash: <Block as BlockT>::Hash,
@@ -469,30 +457,33 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
fn storage_pairs( fn storage_pairs(
&self, &self,
hash: <Block as BlockT>::Hash, hash: <Block as BlockT>::Hash,
key_prefix: &StorageKey, key_prefix: Option<&StorageKey>,
) -> sp_blockchain::Result<Vec<(StorageKey, StorageData)>> {
with_client! {
self,
client,
{
client.storage_pairs(hash, key_prefix)
}
}
}
fn storage_keys_iter(
&self,
hash: <Block as BlockT>::Hash,
prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>, start_key: Option<&StorageKey>,
) -> sp_blockchain::Result< ) -> sp_blockchain::Result<
KeyIterator<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>, PairsIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> { > {
with_client! { with_client! {
self, self,
client, client,
{ {
client.storage_keys_iter(hash, prefix, start_key) client.storage_pairs(hash, key_prefix, start_key)
}
}
}
fn storage_keys(
&self,
hash: <Block as BlockT>::Hash,
prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>,
) -> sp_blockchain::Result<
KeysIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> {
with_client! {
self,
client,
{
client.storage_keys(hash, prefix, start_key)
} }
} }
} }
@@ -513,34 +504,19 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
} }
fn child_storage_keys( fn child_storage_keys(
&self,
hash: <Block as BlockT>::Hash,
child_info: &ChildInfo,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
with_client! {
self,
client,
{
client.child_storage_keys(hash, child_info, key_prefix)
}
}
}
fn child_storage_keys_iter(
&self, &self,
hash: <Block as BlockT>::Hash, hash: <Block as BlockT>::Hash,
child_info: ChildInfo, child_info: ChildInfo,
prefix: Option<&StorageKey>, prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>, start_key: Option<&StorageKey>,
) -> sp_blockchain::Result< ) -> sp_blockchain::Result<
KeyIterator<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>, KeysIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> { > {
with_client! { with_client! {
self, self,
client, client,
{ {
client.child_storage_keys_iter(hash, child_info, prefix, start_key) client.child_storage_keys(hash, child_info, prefix, start_key)
} }
} }
} }