Trait matterdb::Snapshot[][src]

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>>[src]

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<'_>[src]

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[src]

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.

fn as_readonly(&self) -> Self::Readonly[src]

Performs the conversion.

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

fn as_ref(&self) -> &dyn Snapshot[src]

Performs the conversion.

impl Debug for dyn Snapshot[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn from(snapshot: &'a dyn Snapshot) -> Self[src]

Performs the conversion.

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

fn into_erased(self) -> ErasedAccess<'a>[src]

Performs the conversion.

impl RawAccess for &dyn Snapshot[src]

type Changes = ()

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

fn snapshot(&self) -> &dyn Snapshot[src]

Reference to a Snapshot. This is the base relative to which the changes are defined.

fn changes(&self, _address: &ResolvedAddress) -> Self::Changes[src]

Returns changes related to specific address compared to the snapshot().

Implementations on Foreign Types

impl Snapshot for Box<dyn Snapshot>[src]

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

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

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

Loading content...

Implementors

impl Snapshot for RocksDBSnapshot[src]

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

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

impl Snapshot for Patch[src]

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

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

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

Loading content...