[AsyncStreaming] Introduce a MultiProducerSingleConsumerChannel and a duplex - #425
Closed
FranzBusch wants to merge 2 commits into
Closed
[AsyncStreaming] Introduce a MultiProducerSingleConsumerChannel and a duplex#425FranzBusch wants to merge 2 commits into
MultiProducerSingleConsumerChannel and a duplex#425FranzBusch wants to merge 2 commits into
Conversation
FranzBusch
force-pushed
the
fb-async-streaming-mpsc
branch
2 times, most recently
from
May 27, 2026 14:29
e02ca0f to
b793e0e
Compare
FranzBusch
marked this pull request as ready for review
June 2, 2026 06:16
FranzBusch
force-pushed
the
fb-async-streaming-mpsc
branch
from
June 2, 2026 06:17
b793e0e to
e1a6dff
Compare
guoye-zhang
reviewed
Jun 2, 2026
| backpressureStrategy: BackpressureStrategy, | ||
| isolation: isolated (any Actor)? = #isolation, | ||
| body: ( | ||
| consuming sending Writer, |
Contributor
There was a problem hiding this comment.
Why 2 pairs? One pair is more commonly used and you can always build 2 from 1?
Member
Author
There was a problem hiding this comment.
The MPSCChannel is a single pair the duplex is just two pairs connected bi-directionally. Both of them are important and yes one can be build using the other. In fact this PR does that. Having a connected duplex stream is very useful for many testing scenarios.
guoye-zhang
approved these changes
Jun 3, 2026
MultiProducerSingleConsumerChannel and a duplexMultiProducerSingleConsumerChannel and a duplex
Member
|
Sent you a patch on Slack to fix the tests building. With that I'm ok with landing this |
Contributor
|
Merged in #428 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When working with async reader and writer one often needs "root" readers and writers. A multi producer single consumer channel can provide the foundation for such a reader and writer pair. Furthermore, developers often want a connected duplex pair of readers and writers for testing or in-memory purposes.
Modifications
This PR brings over the existing
MultiProducerSingleConsumerAsyncChannelwith adaptions to handle reader and writer like interfaces and leverage unstable types such asUniqueDeque. Furthermore, this PR also brings aDuplexStreamthat sets up two connected pairs of MPSC channels.I intentionally copied and modified the MPSC implementation since I don't want to carry
#ifconditionals in an existing used implementation. Once we stabilize this module we can evaluate how to best proceed.Result
Makes it easier for developers to work with readers and writers. In particular, makes testing a lot easier.