DeleteRange is a method on FlyDbStore that deletes a range of log entries
(min, max uint64)
| 94 | |
| 95 | // DeleteRange is a method on FlyDbStore that deletes a range of log entries |
| 96 | func (fds *FlyDbStore) DeleteRange(min, max uint64) error { |
| 97 | for i := min; i <= max; i++ { |
| 98 | _ = fds.conn.Delete(uint64ToBytes(i)) |
| 99 | } |
| 100 | if fds.firstIndex >= min && fds.firstIndex <= max { |
| 101 | fds.firstIndex = fds.min() |
| 102 | } |
| 103 | if fds.lastIndex >= min && fds.lastIndex <= max { |
| 104 | fds.lastIndex = fds.max() |
| 105 | } |
| 106 | return nil |
| 107 | } |
| 108 | |
| 109 | // Set is used to store key/value pair |
| 110 | func (fds *FlyDbStore) Set(key []byte, val []byte) error { |