pub struct WriteBatch<'db, K: StoreKey + Send, S: ParallelScheduler, const FAMILIES: usize> { /* private fields */ }Expand description
A write batch.
Implementations§
Source§impl<'db, K: StoreKey + Send + Sync, S: ParallelScheduler, const FAMILIES: usize> WriteBatch<'db, K, S, FAMILIES>
impl<'db, K: StoreKey + Send + Sync, S: ParallelScheduler, const FAMILIES: usize> WriteBatch<'db, K, S, FAMILIES>
Sourcepub fn put(&self, family: u32, key: K, value: ValueBuffer<'_>) -> Result<()>
pub fn put(&self, family: u32, key: K, value: ValueBuffer<'_>) -> Result<()>
Puts a key-value pair into the write batch.
Sourcepub fn delete(&self, family: u32, key: K) -> Result<()>
pub fn delete(&self, family: u32, key: K) -> Result<()>
Puts a delete operation into the write batch. This deletes all values for key.
Combining this with a WriteBatch::put of the same key in the same batch is not
supported: which one wins is undefined, and callers are expected to resolve the intent
themselves before writing.
Sourcepub fn delete_value(
&self,
family: u32,
key: K,
value: ValueBuffer<'_>,
) -> Result<()>
pub fn delete_value( &self, family: u32, key: K, value: ValueBuffer<'_>, ) -> Result<()>
Deletes a single key-value pair, leaving any other values for key intact.
Only valid for FamilyKind::MultiValue families: in a SingleValue family a key has one
value and WriteBatch::delete already removes it exactly.
Deleting a pair that is written in the same batch — by this or any other operation on the
key — is not supported, for the reason given on WriteBatch::delete: which one wins
is undefined, and it is the caller’s job to resolve that before writing.
Only values of at most MAX_INLINE_VALUE_SIZE bytes can be deleted this way. This is a
simplifying limitation that could be relaxed if needed. Of course in general the storage
overhead of deleting large values by value makes it apriori inefficient.
Auto Trait Implementations§
impl<'db, K, S, const FAMILIES: usize> !Freeze for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> !RefUnwindSafe for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> !UnwindSafe for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> Send for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> Sync for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> Unpin for WriteBatch<'db, K, S, FAMILIES>
impl<'db, K, S, const FAMILIES: usize> UnsafeUnpin for WriteBatch<'db, K, S, FAMILIES>where
S: UnsafeUnpin,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more