Skip to content

KeyedFuturesUnordered: refactor so that futures are accessible

Jim Newsome requested to merge jnewsome/arti:alt-keyed-futures-unordered into main

Instead of wrapping FuturesUnordered, which doesn't support efficient access to its internal futures, keep the futures themselves in our own HashMap, and use a custom Waker to be notified which futures are ready to be polled.

This allows us to return the original future on remove, and add get and get_mut.

I'm planning to propagate this flexibility upward into StreamPollSet and StreamMap. This will let us wrap the Senders with tightly coupled data (such as flow control), and maybe even the whole stream entries (per !2319 (comment 3057237)), making it easier to encapsulate some of the bookkeeping.

Progress on #1421 (closed), #1397 (closed)

Merge request reports

Loading