-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Flume Overhaul #84
base: master
Are you sure you want to change the base?
Flume Overhaul #84
Conversation
Does this mean flume wouldn't work without an async runtime like tokio? |
It would still support sync through the use of pollster internally |
Yep. Flume's internal futures would be runtime-agnostic. |
Hi. Hows the rewrite going? I was considering to add task sync functions such as |
You're welcome to implement these and I'll merge/release them if you do (the latter is already implemented as |
@zesterer FWIW, |
ce28b9c
to
24505d2
Compare
Sorry for the necro here, but I ended up doing something a bit similar to this in xtra in this pull request: Restioson/xtra#85. It has since evolved a lot with contributions from @thomaseizinger, but the core concepts remain the same, many of which were borrowed from flume and what I learned whilst working on it. It's a bit different as it has to support three kinds of channels in one, but overall the concept is similar to this. It lacks a blocking interface but this could use something lightweight like One thing that we've looked at is replacing the bespoke waiting sender/receiver queues ( I'm not sure if this is still planned at all but I would potentially be interested in looking into it or offering advice based on my experiences implementing xtra's channel, which is very similar to flume's in concept as mentioned previously. |
I would really love to get round to dedicating more time to work on this, but if I'm really honest I think I'm going to struggle given other obligations I have right now (both toward other projects, and toward things in the rest of my life). If someone is interested in picking up the challenge of rewriting Flume with a simpler async core (something that I think would be very rewarding), I'd be very happy to have a discussion with them and pass on what knowledge I have / review changes though. |
Of course, I completely understand!
Awesome :) I might give it a shot if I find some time, and if so you can leave a review if you have time |
This is a new from-scratch implementation of Flume with an async core.
A few things to note about the design:
no_std
. I use my own pollster crate for sync support.master
branchselect
API has been overhauled and is now easier to work into aselect!
macroSome unresolved issues:
master
branch uses a lot of complicated hackery to ensure that the receiver is properly deregistered, but it's still not ideal: it's possible to hold on to a receiver for a long time without polling it, resulting in a 'dead' item that is in the queue, but cannot be received by anything else. The simplest fix would be to use a poll-based model rather than an intrusive wakeup model, but I've found this to perform considerably worse.std
. This is more difficult than might be obvious. Crates likehashbrown
can be depended upon bystd
because they are themselvesno_std
. However, a crate that requires OS sync primitives (likeflume
) cannot be depended upon. A possible solution is forstd
to depend upon theno_std
core and then provide a minimalpollster
-like async executor to evaluate futures.