Skip to content

Delete keys in range #18

@avsaase

Description

@avsaase

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:

  1. Open a read transaction
  2. Read a bunch of keys into memory using read_range
  3. Close the transaction
  4. Open a write transaction
  5. Delete the keys
  6. Commit the transaction
  7. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions