pub struct WriteBatch { /* private fields */ }
Expand description

A WriteBatch contains entries to be written to a MemTable (for example) in a compact form.

The storage format is (with the respective length in bytes)

[tag: 1, keylen: ~var, key: keylen, vallen: ~var, val: vallen]

Implementations§

source§

impl WriteBatch

source

pub fn new() -> WriteBatch

source

pub fn set_contents(&mut self, from: &[u8])

Initializes a WriteBatch with a serialized WriteBatch.

source

pub fn put(&mut self, k: &[u8], v: &[u8])

Adds an entry to a WriteBatch, to be added to the database.

source

pub fn delete(&mut self, k: &[u8])

Marks an entry to be deleted from the database.

source

pub fn clear(&mut self)

Clear the contents of a WriteBatch.

source

pub fn count(&self) -> u32

Returns how many operations are in a batch.

source

pub fn sequence(&self) -> u64

source

pub fn iter(&self) -> WriteBatchIter<'_>

source

pub fn insert_into_memtable(&self, seq: u64, mt: &mut MemTable)

source

pub fn encode(self, seq: u64) -> Vec<u8>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V