riak-1.2.0.0: A Haskell client for the Riak decentralized data store
Safe HaskellNone
LanguageHaskell2010

Network.Riak.Cluster

Synopsis

Documentation

data Cluster Source #

Datatype holding connection-pool with all known cluster nodes

Constructors

Cluster 

Fields

data InClusterError Source #

Error that gets thrown whenever operation couldn't succeed with any node.

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.

create Source #

Arguments

:: 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.