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