rescind releases a lease from this client.
(ctx context.Context, key string, rev int64)
| 185 | |
| 186 | // rescind releases a lease from this client. |
| 187 | func (lkv *leasingKV) rescind(ctx context.Context, key string, rev int64) { |
| 188 | if lkv.leases.Evict(key) > rev { |
| 189 | return |
| 190 | } |
| 191 | cmp := v3.Compare(v3.CreateRevision(lkv.pfx+key), "<", rev) |
| 192 | op := v3.OpDelete(lkv.pfx + key) |
| 193 | for ctx.Err() == nil { |
| 194 | if _, err := lkv.kv.Txn(ctx).If(cmp).Then(op).Commit(); err == nil { |
| 195 | return |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | func (lkv *leasingKV) waitRescind(ctx context.Context, key string, rev int64) error { |
| 201 | cctx, cancel := context.WithCancel(ctx) |