sc_rpc::state

Trait StateBackend

source
pub trait StateBackend<Block, Client>:
    Send
    + Sync
    + 'static
where 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, pending: PendingSubscriptionSink); fn subscribe_storage( &self, pending: PendingSubscriptionSink, keys: Option<Vec<StorageKey>>, deny_unsafe: DenyUnsafe, );
}
Expand description

State backend API.

Required Methods§

source

fn call( &self, block: Option<Block::Hash>, method: String, call_data: Bytes, ) -> Result<Bytes, Error>

Call runtime method at given block.

source

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.

source

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.

source

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.

source

fn storage( &self, block: Option<Block::Hash>, key: StorageKey, ) -> Result<Option<StorageData>, Error>

Returns a storage entry at a specific block’s state.

source

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.

source

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.

source

fn metadata(&self, block: Option<Block::Hash>) -> Result<Bytes, Error>

Returns the runtime metadata as an opaque blob.

source

fn runtime_version( &self, block: Option<Block::Hash>, ) -> Result<RuntimeVersion, Error>

Get the runtime version.

source

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).

source

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.

source

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.

source

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

source

fn subscribe_runtime_version(&self, pending: PendingSubscriptionSink)

New runtime version subscription

source

fn subscribe_storage( &self, pending: PendingSubscriptionSink, keys: Option<Vec<StorageKey>>, deny_unsafe: DenyUnsafe, )

New storage subscription

Implementors§