[][src]Struct grin_store::Batch

pub struct Batch<'a> { /* fields omitted */ }

Batch to write multiple Writeables to db in an atomic manner.

Methods

impl<'a> Batch<'a>[src]

pub fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error>[src]

Writes a single key/value pair to the db

pub fn put_ser<W: Writeable>(&self, key: &[u8], value: &W) -> Result<(), Error>[src]

Writes a single key and its Writeable value to the db. Encapsulates serialization.

pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>[src]

gets a value from the db, provided its key

pub fn exists(&self, key: &[u8]) -> Result<bool, Error>[src]

Whether the provided key exists

pub fn iter<T: Readable>(&self, from: &[u8]) -> Result<SerIterator<T>, Error>[src]

Produces an iterator of Readable types moving forward from the provided key.

pub fn get_ser<T: Readable>(&self, key: &[u8]) -> Result<Option<T>, Error>[src]

Gets a Readable value from the db, provided its key, taking the content of the current batch into account.

pub fn delete(&self, key: &[u8]) -> Result<(), Error>[src]

Deletes a key/value pair from the db

pub fn commit(self) -> Result<(), Error>[src]

Writes the batch to db

pub fn child(&mut self) -> Result<Batch, Error>[src]

Creates a child of this batch. It will be merged with its parent on commit, abandoned otherwise.

Auto Trait Implementations

impl<'a> !Send for Batch<'a>

impl<'a> !Sync for Batch<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self

impl<T> SafeBorrow for T where
    T: ?Sized