Fork me on GitHub
#missionary
<
2024-03-10
>
telekid16:03:41

The https://cljdoc.org/d/missionary/missionary/b.33/api/missionary.core#reductions`m/reductions` says that it returns a discrete flow, but doesn't it actually return a continuous flow?

leonoel10:03:50

The docstring is indeed not great. The flow returned by m/reductions is initialized. If it's initialized AND decoupled, then it's continuous. Otherwise it is discrete

👍 1
Dustin Getz16:03:50

what is “decoupled”

leonoel16:03:47

a flow is decoupled when the sampling rate has no impact on the event production

leonoel16:03:28

m/watch is decoupled, m/relieve too

telekid17:03:51

are these statements true? 1. "continuous flow" could be defined as any flow that is both initialized and decoupled. 2. "discrete flow" could be defined as any flow that is either not initialized, not decoupled, or both. 3. consumers of a decoupled flow do not place backpressure on producers. 4. consumers of coupled flows do place backpressure on producers. 5. "continuous flows" model continuous time, since they can be sampled at any point in time (thanks to initialization and decoupling) 6. "discrete flows" model discrete events. It is often unsafe to drop discrete events (think delta encoding,) so they need backpressure. 7. ...but sometimes you can transform discrete events into a continuous flow by reducing events into state. Example: events representing integer additions to a counter. Since state can (by definition) be sampled at any point in time, reducing these add events (via m/reductions) decouples the producer (event emitter) from the consumer (flow consumer.)

leonoel19:03:50

The statements are correct but the example is wrong. m/reductions doesn't decouple, m/relieve does. You need both to turn the discrete events into a continuous flow

🙏 1