Trait sc_rpc::state::StateBackend
source · pub trait StateBackend<Block, Client>: Send + Sync + 'staticwhere
Block: BlockT + 'static,
Client: Send + Sync + 'static,{
Show 15 methods
// Required methods
fn call(
&self,
block: Option<Block::Hash>,
method: String,
call_data: Bytes
) -> Result<Bytes, Error>;
fn storage_keys(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> Result<Vec<StorageKey>, Error>;
fn storage_pairs(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> Result<Vec<(StorageKey, StorageData)>, Error>;
fn storage_keys_paged(
&self,
block: Option<Block::Hash>,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>
) -> Result<Vec<StorageKey>, Error>;
fn storage(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> Result<Option<StorageData>, Error>;
fn storage_hash(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> Result<Option<Block::Hash>, Error>;
fn storage_size<'life0, 'async_trait>(
&'life0 self,
block: Option<Block::Hash>,
key: StorageKey,
deny_unsafe: DenyUnsafe
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn metadata(&self, block: Option<Block::Hash>) -> Result<Bytes, Error>;
fn runtime_version(
&self,
block: Option<Block::Hash>
) -> Result<RuntimeVersion, Error>;
fn query_storage(
&self,
from: Block::Hash,
to: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>;
fn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Block::Hash>
) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>;
fn read_proof(
&self,
block: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> Result<ReadProof<Block::Hash>, Error>;
fn trace_block(
&self,
block: Block::Hash,
targets: Option<String>,
storage_keys: Option<String>,
methods: Option<String>
) -> Result<TraceBlockResponse, Error>;
fn subscribe_runtime_version(&self, sink: SubscriptionSink);
fn subscribe_storage(
&self,
sink: SubscriptionSink,
keys: Option<Vec<StorageKey>>
);
}
Expand description
State backend API.
Required Methods§
sourcefn call(
&self,
block: Option<Block::Hash>,
method: String,
call_data: Bytes
) -> Result<Bytes, Error>
fn call( &self, block: Option<Block::Hash>, method: String, call_data: Bytes ) -> Result<Bytes, Error>
Call runtime method at given block.
sourcefn storage_keys(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> Result<Vec<StorageKey>, Error>
fn storage_keys( &self, block: Option<Block::Hash>, prefix: StorageKey ) -> Result<Vec<StorageKey>, Error>
Returns the keys with prefix, leave empty to get all the keys.
sourcefn storage_pairs(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> Result<Vec<(StorageKey, StorageData)>, Error>
fn storage_pairs( &self, block: Option<Block::Hash>, prefix: StorageKey ) -> Result<Vec<(StorageKey, StorageData)>, Error>
Returns the keys with prefix along with their values, leave empty to get all the pairs.
sourcefn storage_keys_paged(
&self,
block: Option<Block::Hash>,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>
) -> Result<Vec<StorageKey>, Error>
fn storage_keys_paged( &self, block: Option<Block::Hash>, prefix: Option<StorageKey>, count: u32, start_key: Option<StorageKey> ) -> Result<Vec<StorageKey>, Error>
Returns the keys with prefix with pagination support.
sourcefn storage(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> Result<Option<StorageData>, Error>
fn storage( &self, block: Option<Block::Hash>, key: StorageKey ) -> Result<Option<StorageData>, Error>
Returns a storage entry at a specific block’s state.
sourcefn storage_hash(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> Result<Option<Block::Hash>, Error>
fn storage_hash( &self, block: Option<Block::Hash>, key: StorageKey ) -> Result<Option<Block::Hash>, Error>
Returns the hash of a storage entry at a block’s state.
sourcefn storage_size<'life0, 'async_trait>(
&'life0 self,
block: Option<Block::Hash>,
key: StorageKey,
deny_unsafe: DenyUnsafe
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn storage_size<'life0, 'async_trait>( &'life0 self, block: Option<Block::Hash>, key: StorageKey, deny_unsafe: DenyUnsafe ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Returns the size of a storage entry at a block’s state.
If data is available at key
, it is returned. Else, the sum of values who’s key has key
prefix is returned, i.e. all the storage (double) maps that have this prefix.
sourcefn metadata(&self, block: Option<Block::Hash>) -> Result<Bytes, Error>
fn metadata(&self, block: Option<Block::Hash>) -> Result<Bytes, Error>
Returns the runtime metadata as an opaque blob.
sourcefn runtime_version(
&self,
block: Option<Block::Hash>
) -> Result<RuntimeVersion, Error>
fn runtime_version( &self, block: Option<Block::Hash> ) -> Result<RuntimeVersion, Error>
Get the runtime version.
sourcefn query_storage(
&self,
from: Block::Hash,
to: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>
fn query_storage( &self, from: Block::Hash, to: Option<Block::Hash>, keys: Vec<StorageKey> ) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>
Query historical storage entries (by key) starting from a block given as the second parameter.
NOTE This first returned result contains the initial state of storage for all keys. Subsequent values in the vector represent changes to the previous state (diffs).
sourcefn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Block::Hash>
) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>
fn query_storage_at( &self, keys: Vec<StorageKey>, at: Option<Block::Hash> ) -> Result<Vec<StorageChangeSet<Block::Hash>>, Error>
Query storage entries (by key) starting at block hash given as the second parameter.
sourcefn read_proof(
&self,
block: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> Result<ReadProof<Block::Hash>, Error>
fn read_proof( &self, block: Option<Block::Hash>, keys: Vec<StorageKey> ) -> Result<ReadProof<Block::Hash>, Error>
Returns proof of storage entries at a specific block’s state.
sourcefn trace_block(
&self,
block: Block::Hash,
targets: Option<String>,
storage_keys: Option<String>,
methods: Option<String>
) -> Result<TraceBlockResponse, Error>
fn trace_block( &self, block: Block::Hash, targets: Option<String>, storage_keys: Option<String>, methods: Option<String> ) -> Result<TraceBlockResponse, Error>
Trace storage changes for block
sourcefn subscribe_runtime_version(&self, sink: SubscriptionSink)
fn subscribe_runtime_version(&self, sink: SubscriptionSink)
New runtime version subscription
sourcefn subscribe_storage(
&self,
sink: SubscriptionSink,
keys: Option<Vec<StorageKey>>
)
fn subscribe_storage( &self, sink: SubscriptionSink, keys: Option<Vec<StorageKey>> )
New storage subscription