Trait casper_execution_engine::storage::global_state::StateProvider [−][src]
pub trait StateProvider {
type Error;
type Reader: StateReader<Key, StoredValue, Error = Self::Error>;
fn checkout(
&self,
state_hash: Blake2bHash
) -> Result<Option<Self::Reader>, Self::Error>;
fn commit(
&self,
correlation_id: CorrelationId,
state_hash: Blake2bHash,
effects: AdditiveMap<Key, Transform>
) -> Result<CommitResult, Self::Error>;
fn put_protocol_data(
&self,
protocol_version: ProtocolVersion,
protocol_data: &ProtocolData
) -> Result<(), Self::Error>;
fn get_protocol_data(
&self,
protocol_version: ProtocolVersion
) -> Result<Option<ProtocolData>, Self::Error>;
fn empty_root(&self) -> Blake2bHash;
fn read_trie(
&self,
correlation_id: CorrelationId,
trie_key: &Blake2bHash
) -> Result<Option<Trie<Key, StoredValue>>, Self::Error>;
fn put_trie(
&self,
correlation_id: CorrelationId,
trie: &Trie<Key, StoredValue>
) -> Result<Blake2bHash, Self::Error>;
fn missing_trie_keys(
&self,
correlation_id: CorrelationId,
trie_keys: Vec<Blake2bHash>
) -> Result<Vec<Blake2bHash>, Self::Error>;
}Associated Types
type Reader: StateReader<Key, StoredValue, Error = Self::Error>Required methods
Checkouts to the post state of a specific block.
fn commit(
&self,
correlation_id: CorrelationId,
state_hash: Blake2bHash,
effects: AdditiveMap<Key, Transform>
) -> Result<CommitResult, Self::Error>
fn commit(
&self,
correlation_id: CorrelationId,
state_hash: Blake2bHash,
effects: AdditiveMap<Key, Transform>
) -> Result<CommitResult, Self::Error>Applies changes and returns a new post state hash. block_hash is used for computing a deterministic and unique keys.
fn put_protocol_data(
&self,
protocol_version: ProtocolVersion,
protocol_data: &ProtocolData
) -> Result<(), Self::Error>fn get_protocol_data(
&self,
protocol_version: ProtocolVersion
) -> Result<Option<ProtocolData>, Self::Error>fn empty_root(&self) -> Blake2bHashfn read_trie(
&self,
correlation_id: CorrelationId,
trie_key: &Blake2bHash
) -> Result<Option<Trie<Key, StoredValue>>, Self::Error>
fn read_trie(
&self,
correlation_id: CorrelationId,
trie_key: &Blake2bHash
) -> Result<Option<Trie<Key, StoredValue>>, Self::Error>Reads a Trie from the state if it is present
fn put_trie(
&self,
correlation_id: CorrelationId,
trie: &Trie<Key, StoredValue>
) -> Result<Blake2bHash, Self::Error>
fn put_trie(
&self,
correlation_id: CorrelationId,
trie: &Trie<Key, StoredValue>
) -> Result<Blake2bHash, Self::Error>Insert a trie node into the trie
fn missing_trie_keys(
&self,
correlation_id: CorrelationId,
trie_keys: Vec<Blake2bHash>
) -> Result<Vec<Blake2bHash>, Self::Error>
fn missing_trie_keys(
&self,
correlation_id: CorrelationId,
trie_keys: Vec<Blake2bHash>
) -> Result<Vec<Blake2bHash>, Self::Error>Finds all of the missing or corrupt keys of which are descendants of trie_key