use tokio::sync::mpsc;
#[async_trait::async_trait]
pub trait CoordinationBackend: Send + Sync {
async fn publish(&self, topic: &str, payload: &[u8]) -> Result<(), String>;
async fn subscribe(&self, topic: &str) -> Result<mpsc::Receiver<Vec<u8>>, String>;
async fn set(&self, key: &str, value: &[u8]) -> Result<(), String>;
async fn get(&self, key: &str) -> Result<Option<Vec<u8>>, String>;
async fn cas(&self, key: &str, old_val: Option<&[u8]>, new_val: &[u8]) -> Result<bool, String>;
async fn acquire_lock(&self, key: &str, value: &[u8], ttl_ms: u64) -> Result<bool, String>;
async fn renew_lock(&self, key: &str, value: &[u8], ttl_ms: u64) -> Result<bool, String>;
}