gjohnson / etcd-node

Alternative etcd client for node.js
32 stars 2 forks source link

update to support latest etcd api #9

Open gjohnson opened 10 years ago

gjohnson commented 10 years ago

Now that they have v2...

silas commented 10 years ago

Are you working on this? Do you want to support both the v1 and v2 APIs?

I'd be interested in taking a stab at implementing v2, but I don't want to duplicate work.

gjohnson commented 10 years ago

Yep, working on it right now. It's mostly all internal stuff, but if you have any thoughts or suggestions, drop them here!

gjohnson commented 10 years ago

But to answer your second question, no, it will only support v2.

silas commented 10 years ago

Cool, a couple of things that might be worth changing or thinking about.

It would be nice to kill the singleton-only interface, maybe change to

module.exports = function(options) {
  return new Client(options);
};

exports.Client = Client;

Using a URL instead of a host/port/ssl combination, this would allow the client to support multiple endpoints in the future.

var etcd = require('etcd');

var client = etcd({ url: 'http://localhost:4001' });

// future
var client = etcd({ url: ['http://example1:4001', 'http://example2:4001'] });

SSL client certification, benchmarks, etc...

Once you push your v2 changes I'll start hacking on some of this stuff.

gjohnson commented 10 years ago

@silas more of a rewrite now, so see the tests for examples of the new api. There are plenty of things to clean up still, so feel to add things / refactor / whatever. I am still not 100% happy with this API, so feel free to suggest anything.

https://github.com/gjohnson/etcd-node/tree/refactor

silas commented 10 years ago

Cool.

Might be worthing taking a look at go-etcd code and docs as well (assuming you haven't already), seems to have reasonable abstractions and all the retry/cluster logic.