Struct kv::Transaction
source · [−]Expand description
Transaction
Implementations
sourceimpl<'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
sourceimpl<'a, 'b, K: Clone + Key<'a>, V: Clone + Value> Clone for Transaction<'a, 'b, K, V>
impl<'a, 'b, K: Clone + Key<'a>, V: Clone + Value> Clone for Transaction<'a, 'b, K, V>
sourcefn clone(&self) -> Transaction<'a, 'b, K, V>
fn clone(&self) -> Transaction<'a, 'b, K, V>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more