| 83 | } |
| 84 | |
| 85 | func (lc *leaseCache) LockWriteOps(ops []v3.Op) (ret []chan<- struct{}) { |
| 86 | for _, op := range ops { |
| 87 | if op.IsGet() { |
| 88 | continue |
| 89 | } |
| 90 | key := string(op.KeyBytes()) |
| 91 | if end := string(op.RangeBytes()); end == "" { |
| 92 | if wc, _ := lc.Lock(key); wc != nil { |
| 93 | ret = append(ret, wc) |
| 94 | } |
| 95 | } else { |
| 96 | for k := range lc.entries { |
| 97 | if !inRange(k, key, end) { |
| 98 | continue |
| 99 | } |
| 100 | if wc, _ := lc.Lock(k); wc != nil { |
| 101 | ret = append(ret, wc) |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | return ret |
| 107 | } |
| 108 | |
| 109 | func (lc *leaseCache) NotifyOps(ops []v3.Op) (wcs []<-chan struct{}) { |
| 110 | for _, op := range ops { |