@janriemer
Not cyclic! A DAG has no cycles. But yes, the problem is hard, especially because my future is not Send and I don't know how i can make it Send...
@musicmatze Oh, stupid me!🤦
The "A" in DAG stands for "acyclic" of course.
Thanks for the correction.
Although from 2019, this might be helpful:
"In other words, a future is safe to send across threads if all of the types that are held across .await points implement Send." -
from the Rust blog:
https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html#so-why-doesnt-my-future-implement-send
I hope this helps in some way!?
@musicmatze Are you using async traits from third-party crates? Maybe they have opted out of `Send` (with this: `#[async_trait::async_trait(?Send)]`)?
See also this excellent article by fasterthanlime:
https://fasterthanli.me/articles/getting-in-and-out-of-trouble-with-rust-futures
@janriemer yes: https://docs.rs/ipfs-api-backend-hyper/0.2.0/ipfs_api_backend_hyper/trait.IpfsApi.html and yes they did.
Grrrr...
@janriemer if you're interested: https://github.com/ferristseng/rust-ipfs-api/issues/90
@janriemer yeah well the problem is the library...
@musicmatze Can you iterate over the DAG synchronously, and pipe it into an async channel?
Also, try https://lib.rs/async-stream
@kornel no I can not, because the fetching of the node is async itself ...
The problem is even a bit harder because if I get a Node that has more than one parent, I need to fetch both parents and return them one by one from the stream, having two streams essentially now 😄
@kornel thanks for the crate, I will have a look
@musicmatze "[...]extreme skill with async Rust[...]", hm...I don't even have "skill with async Rust", sorry.😧 😅
But this sounds very interesting, so I'd really appreciate it, if you could keep me updated on this.
It seems you are trying to combine two of the hardest problems in Rust (IMO): cyclic data structures and async 😱