Code Monkey home page Code Monkey logo

Comments (7)

freeekanayaka avatar freeekanayaka commented on July 22, 2024

I plan to add some kind of support for this in the v1 version of the API, currently being worked on. See #130 (comment) to get some feel of how it will look like.

from raft.

freeekanayaka avatar freeekanayaka commented on July 22, 2024

Please would you also elaborate on why you need such a state change callback in the first place?

There might be valid use cases, but as far as I can tell most applications should not need to react to Raft state changes, and they typically just need to check what the current state is, using raft_state().

The fact that you think you need it this callback might be a design smell.

from raft.

pyssling avatar pyssling commented on July 22, 2024

@freeekanayaka any news on this callback? In our case the interest is to disable/enable a rpc server based on leadership state, seems like a valid use case, but feel free to suggest alternatives.

from raft.

freeekanayaka avatar freeekanayaka commented on July 22, 2024

Why do you need to disable the server? Can't the server just call raft_state() as part of the request handling logic and reply some kind of error if it's not the leader? That'd be a very typical thing to do.

from raft.

stgraber avatar stgraber commented on July 22, 2024

@skypexu @pyssling ping

from raft.

pyssling avatar pyssling commented on July 22, 2024

That works for protocols that contain error responses, but many protocols expect socket state to reflect availability. For these I need a callback to open/close the socket.

from raft.

skypexu avatar skypexu commented on July 22, 2024

yes, raft_state() may work in most cases

from raft.

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.