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

Add async support via Tokio #66

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Add async support via Tokio #66

wants to merge 6 commits into from

Conversation

yasamoka
Copy link

@yasamoka yasamoka commented Oct 31, 2024

First of all, thank you for your great work on this crate!

This PR adds support for readers that implement Tokio's AsyncRead and AsyncSeek traits.

My use case is determining the file format of potentially large S3 objects without having to read entire objects into memory first. A reader that implements AsyncRead is provided courtesy of aws_smithy_types, but for AsyncSeek I had to implement my own wrapper on top. An example of such can be provided if needed.

Adding async support required moving common functionality away from the file format readers first, then introducing async implementations of those readers in parallel with the sync versions. The commit sequence shows this step-by-step.

Please let me know if there are any changes required.

@mmalecot mmalecot changed the base branch from main to dev October 31, 2024 17:05
@mmalecot
Copy link
Owner

Thanks for your PR!
Can you please rebase on dev branch as I did changes today?
I'm going to review your modifications, but the feature seems interesting :).

@yasamoka
Copy link
Author

On it!

@yasamoka
Copy link
Author

Done.

@mmalecot
Copy link
Owner

mmalecot commented Nov 1, 2024

There’s quite a bit of code duplication between the sync and async reader implementations: there might be something we can do with macros.

I'll try to think about it on my own, but maybe we can take inspiration from other crates like surf or reqwest.

@mmalecot mmalecot deleted the branch mmalecot:dev November 7, 2024 19:56
@mmalecot mmalecot closed this Nov 7, 2024
@yasamoka
Copy link
Author

yasamoka commented Nov 7, 2024

Hello, what was decided regarding this? I'd like to know. Thanks!

@mmalecot mmalecot reopened this Nov 7, 2024
@mmalecot
Copy link
Owner

mmalecot commented Nov 7, 2024

Hi, I closed the PR by deleting the dev branch, I've just restored it.
Still need to see how to better manage readers without duplicating too much code.

@yasamoka
Copy link
Author

yasamoka commented Nov 7, 2024

Do let me know if I can help with something after you've thought about it.

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

Successfully merging this pull request may close these issues.

2 participants