Type Alias WriteBatch

Source
pub type WriteBatch = WriteBatchWithTransaction<false>;
Expand description

A type alias to keep compatibility. See WriteBatchWithTransaction for details

Aliased Type§

struct WriteBatch { /* private fields */ }

Implementations

Source§

impl<const TRANSACTION: bool> WriteBatchWithTransaction<TRANSACTION>

Source

pub fn from_data(data: &[u8]) -> Self

Construct with a reference to a byte array serialized by WriteBatch.

Source

pub fn len(&self) -> usize

Source

pub fn size_in_bytes(&self) -> usize

Return WriteBatch serialized size (in bytes).

Source

pub fn data(&self) -> &[u8]

Return a reference to a byte array which represents a serialized version of the batch.

Source

pub fn is_empty(&self) -> bool

Source

pub fn iterate(&self, callbacks: &mut dyn WriteBatchIterator)

Iterate the put and delete operations within this write batch. Note that this does not return an Iterator but instead will invoke the put() and delete() member functions of the provided WriteBatchIterator trait implementation.

Source

pub fn put<K, V>(&mut self, key: K, value: V)
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Insert a value into the database under the given key.

Source

pub fn put_cf<K, V>(&mut self, cf: &impl AsColumnFamilyRef, key: K, value: V)
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge<K, V>(&mut self, key: K, value: V)
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn merge_cf<K, V>(&mut self, cf: &impl AsColumnFamilyRef, key: K, value: V)
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn delete<K: AsRef<[u8]>>(&mut self, key: K)

Removes the database entry for key. Does nothing if the key was not found.

Source

pub fn delete_cf<K: AsRef<[u8]>>(&mut self, cf: &impl AsColumnFamilyRef, key: K)

Source

pub fn clear(&mut self)

Clear all updates buffered in this batch.

Source§

impl WriteBatchWithTransaction<false>

Source

pub fn delete_range<K: AsRef<[u8]>>(&mut self, from: K, to: K)

Remove database entries from start key to end key.

Removes the database entries in the range [“begin_key”, “end_key”), i.e., including “begin_key” and excluding “end_key”. It is not an error if no keys exist in the range [“begin_key”, “end_key”).

Source

pub fn delete_range_cf<K: AsRef<[u8]>>( &mut self, cf: &impl AsColumnFamilyRef, from: K, to: K, )

Remove database entries in column family from start key to end key.

Removes the database entries in the range [“begin_key”, “end_key”), i.e., including “begin_key” and excluding “end_key”. It is not an error if no keys exist in the range [“begin_key”, “end_key”).

Trait Implementations

Source§

impl<const TRANSACTION: bool> Default for WriteBatchWithTransaction<TRANSACTION>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const TRANSACTION: bool> Drop for WriteBatchWithTransaction<TRANSACTION>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<const TRANSACTION: bool> Send for WriteBatchWithTransaction<TRANSACTION>