Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientv3: document context to "KeepAlive" API #9023

Merged
merged 3 commits into from
Dec 19, 2017

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Dec 15, 2017

Address #8993.

// When the context "ctx" is canceled or timed out,
// returned "LeaseKeepAliveResponse" channel is closed,
// and "LeaseKeepAliveResponse" from this closed channel is nil.
// If the context is "context.Background/TODO",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably wont say anything about the TODO one. line 116 already explains it. we might want to talk about when an error can be returned though.

@@ -114,6 +114,9 @@ type Lease interface {
Leases(ctx context.Context) (*LeaseLeasesResponse, error)

// KeepAlive keeps the given lease alive forever.
// If the context "ctx" is canceled or timed out,
// returned "LeaseKeepAliveResponse" channel is closed,
// and "LeaseKeepAliveResponse" from this closed channel is nil.
KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should document about the error? for example, what happens if the client failed to send keepalive for a few minutes, and when it reconnected the lease is already expired?

@codecov-io
Copy link

codecov-io commented Dec 16, 2017

Codecov Report

Merging #9023 into master will increase coverage by 0.1%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #9023     +/-   ##
=========================================
+ Coverage   76.12%   76.22%   +0.1%     
=========================================
  Files         359      359             
  Lines       29838    29838             
=========================================
+ Hits        22715    22745     +30     
+ Misses       5548     5529     -19     
+ Partials     1575     1564     -11
Impacted Files Coverage Δ
clientv3/lease.go 92.77% <ø> (ø) ⬆️
mvcc/watchable_store.go 86.34% <0%> (-4.06%) ⬇️
rafthttp/peer.go 90.22% <0%> (-1.51%) ⬇️
pkg/adt/interval_tree.go 89.48% <0%> (-0.91%) ⬇️
clientv3/namespace/watch.go 93.93% <0%> (ø) ⬆️
etcdserver/api/v2http/client.go 90.78% <0%> (+0.44%) ⬆️
etcdserver/server.go 79.47% <0%> (+0.57%) ⬆️
clientv3/watch.go 96.03% <0%> (+0.99%) ⬆️
etcdserver/v3_server.go 82.17% <0%> (+1.03%) ⬆️
pkg/netutil/netutil.go 66.66% <0%> (+1.14%) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c326ab...fffb265. Read the comment docs.

@gyuho
Copy link
Contributor Author

gyuho commented Dec 18, 2017

@xiang90 PTAL. Picked up the documentation from #7866.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
@xiang90
Copy link
Contributor

xiang90 commented Dec 19, 2017

lgtm

@gyuho gyuho merged commit b0a7623 into etcd-io:master Dec 19, 2017
@gyuho gyuho deleted the keepalive-doc branch December 19, 2017 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants