Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data Cluster = Cluster {
- clusterPools :: [Pool]
- clusterGen :: TMVar PureMT
- data InClusterError = InClusterError [SomeException]
- connectToCluster :: [Client] -> IO Cluster
- inCluster :: (MonadThrow m, MonadBaseControl IO m) => Cluster -> (Connection -> m a) -> m a
- create :: Client -> Int -> NominalDiffTime -> Int -> IO Pool
- defaultClient :: Client
Documentation
Datatype holding connection-pool with all known cluster nodes
Cluster | |
|
data InClusterError Source #
Error that gets thrown whenever operation couldn't succeed with any node.
Instances
Show InClusterError Source # | |
Defined in Network.Riak.Cluster showsPrec :: Int -> InClusterError -> ShowS # show :: InClusterError -> String # showList :: [InClusterError] -> ShowS # | |
Exception InClusterError Source # | |
Defined in Network.Riak.Cluster |
connectToCluster :: [Client] -> IO Cluster Source #
Function to connect to riak cluster with sane pool defaults
inCluster :: (MonadThrow m, MonadBaseControl IO m) => Cluster -> (Connection -> m a) -> m a Source #
Tries to run some operation for a random riak node. If it fails,
tries all other nodes. If all other nodes fail - throws
InClusterError
exception.
:: Client | Client configuration. The client ID is ignored, and always regenerated automatically for each new connection. |
-> Int | Stripe count. The number of distinct sub-pools to maintain. The smallest acceptable value is 1. |
-> NominalDiffTime | Amount of time for which an unused connection is kept open. The smallest acceptable value is 0.5 seconds. The elapsed time before closing may be a little longer than requested, as the reaper thread wakes at 2-second intervals. |
-> Int | Maximum number of connections to keep open per stripe. The smallest acceptable value is 1. Requests for connections will block if this limit is reached on a single stripe, even if other stripes have idle connections available. |
-> IO Pool |
Create a new connection pool.
defaultClient :: Client Source #
Default client configuration. Talks to localhost, port 8087, with a randomly chosen client ID.