It would be super helpful if there was an API to delete all keys within a given range.
I would like to store log entries with keys of the form log_id#timestamp where timestamp is a i64 representing milliseconds since the epoch. Currently, the only way to delete all log entries for a given log_id is to:
- Open a read transaction
- Read a bunch of keys into memory using
read_range
- Close the transaction
- Open a write transaction
- Delete the keys
- Commit the transaction
- Repeat until all keys in the range are deleted
With a delete_range this could be as easy as deleting all keys between log_id#0 and log_id#i64::MAX.
You could argue that a key-value store is not ideal for this application but the existence of the Cursor API suggests that there are other uses for working with ranges of keys where it could be useful to delete a range in one operation.
It would be super helpful if there was an API to delete all keys within a given range.
I would like to store log entries with keys of the form
log_id#timestampwheretimestampis ai64representing milliseconds since the epoch. Currently, the only way to delete all log entries for a givenlog_idis to:read_rangeWith a
delete_rangethis could be as easy as deleting all keys betweenlog_id#0andlog_id#i64::MAX.You could argue that a key-value store is not ideal for this application but the existence of the
CursorAPI suggests that there are other uses for working with ranges of keys where it could be useful to delete a range in one operation.