use crate::{BusState, BusStats, Result};
use async_trait::async_trait;
use tokio::sync::mpsc;
#[derive(Debug, Clone)]
pub struct BusMessage {
pub json: String,
}
#[async_trait]
pub trait Backend: Send + Sync {
async fn start(&self) -> Result<()>;
async fn stop(&self, timeout_secs: u32) -> Result<()>;
async fn send(&self, message: &str) -> Result<()>;
fn state(&self) -> BusState;
fn stats(&self) -> BusStats;
fn worker_count(&self) -> i32;
fn client_count(&self) -> i32;
fn subscribe(&self) -> Option<mpsc::Receiver<BusMessage>>;
fn backend_type(&self) -> &'static str;
}