Skip to main content

BatchOperations

Trait BatchOperations 

Source
pub trait BatchOperations: Send {
    // Required methods
    fn insert(&mut self, key: Vec<u8>, value: Vec<u8>);
    fn remove(&mut self, key: Vec<u8>);
    fn expect_value(&mut self, key: Vec<u8>, expected_value: Vec<u8>);
    fn commit(self: Box<Self>) -> Result<()>;
}
Expand description

Batch operations for atomic writes.

Required Methods§

Source

fn insert(&mut self, key: Vec<u8>, value: Vec<u8>)

Queues an insert operation.

Source

fn remove(&mut self, key: Vec<u8>)

Queues a remove operation.

Source

fn expect_value(&mut self, key: Vec<u8>, expected_value: Vec<u8>)

Sets an expected value for optimistic concurrency.

Source

fn commit(self: Box<Self>) -> Result<()>

Commits all queued operations atomically.

§Errors

Returns an error if the commit fails or expected values don’t match.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§