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

Genericize Keys to support custom Ord types #34

Open
ecton opened this issue Feb 8, 2022 · 0 comments
Open

Genericize Keys to support custom Ord types #34

ecton opened this issue Feb 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@ecton
Copy link
Member

ecton commented Feb 8, 2022

I was pondering khonsulabs/bonsaidb#184 and how it was a shame that floats weren't orderable at the bit level so that they could be used in keys. It occurred to me that we might be able to convert the current usage of [u8] as the key type into something like what BonsaiDb has in its Key trait -- perhaps the Key trait moves to Nebari.

Instead of requiring Key to be binary-sortable, now it just needs to be any type that is Ord and can convert to bytes. Taking it a step further this could mean that the Key trait could be replaced as a combination of transmog::BorrowedDeserializer and Ord.

I'm not sure if all of this is actually feasible, but it could open up the possibility of any Ord type being able to be used as a Key in Nebari and BonsaiDb.

(And yes, I'm aware that floats are only PartialOrd, but that can be worked around by a simple wrapper like ordered_float)

@ecton ecton added the enhancement New feature or request label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant