-
Notifications
You must be signed in to change notification settings - Fork 160
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
Option as RedbValue #486
Comments
Oh ya, this seems like a good idea. It also gives me a good test case for working through some of the complexities of supporting #360 . There are enough use cases for type alignment that I think it'd be nice to support, but as much as possible I want the alignment to be checked at compile time, so that it doesn't introduce a bunch of subtle bugs |
Is |
Oh not directly. It's just that one of the complexities of type alignment is nested types. Implementing nested aligned types in tuples would be pretty annoying, but I'd like to implement them for something to be sure the abstractions work. Option seems like a good, simple, first type for that |
Check out my comment in #360 (comment), but I'm wondering if alignment might be something that redb only needs to support for top-level byte slice and array keys and values. If a user needs alignment, then there's a good chance that they need it because they're going to do some kind of performance-critical zero-copy deserialization from a byte slice to higher level types that require alignment. And in those circumstances, they might also have their own serialization/deserialization format that they'll be using instead of redb's types/tuples. So in that case might be limited utility in supporting alignment for things other than byte slices, which might reduce the complexity of the implementation. |
I was thinking about combing two tables which map keys to u64s. However, the second table doesn't have an entry for each ID, so the value type would need to be
(u64, Option<u64>)
, butOption<u64>
doesn't have an impl forRedbValue
.This isn't at all pressing, since I can just leave them separate, and I was combining them based on the assumption that having fewer tables with multiple values in each table would be faster, and I haven't actually benchmarked that. However I assume it'll be a common use-case.
The text was updated successfully, but these errors were encountered: