use crate::ports::provided::Value;
pub trait InMemoryClient: Send + Sync {
fn get(&self, key: &str) -> Option<Value>;
fn set(&self, key: &str, value: Value) -> bool;
fn delete(&self, key: &str) -> bool;
}
pub trait KVSClient: Send + Sync {
fn get(&self, key: &str) -> Option<Vec<u8>>;
fn set(&self, key: &str, value: Vec<u8>, ttl: Option<u64>) -> bool;
fn delete(&self, key: &str) -> bool;
}
pub trait EnvClient: Send + Sync {
fn get(&self, keys: &[Vec<u8>]) -> Option<Vec<Value>>;
fn set(&self, key: &str, value: Vec<u8>) -> bool;
fn delete(&self, key: &str) -> bool;
}
pub trait DbClient: Send + Sync {
fn get(
&self,
connection: &Value,
table: &str,
keys: &[Vec<u8>],
where_clause: Option<&[u8]>,
) -> Option<Vec<Value>>;
fn set(
&self,
connection: &Value,
table: &str,
keys: &[Vec<u8>],
where_clause: Option<&[u8]>,
) -> bool;
fn delete(
&self,
connection: &Value,
table: &str,
where_clause: Option<&[u8]>,
) -> bool;
}
pub trait HttpClient: Send + Sync {
fn get(
&self,
url: &str,
keys: &[Vec<u8>],
headers: Option<&[(Vec<u8>, Vec<u8>)]>,
) -> Option<Vec<Value>>;
fn set(
&self,
url: &str,
body: Value,
headers: Option<&[(Vec<u8>, Vec<u8>)]>,
) -> bool;
fn delete(
&self,
url: &str,
headers: Option<&[(Vec<u8>, Vec<u8>)]>,
) -> bool;
}
pub trait FileClient: Send + Sync {
fn get(&self, key: &str) -> Option<Vec<u8>>;
fn set(&self, key: &str, value: Vec<u8>) -> bool;
fn delete(&self, key: &str) -> bool;
}