Add UsageProvider trait to AbstractClient (#3106)

* Add `UsageProvider` trait to `AbstractClient`

* Fix
This commit is contained in:
Bastian Köcher
2021-05-26 13:15:45 +02:00
committed by GitHub
parent 0da48f736a
commit 7f34d76fd4
+4 -2
View File
@@ -23,7 +23,7 @@ use sp_blockchain::HeaderBackend;
use sp_runtime::{ use sp_runtime::{
Justifications, generic::{BlockId, SignedBlock}, traits::{Block as BlockT, BlakeTwo256}, Justifications, generic::{BlockId, SignedBlock}, traits::{Block as BlockT, BlakeTwo256},
}; };
use sc_client_api::{Backend as BackendT, BlockchainEvents, KeyIterator, AuxStore}; use sc_client_api::{Backend as BackendT, BlockchainEvents, KeyIterator, AuxStore, UsageProvider};
use sp_storage::{StorageData, StorageKey, ChildInfo, PrefixedStorageKey}; use sp_storage::{StorageData, StorageKey, ChildInfo, PrefixedStorageKey};
use polkadot_primitives::v1::{Block, ParachainHost, AccountId, Nonce, Balance, Header, BlockNumber, Hash}; use polkadot_primitives::v1::{Block, ParachainHost, AccountId, Nonce, Balance, Header, BlockNumber, Hash};
use consensus_common::BlockStatus; use consensus_common::BlockStatus;
@@ -79,6 +79,7 @@ pub trait AbstractClient<Block, Backend>:
StateBackend = Backend::State StateBackend = Backend::State
> >
+ AuxStore + AuxStore
+ UsageProvider<Block>
where where
Block: BlockT, Block: BlockT,
Backend: BackendT<Block>, Backend: BackendT<Block>,
@@ -95,6 +96,7 @@ impl<Block, Backend, Client> AbstractClient<Block, Backend> for Client
+ ProvideRuntimeApi<Block> + ProvideRuntimeApi<Block>
+ HeaderBackend<Block> + HeaderBackend<Block>
+ AuxStore + AuxStore
+ UsageProvider<Block>
+ Sized + Sized
+ Send + Send
+ Sync + Sync
@@ -173,7 +175,7 @@ impl ClientHandle for Client {
} }
} }
impl sc_client_api::UsageProvider<Block> for Client { impl UsageProvider<Block> for Client {
fn usage_info(&self) -> sc_client_api::ClientInfo<Block> { fn usage_info(&self) -> sc_client_api::ClientInfo<Block> {
match self { match self {
Self::Polkadot(client) => client.usage_info(), Self::Polkadot(client) => client.usage_info(),