Package io.etcd.jetcd

Interface Lease

All Superinterfaces:
AutoCloseable, CloseableClient

public interface Lease extends CloseableClient
Interface of KeepAlive talking to etcd.
  • Method Details

    • grant

      New a lease with ttl value.
      Parameters:
      ttl - ttl value, unit seconds
      Returns:
      the grant response
    • grant

      CompletableFuture<LeaseGrantResponse> grant(long ttl, long timeout, TimeUnit unit)
      New a lease with ttl value.Waits if necessary for at most the given time if etcd server is available.
      Parameters:
      ttl - ttl value, unit seconds
      timeout - the maximum time to waits
      unit - the time unit of the timeout argument
      Returns:
      The grant response
    • revoke

      CompletableFuture<LeaseRevokeResponse> revoke(long leaseId)
      revoke one lease and the key bind to this lease will be removed.
      Parameters:
      leaseId - id of the lease to revoke
      Returns:
      the revoke response
    • keepAliveOnce

      CompletableFuture<LeaseKeepAliveResponse> keepAliveOnce(long leaseId)
      keep alive one lease only once.
      Parameters:
      leaseId - id of lease to keep alive once
      Returns:
      The keep alive response
    • timeToLive

      CompletableFuture<LeaseTimeToLiveResponse> timeToLive(long leaseId, LeaseOption leaseOption)
      retrieves the lease information of the given lease ID.
      Parameters:
      leaseId - id of lease
      leaseOption - LeaseOption
      Returns:
      LeaseTimeToLiveResponse wrapped in CompletableFuture
    • keepAlive

      CloseableClient keepAlive(long leaseId, io.grpc.stub.StreamObserver<LeaseKeepAliveResponse> observer)
      keep the given lease alive forever.
      Parameters:
      leaseId - lease to be keep alive forever.
      observer - the observer
      Returns:
      a KeepAliveListener that listens for KeepAlive responses.