Closed wbarnha closed 1 year ago
Hi
Currently the in
operator, or __contains__
method first calls key_may_exist
and then calls get
, which is similar to key_may_exist
, but cannot return the value fetched or control whether to fetch. Hmm. Looks like a nice Api to me. Let me see how to add it.
rust-rocksdb has not yet implemented returning value from key_may_exists. To get the value, one needs to pass a mutable pointer to the C API.
Implemented in #55
I think this is not very accurate:
Returns:
(True, None) if key is found but value not in memory
(True, None) if key is found and fetch=False
(True, <data>) if key is found and value in memory and fetch=True
(False, None) if key is not found
I think the API works the following way:
And flip it around:
I’ve also added read/write options for put, get, delete, and delete_range.
Thank you so much, I'm so excited to use this project with Faust! There are a few remaining differences (like iterkeys, iteritems, seek_to_first), but I've managed to work around those.
Thanks for the help with our migration! Because of your changes, I was able to get most of the tests in https://github.com/faust-streaming/faust/pull/478 working smoothly. We almost have all of
rocksdict
ready to replacepython-rocksdb
! There is one method remaining to mirror from https://faust-streaming.github.io/python-rocksdb/api/database.html that I particularly need:I'll try to take a stab at adding it myself, but I'm unsure where to begin currently.