io.etcd.jetcd

## Interface Lease

All Superinterfaces:
  AutoCloseable, CloseableClient

    public interface Lease
    extends CloseableClient

Interface of KeepAlive talking to etcd.

### Method Summary

All Methods Instance Methods Abstract Methods
`CompletableFuture<LeaseGrantResponse>` `grant(long ttl)` New a lease with ttl value.
`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.
`CloseableClient` `keepAlive(long leaseId, io.grpc.stub.StreamObserver<LeaseKeepAliveResponse> observer)` keep the given lease alive forever.
`CompletableFuture<LeaseKeepAliveResponse>` `keepAliveOnce(long leaseId)` keep alive one lease only once.
`CompletableFuture<LeaseRevokeResponse>` `revoke(long leaseId)` revoke one lease and the key bind to this lease will be removed.
`CompletableFuture<LeaseTimeToLiveResponse>` `timeToLive(long leaseId, LeaseOption leaseOption)` retrieves the lease information of the given lease ID.

### Methods inherited from interface io.etcd.jetcd.CloseableClient

`close`

### Method Detail

#### grant

    CompletableFuture<LeaseGrantResponse> grant(long ttl)

New a lease with ttl value.

Parameters:
  `ttl` - ttl value, unit seconds

#### 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:

#### 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

#### 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.