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

Expose a safe low-level cursor API. #255

Open
nolanderc opened this issue Apr 29, 2024 · 2 comments
Open

Expose a safe low-level cursor API. #255

nolanderc opened this issue Apr 29, 2024 · 2 comments

Comments

@nolanderc
Copy link
Contributor

The LMDB cursor API is quite powerful; something similar should be exposed by heed. The RwIter API gets close, but is unsafe and does not handle seeking to arbitrary keys. The API should allow the following operations:

  • Seeking to an arbitrary key.
  • Seeking to the next/previous key-value pair.
  • Reading the current key/value (could be part of the seeking operations).
  • Inserting an arbitrary key-value pair (LMDB optimizes for cases where the key would end up close to where the cursor is currently pointing).

A full cursor API would also let us efficiently implement an API similar to HashMap::entry (see this comment).

@MathGeniusJodie
Copy link

ooh, if that makes multiget possible I'm really looking forward to it!

@Kerollmops
Copy link
Member

Hey @MathGeniusJodie, @oXtxNt9U, @sebastijankuzner, and @Nuhvi 👋

It's an open-source repository. Feel free to propose solutions though play.rust-lang.org (before implementation) and probably directly expose the internal Cursor type and make it more safe or wrap it if necessary.

Have a nice day 🌞

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

3 participants