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

Async version #25

Closed
ozgrakkurt opened this issue Apr 1, 2023 · 2 comments
Closed

Async version #25

ozgrakkurt opened this issue Apr 1, 2023 · 2 comments

Comments

@ozgrakkurt
Copy link

Hey!

Would adding an option to have an async version via something like maybe_async make sense?

I want to implement this since I want to use this database but I want to use it in an async context and doing tokio::spawn_blocking or similar for every db call doesn't feel right.

@pjtatlow
Copy link
Owner

pjtatlow commented Apr 3, 2023

Hey @ozgrakkurt, this isn't a bad idea, but it only makes sense for writes.

All reads are done to a memory map, so there is nothing to do asyncronously. When we try to read from a memory address, if that page isn't in memory we will just get a page fault and the OS will load that in. There's no way to "asyncify" that.

Writes are done directly to the file though, so the commit method on the transaction could be async. It shouldn't be difficult, I just haven't gotten around to doing this yet. Are you interested in giving it a try?

@ozgrakkurt
Copy link
Author

Thanks for the explanation! I decided to just go with sync API so it is fine for me for now.

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

2 participants