Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose NotFound as a specific StoreError #186

Open
rnewman opened this issue Dec 18, 2019 · 1 comment
Open

Expose NotFound as a specific StoreError #186

rnewman opened this issue Dec 18, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@rnewman
Copy link
Contributor

rnewman commented Dec 18, 2019

At present a missing key in a .delete call returns StoreError::LmdbError(lmdb::error::Error::NotFound). It is necessary to handle this case specifically in order to implement delete-if-present, which means that consumers need to take a dependency on lmdb-rkv.

One solution for this is to handle NotFound specially in rkv's own interface. I'm open to other suggestions.

@dfoxfranke
Copy link

+1. I'd go so far as to say that delete-if-present is the semantics almost everybody wants, and trying to delete a non-existent key should not be considered an error. I propose changing the return type of .delete() to be Result<bool, StoreError>, where the Ok variant is true if the key existed and false if it didn't.

@rnewman rnewman added the enhancement New feature or request label Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants