etcd-node icon indicating copy to clipboard operation
etcd-node copied to clipboard

update to support latest etcd api

Open gjohnson opened this issue 11 years ago • 6 comments

Now that they have v2...

gjohnson avatar Feb 09 '14 05:02 gjohnson

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.

silas avatar Feb 09 '14 21:02 silas

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

gjohnson avatar Feb 09 '14 21:02 gjohnson

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

gjohnson avatar Feb 09 '14 21:02 gjohnson

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.

silas avatar Feb 09 '14 22:02 silas

@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

gjohnson avatar Feb 10 '14 00:02 gjohnson

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.

silas avatar Feb 10 '14 01:02 silas