update lmdb-rkv to latest version 0.11 #105
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@ncloudioj Per mozilla/lmdb-rs#14, the latest version of the lmdb-rkv crate returns an error instead of panicking when
mdb_cursor_get()
returns an error. That changes the return value of lmdb::Iter.next(), which is now a Result; so we need to update rkv::Iter.next() accordingly.We could maintain backward compatibility by continuing to return
(&'env [u8], Result<Option<Value<'env>>, StoreError>)
from rkv::Iter.next(), either ignoring an Err result from lmdb::Iter.next() or hiding it in the key-value tuple's value field (which can currently be a StoreError if read_transform() fails to transform the value). But that's either a silent failure or a misleading result.Alternately, we could distinguish between a StoreError result of lmdb::Iter.next() and a StoreError result of read_transform() by returning
Result<(&'env [u8], Result<Option<Value<'env>>, StoreError>), StoreError>
, i.e. either an error or a key-value tuple whose value field may contain an error. But that feels overcomplex, requiring two layers of error handling by the consumer.This branch adopts the third approach of reporting all errors while consolidating error reporting by returning
Result<(&'env [u8], Option<Value<'env>>), StoreError>
, i.e. either a key-value tuple (that does not contain an error) or a StoreError (which can be either from lmdb::Iter.next() or from read_transform()).As this is a breaking change, the branch also increments the minor version of rkv.