Trait sc_rpc::state::StateBackend
source · [−]pub trait StateBackend<Block: BlockT, Client>: Send + Sync + 'static where
Block: BlockT + 'static,
Client: Send + Sync + 'static, {
Show 16 methods
fn call(
&self,
block: Option<Block::Hash>,
method: String,
call_data: Bytes
) -> FutureResult<Bytes>;
fn storage_keys(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<StorageKey>>;
fn storage_pairs(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<(StorageKey, StorageData)>>;
fn storage_keys_paged(
&self,
block: Option<Block::Hash>,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>
) -> FutureResult<Vec<StorageKey>>;
fn storage(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<StorageData>>;
fn storage_hash(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<Block::Hash>>;
fn storage_size(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<u64>>;
fn metadata(&self, block: Option<Block::Hash>) -> FutureResult<Bytes>;
fn runtime_version(
&self,
block: Option<Block::Hash>
) -> FutureResult<RuntimeVersion>;
fn query_storage(
&self,
from: Block::Hash,
to: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>;
fn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Block::Hash>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>;
fn read_proof(
&self,
block: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<ReadProof<Block::Hash>>;
fn subscribe_runtime_version(
&self,
_meta: Metadata,
subscriber: Subscriber<RuntimeVersion>
);
fn unsubscribe_runtime_version(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>;
fn subscribe_storage(
&self,
_meta: Metadata,
subscriber: Subscriber<StorageChangeSet<Block::Hash>>,
keys: Option<Vec<StorageKey>>
);
fn unsubscribe_storage(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>;
}
Expand description
State backend API.
Required methods
Call runtime method at given block.
fn storage_keys(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<StorageKey>>
fn storage_keys(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<StorageKey>>
Returns the keys with prefix, leave empty to get all the keys.
fn storage_pairs(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<(StorageKey, StorageData)>>
fn storage_pairs(
&self,
block: Option<Block::Hash>,
prefix: StorageKey
) -> FutureResult<Vec<(StorageKey, StorageData)>>
Returns the keys with prefix along with their values, leave empty to get all the pairs.
fn storage_keys_paged(
&self,
block: Option<Block::Hash>,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>
) -> FutureResult<Vec<StorageKey>>
fn storage_keys_paged(
&self,
block: Option<Block::Hash>,
prefix: Option<StorageKey>,
count: u32,
start_key: Option<StorageKey>
) -> FutureResult<Vec<StorageKey>>
Returns the keys with prefix with pagination support.
fn storage(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<StorageData>>
fn storage(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<StorageData>>
Returns a storage entry at a specific block’s state.
fn storage_hash(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<Block::Hash>>
fn storage_hash(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<Block::Hash>>
Returns the hash of a storage entry at a block’s state.
fn storage_size(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<u64>>
fn storage_size(
&self,
block: Option<Block::Hash>,
key: StorageKey
) -> FutureResult<Option<u64>>
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.
Returns the runtime metadata as an opaque blob.
fn runtime_version(
&self,
block: Option<Block::Hash>
) -> FutureResult<RuntimeVersion>
fn runtime_version(
&self,
block: Option<Block::Hash>
) -> FutureResult<RuntimeVersion>
Get the runtime version.
fn query_storage(
&self,
from: Block::Hash,
to: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>
fn query_storage(
&self,
from: Block::Hash,
to: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>
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).
fn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Block::Hash>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>
fn query_storage_at(
&self,
keys: Vec<StorageKey>,
at: Option<Block::Hash>
) -> FutureResult<Vec<StorageChangeSet<Block::Hash>>>
Query storage entries (by key) starting at block hash given as the second parameter.
fn read_proof(
&self,
block: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<ReadProof<Block::Hash>>
fn read_proof(
&self,
block: Option<Block::Hash>,
keys: Vec<StorageKey>
) -> FutureResult<ReadProof<Block::Hash>>
Returns proof of storage entries at a specific block’s state.
fn subscribe_runtime_version(
&self,
_meta: Metadata,
subscriber: Subscriber<RuntimeVersion>
)
fn subscribe_runtime_version(
&self,
_meta: Metadata,
subscriber: Subscriber<RuntimeVersion>
)
New runtime version subscription
fn unsubscribe_runtime_version(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
fn unsubscribe_runtime_version(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
Unsubscribe from runtime version subscription
fn subscribe_storage(
&self,
_meta: Metadata,
subscriber: Subscriber<StorageChangeSet<Block::Hash>>,
keys: Option<Vec<StorageKey>>
)
fn subscribe_storage(
&self,
_meta: Metadata,
subscriber: Subscriber<StorageChangeSet<Block::Hash>>,
keys: Option<Vec<StorageKey>>
)
New storage subscription
fn unsubscribe_storage(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
fn unsubscribe_storage(
&self,
_meta: Option<Metadata>,
id: SubscriptionId
) -> RpcResult<bool>
Unsubscribe from storage subscription