use async_trait::async_trait;
use deadpool_redis::redis::Value as RedisValue;
use crate::types::DagNodeSyncState;
#[async_trait]
pub trait DagStore: Send + Sync {
async fn get(&self, key: &str) -> Result<Option<Vec<u8>>, String>;
async fn set(
&self,
key: &str,
value: &[u8],
ttl: Option<std::time::Duration>,
) -> Result<(), String>;
async fn del(&self, key: &str) -> Result<(), String>;
async fn incr(&self, key: &str, delta: i64) -> Result<i64, String>;
async fn eval_lua(
&self,
script: &str,
keys: &[&str],
args: &[&str],
) -> Result<RedisValue, String>;
}
#[async_trait]
pub trait DagEventSink: Send + Sync {
async fn emit(&self, event: &DagNodeSyncState) -> Result<(), String>;
}