git.iko.soy/typeable/bloodhound
on master help sign in
Clean up TODOs
69eeed4Michael Xavier
src/Database/Bloodhound/Client.hs+19−21
@@ -92,34 +92,32 @@ module Database.Bloodhound.Client
92 )
92 )
93 where
93 where
94
94
95−import qualified Blaze.ByteString.Builder as BB
95+import qualified Blaze.ByteString.Builder as BB
96−import Control.Applicative as A
96+import Control.Applicative as A
97import Control.Monad
97import Control.Monad
98import Control.Monad.Catch
98import Control.Monad.Catch
99import Control.Monad.IO.Class
99import Control.Monad.IO.Class
100import Data.Aeson
100import Data.Aeson
101import Data.ByteString.Lazy.Builder
101import Data.ByteString.Lazy.Builder
102−import qualified Data.ByteString.Lazy.Char8 as L
102+import qualified Data.ByteString.Lazy.Char8 as L
103−import Data.Foldable (toList)
103+import Data.Foldable (toList)
104−import qualified Data.HashMap.Strict as HM
104+import qualified Data.HashMap.Strict as HM
105import Data.Ix
105import Data.Ix
106−import qualified Data.List as LS (filter, foldl')
106+import qualified Data.List as LS (filter, foldl')
107−import Data.List.NonEmpty (NonEmpty (..))
107+import Data.List.NonEmpty (NonEmpty (..))
108−import Data.Maybe (catMaybes, fromMaybe,
108+import Data.Maybe (catMaybes, fromMaybe, isJust)
109− isJust)
110import Data.Monoid
109import Data.Monoid
111−import Data.Text (Text)
110+import Data.Text (Text)
112−import qualified Data.Text as T
111+import qualified Data.Text as T
113−import qualified Data.Text.Encoding as T
112+import qualified Data.Text.Encoding as T
114import Data.Time.Clock
113import Data.Time.Clock
115−import qualified Data.Vector as V
114+import qualified Data.Vector as V
116−import Debug.Trace
117import Network.HTTP.Client
115import Network.HTTP.Client
118−import qualified Network.HTTP.Types.Method as NHTM
116+import qualified Network.HTTP.Types.Method as NHTM
119−import qualified Network.HTTP.Types.Status as NHTS
117+import qualified Network.HTTP.Types.Status as NHTS
120−import qualified Network.HTTP.Types.URI as NHTU
118+import qualified Network.HTTP.Types.URI as NHTU
121−import qualified Network.URI as URI
119+import qualified Network.URI as URI
122−import Prelude hiding (filter, head)
120+import Prelude hiding (filter, head)
123
121
124import Database.Bloodhound.Types
122import Database.Bloodhound.Types
125
123
@@ -590,13 +588,13 @@ parseEsResponse :: (MonadThrow m, FromJSON a) => Reply
590parseEsResponse reply
588parseEsResponse reply
591 | respIsTwoHunna reply = case eitherDecode body of
589 | respIsTwoHunna reply = case eitherDecode body of
592 Right a -> return (Right a)
590 Right a -> return (Right a)
593− Left e -> traceShow e tryParseError
591+ Left _ -> tryParseError
594 | otherwise = tryParseError
592 | otherwise = tryParseError
595 where body = responseBody reply
593 where body = responseBody reply
596 tryParseError = case eitherDecode body of
594 tryParseError = case eitherDecode body of
597 Right e -> return (Left e)
595 Right e -> return (Left e)
598 -- this case should not be possible
596 -- this case should not be possible
599− Left e -> traceShow e explode
597+ Left _ -> explode
600 explode = throwM (EsProtocolException body)
598 explode = throwM (EsProtocolException body)
601
599
602-- | 'indexExists' enables you to check if an index exists. Returns 'Bool'
600-- | 'indexExists' enables you to check if an index exists. Returns 'Bool'
src/Database/Bloodhound/Types.hs+3−3
@@ -3892,7 +3892,7 @@ data NodeHTTPInfo = NodeHTTPInfo {
3892 } deriving (Eq, Show, Generic, Typeable)
3892 } deriving (Eq, Show, Generic, Typeable)
3893
3893
3894data NodeTransportInfo = NodeTransportInfo {
3894data NodeTransportInfo = NodeTransportInfo {
3895− nodeTransportProfiles :: [BoundTransportAddress] --TODO: bound transport/publish addresses, paper over NULL meaning []
3895+ nodeTransportProfiles :: [BoundTransportAddress]
3896 , nodeTransportAddress :: BoundTransportAddress
3896 , nodeTransportAddress :: BoundTransportAddress
3897 } deriving (Eq, Show, Generic, Typeable)
3897 } deriving (Eq, Show, Generic, Typeable)
3898
3898
@@ -3952,7 +3952,7 @@ data ThreadPoolSize = ThreadPoolBounded Int
3952
3952
3953data ThreadPoolType = ThreadPoolScaling
3953data ThreadPoolType = ThreadPoolScaling
3954 | ThreadPoolFixed
3954 | ThreadPoolFixed
3955− | ThreadPoolCached --TODO: are there others
3955+ | ThreadPoolCached
3956 deriving (Eq, Show, Generic, Typeable)
3956 deriving (Eq, Show, Generic, Typeable)
3957
3957
3958data NodeJVMInfo = NodeJVMInfo {
3958data NodeJVMInfo = NodeJVMInfo {
@@ -3964,7 +3964,7 @@ data NodeJVMInfo = NodeJVMInfo {
3964 , nodeJVMVMVersion :: VersionNumber
3964 , nodeJVMVMVersion :: VersionNumber
3965 -- ^ JVM doesn't seme to follow normal version conventions
3965 -- ^ JVM doesn't seme to follow normal version conventions
3966 , nodeJVMVMName :: Text
3966 , nodeJVMVMName :: Text
3967− , nodeJVMVersion :: VersionNumber --TODO: normalize underscores
3967+ , nodeJVMVersion :: VersionNumber
3968 , nodeJVMPID :: PID
3968 , nodeJVMPID :: PID
3969 } deriving (Eq, Show, Generic, Typeable)
3969 } deriving (Eq, Show, Generic, Typeable)
3970
3970
tests/tests.hs−1
@@ -1573,7 +1573,6 @@ main = hspec $ do
1573 -- parsing. Node info is so variable, there's not much I can
1573 -- parsing. Node info is so variable, there's not much I can
1574 -- assert here.
1574 -- assert here.
1575 Right NodesInfo {..} -> length nodesInfo `shouldBe` 1
1575 Right NodesInfo {..} -> length nodesInfo `shouldBe` 1
1576− --TODO: more assertions if possible
1577 Left e -> expectationFailure ("Expected NodesInfo but got " <> show e)
1576 Left e -> expectationFailure ("Expected NodesInfo but got " <> show e)
1578
1577
1579 describe "Enum DocVersion" $ do
1578 describe "Enum DocVersion" $ do