1use std::sync::Arc;
2
3use tokio::net::ToSocketAddrs;
4
5pub use bb8;
6
7use async_trait::async_trait;
8use tokio_valkey::Client;
9
10#[derive(Clone, Debug)]
12pub struct ValkeyConnectionManager {
13 client: Arc<Client>,
14}
15
16impl ValkeyConnectionManager {
17 pub async fn new<A: ToSocketAddrs>(addr: A) -> tokio_valkey::Result<Self> {
19 Ok(Self {
20 client: Arc::new(Client::connect(addr).await?),
21 })
22 }
23}
24
25pub struct MultiplexedConn;
26
27#[async_trait]
28impl bb8::ManageConnection for ValkeyConnectionManager {
29 type Connection = MultiplexedConn;
30 type Error = tokio_valkey::Error;
31
32 async fn connect(&self) -> Result<Self::Connection, Self::Error> {
33 unimplemented!()
34 }
35
36 async fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error> {
37 unimplemented!()
38 }
39
40 fn has_broken(&self, _: &mut Self::Connection) -> bool {
41 false
42 }
43}