Struct grin_store::lmdb::Batch
source · pub struct Batch<'a> { /* private fields */ }
Expand description
Batch to write multiple Writeables to db in an atomic manner.
Implementations§
source§impl<'a> Batch<'a>
impl<'a> Batch<'a>
sourcepub fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error>
pub fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error>
Writes a single key/value pair to the db
sourcepub fn put_ser<W: Writeable>(&self, key: &[u8], value: &W) -> Result<(), Error>
pub fn put_ser<W: Writeable>(&self, key: &[u8], value: &W) -> Result<(), Error>
Writes a single key and its Writeable
value to the db.
Encapsulates serialization using the (default) version configured on the store instance.
sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Protocol version used by this batch.
sourcepub fn put_ser_with_version<W: Writeable>(
&self,
key: &[u8],
value: &W,
version: ProtocolVersion
) -> Result<(), Error>
pub fn put_ser_with_version<W: Writeable>( &self, key: &[u8], value: &W, version: ProtocolVersion ) -> Result<(), Error>
Writes a single key and its Writeable
value to the db.
Encapsulates serialization using the specified protocol version.
sourcepub fn get_with<F, T>(
&self,
key: &[u8],
deserialize: F
) -> Result<Option<T>, Error>
pub fn get_with<F, T>( &self, key: &[u8], deserialize: F ) -> Result<Option<T>, Error>
Low-level access for retrieving data by key. Takes a function for flexible deserialization.
sourcepub fn exists(&self, key: &[u8]) -> Result<bool, Error>
pub fn exists(&self, key: &[u8]) -> Result<bool, Error>
Whether the provided key exists. This is in the context of the current write transaction.
sourcepub fn iter<F, T>(
&self,
prefix: &[u8],
deserialize: F
) -> Result<PrefixIterator<F, T>, Error>
pub fn iter<F, T>( &self, prefix: &[u8], deserialize: F ) -> Result<PrefixIterator<F, T>, Error>
Produces an iterator from the provided key prefix.
Auto Trait Implementations§
impl<'a> !Freeze for Batch<'a>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more