Skip to content

Commit

Permalink
Merge branch 'release/v0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsutoshi Aoe committed May 17, 2016
2 parents 967ae0f + fe07bd8 commit cd28d67
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
*.sublime-*
.DS_Store
.cabal-sandbox
/.stack-work/
/dist/
cabal.sandbox.config
7 changes: 7 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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
----------

Expand Down
10 changes: 5 additions & 5 deletions 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
Expand Down Expand Up @@ -61,7 +61,7 @@ library
ViewPatterns
ghc-options: -Wall
build-depends:
base >= 4 && < 4.9
base >= 4 && < 5.0
, attoparsec < 0.14
, bytestring
, containers
Expand All @@ -70,15 +70,15 @@ 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
, vector

if flag(aeson-070)
build-depends:
aeson >= 0.7.0 && < 0.10
aeson >= 0.7.0 && < 0.12
, scientific >= 0.2
else
build-depends:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/Database/InfluxDB.hs
Expand Up @@ -24,7 +24,7 @@ module Database.InfluxDB
, TimePrecision(..)
, Server(..), localServer
, ServerPool, newServerPool
, newServerPoolWithRetryPolicy, newServerPoolWithRetrySettings
, newServerPoolWithRetryPolicy
, Database(..)
, User(..)
, Admin(..)
Expand Down
2 changes: 1 addition & 1 deletion src/Database/InfluxDB/Encode.hs
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Database/InfluxDB/Http.hs
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/Database/InfluxDB/TH.hs
Expand Up @@ -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
Expand Down
20 changes: 5 additions & 15 deletions src/Database/InfluxDB/Types.hs
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
module Database.InfluxDB.Types
Expand All @@ -27,10 +28,8 @@ module Database.InfluxDB.Types
-- * Server pool
, ServerPool
, serverRetryPolicy
, serverRetrySettings
, newServerPool
, newServerPoolWithRetryPolicy
, newServerPoolWithRetrySettings
, activeServer
, failover

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
35 changes: 35 additions & 0 deletions 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

0 comments on commit cd28d67

Please sign in to comment.