-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
api: lease list #8358
api: lease list #8358
Conversation
@gyuho probably better to keep it simple for now; can add TTLs later if there's a need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly concerned about naming this LeaseList and how it gets called List in the client
clientv3/lease.go
Outdated
@@ -98,6 +110,9 @@ type Lease interface { | |||
// TimeToLive retrieves the lease information of the given lease ID. | |||
TimeToLive(ctx context.Context, id LeaseID, opts ...LeaseOption) (*LeaseTimeToLiveResponse, error) | |||
|
|||
// List retrieves all leases. | |||
List(ctx context.Context) (*LeaseListResponse, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this it's possible to do client.List()
, which isn't clearly related to leases. Right now the pattern for RPCs is rpcname = LeaseX => client name = X. Maybe the RPC should be LeaseLeases
so the client name can be Leases()
?
lease/leasehttp/http.go
Outdated
kbs := make([][]byte, len(ks)) | ||
for i := range ks { | ||
kbs[i] = []byte(ks[i]) | ||
switch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this go through the http path so it can get the TTL? Can this RPC not do TTLs for the time being instead? Right now it won't work if the member is partitioned from the leader. Would prefer to keep it simple at first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to go through raft at all?
@@ -56,6 +56,7 @@ This is a generated documentation. Please read the proto files for more. | |||
| ------ | ------------ | ------------- | ----------- | | |||
| LeaseGrant | LeaseGrantRequest | LeaseGrantResponse | LeaseGrant creates a lease which expires if the server does not receive a keepAlive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history. | | |||
| LeaseRevoke | LeaseRevokeRequest | LeaseRevokeResponse | LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. | | |||
| LeaseList | LeaseListRequest | LeaseListResponse | LeaseList lists all existing leases. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be LeaseLeases so the rpc's still match the client interfaces?
85cba1c
to
6ddea9a
Compare
I made the RPC only served by local node. PTAL. Thanks. |
c2eefe1
to
42dc170
Compare
@heyitsanthony Changed |
Codecov Report
@@ Coverage Diff @@
## master #8358 +/- ##
=========================================
Coverage ? 77.11%
=========================================
Files ? 353
Lines ? 28206
Branches ? 0
=========================================
Hits ? 21750
Misses ? 4932
Partials ? 1524
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after s/Leases() []leasepb.Lease/Leases() []*Lease/
lease/lessor.go
Outdated
return leases | ||
} | ||
|
||
func (le *lessor) Leases() []leasepb.Lease { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just Leases() []*Lease
? the call to this pulls out the fields into another structure anyway
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
Signed-off-by: Gyu-Ho Lee <[email protected]>
@heyitsanthony Should we return remaining on each lease, like
TimeToLive
?