I have two streams. slow_stream and fast_stream. I am trying to write fast_stream to s3 in a bucket named by the result of slow_stream.
Ideally, I'd do something like,
while let Some(slow) = slow_stream.next().await {
while let Some(fast) = fast_stream.next().await {
tokio::spawn(async_put_in_s3_bucket(fast,slow));
}
}
If fast_stream runs indefinitely, does the control flow return to the outer loop here? Is this the correct way to handle this? Is it faster than using two tokio::spawn's and a mutex to communicate b/t them? Is there a more rust-y way to accomplish this? It seems like there is a way to use a codec to turn a fast stream into a ByteStream directly, but I'm still missing something about how to get it into s3 w/ the info from slow.