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

Marble::read buffer alignment #1

Open
bonsairobo opened this issue Aug 3, 2022 · 4 comments
Open

Marble::read buffer alignment #1

bonsairobo opened this issue Aug 3, 2022 · 4 comments

Comments

@bonsairobo
Copy link

I think it would be useful to guarantee some minimum alignment of the buffer returned from Marble::read, which would allow the buffer to be used with zero-copy deserialization like rkyv. I know that sled aligns IVecs to 16 bytes (on the main branch). I hacked this into my fork of marble here.

@spacejam
Copy link
Member

Hey @bonsairobo I'm thinking about allowing Marble::read to take a generic allocator as an argument, in the same way that the std::collections do, and in your allocator you can make it a simple pass-through that calls max on the alignment with your desired minimum alignment before passing it to the default allocator.

@bonsairobo
Copy link
Author

@spacejam That sounds good. Although if the container I want to use (e.g. rkyv::AlignedVec) is not generic over allocators, then it is hard to use this API. Maybe you'd rather like a trait similar to the Buffer trait I've got here.

@fabianmurariu
Copy link

@spacejam any chance you would revisit this? I'm also trying to use rkyv with marble (well with any storage layer for that matter)

@rdaum
Copy link

rdaum commented Aug 18, 2023

I guess it would help if I had read this thread first before filing my other issue. Some duplication of conversation here.

FWIW I vote highly for this approach.

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

4 participants