diff --git a/.gitignore b/.gitignore index b6c433c..1fc6e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.sublime-* .DS_Store .cabal-sandbox +/.stack-work/ /dist/ cabal.sandbox.config diff --git a/CHANGELOG.md b/CHANGELOG.md index 9465eba..186fa93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.10.0 - 2016-05-17 + +* Fix a typo in a Haddock comment (#28) +* Drop support for retry < 0.7 +* Add stack.yml +* Add support for GHC 8.0.1 (#29) + ## v0.9.1.3 - 2015-06-02 * Relax upper bound for aeson diff --git a/README.md b/README.md index 8567e30..f8c4097 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Haskell client library for InfluxDB [![Coverage Status](https://coveralls.io/repos/maoe/influxdb-haskell/badge.png?branch=develop)](https://coveralls.io/r/maoe/influxdb-haskell?branch=develop) [![Gitter chat](https://badges.gitter.im/maoe/influxdb-haskell.png)](https://gitter.im/maoe/influxdb-haskell) +Support for current version of InfluxDB is under development. + Contact information ---------- diff --git a/influxdb.cabal b/influxdb.cabal index 7c069e8..4a90469 100644 --- a/influxdb.cabal +++ b/influxdb.cabal @@ -1,5 +1,5 @@ name: influxdb -version: 0.9.1.3 +version: 0.10.0 synopsis: Haskell client library for InfluxDB description: Haskell client library for InfluxDB homepage: https://github.com/maoe/influxdb-haskell @@ -61,7 +61,7 @@ library ViewPatterns ghc-options: -Wall build-depends: - base >= 4 && < 4.9 + base >= 4 && < 5.0 , attoparsec < 0.14 , bytestring , containers @@ -70,7 +70,7 @@ library , exceptions >= 0.5 && < 0.9 , http-client < 0.5 , mtl < 2.3 - , retry >= 0.6 && < 0.7 + , retry >= 0.7 && < 0.8 , tagged , template-haskell , text < 1.3 @@ -78,7 +78,7 @@ library if flag(aeson-070) build-depends: - aeson >= 0.7.0 && < 0.10 + aeson >= 0.7.0 && < 0.12 , scientific >= 0.2 else build-depends: @@ -142,5 +142,5 @@ source-repository head source-repository this type: git - tag: v0.9.1.3 + tag: v0.10.0 location: https://github.com/maoe/influxdb-haskell.git diff --git a/src/Database/InfluxDB.hs b/src/Database/InfluxDB.hs index 8250833..d3b5836 100644 --- a/src/Database/InfluxDB.hs +++ b/src/Database/InfluxDB.hs @@ -24,7 +24,7 @@ module Database.InfluxDB , TimePrecision(..) , Server(..), localServer , ServerPool, newServerPool - , newServerPoolWithRetryPolicy, newServerPoolWithRetrySettings + , newServerPoolWithRetryPolicy , Database(..) , User(..) , Admin(..) diff --git a/src/Database/InfluxDB/Encode.hs b/src/Database/InfluxDB/Encode.hs index d812268..6b28c90 100644 --- a/src/Database/InfluxDB/Encode.hs +++ b/src/Database/InfluxDB/Encode.hs @@ -28,7 +28,7 @@ class ToSeries a where -- > data EventType = Login | Logout -- > -- > instance ToSeriesData Event where --- > toSeriesColumn _ = V.fromList ["user", "type"] +-- > toSeriesColumns _ = V.fromList ["user", "type"] -- > toSeriesPoints (Event user ty) = V.fromList [toValue user, toValue ty] -- > -- > instance ToValue EventType diff --git a/src/Database/InfluxDB/Http.hs b/src/Database/InfluxDB/Http.hs index e27c08c..93931e3 100644 --- a/src/Database/InfluxDB/Http.hs +++ b/src/Database/InfluxDB/Http.hs @@ -84,7 +84,7 @@ import Text.Printf (printf) import Prelude import Control.Monad.Catch (Handler(..)) -import Control.Retry +import Control.Retry (recovering) import Data.Aeson ((.=)) import Data.Aeson.TH (deriveToJSON) import Data.Default.Class (Default(def)) @@ -742,7 +742,7 @@ withPool -> IO a withPool pool request f = do retryPolicy <- serverRetryPolicy <$> readIORef pool - recovering retryPolicy handlers $ do + recovering retryPolicy handlers $ \_ -> do server <- activeServer pool f $ makeRequest server where diff --git a/src/Database/InfluxDB/TH.hs b/src/Database/InfluxDB/TH.hs index 06d0f47..ab86e09 100644 --- a/src/Database/InfluxDB/TH.hs +++ b/src/Database/InfluxDB/TH.hs @@ -57,14 +57,22 @@ deriveWith :: (Options -> Name -> [TyVarBndr] -> Con -> Q Dec) -> Options -> Dec -> Q Dec deriveWith f opts dec = case dec of +#if MIN_VERSION_template_haskell(2, 11, 0) + DataD _ tyName tyVars _ [con] _ -> f opts tyName tyVars con + NewtypeD _ tyName tyVars _ con _ -> f opts tyName tyVars con +#else DataD _ tyName tyVars [con] _ -> f opts tyName tyVars con NewtypeD _ tyName tyVars con _ -> f opts tyName tyVars con +#endif _ -> fail $ "Expected a data or newtype declaration, but got " ++ show dec toSeriesDataBody :: Options -> Name -> [TyVarBndr] -> Con -> Q Dec toSeriesDataBody opts tyName tyVars con = do case con of RecC conName vars -> InstanceD +#if MIN_VERSION_template_haskell(2, 11, 0) + Nothing +#endif <$> mapM tyVarToPred tyVars <*> [t| ToSeriesData $(conT tyName) |] <*> deriveDecs conName vars diff --git a/src/Database/InfluxDB/Types.hs b/src/Database/InfluxDB/Types.hs index 54d2e8e..9a46864 100644 --- a/src/Database/InfluxDB/Types.hs +++ b/src/Database/InfluxDB/Types.hs @@ -3,6 +3,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} module Database.InfluxDB.Types @@ -27,10 +28,8 @@ module Database.InfluxDB.Types -- * Server pool , ServerPool , serverRetryPolicy - , serverRetrySettings , newServerPool , newServerPoolWithRetryPolicy - , newServerPoolWithRetrySettings , activeServer , failover @@ -54,7 +53,7 @@ import Data.Word (Word32) import GHC.Generics (Generic) import qualified Data.Sequence as Seq -import Control.Retry (RetryPolicy(..), limitRetries, exponentialBackoff) +import Control.Retry (RetryPolicy, limitRetries, exponentialBackoff) import Data.Aeson ((.=), (.:)) import Data.Aeson.TH import qualified Data.Aeson as A @@ -204,11 +203,7 @@ data ServerPool = ServerPool , serverBackup :: !(Seq Server) -- ^ The rest of the servers in the pool. , serverRetryPolicy :: !RetryPolicy - } deriving (Typeable, Generic) - -{-# DEPRECATED serverRetrySettings "Use serverRetryPolicy instead" #-} -serverRetrySettings :: ServerPool -> RetryPolicy -serverRetrySettings = serverRetryPolicy + } newtype Database = Database { databaseName :: Text @@ -247,8 +242,9 @@ data ShardSpace = ShardSpace -- | Create a non-empty server pool. You must specify at least one server -- location to create a pool. newServerPool :: Server -> [Server] -> IO (IORef ServerPool) -newServerPool = newServerPoolWithRetrySettings defaultRetryPolicy +newServerPool = newServerPoolWithRetryPolicy defaultRetryPolicy where + defaultRetryPolicy :: RetryPolicy defaultRetryPolicy = limitRetries 5 <> exponentialBackoff 50 newServerPoolWithRetryPolicy @@ -260,12 +256,6 @@ newServerPoolWithRetryPolicy retryPolicy active backups = , serverRetryPolicy = retryPolicy } -{-# DEPRECATED newServerPoolWithRetrySettings - "Use newServerPoolWithRetryPolicy instead" #-} -newServerPoolWithRetrySettings - :: RetryPolicy -> Server -> [Server] -> IO (IORef ServerPool) -newServerPoolWithRetrySettings = newServerPoolWithRetryPolicy - -- | Get a server from the pool. activeServer :: IORef ServerPool -> IO Server activeServer ref = do diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..4f74548 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,35 @@ +# This file was automatically generated by stack init +# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/ + +# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) +resolver: lts-5.12 + +# Local packages, usually specified by relative directory name +packages: +- '.' +# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) +extra-deps: [] + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true + +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: >= 1.0.0 + +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 + +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] + +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor