The data source
Define a data source trait. The trait will have two methods:
-
init
, which will take a sender mpsc for updates. It'll put updates to flows there, in a push manner ‒ some struct that'd contain:- A lookup key (maybe more than one) ‒ see #35 (closed) for the keys
- Some headers to be added to the flow (may be 0)
- Possibly a statistics update
-
tick
, called repeatedly. This'll return (possibly empty) stream of the above updates. This is the pull method, and it is called just before closing a slice. Once the stream is fully fed into the same mpsc, the gatherer can close the slice.
Use this for arbitrary number of such traits. Convert the guts to conform to this.
For the closing trick to work, we probably need the mpsc to have 0 capacity.
Edited by Ghost User