Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Throttle

- type Measure a = a -> Double
- data ThrottleConf a
- newThrottleConf :: ThrottleConf a
- throttleConfSetMeasure :: Measure a -> ThrottleConf a -> ThrottleConf a
- throttleConfThrottleConsumer :: ThrottleConf a -> ThrottleConf a
- throttleConfThrottleProducer :: ThrottleConf a -> ThrottleConf a
- throttleConfSetInterval :: Double -> ThrottleConf a -> ThrottleConf a
- throttleConfSetMaxThroughput :: Double -> ThrottleConf a -> ThrottleConf a
- throttleConfSetBufferSize :: Int -> ThrottleConf a -> ThrottleConf a
- throttleConfSetEmaAlpha :: Double -> ThrottleConf a -> ThrottleConf a
- throttle :: ThrottleConf a -> IO (Maybe a) -> (Maybe a -> IO ()) -> IO (Async ())

# Documentation

type Measure a = a -> Double Source #

Type of a measure function for items of the specified type. The measure function is used by the user to specify a notion of size used for throughput computations.

data ThrottleConf a Source #

Configuration for throttling.

newThrottleConf :: ThrottleConf a Source #

Produce a new `ThrottleConf`

.

throttleConfSetMeasure :: Measure a -> ThrottleConf a -> ThrottleConf a Source #

Set measure function in configuration.

throttleConfSetInterval :: Double -> ThrottleConf a -> ThrottleConf a Source #

Set interval in configuration.

throttleConfSetMaxThroughput :: Double -> ThrottleConf a -> ThrottleConf a Source #

Set max throughput in configuration.

throttleConfSetBufferSize :: Int -> ThrottleConf a -> ThrottleConf a Source #

Set buffer size in configuration.

throttleConfSetEmaAlpha :: Double -> ThrottleConf a -> ThrottleConf a Source #

Set exponential weight factor used for computing current item size.