datastream/erlang/internal/pump

Internal helpers for BEAM extension worker pumps.

A pump is a process that pulls from an upstream Stream(a) and forwards each element to a result subject. Combinators in datastream/erlang/par and datastream/erlang/time use this to drive an upstream concurrently with their own coordinator loop.

Each pump is paired with a stop subject. Sending Stop to that subject causes the worker to close the upstream and exit at the start of its next iteration. A worker blocked inside datastream.pull only stops after that pull returns; pulls that never return leave the worker resident.

Search Document