bikeshedder / deadpool

Dead simple pool implementation for rust with async-await
Apache License 2.0
1.08k stars 137 forks source link

deadpool-redis does not export ProtocolVersion #353

Closed bIgBV closed 2 months ago

bIgBV commented 2 months ago

I'm trying to create a pool of redis ClusterClient connections and want to use RESP3. Unfortunately, while RedisConnectionInfo is exported by the crate, the ProtocolVersion enum is not, and therefore I cannot construct a deadpool_redis::ConnectionInfo struct.:

let nodes = vec![
    ("redis://localhost", 7011),
    ("redis://localhost", 7021),
    ("redis://localhost", 7031),
];
let connectionInfo = nodes
    .into_iter()
    .map(|(url, port)| deadpool_redis::ConnectionInfo {
        addr: deadpool_redis::ConnectionAddr::Tcp(url.to_owned(), port),
        redis: deadpool_redis::RedisConnectionInfo {
            db: 0,
            protocol: deadpool_redis::config::ProtocolVersion::RESP3,
            username: None,
            password: None,
        },
    })
    .collect();
let config = Config {
    urls: None,
    connections: Some(connectionInfo),
    pool: None,
    read_from_replicas: false,
};

Is this intentional? If so, is there a different way to specify the protocol version? Because while the crate does export the ClusterClientBuilder, it doesn't look like as a user of the crate, I don't have the ability to provide an instantiated builder to the manager.

bikeshedder commented 2 months ago

Thanks a lot. That was indeed an oversight!

I just merged the PR made a release on crates.io:

bIgBV commented 2 months ago

Thank you for the quick response!