Struct kvdb::DBTransaction
source · pub struct DBTransaction {
pub ops: Vec<DBOp>,
}
Expand description
Write transaction. Batches a sequence of put/delete operations for efficiency.
Fields§
§ops: Vec<DBOp>
Database operations.
Implementations§
source§impl DBTransaction
impl DBTransaction
sourcepub fn new() -> DBTransaction
pub fn new() -> DBTransaction
Create new transaction.
sourcepub fn with_capacity(cap: usize) -> DBTransaction
pub fn with_capacity(cap: usize) -> DBTransaction
Create new transaction with capacity.
sourcepub fn put(&mut self, col: u32, key: &[u8], value: &[u8])
pub fn put(&mut self, col: u32, key: &[u8], value: &[u8])
Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
sourcepub fn put_vec(&mut self, col: u32, key: &[u8], value: Vec<u8>)
pub fn put_vec(&mut self, col: u32, key: &[u8], value: Vec<u8>)
Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
sourcepub fn delete_prefix(&mut self, col: u32, prefix: &[u8])
pub fn delete_prefix(&mut self, col: u32, prefix: &[u8])
Delete all values with the given key prefix. Using an empty prefix here will remove all keys (all keys start with the empty prefix).
Trait Implementations§
source§impl Clone for DBTransaction
impl Clone for DBTransaction
source§fn clone(&self) -> DBTransaction
fn clone(&self) -> DBTransaction
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for DBTransaction
impl Default for DBTransaction
source§fn default() -> DBTransaction
fn default() -> DBTransaction
Returns the “default value” for a type. Read more
source§impl PartialEq for DBTransaction
impl PartialEq for DBTransaction
source§fn eq(&self, other: &DBTransaction) -> bool
fn eq(&self, other: &DBTransaction) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for DBTransaction
Auto Trait Implementations§
impl Freeze for DBTransaction
impl RefUnwindSafe for DBTransaction
impl Send for DBTransaction
impl Sync for DBTransaction
impl Unpin for DBTransaction
impl UnwindSafe for DBTransaction
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)