git.iko.soy/typeable/bloodhound
on master help sign in
Merge pull request #239 from bitemyapp/bitemyapp/updatable-index-setting-json-iso
c71a130Chris Allen
.travis.yml−5
@@ -11,11 +11,6 @@ env:
11 global:
11 global:
12 - JAVA_HOME=/usr/lib/jvm/java-8-oracle
12 - JAVA_HOME=/usr/lib/jvm/java-8-oracle
13 matrix:
13 matrix:
14− - GHCVER=7.8 ESVER=1.3.6 STACK_YAML=stack-7.8.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
15− - GHCVER=7.8 ESVER=1.4.1 STACK_YAML=stack-7.8.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
16− - GHCVER=7.10 ESVER=1.5.2 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
17− - GHCVER=7.10 ESVER=1.6.0 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
18− - GHCVER=7.10 ESVER=1.7.6 STACK_YAML=stack-7.10.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
19 - GHCVER=8.0 ESVER=1.7.6 STACK_YAML=stack-8.0.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
14 - GHCVER=8.0 ESVER=1.7.6 STACK_YAML=stack-8.0.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
20 - GHCVER=8.0 ESVER=5.0.2 STACK_YAML=stack-8.0.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
15 - GHCVER=8.0 ESVER=5.0.2 STACK_YAML=stack-8.0.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
21 - GHCVER=8.2 ESVER=1.7.6 STACK_YAML=stack.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
16 - GHCVER=8.2 ESVER=1.7.6 STACK_YAML=stack.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
src/Bloodhound/Import.hs+1
@@ -9,6 +9,7 @@ module Bloodhound.Import
9 , showText
9 , showText
10 , deleteSeveral
10 , deleteSeveral
11 , oPath
11 , oPath
12+ , tshow
12 ) where
13 ) where
13
14
14import Control.Applicative as X (Alternative (..), optional)
15import Control.Applicative as X (Alternative (..), optional)
src/Database/V5/Bloodhound/Internal/Client.hs+22−10
@@ -1418,15 +1418,20 @@ data NodeJVMInfo = NodeJVMInfo {
1418 , nodeJVMInfoMemoryInfo :: JVMMemoryInfo
1418 , nodeJVMInfoMemoryInfo :: JVMMemoryInfo
1419 , nodeJVMInfoStartTime :: UTCTime
1419 , nodeJVMInfoStartTime :: UTCTime
1420 , nodeJVMInfoVMVendor :: Text
1420 , nodeJVMInfoVMVendor :: Text
1421− , nodeJVMVMVersion :: VersionNumber
1421+ , nodeJVMVMVersion :: VMVersion
1422 -- ^ JVM doesn't seme to follow normal version conventions
1422 -- ^ JVM doesn't seme to follow normal version conventions
1423 , nodeJVMVMName :: Text
1423 , nodeJVMVMName :: Text
1424− , nodeJVMVersion :: VersionNumber
1424+ , nodeJVMVersion :: JVMVersion
1425 , nodeJVMPID :: PID
1425 , nodeJVMPID :: PID
1426 } deriving (Eq, Show)
1426 } deriving (Eq, Show)
1427
1427
1428−-- | Handles quirks in the way JVM versions are rendered (1.7.0_101 -> 1.7.0.101)
1428+-- | We cannot parse JVM version numbers and we're not going to try.
1429+newtype JVMVersion =
1429−newtype JVMVersion = JVMVersion { unJVMVersion :: VersionNumber }
1430+ JVMVersion { unJVMVersion :: Text }
1431+ deriving (Eq, Show)
1432+
1433+instance FromJSON JVMVersion where
1434+ parseJSON = withText "JVMVersion" (pure . JVMVersion)
1430
1435
1431data JVMMemoryInfo = JVMMemoryInfo {
1436data JVMMemoryInfo = JVMMemoryInfo {
1432 jvmMemoryInfoDirectMax :: Bytes
1437 jvmMemoryInfoDirectMax :: Bytes
@@ -1436,6 +1441,18 @@ data JVMMemoryInfo = JVMMemoryInfo {
1436 , jvmMemoryInfoHeapInit :: Bytes
1441 , jvmMemoryInfoHeapInit :: Bytes
1437 } deriving (Eq, Show)
1442 } deriving (Eq, Show)
1438
1443
1444+-- VM version numbers don't appear to be SemVer
1445+-- so we're special casing this jawn.
1446+newtype VMVersion =
1447+ VMVersion { unVMVersion :: Text }
1448+ deriving (Eq, Show)
1449+
1450+instance ToJSON VMVersion where
1451+ toJSON = toJSON . unVMVersion
1452+
1453+instance FromJSON VMVersion where
1454+ parseJSON = withText "VMVersion" (pure . VMVersion)
1455+
1439newtype JVMMemoryPool = JVMMemoryPool {
1456newtype JVMMemoryPool = JVMMemoryPool {
1440 jvmMemoryPool :: Text
1457 jvmMemoryPool :: Text
1441 } deriving (Eq, Show, FromJSON)
1458 } deriving (Eq, Show, FromJSON)
@@ -2228,14 +2245,9 @@ instance FromJSON NodeJVMInfo where
2228 <*> o .: "vm_vendor"
2245 <*> o .: "vm_vendor"
2229 <*> o .: "vm_version"
2246 <*> o .: "vm_version"
2230 <*> o .: "vm_name"
2247 <*> o .: "vm_name"
2231− <*> (unJVMVersion <$> o .: "version")
2248+ <*> o .: "version"
2232 <*> o .: "pid"
2249 <*> o .: "pid"
2233
2250
2234−instance FromJSON JVMVersion where
2235− parseJSON (String t) =
2236− JVMVersion <$> parseJSON (String (T.replace "_" "." t))
2237− parseJSON v = JVMVersion <$> parseJSON v
2238−
2239instance FromJSON JVMMemoryInfo where
2251instance FromJSON JVMMemoryInfo where
2240 parseJSON = withObject "JVMMemoryInfo" parse
2252 parseJSON = withObject "JVMMemoryInfo" parse
2241 where
2253 where
stack-7.10.yamldeleted−21
@@ -1,21 +0,0 @@
1−flags:
2− bloodhound-examples:
3− werror: true
4−packages:
5−- '.'
6−- './examples'
7−extra-deps:
8−- http-client-0.5.0
9−- aeson-1.2.0.0
10−- fail-4.9.0.0
11−- http-types-0.9
12−- attoparsec-0.13.0.1
13−- quickcheck-properties-0.1
14−- semigroups-0.18.3
15−- uri-bytestring-0.1.9
16−- temporary-resourcet-0.1.0.0
17−- transformers-compat-0.5.1.4
18−- pretty-simple-2.0.2.0
19−- quickcheck-arbitrary-template-0.2.0.0
20−
21−resolver: lts-6.12
stack-7.8.yamldeleted−25
@@ -1,25 +0,0 @@
1−flags:
2− aeson:
3− old-locale: true
4− bloodhound-examples:
5− werror: true
6−packages:
7−- '.'
8−- './examples'
9−extra-deps:
10−- aeson-0.11.1.0
11−- fail-4.9.0.0
12−- http-types-0.9
13−- http-client-0.5.0
14−- attoparsec-0.13.0.1
15−- quickcheck-properties-0.1
16−- semigroups-0.18.0.1
17−- tagged-0.8.3
18−- uri-bytestring-0.1.9
19−- void-0.7.1
20−- generics-sop-0.2.2.0
21−- unordered-containers-0.2.6.0
22−- pretty-simple-2.0.2.0
23−- quickcheck-arbitrary-template-0.2.0.0
24−
25−resolver: lts-2.18
tests/V5/Test/Generators.hs+4−3
@@ -462,9 +462,6 @@ makeArbitrary ''Analysis
462instance Arbitrary Analysis where arbitrary = arbitraryAnalysis
462instance Arbitrary Analysis where arbitrary = arbitraryAnalysis
463makeArbitrary ''Tokenizer
463makeArbitrary ''Tokenizer
464instance Arbitrary Tokenizer where arbitrary = arbitraryTokenizer
464instance Arbitrary Tokenizer where arbitrary = arbitraryTokenizer
465−makeArbitrary ''UpdatableIndexSetting
466−instance Arbitrary UpdatableIndexSetting where
467− arbitrary = arbitraryUpdatableIndexSetting
468makeArbitrary ''Compression
465makeArbitrary ''Compression
469instance Arbitrary Compression where arbitrary = arbitraryCompression
466instance Arbitrary Compression where arbitrary = arbitraryCompression
470makeArbitrary ''Bytes
467makeArbitrary ''Bytes
@@ -534,6 +531,10 @@ instance Arbitrary FactorMissingFieldValue where arbitrary = arbitraryFactorMiss
534makeArbitrary ''FactorModifier
531makeArbitrary ''FactorModifier
535instance Arbitrary FactorModifier where arbitrary = arbitraryFactorModifier
532instance Arbitrary FactorModifier where arbitrary = arbitraryFactorModifier
536
533
534+makeArbitrary ''UpdatableIndexSetting
535+instance Arbitrary UpdatableIndexSetting where
536+ arbitrary = resize 10 arbitraryUpdatableIndexSetting
537+
537newtype UpdatableIndexSetting' =
538newtype UpdatableIndexSetting' =
538 UpdatableIndexSetting' UpdatableIndexSetting
539 UpdatableIndexSetting' UpdatableIndexSetting
539 deriving (Show, Eq, ToJSON, FromJSON, ApproxEq, Typeable)
540 deriving (Show, Eq, ToJSON, FromJSON, ApproxEq, Typeable)