Open rnewman opened 4 years ago
+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.
At present a missing key in a
.delete
call returnsStoreError::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 onlmdb-rkv
.One solution for this is to handle
NotFound
specially in rkv's own interface. I'm open to other suggestions.