riak 0.8.0.0 → 0.9.0.0
raw patch · 5 files changed
+42/−34 lines, 5 filesdep +protocol-buffersdep +transformersdep −protocol-buffers-forkdep ~aesondep ~attoparsecdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: protocol-buffers, transformers
Dependencies removed: protocol-buffers-fork
Dependency ranges changed: aeson, attoparsec, base, blaze-builder, monad-control, riak-protobuf, text
API changes (from Hackage documentation)
- Network.Riak: foldKeys :: Connection -> Bucket -> (a -> Key -> IO a) -> a -> IO a
+ Network.Riak: foldKeys :: MonadIO m => Connection -> Bucket -> (a -> Key -> m a) -> a -> m a
- Network.Riak: modify_ :: (FromJSON a, ToJSON a, Resolvable a) => Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> IO a) -> IO a
+ Network.Riak: modify_ :: (MonadIO m, FromJSON a, ToJSON a, Resolvable a) => Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> m a) -> m a
- Network.Riak.Basic: foldKeys :: Connection -> Bucket -> (a -> Key -> IO a) -> a -> IO a
+ Network.Riak.Basic: foldKeys :: MonadIO m => Connection -> Bucket -> (a -> Key -> m a) -> a -> m a
- Network.Riak.JSON.Resolvable: modify_ :: (FromJSON a, ToJSON a, Resolvable a) => Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> IO a) -> IO a
+ Network.Riak.JSON.Resolvable: modify_ :: (MonadIO m, FromJSON a, ToJSON a, Resolvable a) => Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> m a) -> m a
Files
- riak.cabal +22/−17
- src/Network/Riak/Basic.hs +4/−3
- src/Network/Riak/JSON/Resolvable.hs +3/−2
- src/Network/Riak/Resolvable/Internal.hs +11/−10
- tests/Properties.hs +2/−2
riak.cabal view
@@ -1,5 +1,5 @@ name: riak-version: 0.8.0.0+version: 0.9.0.0 synopsis: A Haskell client for the Riak decentralized data store description: A Haskell client library for the Riak decentralized data@@ -42,6 +42,10 @@ cabal-version: >=1.8 +source-repository head+ type: git+ location: https://github.com:markhibberd/riak-haskell-client.git+ flag debug description: allow debug logging default: True@@ -84,22 +88,23 @@ Network.Riak.Types.Internal build-depends:- aeson >= 0.3.2.4,- attoparsec >= 0.10,- base == 4.*,- binary,- blaze-builder,- bytestring,- containers,- monad-control >= 0.2.0.1,- network >= 2.3,- resource-pool == 0.2.*,- protocol-buffers-fork == 2.0.*,- pureMD5,- random,- riak-protobuf == 0.19.*,- text >= 0.11.0.6,- time+ aeson >= 0.8 && < 0.10,+ attoparsec >= 0.12.1.6 && < 0.14,+ base >= 3 && <5,+ binary,+ blaze-builder >= 0.3 && <= 0.5,+ bytestring,+ containers,+ transformers >= 0.3 && < 0.5,+ monad-control ,+ network >= 2.3,+ resource-pool == 0.2.*,+ protocol-buffers >= 2.1.4 && < 2.2,+ pureMD5,+ random,+ riak-protobuf == 0.20.*,+ text == 1.2.*,+ time if flag(debug) cpp-options: -DASSERTS -DDEBUG
src/Network/Riak/Basic.hs view
@@ -44,6 +44,7 @@ ) where import Control.Applicative ((<$>))+import Control.Monad.IO.Class import Data.Maybe (fromMaybe) import Network.Riak.Connection.Internal import Network.Riak.Escape (unescape)@@ -117,12 +118,12 @@ -- Fold over the keys in a bucket. -- -- /Note/: this operation is expensive. Do not use it in production.-foldKeys :: Connection -> T.Bucket -> (a -> Key -> IO a) -> a -> IO a+foldKeys :: (MonadIO m) => Connection -> T.Bucket -> (a -> Key -> m a) -> a -> m a foldKeys conn bucket f z0 = do- sendRequest conn $ Req.listKeys bucket+ liftIO $ sendRequest conn $ Req.listKeys bucket let g z = f z . unescape loop z = do- ListKeysResponse{..} <- recvResponse conn+ ListKeysResponse{..} <- liftIO $ recvResponse conn z1 <- F.foldlM g z keys if fromMaybe False done then return z1
src/Network/Riak/JSON/Resolvable.hs view
@@ -31,6 +31,7 @@ , putMany_ ) where +import Control.Monad.IO.Class import Data.Aeson.Types (FromJSON(..), ToJSON(..)) import Network.Riak.Resolvable.Internal (ResolutionFailure(..), Resolvable(..)) import Network.Riak.Types.Internal hiding (MessageTag(..))@@ -84,9 +85,9 @@ -- If the 'put' phase of this function gives up due to apparently -- being stuck in a conflict resolution loop, it will throw a -- 'ResolutionFailure' exception.-modify_ :: (FromJSON a, ToJSON a, Resolvable a) =>+modify_ :: (MonadIO m, FromJSON a, ToJSON a, Resolvable a) => Connection -> Bucket -> Key -> R -> W -> DW- -> (Maybe a -> IO a) -> IO a+ -> (Maybe a -> m a) -> m a modify_ = R.modify_ J.get J.put {-# INLINE modify_ #-}
src/Network/Riak/Resolvable/Internal.hs view
@@ -33,6 +33,7 @@ import Control.Arrow (first) import Control.Exception (Exception, throwIO) import Control.Monad (unless)+import Control.Monad.IO.Class import Data.Aeson.Types (FromJSON, ToJSON) import Data.Data (Data) import Data.Either (partitionEithers)@@ -151,23 +152,23 @@ put doPut conn bucket key mvclock0 val0 w dw >> return () {-# INLINE put_ #-} -modify :: (Resolvable a) => Get a -> Put a- -> Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> IO (a,b))- -> IO (a,b)+modify :: (MonadIO m, Resolvable a) => Get a -> Put a+ -> Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> m (a,b))+ -> m (a,b) modify doGet doPut conn bucket key r w dw act = do- a0 <- get doGet conn bucket key r+ a0 <- liftIO $ get doGet conn bucket key r (a,b) <- act (fst <$> a0)- (a',_) <- put doPut conn bucket key (snd <$> a0) a w dw+ (a',_) <- liftIO $ put doPut conn bucket key (snd <$> a0) a w dw return (a',b) {-# INLINE modify #-} -modify_ :: (Resolvable a) => Get a -> Put a- -> Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> IO a)- -> IO a+modify_ :: (MonadIO m, Resolvable a) => Get a -> Put a+ -> Connection -> Bucket -> Key -> R -> W -> DW -> (Maybe a -> m a)+ -> m a modify_ doGet doPut conn bucket key r w dw act = do- a0 <- get doGet conn bucket key r+ a0 <- liftIO $ get doGet conn bucket key r a <- act (fst <$> a0)- fst <$> put doPut conn bucket key (snd <$> a0) a w dw+ liftIO $ fst <$> put doPut conn bucket key (snd <$> a0) a w dw {-# INLINE modify_ #-} putMany :: (Resolvable a) =>
tests/Properties.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}-+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-unused-binds #-} import Control.Applicative ((<$>)) import Control.Exception (finally) import Control.Monad (forM_)@@ -17,7 +18,6 @@ import qualified Test.HUnit as HU import Test.Framework (defaultMain, Test) import Test.Framework.Providers.QuickCheck2 (testProperty)-import Test.Framework.Providers.HUnit (testCase) import Test.QuickCheck (Arbitrary(..), (==>)) import Test.QuickCheck.Property (Property) import Test.QuickCheck.Monadic (assert, monadicIO, run)