rkv
rkv copied to clipboard
Expose NotFound as a specific StoreError
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.
+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.