Giter Site home page Giter Site logo

Comments (3)

nihohit avatar nihohit commented on July 2, 2024 1

@danprueitt has this issue been fully or partially mitigated in 0.25.0?

from redis-rs.

nihohit avatar nihohit commented on July 2, 2024

Routing will be exposed in the async cluster in the next release (

pub async fn route_command(&mut self, cmd: &Cmd, routing: RoutingInfo) -> RedisResult<Value> {
). If you want to contribute exposed routing to the sync cluster, that will be very much appreciated.

As for being able to iterate over the connections of each node - I believe that will be simple in the sync cluster connection, but not so simple in the async one, due to its disjoint structure. Again, contributions will be very much appreciated.
In any case you can get info on the structure of the cluster using CLUSTER NODES/SLOTS/SHARDS.

from redis-rs.

joachimbulow avatar joachimbulow commented on July 2, 2024

Not exactly a solution to this, but anyway, for reference, I was able to make something work by hashtagging my keys and obtaining a RoutingInfo like so:

  let routing_info = RoutingInfo::SingleNode(SpecificNode(Route::new(
            get_slot("{my_pattern}".as_bytes()),
            ReplicaOptional,
        )));

(Imports are from the cluster_routing.rs)

And then using that with the newly exposed route_command function to call my function specifically to the correct node:

 let foo_cmd = redis::cmd("SCAN")
            .cursor_arg(0)
            .arg("MATCH")
            .arg("{my_pattern}:*")
            .arg("COUNT")
            .arg(1000)
            .to_owned();

        let my_res = my_conn.route_command(&foo_cmd, routing_info).await?;

from redis-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.