rings_core/storage/
mod.rs1#[cfg(feature = "wasm")]
4pub mod idb;
5pub mod memory;
6#[cfg(all(not(feature = "wasm"), not(feature = "dummy")))]
7pub mod sled;
8
9use async_trait::async_trait;
10
11use crate::error::Result;
12pub use crate::storage::memory::MemStorage;
13
14#[cfg_attr(feature = "wasm", async_trait(?Send))]
16#[cfg_attr(not(feature = "wasm"), async_trait)]
17pub trait KvStorageInterface<V> {
18 async fn get(&self, key: &str) -> Result<Option<V>>;
20
21 async fn put(&self, key: &str, value: &V) -> Result<()>;
23
24 async fn get_all(&self) -> Result<Vec<(String, V)>>;
25
26 async fn remove(&self, key: &str) -> Result<()>;
28
29 async fn clear(&self) -> Result<()>;
31
32 async fn count(&self) -> Result<u32>;
34}