Class: Etcdv3::Lock
- Includes:
- GRPC::Core::TimeConsts
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/lock.rb
Instance Method Summary collapse
-
#initialize(hostname, credentials, timeout, metadata = {}) ⇒ Lock
constructor
A new instance of Lock.
- #lock(name, lease_id, timeout: nil) ⇒ Object
- #unlock(key, timeout: nil) ⇒ Object
Methods included from GRPC::Core::TimeConsts
Constructor Details
#initialize(hostname, credentials, timeout, metadata = {}) ⇒ Lock
Returns a new instance of Lock.
5 6 7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/lock.rb', line 5 def initialize(hostname, credentials, timeout, = {}) @stub = V3lockpb::Lock::Stub.new(hostname, credentials) @timeout = timeout @metadata = end |
Instance Method Details
#lock(name, lease_id, timeout: nil) ⇒ Object
11 12 13 14 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/lock.rb', line 11 def lock(name, lease_id, timeout: nil) request = V3lockpb::LockRequest.new(name: name, lease: lease_id) @stub.lock(request, metadata: @metadata, deadline: deadline(timeout)) end |
#unlock(key, timeout: nil) ⇒ Object
16 17 18 19 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/lock.rb', line 16 def unlock(key, timeout: nil) request = V3lockpb::UnlockRequest.new(key: key) @stub.unlock(request, metadata: @metadata, deadline: deadline(timeout)) end |