mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #9023 from gyuho/keepalive-doc
clientv3: document context to "KeepAlive" API
This commit is contained in:
commit
b0a7623be8
2
.words
2
.words
@ -1,6 +1,8 @@
|
|||||||
ErrCodeEnhanceYourCalm
|
ErrCodeEnhanceYourCalm
|
||||||
ErrTimeout
|
ErrTimeout
|
||||||
GoAway
|
GoAway
|
||||||
|
KeepAlive
|
||||||
|
Keepalive
|
||||||
RPC
|
RPC
|
||||||
RPCs
|
RPCs
|
||||||
TODO
|
TODO
|
||||||
|
@ -113,11 +113,29 @@ type Lease interface {
|
|||||||
// Leases retrieves all leases.
|
// Leases retrieves all leases.
|
||||||
Leases(ctx context.Context) (*LeaseLeasesResponse, error)
|
Leases(ctx context.Context) (*LeaseLeasesResponse, error)
|
||||||
|
|
||||||
// KeepAlive keeps the given lease alive forever.
|
// KeepAlive keeps the given lease alive forever. If the keepalive response
|
||||||
|
// posted to the channel is not consumed immediately, the lease client will
|
||||||
|
// continue sending keep alive requests to the etcd server at least every
|
||||||
|
// second until latest response is consumed.
|
||||||
|
//
|
||||||
|
// The returned "LeaseKeepAliveResponse" channel closes if underlying keep
|
||||||
|
// alive stream is interrupted in some way the client cannot handle itself;
|
||||||
|
// given context "ctx" is canceled or timed out. "LeaseKeepAliveResponse"
|
||||||
|
// from this closed channel is nil.
|
||||||
|
//
|
||||||
|
// If client keep alive loop halts with an unexpected error (e.g. "etcdserver:
|
||||||
|
// no leader") or canceled by the caller (e.g. context.Canceled), the error
|
||||||
|
// is returned. Otherwise, it retries.
|
||||||
|
//
|
||||||
|
// TODO(v4.0): post errors to last keep alive message before closing
|
||||||
|
// (see https://github.com/coreos/etcd/pull/7866)
|
||||||
KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error)
|
KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error)
|
||||||
|
|
||||||
// KeepAliveOnce renews the lease once. In most of the cases, KeepAlive
|
// KeepAliveOnce renews the lease once. The response corresponds to the
|
||||||
// should be used instead of KeepAliveOnce.
|
// first message from calling KeepAlive. If the response has a recoverable
|
||||||
|
// error, KeepAliveOnce will retry the RPC with a new keep alive message.
|
||||||
|
//
|
||||||
|
// In most of the cases, Keepalive should be used instead of KeepAliveOnce.
|
||||||
KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error)
|
KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error)
|
||||||
|
|
||||||
// Close releases all resources Lease keeps for efficient communication
|
// Close releases all resources Lease keeps for efficient communication
|
||||||
|
Loading…
x
Reference in New Issue
Block a user