Skip to content

Commit

Permalink
Remove KeyValueMutate for InMemoryStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
acerone85 committed Sep 25, 2024
1 parent ac5bb96 commit ee8edeb
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions crates/storage/src/structured_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,13 @@ pub mod test {
use crate as fuel_core_storage;
use crate::kv_store::{
KeyValueInspect,
KeyValueMutate,
StorageColumn,
};
use fuel_core_storage::{
kv_store::Value,
Result as StorageResult,
};
use std::{
collections::HashMap,
sync::Arc,
};
use std::collections::HashMap;

type Storage = HashMap<(u32, Vec<u8>), Value>;

Expand Down Expand Up @@ -454,27 +450,4 @@ pub mod test {
Ok(value)
}
}

impl<Column> KeyValueMutate for InMemoryStorage<Column>
where
InMemoryStorage<Column>: KeyValueInspect,
{
#[doc = " Writes the `buf` into the storage and returns the number of written bytes."]
fn write(
&mut self,
key: &[u8],
column: Self::Column,
buf: &[u8],
) -> StorageResult<usize> {
self.storage
.insert((column.id(), key.to_vec()), Arc::new(buf.to_vec()));
Ok(buf.len())
}

#[doc = " Removes the value from the storage."]
fn delete(&mut self, key: &[u8], column: Self::Column) -> StorageResult<()> {
self.storage.remove(&(column.id(), key.to_vec()));
Ok(())
}
}
}

0 comments on commit ee8edeb

Please sign in to comment.