pub trait Read: Send + Send {
type StateId;
type Key;
type Value;
// Required methods
fn get(
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<HashMap<Self::Key, Self::Value>, StateReadError>;
fn clone_box(
&self
) -> Box<dyn Read<StateId = Self::StateId, Key = Self::Key, Value = Self::Value>>;
}
Expand description
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.
Required Associated Types§
Required Methods§
sourcefn get(
&self,
state_id: &Self::StateId,
keys: &[Self::Key]
) -> Result<HashMap<Self::Key, Self::Value>, StateReadError>
fn get( &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.