Struct kv::Transaction
source · pub struct Transaction<'a, 'b, K: Key<'a>, V: Value>(/* private fields */);
Expand description
Transaction
Implementations§
source§impl<'a, 'b, K: Key<'a>, V: Value> Transaction<'a, 'b, K, V>
impl<'a, 'b, K: Key<'a>, V: Value> Transaction<'a, 'b, K, V>
sourcepub fn get(&self, key: &K) -> Result<Option<V>, TransactionError<Error>>
pub fn get(&self, key: &K) -> Result<Option<V>, TransactionError<Error>>
Get the value associated with the specified key
sourcepub fn set(
&self,
key: &K,
value: &V
) -> Result<Option<V>, TransactionError<Error>>
pub fn set( &self, key: &K, value: &V ) -> Result<Option<V>, TransactionError<Error>>
Set the value associated with the specified key to the provided value
sourcepub fn remove(&self, key: &K) -> Result<Option<V>, TransactionError<Error>>
pub fn remove(&self, key: &K) -> Result<Option<V>, TransactionError<Error>>
Remove the value associated with the specified key from the database
sourcepub fn batch(&self, batch: &Batch<K, V>) -> Result<(), TransactionError<Error>>
pub fn batch(&self, batch: &Batch<K, V>) -> Result<(), TransactionError<Error>>
Apply batch update
sourcepub fn generate_id(&self) -> Result<u64, TransactionError<Error>>
pub fn generate_id(&self) -> Result<u64, TransactionError<Error>>
Generate a monotonic ID. Not guaranteed to be contiguous or idempotent, can produce different values in the same transaction in case of conflicts
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'b, K, V> !RefUnwindSafe for Transaction<'a, 'b, K, V>
impl<'a, 'b, K, V> !Send for Transaction<'a, 'b, K, V>
impl<'a, 'b, K, V> !Sync for Transaction<'a, 'b, K, V>
impl<'a, 'b, K, V> Unpin for Transaction<'a, 'b, K, V>where K: Unpin, V: Unpin,
impl<'a, 'b, K, V> !UnwindSafe for Transaction<'a, 'b, K, V>
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