use crate::TorshResult;
use async_trait::async_trait;
use std::time::Duration;
#[async_trait]
pub trait Store: Send + Sync {
async fn set(&self, key: &str, value: &[u8]) -> TorshResult<()>;
async fn get(&self, key: &str) -> TorshResult<Option<Vec<u8>>>;
async fn wait(&self, keys: &[String]) -> TorshResult<()>;
async fn delete(&self, key: &str) -> TorshResult<()>;
async fn num_keys(&self) -> TorshResult<usize>;
async fn contains(&self, key: &str) -> TorshResult<bool>;
async fn set_with_expiry(&self, key: &str, value: &[u8], ttl: Duration) -> TorshResult<()>;
async fn compare_and_swap(
&self,
key: &str,
expected: Option<&[u8]>,
value: &[u8],
) -> TorshResult<bool>;
async fn add(&self, key: &str, value: i64) -> TorshResult<i64>;
}