The roundRobin package

[ Tags: concurrency, library, mit ] [ Propose Tags ]

This package provide a simple data type wrap a round-robin table. so you can select resources(host, connection...) using round-robin fashion.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.1.2.0
Dependencies base (>=4.6 && <5.0), semigroups [details]
License MIT
Author winterland1989
Maintainer winterland1989@gmail.com
Category Concurrency
Source repository head: git clone https://github.com/winterland1989/roundRobin.git
Uploaded Sun Aug 7 03:38:18 UTC 2016 by winterland
Distributions NixOS:0.1.2.0
Downloads 230 total (21 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-11-21 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for roundRobin-0.1.2.0

[back to package description]

Hackage Travis-CI

A simple round-robin data type

This package provide a simple data type wrap a round-robin table. so you can select resources(host, connection...) using round-robin fashion.

Example

import qualified Date.RoundRobin as RR
import qualified Network.HTTP.Client as HTTP

main :: IO ()
main = do
    reqs <- mapM HTTP.parseUrl ["http://foo.com", "http://bar.com", "http://qux.com"]
    proxyTable <- RR.newRoundRobin reqs
    manager <- HTTP.newManager HTTP.defaultManagerSettings

    ...
    -- maybe now you're inside a server service(a forked thread)
    -- use select to choose a request in round-robin fashion
        req <- RR.select proxyTable
        res <- HTTP.httpLbs req manager
        ...