diff --git a/nomos-services/src/storage/backends/mod.rs b/nomos-services/src/storage/backends/mod.rs index 5bdd782d..c78e9f29 100644 --- a/nomos-services/src/storage/backends/mod.rs +++ b/nomos-services/src/storage/backends/mod.rs @@ -47,3 +47,30 @@ pub trait StorageBackend { transaction: Self::Transaction, ) -> Result<::Result, Self::Error>; } + +#[cfg(test)] +pub mod testing { + use crate::storage::backends::StorageSerde; + use bytes::Bytes; + use serde::de::DeserializeOwned; + use serde::Serialize; + use thiserror::Error; + + pub struct NoStorageSerde; + + #[derive(Error, Debug)] + #[error("Fake error")] + pub struct NoError; + + impl StorageSerde for NoStorageSerde { + type Error = NoError; + + fn serialize(_value: T) -> Bytes { + Bytes::new() + } + + fn deserialize(_buff: Bytes) -> Result { + Err(NoError) + } + } +}