Closed wbarnha closed 1 year ago
Hi. Great.
The current behavior of __getitem__()
raise KeyError
when the key does not exist, which is the same as python Dict
.
The behavior of __delitem__()
, however does NOT raise exception when the key does not exist, which is different from python Dict
. But this is because RocksDB uses SST and doesn't check key existence upon deletion.
I think maybe we could make get()
to have the same interface as python Dict
:
@overload
def get(self, __key: _KT) -> _VT_co | None: ...
@overload
def get(self, __key: _KT, default: _VT_co | _T) -> _VT_co | _T: ...
get('non existent key')
returns None
instead of throwing an exception.What do you think?
My thoughts exactly! I'm not that familiar with Rust yet so I wasn't sure how to go about doing so.
OK, I'll modify it a bit.
Merged into v0.3.8! BTW, what makes you switch to rocksdict from python-rocksdb?
Long story short, I made an inefficient CI/CD chain for https://github.com/faust-streaming/python-rocksdb, and the wheels are 66 MB. For each version of Python I need to support, it gets pretty clunky after a while. Especially combined with the fact that the unzipped wheel is 250 MB.
I originally contacted the maintainer of https://github.com/twmht/python-rocksdb to get control over consolidating all python-rocksdb forks, but that never came to fruition. Since I think you're actively maintaining a performant, compact RocksDB driver for Python, I think going with your project is the best solution.
Thanks for the fast response by the way, I really appreciate it!
I'm currently in the process of replacing
python-rocksdb
in the Faust-Streaming project withrocksdict
. Since I can't subclassRdict
, it'd be appreciated if we could have similarput
,get
, anddelete
calls to make the transition much easier. Thoughts?