CLOVIS
02/15/2020, 3:48 PMnext()
or something similar), and from one-to-many producers to add new data to it.
That sounds awfully similar to what a Channel is, however from my understanding the consumer·s of a channel act as soon as an element is produced, rather than when they want to?
Basically I'm searching for a way to have the client decide when new elements are produced, and that data structure would have some kind of buffer of size n
so the client could almost always get the data instantaneously, and the producer·s would get to work immediately when the buffer gets too small to add new elements.diesieben07
02/15/2020, 3:57 PMsend
suspends the sender until there is room available in the buffer. Backpressure is built-in, you don't need to do anything special.Channel(5)
there will only ever be 5 objects in memory at most, even if the receiver is too slow. The sender will just have to wait then (suspended).kevin.cianfarini
02/15/2020, 4:01 PMcollect
and send/receive
since they're suspending functions.
I would recommend using flow over channelstreetsofboston
02/15/2020, 4:34 PMCLOVIS
02/17/2020, 10:44 AM