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

Add automatic methods to KeyValueDB which test for the existence of certain objects #409

Merged
merged 1 commit into from
Jul 28, 2020

Conversation

coriolinus
Copy link
Contributor

@coriolinus coriolinus commented Jul 27, 2020

Motivation: We have a use case in which we care about a large object's
existence, but don't care to load megabytes of data from disc. We have
only a dyn KeyValueDB handle available; whatever we use has to be
part of the trait.

By adding automatic implementations for the new methods, we avoid
breaking existing code. The automatic implementations are no worse than
the code which is possible with the existing API.

Part 2 of this fix will be tracking down the concrete type in use
and implementing specializations of those methods, so that we actually
do save work, but that's dependent on this PR being merged.

Compatibility: this won't change the behavior of any existing code, even if
concrete instantiators already have methods which shadow the default
implementation: playground.

…ertain objects

Motivation: We have a use case in which we care about a large object's
existence, but don't care to load megabytes of data from disc. We have
only a `dyn KeyValueDB` handle available; whatever we use has to be
part of the trait.

By adding automatic implementations for the new methods, we avoid
breaking existing code which is no worse than the existing strategy.

Part 2 of this fix will be tracking down the concrete type in use
and implementing specializations of those methods, so that we actually
do save work, but that's dependent on this PR being merged.
Copy link
Member

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Regarding part 2, for rocksdb it is blocked on rust-rocksdb/rust-rocksdb#439, but even then from reading the docs, it seems that this function may return false positives, this is probably not what we want.

@dvdplm dvdplm merged commit 760447f into master Jul 28, 2020
@dvdplm dvdplm deleted the prgn-kvdb-object-existence branch July 28, 2020 08:08
@ordian
Copy link
Member

ordian commented Jul 28, 2020

Also note, that this change is breaking (and also for all kvdb-* crates).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants