Fix PkvStore::get not returning NotFound on empty db when building for native (redb) #46
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.
Previously when doing
PkvStore::get
on just created (empty) database would return internal redb table error instead ofGetError::NotFound
. This behavior is not consistent with all the other backends which returnGetError::NotFound
. The error that gets returned isGetError::ReDbTableError(redb::TableError::TableDoesNotExist(_))
.redb
returns this error as it does not create tables when callingopen_table
on read transactions, it creates tables only when callingopen_table
on write transactions.The two workarounds are:
Err
variant when doingPkvStore::get
and just handleOk
variantNotFound
or other critical error)This forces users of
bevy_pkv
to add explicit dependency onredb
if they want to handle this error, making it harder to support cross platform apps.The solution is to create the table beforehand when creating database.