tempodb 0.2.2.1 → 0.2.2.2
raw patch · 3 files changed
+26/−16 lines, 3 filesdep ~aesondep ~containers
Dependency ranges changed: aeson, containers
Files
- src/Database/Tempodb/Types.hs +12/−2
- src/Database/Tempodb/Util.hs +10/−10
- tempodb.cabal +4/−4
src/Database/Tempodb/Types.hs view
@@ -8,10 +8,12 @@ import Control.Monad import Control.Monad.Reader import Data.Aeson-import Data.Aeson.Types (Parser)+import Data.Aeson.Types+import qualified Data.ByteString as B import Data.ByteString.Char8 as C8 import Data.Map (Map) import qualified Data.Text as T+import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Data.Time import Data.Typeable (Typeable) import Network.Http.Client@@ -51,7 +53,7 @@ , key :: ByteString , name :: ByteString , tags :: [ByteString]- , attributes :: Map ByteString ByteString+ , attributes :: Map T.Text T.Text } deriving (Show, Eq, Ord) instance FromJSON Series where@@ -71,6 +73,14 @@ , "tags" .= t , "attributes" .= a ]++instance ToJSON B.ByteString where+ toJSON = String . decodeUtf8+ {-# INLINE toJSON #-}++instance FromJSON B.ByteString where+ parseJSON = withText "ByteString" $ pure . encodeUtf8+ {-# INLINE parseJSON #-} data Data = Data { uid :: Maybe IdOrKey
src/Database/Tempodb/Util.hs view
@@ -8,7 +8,7 @@ import Control.Exception (Exception, throw) import Data.ByteString.Char8 as C8 import Data.Typeable-import Network.Http.Client+import qualified Network.Http.Client as C import OpenSSL (withOpenSSL) import System.IO.Streams (InputStream, write) @@ -19,25 +19,25 @@ rootpath = "/v1" -- | Run a constructed request.-runRequest :: Request -> Maybe ByteString -> IO (Int,ByteString)+runRequest :: C.Request -> Maybe ByteString -> IO (Int,ByteString) runRequest r b = withOpenSSL $ do- withConnection (establishConnection "https://api.tempo-db.com") go+ C.withConnection (C.establishConnection "https://api.tempo-db.com") go where body = case b of- Nothing -> emptyBody+ Nothing -> C.emptyBody Just v -> (\o -> write (Just $ fromByteString v) o) go c = do- sendRequest c r body- receiveResponse c concatHandlerSt'+ C.sendRequest c r body+ C.receiveResponse c concatHandlerSt' -concatHandlerSt' :: Response -> InputStream ByteString -> IO (StatusCode,ByteString)+concatHandlerSt' :: C.Response -> InputStream ByteString -> IO (C.StatusCode, ByteString) concatHandlerSt' p i = if s >= 300 then throw (HttpClientError s m)- else (concatHandler p i) >>= return . (s,)+ else (C.concatHandler p i) >>= return . (s,) where- s = getStatusCode p- m = getStatusMessage p+ s = C.getStatusCode p+ m = C.getStatusMessage p data HttpClientError = HttpClientError Int ByteString deriving (Typeable)
tempodb.cabal view
@@ -1,5 +1,5 @@ name: tempodb-version: 0.2.2.1+version: 0.2.2.2 synopsis: A small Haskell wrapper around the TempoDB api. description: TempoDB is a time-series database as-a-service with a@@ -26,7 +26,7 @@ library hs-source-dirs: src cpp-options: -Dcabal- ghc-options: -Wall -fno-warn-type-defaults -fno-warn-unused-do-bind+ ghc-options: -Wall -fno-warn-type-defaults -fno-warn-orphans -fno-warn-unused-do-bind Build-Depends: base >= 4.6 && < 4.7,@@ -35,10 +35,10 @@ HTTP >= 4000.2.9 && < 4000.2.12, HsOpenSSL >= 0.10.4 && < 0.11, bytestring >= 0.9.1 && < 0.11,- aeson >= 0.7.0.2 && < 0.7.1,+ aeson >= 0.7.0.1 && < 0.7.0.2, io-streams >= 1.1.2.0 && < 1.2, blaze-builder >= 0.3.3.0 && < 0.4,- containers >= 0.5.0.0 && < 0.6,+ containers >= 0.5.5.0 && < 0.6, time >= 1.4.0.1 && < 1.5, old-locale >= 1.0.0.5 && < 1.0.1, text >= 0.11.3.1 && < 1.2