This ties in with #40 and #53 both of which heavily rely on the discussion in python-trio/trio#987.
The main gotcha is that trio's mem chans don't have broadcasting built-in (frankly making them mostly an SC anti-pattern if you have followed the .clone() semantics discussion). This mis-assumption was what originally fueled #203.
The obvious main use case is for broadcasting stream data on the receive side of a stream such that multiple rx-side tasks get each their own copy of a new message. NB: We already have a prototype for producer side ala tractor.msg.pub, though I'm not sure it's the best solution either.
Depending on how we move forward with bidirectional-streaming in #53 it might be worth offering a .clone() or similar method which provides a broadcast reference token to consumer tasks.
Definitely needs a deeper dive.
For reference here's the current short list of broadcast chan impls:
Any more implementations are greatly welcome from the lurker pack 😉
This ties in with #40 and #53 both of which heavily rely on the discussion in python-trio/trio#987.
The main gotcha is that
trio's mem chans don't have broadcasting built-in (frankly making them mostly an SC anti-pattern if you have followed the.clone()semantics discussion). This mis-assumption was what originally fueled #203.The obvious main use case is for broadcasting stream data on the receive side of a stream such that multiple rx-side tasks get each their own copy of a new message. NB: We already have a prototype for producer side ala
tractor.msg.pub, though I'm not sure it's the best solution either.Depending on how we move forward with bidirectional-streaming in #53 it might be worth offering a
.clone()or similar method which provides a broadcast reference token to consumer tasks.Definitely needs a deeper dive.
For reference here's the current short list of broadcast chan impls:
the
eventual_valuespredicate matching iterator intrio-utilthe "lossless", slowest consumer limiting, event queue
aioeventgist from @basakslurry'sPipeline.tap()effectively does the,but, with non-zero buffer size reccomendations:
Any more implementations are greatly welcome from the lurker pack 😉