2w
it's been two years, I'm still finding new purposes for my push-buffer data structure, and I still haven't figured out a way to concisely describe what it is

what the hell, this is getting ridiculous

#ProjectToot
2
0
0
0
18h
@joepie91 shooting from the hip, but what is the difference between this and a mpsc channel?
1
0
0
0
18h
@mei comparing to tokio mpsc channels (it being async), some differences that stand out:
- a push-buffer can have many consumers
- a push-buffer can operate in pull mode, kicking off work itself to satisfy requests
- a push-buffer can 'route' both values and errors into different 'lanes' depending on what they are, or alternately broadcast them across all
1
0
1
0
18h
@joepie91 ohh that is so clever! each and every one of those points, though especially the pull mode sounds very cool and useful. i've wanted that before, and had to kind of make unsemantic changes to my program to satisfy it (basically always keeping the channel backlogged, same difference as do{}while v while{} if i understand that syntax correctly)
1
0
1
0

18h
@mei yeah, keeping it perpetually backlogged does seem like it would achieve something similar, from how you describe it

another thing with push-buffer, that combines really well with pull-mode, is that it supports the NoValue marker that I also use for promistreams, to explicitly signal that no value could be produced for one reason or another - in pull mode, that'll just kick off another task, repeating until all pending requests have been satisfied

I think that case would be really difficult to reproduce with the permanently-backlogged approach, because at least in tokio to use the waiting mechanism, you need to already be presenting a value to the channel, so you can't then decide not to push it after all
1
0
1
0
@mei I do think that 'channel' is probably a better naming category than 'buffer', now that you mention it, although I still wouldn't know what kind of channel to call it 😅
1
0
0
0
@joepie91 yes, this is a really neat concept and you have basically Done A Computer Science. you should name it yourself! a mpmc [something] channel

it's something like a bike chain where gears can turn things both ways from any end of the system. i wanted to say it's like a (literal) rope but ropes tend to be elastic and so they don't work in this way (they are pull-only from both sides)
1
0
1
0
@mei help, but then I have to name things
1
0
0
0
@mei also I still don't quite understand how to formalize this or why this particular combination of features works so well 😅
0
0
0
0