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

Can this awasome add the range selection Feature? #301

Open
liuzhijun opened this issue Jan 2, 2024 · 2 comments
Open

Can this awasome add the range selection Feature? #301

liuzhijun opened this issue Jan 2, 2024 · 2 comments

Comments

@liuzhijun
Copy link

can take a reference here:
https://plyvel.readthedocs.io/en/latest/user.html#iterators

samples like:

for key, value in db.iterator(start=b'key-2', stop=b'key-4'):

for key, value in db.iterator(start=b'key-3'):

for key, value in db.iterator(start=b'key-2', include_start=False, stop=b'key-5', include_stop=True):

for key, value in db.iterator(prefix=b'ke'):

...etc

I can also submit a PR if ok.

Thank you !!

@grantjenks
Copy link
Owner

It sort of already exists with the iterkeys method.

I think I would also rather base the API on https://grantjenks.com/docs/sortedcontainers/sortedlist.html#sortedcontainers.SortedList.irange

Please describe your use case further.

@liuzhijun
Copy link
Author

Yes, I think it's OK.
Sorted Containers's irange api also works!

The idea that the requirements for range selection was come from the foundationdb's api.
From here: https://apple.github.io/foundationdb/data-modeling.html#the-core-data-model

What's more amazing is the tuple based key operation(pack and uppack) in foundation db's Python API that can apply to any sorted persistent storage that lead to a amazing OLTP persitent layer.
take a api usage here: https://apple.github.io/foundationdb/class-scheduling.html
the tuple based api here: https://apple.github.io/foundationdb/api-python.html#api-python-tuple-layer

That's all why I think the persistent container should support range selection based on the start and end key.

Thank you again for your kindly comment and such a amazoning library !!

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

No branches or pull requests

2 participants