Gozala / reducers

Library for higher-order manipulation of collections
MIT License
181 stars 8 forks source link

Be opinionated. Recommend a backpressure protocol. #37

Closed Raynos closed 11 years ago

Raynos commented 11 years ago

That way everyone that writes new reducers can comply with it.

That way stream-reduce can convert between node's Stream backpressure protocol and the reducers one.

Gozala commented 11 years ago

Backpressure is just one flavor of IO coordination and very specific to input types node works with. It's also not relevant for other types of inputs like user events, recommending back-pressure would be fullish, since there is no solution that is not an app specific. For inputs that are already present is also foolish since queuing such inputs is as effective, but does not implies complexity.

Raynos commented 11 years ago

@Gozala What I really want is for input and output to be able to apply back pressure

stream(map(req, ...)).pipe(res)

So I guess this should just be opinionated in stream-reduce I guess. Might aswell make it more generic.

Gozala commented 11 years ago

stream-reduce can handle it properly similar to how fs-reduce does it. Inputs that don't have notion of backpressure will be just queued.