davissp14 / etcdv3-ruby

Etcd v3 Ruby Client
MIT License
52 stars 17 forks source link

Add support for native ETCD distributed locks #122

Closed dcepelik closed 5 years ago

dcepelik commented 5 years ago

Hi Shaun,

as promised.

One new test case is commented out as it's failing, this is because you have a sophisticated helper in place which I wanted to leverage but which cannot be used for the lock gRPC call (obviously it will time out, because it's locked from the previous call in the same helper call). I don't know the proper Ruby way of making this work (unlocking in the helper), so I was hoping you would have the capacity to fix that one test case, or at least provide some hints how to do it.

I've done extensive local testing and everything seems to work well. The semantics of the locking/unlocking are really simple, as the RPC call will fail, or a time-out will occur, or the locking/unlocking has succeeded. Still this deserves a thorough examination, because I'm not much of a Ruby programmer and have been fighting with the tools. (For example, I did not find a way to convince gRPC compiler to generate relative requires, so I had to fix them manually.)

One more note, most pieces of protobuf code were taken from the official ETCD github repo, but it's not mentioned anywhere. (But I suspect that's the case for other protobuf code in the gem as well.)

Please let me know if I can do more.

David

codecov[bot] commented 5 years ago

Codecov Report

Merging #122 into master will increase coverage by 0.09%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
+ Coverage   98.35%   98.45%   +0.09%     
==========================================
  Files          24       29       +5     
  Lines        1521     1614      +93     
==========================================
+ Hits         1496     1589      +93     
  Misses         25       25
Impacted Files Coverage Δ
lib/etcdv3/connection.rb 91.3% <ø> (ø) :arrow_up:
lib/etcdv3/auth.rb 100% <100%> (ø) :arrow_up:
lib/etcdv3/lock.rb 100% <100%> (ø)
spec/etcdv3_spec.rb 100% <100%> (ø) :arrow_up:
lib/etcdv3/etcdrpc/v3lock_services_pb.rb 100% <100%> (ø)
lib/etcdv3/etcdrpc/annotations_pb.rb 100% <100%> (ø)
lib/etcdv3/kv.rb 96.87% <100%> (+0.1%) :arrow_up:
lib/etcdv3.rb 98.97% <100%> (+0.12%) :arrow_up:
lib/etcdv3/etcdrpc/rpc_pb.rb 100% <100%> (ø) :arrow_up:
lib/etcdv3/etcdrpc/v3lock_pb.rb 100% <100%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c5e754d...854705b. Read the comment docs.

graywolf-at-work commented 5 years ago

If this is merged, #115 can be closed since this fixes the same issue.

dcepelik commented 5 years ago

Fixed.

davissp14 commented 5 years ago

Nice work!