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

Wondering about an ets:select_reverse equivalent for mnesia #8993

Open
Bentheburrito opened this issue Oct 27, 2024 · 3 comments
Open

Wondering about an ets:select_reverse equivalent for mnesia #8993

Bentheburrito opened this issue Oct 27, 2024 · 3 comments
Assignees
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS

Comments

@Bentheburrito
Copy link

Is your feature request related to a problem? Please describe.
ets has a select_reverse/1-3, which is the same as select/1-3 except it traverses an ordered_set table backwards. There doesn't seem to be an equivalent for mnesia, only mnesia:select/1-4. Is there a particular reason/limitation for this, or has there simply been no need for it in the past?

Describe the solution you'd like
An mnesia:select_reverse/1-4 would be very useful to me, as I'd like the ability to traverse an ordered_set table in both directions.

Describe alternatives you've considered
mnesia does have an ets/1,2 which might work, but I think is undesirable since the given function is executed "in a raw context that is not protected by a transaction."

Additional context
I'm a new mnesia user, so apologies if I've missed something. If there is no technical reason why mnesia:select_reverse could not exist, I'd be happy to try to contribute it. I am more of an Elixir than Erlang dev though, so any guidance (outside of reading the contributor's guide of course) would be welcome :)

Thanks in advance!

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Oct 28, 2024
@Mikaka27
Copy link
Contributor

Mikaka27 commented Nov 4, 2024

We're open to contributions regarding this, from quick look at the code I don't see any obvious limitations.
But you must know that adding this requires extending external backends as well.

So things like: https://github.com/aeternity/mnesia_rocksdb would need to be adapted as well (they would need to handle new callback).

@Mikaka27 Mikaka27 self-assigned this Nov 4, 2024
@Mikaka27 Mikaka27 added the help wanted Issue not worked on by OTP; help wanted from the community label Nov 4, 2024
@Bentheburrito
Copy link
Author

Awesome! I'll take a look at implementing this when I get some time (hopefully later this month).

After I get a PR up for review, would opening an issue to note the new callback in the external backends' repositories suffice? I'm not familiar with the external backend landscape, so let me know if there are any other widely used ones that should be made aware (I see mnesia_rocksdb mentions mnesia_eleveldb)

@dgud
Copy link
Contributor

dgud commented Nov 13, 2024

You don't have to make that, just make sure it could work for them to add the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

4 participants