Make StoreUpdate generic over the byte slice ownership

This permits to call it without having to create a Vec<u8> when possible.
This commit is contained in:
Julien Cretin
2021-01-20 15:56:06 +01:00
parent 8bdfeb4aec
commit 8634e2ec24
4 changed files with 26 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ pub enum StoreOperation {
/// Applies a transaction.
Transaction {
/// The list of updates to be applied.
updates: Vec<StoreUpdate>,
updates: Vec<StoreUpdate<Vec<u8>>>,
},
/// Deletes all keys above a threshold.
@@ -89,7 +89,7 @@ impl StoreModel {
}
/// Applies a transaction.
fn transaction(&mut self, updates: Vec<StoreUpdate>) -> StoreResult<()> {
fn transaction(&mut self, updates: Vec<StoreUpdate<Vec<u8>>>) -> StoreResult<()> {
// Fail if the transaction is invalid.
if self.format.transaction_valid(&updates).is_none() {
return Err(StoreError::InvalidArgument);