#[cfg(feature = "postgres")]
mod postgres;
#[cfg(feature = "postgres")]
pub use postgres::PostgresPubSub;
#[cfg(feature = "memory")]
mod memory;
#[cfg(feature = "memory")]
pub use memory::MemoryPubSub;
use async_trait::async_trait;
#[async_trait]
pub trait PubSub: Send + Sync {
#[allow(dead_code)]
async fn publish(&self, stream: &str, payload: &[u8]) -> anyhow::Result<()>;
async fn subscribe(&self, stream: &str) -> anyhow::Result<()>;
async fn unsubscribe(&self, stream: &str) -> anyhow::Result<()>;
async fn listen<F>(&self, callback: F) -> anyhow::Result<()>
where
F: Fn(String, Vec<u8>) + Send + Sync + 'static;
}