provide client.WithLease to user

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
This commit is contained in:
yanxuean
2017-11-23 10:14:00 +08:00
parent 8e09b565a7
commit d56b49dd7c
3 changed files with 6 additions and 5 deletions

View File

@@ -51,7 +51,8 @@ func (c *Client) ListLeases(ctx context.Context) ([]Lease, error) {
return leases, nil
}
func (c *Client) withLease(ctx context.Context) (context.Context, func() error, error) {
// WithLease attaches a lease on the context
func (c *Client) WithLease(ctx context.Context) (context.Context, func() error, error) {
_, ok := leases.Lease(ctx)
if ok {
return ctx, func() error {