mcavage / node-leader Goto Github PK
View Code? Open in Web Editor NEWA micro library for performing leader election with zookeeper
A micro library for performing leader election with zookeeper
Hey,
The example confused me, so this is my attempt to make it more clear, is my clarification correct?
Thanks,
D
elect(opts, function(err, node) {
if (node.leader) {
console.log('Hooray! I am the leader!');
} else {
+ // you are not the leader, but might be elected at some later time.
node.on('leader', function() {
- console.log('I got elected as the leader!');
+ console.log('Old leader is down, and I was just elected as the leader!');
});
}
});
Note that the example will not run out of the box because /my/service/path
may not yet exist.
npm install leader
installs the following leader package
Is this package deprecated? Want to evaluate this package if possible.
This project looks awesome! I've been waiting / wanting to do something like this myself for quite a while in Node, but haven't had enough real experience with ZK to do it.
I'd love to see a real world example when the lib is up to it - say, a simple example to manage master promotion in Redis or something like that. Would that be doable?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.