| 121 | } |
| 122 | |
| 123 | func (kv *KeyValue) Delete(key string) error { |
| 124 | kv.mu.RLock() |
| 125 | defer kv.mu.RUnlock() |
| 126 | // This isn't an ideal implementation, since it synchronously |
| 127 | // deletes from the backing store. But deletes aren't really |
| 128 | // used, so ignoring for now. |
| 129 | // Could also use a syncutil.Group to do these in parallel, |
| 130 | // but the buffer should be an in-memory implementation |
| 131 | // anyway, so should be fast. |
| 132 | err1 := kv.buf.Delete(key) |
| 133 | err2 := kv.back.Delete(key) |
| 134 | if err1 != nil { |
| 135 | return err1 |
| 136 | } |
| 137 | return err2 |
| 138 | } |
| 139 | |
| 140 | func (kv *KeyValue) BeginBatch() sorted.BatchMutation { |
| 141 | return new(batch) |