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

Support for etcd3

Open jmlMetaswitch opened this issue 8 years ago • 16 comments
trafficstars

Do you have plans to support etcd v3, and in particular transactions?

jmlMetaswitch avatar Feb 10 '17 16:02 jmlMetaswitch

Of course I'd like to support v3, though I hadn't spent any time thinking about it yet. I'm not sure what the state of gRPC in Rust is right now. Last I looked it was in early development, but it's been a while.

jimmycuadra avatar Feb 10 '17 22:02 jimmycuadra

I've not done too much investigation yet either, and I'm not sure whether I'll need this, but I'll get back in touch if I think that extending your work is the best bet. Thanks for the swift response!

jmlMetaswitch avatar Feb 13 '17 09:02 jmlMetaswitch

Adding etcd v3 support would be very nice. Using gRPC with Rust is not too bad. There are a couple of quirks, protobuf manipulation in Rust is not as nice as in Go, but overall its doable.

VoyTechnology avatar Feb 19 '18 22:02 VoyTechnology

I would be happy to help implement this.

tmccombs avatar Dec 13 '18 23:12 tmccombs

PRs most welcome! Which approach to gRPC in Rust do you all think is best these days?

jimmycuadra avatar Dec 14 '18 10:12 jimmycuadra

would it be better to create a new version that only supports v3, or implement it in a way that supports both v2 and v3? Looking at clients in other languages, it looks like most only support one version of the API for a single version of the library. But that is just from a cursory search.

tmccombs avatar Dec 15 '18 07:12 tmccombs

I'd prefer to leave the existing support for v2. This could be done by nesting API-version-specific items in top level modules called v2 and v3.

jimmycuadra avatar Dec 15 '18 11:12 jimmycuadra

Which approach to gRPC in Rust do you all think is best these days?

I don't know, the grpcio crate seems to be more popular on crates.io, and more active on github, but depends on the grpc-core c library (which could be good since that is standard implemenation, or bad because it requires building a c library and a fair amount of unsafe code). The grpc crate on the other hand is implemented in pure rust using tokio and futures. Another possiblity is using the protobuf crate for serializing/deserializing messages, but then use hyper/h2 directly for the transport. I don't know what the best approach for this is.

@VoyTechnology what are your thoughts? Since it sounds like you might have some experience with grpc in rust.

tmccombs avatar Dec 19 '18 07:12 tmccombs

Hey all, I've used the grpc create quite a lot, it should definitely work. I was hoping to see tower grpc stabilize by now, but it looks like it has not yet. Which is unfortunate because it has a significantly more simple interface.

I would be happy to help will getting things rolling on this front.

  • We can just create a proto directory in this repo with all of the needed protos.
  • Introduce a build.rs which will generate the Rust code from the protos for us.
  • Then we just build out the interface on top of that, nest it under a v3 module or something like that (as proposed above).

I am definitely interested in being able to use the transaction system & leases.

thedodd avatar Jan 13 '19 20:01 thedodd

I created a branch that has the protobuf files in a proto directory (and a script to pull down new versions if/when necessary) at https://github.com/tmccombs/rust-etcd/tree/etcdv3

tmccombs avatar Jan 16 '19 08:01 tmccombs

Awesome. Happy to take a look. Are you planning on opening a PR for it against this repo??

thedodd avatar Jan 17 '19 00:01 thedodd

https://github.com/jimmycuadra/rust-etcd/pull/25/files

done

tmccombs avatar Jan 17 '19 07:01 tmccombs

I am new to etcd. Can't we just call etcd-3 via HTTP requests?

thehappycoder avatar Apr 05 '19 20:04 thehappycoder

etcd-3 uses GRPC, which does use HTTP, but it uses HTTP/2 instead of HTTP/1.1 and protobufs instead of json.

tmccombs avatar Apr 05 '19 21:04 tmccombs

In case if it's going to help, I found some code: https://github.com/angelrain1/grpc_etcd https://github.com/ccc13/etcd-rs

thehappycoder avatar Apr 05 '19 22:04 thehappycoder

In additions to gRPC, etcd v3 also provides a JSON gRPC gateway.

iwinux avatar Sep 27 '19 00:09 iwinux