MCPcopy
hub / github.com/etcd-io/etcd / rescind

Method rescind

client/v3/leasing/kv.go:187–198  ·  view source on GitHub ↗

rescind releases a lease from this client.

(ctx context.Context, key string, rev int64)

Source from the content-addressed store, hash-verified

185
186// rescind releases a lease from this client.
187func (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
200func (lkv *leasingKV) waitRescind(ctx context.Context, key string, rev int64) error {
201 cctx, cancel := context.WithCancel(ctx)

Callers 1

monitorLeaseMethod · 0.95

Calls 7

EvictMethod · 0.80
CompareMethod · 0.65
CommitMethod · 0.65
ThenMethod · 0.65
IfMethod · 0.65
TxnMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected