Sha256: 8386eda3a6e3e2ed3d9dbc57641ccb51486792f4d1ef013b5792cdaffe1d63d3
Contents?: true
Size: 1.18 KB
Versions: 10
Compression:
Stored size: 1.18 KB
Contents
class Etcdv3 class Lease include GRPC::Core::TimeConsts def initialize(hostname, credentials, timeout, metadata={}) @stub = Etcdserverpb::Lease::Stub.new(hostname, credentials) @timeout = timeout @metadata = metadata end def lease_grant(ttl, timeout: nil) request = Etcdserverpb::LeaseGrantRequest.new(TTL: ttl) @stub.lease_grant(request, metadata: @metadata, deadline: deadline(timeout)) end def lease_revoke(id, timeout: nil) request = Etcdserverpb::LeaseRevokeRequest.new(ID: id) @stub.lease_revoke(request, metadata: @metadata, deadline: deadline(timeout)) end def lease_ttl(id, timeout: nil) request = Etcdserverpb::LeaseTimeToLiveRequest.new(ID: id, keys: true) @stub.lease_time_to_live(request, metadata: @metadata, deadline: deadline(timeout)) end def lease_keep_alive_once(id, timeout: nil) request = Etcdserverpb::LeaseKeepAliveRequest.new(ID: id) @stub.lease_keep_alive([request], metadata: @metadata, deadline: deadline(timeout)).each do |resp| return resp end end private def deadline(timeout) from_relative_time(timeout || @timeout) end end end
Version data entries
10 entries across 10 versions & 2 rubygems