Description
Throttler between arbitrary IO producer and consumer functions.
Description
This packages provides functionality for throttling IO using general IO callbacks. The throttling depends on a provided configuration. The supported throttling modes are producer throttling, consumer throttling or producer & consumer throttling.
README.md
throttle-io-stream
About
This packages provides throttling functionality for arbitrary IO producers and consumers. The core function exported is the following:
throttle :: ThrottleConf a -- ^ Throttling configuration
-> IO (Maybe a) -- ^ Input callback
-> (Maybe a -> IO ()) -- ^ Output callback
-> IO (Async ()) -- ^ Returns an async handler for this
-- throttling process
This will spawn asynchronous operations that
consume data using the provided input callback and write it into an internal buffering queue and
produce data from the buffering queue using the provided consumer callback.