[][src]Trait exonum_merkledb::Snapshot

pub trait Snapshot: Send + Sync + 'static {
    fn get(&self, name: &ResolvedAddress, key: &[u8]) -> Option<Vec<u8>>;
fn iter(&self, name: &ResolvedAddress, from: &[u8]) -> Iter; fn contains(&self, name: &ResolvedAddress, key: &[u8]) -> bool { ... } }

A read-only snapshot of a storage backend.

A Snapshot instance is an immutable representation of a certain storage state. It provides read isolation, so consistency is guaranteed even if the data in the database changes between reads.

Required methods

fn get(&self, name: &ResolvedAddress, key: &[u8]) -> Option<Vec<u8>>

Returns a value corresponding to the specified address and key as a raw vector of bytes, or None if it does not exist.

fn iter(&self, name: &ResolvedAddress, from: &[u8]) -> Iter

Returns an iterator over the entries of the snapshot in ascending order starting from the specified key. The iterator element type is (&[u8], &[u8]).

Loading content...

Provided methods

fn contains(&self, name: &ResolvedAddress, key: &[u8]) -> bool

Returns true if the snapshot contains a value for the specified address and key.

The default implementation checks existence of the value using get.

Loading content...

Trait Implementations

impl<'_> AsReadonly for &'_ dyn Snapshot[src]

type Readonly = Self

Readonly version of the access.

impl AsRef<dyn Snapshot + 'static> for dyn Snapshot[src]

impl Debug for dyn Snapshot[src]

impl<'a> From<&'a (dyn Snapshot + 'static)> for GenericRawAccess<'a>[src]

impl<'a> IntoErased<'a> for &'a dyn Snapshot[src]

impl<'_> RawAccess for &'_ dyn Snapshot[src]

type Changes = ()

Type of the changes() that will be applied to the database.

Implementations on Foreign Types

impl Snapshot for Box<dyn Snapshot>[src]

Loading content...

Implementors

impl Snapshot for Patch[src]

Loading content...