pub trait StorageWriteBatch: Send {
// Required methods
fn put_batch(
&mut self,
table: &'static str,
batch: Vec<(Vec<u8>, Vec<u8>)>,
) -> Result<(), StoreError>;
fn delete(
&mut self,
table: &'static str,
key: &[u8],
) -> Result<(), StoreError>;
fn merge(
&mut self,
table: &'static str,
key: &[u8],
operand: &[u8],
) -> Result<(), StoreError>;
fn commit(&mut self) -> Result<(), StoreError>;
// Provided method
fn put(
&mut self,
table: &'static str,
key: &[u8],
value: &[u8],
) -> Result<(), StoreError> { ... }
}Expand description
Write transaction interface.
Note that this does not provide read access, since we don’t currently use that functionality.
Changes are not persisted until commit() is called.
Required Methods§
Sourcefn put_batch(
&mut self,
table: &'static str,
batch: Vec<(Vec<u8>, Vec<u8>)>,
) -> Result<(), StoreError>
fn put_batch( &mut self, table: &'static str, batch: Vec<(Vec<u8>, Vec<u8>)>, ) -> Result<(), StoreError>
Stores multiple key-value pairs in the specified table within the transaction.
Sourcefn delete(&mut self, table: &'static str, key: &[u8]) -> Result<(), StoreError>
fn delete(&mut self, table: &'static str, key: &[u8]) -> Result<(), StoreError>
Removes a key-value pair from the specified table.
Sourcefn merge(
&mut self,
table: &'static str,
key: &[u8],
operand: &[u8],
) -> Result<(), StoreError>
fn merge( &mut self, table: &'static str, key: &[u8], operand: &[u8], ) -> Result<(), StoreError>
Appends a merge operand for the given key in the specified table.
The actual combine step is deferred — backends with a registered merge operator (RocksDB) apply it at read or compaction time; backends without (InMemory) dispatch by table and apply inline.
Currently used for TRANSACTION_LOCATIONS. Calling on a table without
a registered merge function is an error.
Sourcefn commit(&mut self) -> Result<(), StoreError>
fn commit(&mut self) -> Result<(), StoreError>
Commits all changes made in this transaction.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".