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

Support writing Avro containers asynchronously #140

Open
alexbiehl opened this issue Jul 6, 2020 · 5 comments
Open

Support writing Avro containers asynchronously #140

alexbiehl opened this issue Jul 6, 2020 · 5 comments

Comments

@alexbiehl
Copy link

alexbiehl commented Jul 6, 2020

Currently avro_rs::Writer expects the underlying writer to implement std::io::Write which makes it unsuitable for use in streaming environments with futures/async_std/tokio.

I know the ecosystem is a little scattered but it would be great if avro_rs supported one of the asynchronous write interfaces like tokio::io::AsyncWrite or async_std::io::Write.

@kendru
Copy link

kendru commented Jul 15, 2020

Would a PR that adds support for tokio::io::AsyncWrite be desired by this project?

@poros
Copy link
Collaborator

poros commented Jul 18, 2020

Thanks for being willing to contribute, @kendru!

I am not thrilled by the perspective of tying this library to any of the async runtimes, as there isn't truly any standard atm (although tokio seems to be the most mature among them). Even if we want to add support for it, it would be under a cargo feature.

@alexbiehl is also the only one who asked for such a feature, so I can't really tell that there is much of request for it either.

As for now, perhaps we could offer the possibility to the users of implementing the Writer interface, so they can implement it for their runtime of choice? What do you people think?

@kendru
Copy link

kendru commented Jul 23, 2020

@poros I completely understand not wanting to tie this library to a specific async runtime, and I would be happy to try implementing tokio's AsyncWrite interface under a cargo feature. This functionality would be very useful for a project that I am currently working on, and I would imagine that as the use of async code in Rust becomes more common, this will be useful for more people. Since tokio does look like the de-facto runtime, I think that it would make sense to support it. That said, if you are still not convinced that it would be useful for this library to offer an async interface, I completely understand.

@poros
Copy link
Collaborator

poros commented Jul 24, 2020

I am only a bit worried that we will need to keep maintaining it in a fast-changing ecosystem when, at the end, it isn't a core component of a serde library.

@kendru : what do you think about the Writer public trait approach I mentioned above? Would that allow you to implement something that works with tokio? If not, I would be OK to go for the cargo feature approach.

@sycured
Copy link

sycured commented Mar 22, 2021

Have you any ETA about async?

@kendru have you any fork or patch for async?

How to permit the usage of tokio and async_std?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants