1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use anyhow::Result;
use tokio::sync::broadcast;

#[cfg(feature = "graphql")]
pub mod gql;
#[cfg(feature = "tcp")]
pub mod tcp;
#[cfg(feature = "ws")]
pub mod ws;

pub trait Connection {
    fn set(&mut self, key: &str, value: &str) -> Result<u64>;
    fn get(&mut self, key: &str) -> Result<u64>;
    fn pget(&mut self, key: &str) -> Result<u64>;
    fn subscribe(&mut self, key: &str) -> Result<u64>;
    fn psubscribe(&mut self, key: &str) -> Result<u64>;
    fn export(&mut self, path: &str) -> Result<u64>;
    fn import(&mut self, path: &str) -> Result<u64>;
    fn acks(&mut self) -> broadcast::Receiver<u64>;
}