[−][src]Trait transact::state::Read
state::Read
provides a way to retrieve state from a particular storage
system.
It provides the ability to read values from an underlying storage
Implementations are expected to be thread-safe.
Associated Types
type StateId
A reference to a checkpoint in state. It could be a merkle hash for a merkle database.
type Key
The Key that is being stored in state.
type Value
The Value that is being stored in state.
Required methods
fn get(
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<HashMap<Self::Key, Self::Value>, StateReadError>
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<HashMap<Self::Key, Self::Value>, StateReadError>
At a given StateId
, attempt to retrieve the given slice of keys.
The results of the get will be returned in a HashMap
. Only keys that
were found will be in this map. Keys missing from the map can be
assumed to be missing from the underlying storage system as well.
Errors
StateReadError
is returned if any issues occur while trying to fetch
the values.
fn clone_box(
&self
) -> Box<dyn Read<StateId = Self::StateId, Key = Self::Key, Value = Self::Value>>
&self
) -> Box<dyn Read<StateId = Self::StateId, Key = Self::Key, Value = Self::Value>>
Implementors
impl Read for HashMapState
[src]
type StateId = String
type Key = String
type Value = Vec<u8>
fn get(
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<State, StateReadError>
[src]
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<State, StateReadError>
fn clone_box(
&self
) -> Box<dyn Read<StateId = String, Key = String, Value = Vec<u8>>>
[src]
&self
) -> Box<dyn Read<StateId = String, Key = String, Value = Vec<u8>>>