[][src]Struct grin_store::lmdb::Batch

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

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

Implementations

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 using the (default) version configured on the store instance.

pub fn protocol_version(&self) -> ProtocolVersion[src]

Protocol version used by this batch.

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

Writes a single key and its Writeable value to the db. Encapsulates serialization using the specified protocol version.

pub fn get_with<T, F>(&self, key: &[u8], f: F) -> Result<Option<T>, Error> where
    F: Fn(&[u8]) -> T, 
[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> !RefUnwindSafe for Batch<'a>

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

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

impl<'a> Unpin for Batch<'a>

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

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,