-
Notifications
You must be signed in to change notification settings - Fork 56
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
Switch to async / std::future::Future across codebase #213
Comments
It would probably be more accurate to say "convert tough to async / |
(I guess more specifically: I am rashly assuming this is still something we want to do before tough 1.0; is that correct?) |
Yes, we should do this. Now that I understand the Rust
We should get input from @tjkirch and @zmrow on these points. |
Progress update: I have tough building, except for the editor module. tough/tough/src/editor/signed.rs Lines 592 to 600 in 446615b
|
Hi @iliana it sounds like you got pretty close with this. I wonder if there is a way to collaborate on it. By its nature, a partial implementation cannot be merged, so it's tricky. |
I'll push my WIP branch later today, I shifted onto using tough as-is (synchronously) for expediency's sake a few weeks back. |
We just did this in another place as well, and it made me sad. If you're using a tokio runtime, then I think the safe thing to do is to spawn a thread for tough calls. Is this what you did? // tokio runtime exists
thread::spawn(|| {
tough::blah();
}).join().expect("I failed") |
Yeah I ended up doing something similar with |
@iliana I started looking at this tonight. I think it all starts with a decision on the #[async_trait::async_trait]
pub trait Transport: Debug + DynClone {
/// Opens a `Read` object for the file specified by `url`.
async fn fetch(
&self,
url: Url,
) -> Result<
Box<dyn futures::Stream<Item = Result<bytes::Bytes, TransportError>> + Send>,
TransportError,
>;
} Or maybe... #[async_trait::async_trait]
pub trait Transport: Debug + DynClone {
/// Opens a `Read` object for the file specified by `url`.
async fn fetch(&self, url: Url) -> Result<Box<dyn futures::AsyncRead + Send>, TransportError>;
} Changing to a |
I finally got over whatever mental hurdle I had to push the WIP i have: develop...iliana:async-or-swim |
@webern so for Transport I specifically used However I have been building without the http feature in my WIP branch so far. I'm not sure yet whether I can convert from a |
@iliana there's |
Hi, is there any ETA when it would be possible to use tough properly in an async environment? |
Currently, we do not have a reliable ETA for this request. |
Is there a way to help here? For example picking up the work from @iliana ? It'd be really nice to a) avoid the multiple executors thing and b) better integration with existing async code. |
Thanks @matze - contributions are definitely welcome if you are able to take a look. |
I think the first question is, if it's okay to lock into and depend on tokio or to be executor-agnostic? tokio is the de-facto standard, on the other hand I can in principle see the need to run tough in a no_std environment with a different executor. I tried rebasing @iliana's branch but of course it does not apply after so much time. |
I see that @iliana's branch uses Barring any good suggestions, I think |
I did a conversion to async based on streams as a replacement for |
Closed by #687! |
tough-ssm
creates its owntokio
runtime because it needs to use therusoto
which is async. However, this causes a problem if you're trying to usetough-ssm
anywhere else that is async... (because multiple runtimes)We've seen errors like this:
We should probably change the
KeySource
trait to be async using theasync-trait
crateThe text was updated successfully, but these errors were encountered: