[][src]Trait transact::state::Read

pub trait Read: Send + Send {
    type StateId;
    type Key;
    type Value;
    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>>; }

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.

Loading content...

Required methods

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.

fn clone_box(
    &self
) -> Box<dyn Read<StateId = Self::StateId, Key = Self::Key, Value = Self::Value>>

Loading content...

Implementors

impl Read for HashMapState[src]

type StateId = String

type Key = String

type Value = Vec<u8>

impl Read for MerkleState[src]

type StateId = String

type Key = String

type Value = Vec<u8>

Loading content...