Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

simpleClient #24

Open
wants to merge 2 commits into from

1 participant

Bryce Verdier
Bryce Verdier
btv commented

I had a hard time figuring out how to create a client because my setup wasn't running a local Riak Node. So I had to figure out the Data.ByteString.Lazy.empty input for ClientID by reading through the source code. I thought I would write something that might help other people not have to figure that out on their own.

Bryce Verdier added some commits
Bryce Verdier Code for the simpleClient function. 3139189
Bryce Verdier Configuration changes.
simpleClient can now be called with a "import Network.Riak".
0a76400
markhibberd markhibberd referenced this pull request in markhibberd/riak-haskell-client
Closed

Pull in open pull requests against old repository. #2

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2013
  1. Code for the simpleClient function.

    Bryce Verdier authored
  2. Configuration changes.

    Bryce Verdier authored
    simpleClient can now be called with a "import Network.Riak".
This page is out of date. Refresh to see the latest.
1  src/Network/Riak.hs
View
@@ -42,6 +42,7 @@ module Network.Riak
, Client(..)
, defaultClient
, getClientID
+ , simpleClient
-- * Connection management
, Connection(..)
, connect
1  src/Network/Riak/Basic.hs
View
@@ -20,6 +20,7 @@ module Network.Riak.Basic
ClientID
, Client(..)
, defaultClient
+ , simpleClient
-- * Connection management
, Connection(..)
, connect
1  src/Network/Riak/Connection.hs
View
@@ -16,6 +16,7 @@ module Network.Riak.Connection
-- * Client configuration
, defaultClient
, makeClientID
+ , simpleClient
-- * Requests and responses
-- ** Sending and receiving
, exchange
11 src/Network/Riak/Connection/Internal.hs
View
@@ -20,6 +20,7 @@ module Network.Riak.Connection.Internal
-- * Client configuration
, defaultClient
, makeClientID
+ , simpleClient
-- * Requests and responses
-- ** Sending and receiving requests and responses
, exchange
@@ -73,6 +74,16 @@ defaultClient = Client {
, clientID = L.empty
}
+-- | Easy to use client configuration. Input is either the IP address or fully
+-- qualified domain name of the Riak node. Defaults to port 8087 with a
+-- randomly chosen client ID.
+simpleClient :: String -> Client
+simpleClient inputHost = Client {
+ host = inputHost
+ , port = "8087"
+ , clientID = L.empty
+ }
+
-- | Tell the server our client ID.
setClientID :: Connection -> ClientID -> IO ()
setClientID conn i = do
Something went wrong with that request. Please try again.