@@ -258,6 +258,8 @@ module Database.Bloodhound.Types
258 , SnapshotSelection(..)
258 , SnapshotSelection(..)
259 , SnapshotPattern(..)
259 , SnapshotPattern(..)
260 , SnapshotInfo(..)
260 , SnapshotInfo(..)
261+ , SnapshotShardFailure(..)
261 , SnapshotName(..)
263 , SnapshotName(..)
262 , SnapshotState(..)
264 , SnapshotState(..)
263 , SnapshotRestoreSettings(..)
265 , SnapshotRestoreSettings(..)
@@ -3687,7 +3689,7 @@ data SnapshotRepoSelection = SnapshotRepoList (NonEmpty SnapshotRepoPattern)
3689-- | Either specifies an exact repo name or one with globs in it,
3691-- | Either specifies an exact repo name or one with globs in it,
3690−-- e.g. @RepoPattern "foo*"@ __NOTE__:@ Patterns are not supported on ES < 1.7
3692+-- e.g. @RepoPattern "foo*"@ __NOTE__: Patterns are not supported on ES < 1.7
3691data SnapshotRepoPattern = ExactRepo SnapshotRepoName
3693data SnapshotRepoPattern = ExactRepo SnapshotRepoName
3692 | RepoPattern Text
3694 | RepoPattern Text
3693 deriving (Eq, Generic, Show, Typeable)
3695 deriving (Eq, Generic, Show, Typeable)
@@ -3746,6 +3748,7 @@ instance FromJSON SnapshotVerification where
3746 SnapshotNodeVerification (FullNodeId rawFullId) <$> o .: "name"
3748 SnapshotNodeVerification (FullNodeId rawFullId) <$> o .: "name"
3751+-- | A node that has verified a snapshot
3749data SnapshotNodeVerification = SnapshotNodeVerification {
3752data SnapshotNodeVerification = SnapshotNodeVerification {
3750 snvFullId :: FullNodeId
3753 snvFullId :: FullNodeId
3751 , snvNodeName :: NodeName
3754 , snvNodeName :: NodeName
@@ -3758,6 +3761,8 @@ newtype FullNodeId = FullNodeId { fullNodeId :: Text }
3758 deriving (Eq, Ord, Generic, Show, Typeable, FromJSON)
3761 deriving (Eq, Ord, Generic, Show, Typeable, FromJSON)
3764+-- | A human-readable node name that is supplied by the user in the
3765+-- node config or automatically generated by ElasticSearch.
3761newtype NodeName = NodeName { nodeName :: Text }
3766newtype NodeName = NodeName { nodeName :: Text }
3762 deriving (Eq, Ord, Generic, Show, Typeable, FromJSON)
3767 deriving (Eq, Ord, Generic, Show, Typeable, FromJSON)
@@ -3778,14 +3783,19 @@ defaultSnapshotRepoUpdateSettings :: SnapshotRepoUpdateSettings
3778defaultSnapshotRepoUpdateSettings = SnapshotRepoUpdateSettings True
3783defaultSnapshotRepoUpdateSettings = SnapshotRepoUpdateSettings True
3781−-- | A filesystem-based snapshot repo that ships with elasticsearch.
3786+-- | A filesystem-based snapshot repo that ships with
3787+-- ElasticSearch. This is an instance of 'SnapshotRepo' so it can be
3788+-- used with 'updateSnapshotRepo'
3782data FsSnapshotRepo = FsSnapshotRepo {
3789data FsSnapshotRepo = FsSnapshotRepo {
3783 fsrName :: SnapshotRepoName
3790 fsrName :: SnapshotRepoName
3784 , fsrLocation :: FilePath
3791 , fsrLocation :: FilePath
3785 , fsrCompressMetadata :: Bool
3792 , fsrCompressMetadata :: Bool
3786 , fsrChunkSize :: Maybe Bytes
3793 , fsrChunkSize :: Maybe Bytes
3794+ -- ^ Size by which to split large files during snapshotting.
3787 , fsrMaxRestoreBytesPerSec :: Maybe Bytes
3795 , fsrMaxRestoreBytesPerSec :: Maybe Bytes
3796+ -- ^ Throttle node restore rate. If not supplied, defaults to 40mb/sec
3788 , fsrMaxSnapshotBytesPerSec :: Maybe Bytes
3797 , fsrMaxSnapshotBytesPerSec :: Maybe Bytes
3798+ -- ^ Throttle node snapshot rate. If not supplied, defaults to 40mb/sec
3789 } deriving (Eq, Generic, Show, Typeable)
3799 } deriving (Eq, Generic, Show, Typeable)
@@ -3827,10 +3837,8 @@ class SnapshotRepo r where
3827 fromGSnapshotRepo :: GenericSnapshotRepo -> Either SnapshotRepoConversionError r
3837 fromGSnapshotRepo :: GenericSnapshotRepo -> Either SnapshotRepoConversionError r
3830−data SnapshotRepoConversionError = RepoTypeMismatch SnapshotRepoType
3840+data SnapshotRepoConversionError = RepoTypeMismatch SnapshotRepoType SnapshotRepoType
3831− -- ^ Expected type
3841+ -- ^ Expected type and actual type
3834 | OtherRepoConversionError Text
3842 | OtherRepoConversionError Text
3835 deriving (Show, Eq, Generic, Typeable)
3843 deriving (Show, Eq, Generic, Typeable)
@@ -3891,7 +3899,7 @@ data SnapshotPattern = ExactSnap SnapshotName
3891-- redundancies with 'SnapshotStatus'
3899-- redundancies with 'SnapshotStatus'
3892data SnapshotInfo = SnapshotInfo {
3900data SnapshotInfo = SnapshotInfo {
3893 snapInfoShards :: ShardResult
3901 snapInfoShards :: ShardResult
3894− --TODO: what does failures produce? list of what?
3902+ , snapInfoFailures :: [SnapshotShardFailure]
3895 , snapInfoDuration :: NominalDiffTime
3903 , snapInfoDuration :: NominalDiffTime
3896 , snapInfoEndTime :: UTCTime
3904 , snapInfoEndTime :: UTCTime
3897 , snapInfoStartTime :: UTCTime
3905 , snapInfoStartTime :: UTCTime
@@ -3905,6 +3913,7 @@ instance FromJSON SnapshotInfo where
3905 parseJSON = withObject "SnapshotInfo" parse
3913 parseJSON = withObject "SnapshotInfo" parse
3907 parse o = SnapshotInfo <$> o .: "shards"
3915 parse o = SnapshotInfo <$> o .: "shards"
3916+ <*> o .: "failures"
3908 <*> (unMS <$> o .: "duration_in_millis")
3917 <*> (unMS <$> o .: "duration_in_millis")
3909 <*> (posixMS <$> o .: "end_time_in_millis")
3918 <*> (posixMS <$> o .: "end_time_in_millis")
3910 <*> (posixMS <$> o .: "start_time_in_millis")
3919 <*> (posixMS <$> o .: "start_time_in_millis")
@@ -3912,6 +3921,26 @@ instance FromJSON SnapshotInfo where
3912 <*> o .: "indices"
3921 <*> o .: "indices"
3913 <*> o .: "snapshot"
3922 <*> o .: "snapshot"
3924+data SnapshotShardFailure = SnapshotShardFailure {
3925+ snapShardFailureIndex :: IndexName
3926+ , snapShardFailureNodeId :: Maybe NodeName -- I'm not 100% sure this isn't actually 'FullNodeId'
3927+ , snapShardFailureReason :: Text
3928+ , snapShardFailureShardId :: ShardId
3929+ } deriving (Eq, Show, Generic, Typeable)
3932+instance FromJSON SnapshotShardFailure where
3933+ parseJSON = withObject "SnapshotShardFailure" parse
3935+ parse o = SnapshotShardFailure <$> o .: "index"
3936+ <*> o .:? "node_id"
3938+ <*> o .: "shard_id"
3941+newtype ShardId = ShardId { shardId :: Int }
3942+ deriving (Eq, Show, Generic, Typeable, FromJSON)
3915-- | Milliseconds
3944-- | Milliseconds
3916newtype MS = MS NominalDiffTime
3945newtype MS = MS NominalDiffTime
@@ -3999,8 +4028,7 @@ newtype RestoreRenamePattern = RestoreRenamePattern { rrPattern :: Text }
3999-- | A single token in a index renaming scheme for a restore. These
4028-- | A single token in a index renaming scheme for a restore. These
4000-- are concatenated into a string before being sent to
4029-- are concatenated into a string before being sent to
4001-- ElasticSearch. Check out these Java
4030-- ElasticSearch. Check out these Java
4002−-- <https://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html
4031+-- <https://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html docs> to find out more if you're into that sort of thing.
4003−-- docs> to find out more if you're into that sort of thing.
4004data RestoreRenameToken = RRTLit Text
4032data RestoreRenameToken = RRTLit Text
4005 -- ^ Just a literal string of characters
4033 -- ^ Just a literal string of characters
4006 | RRSubWholeMatch
4034 | RRSubWholeMatch
@@ -4011,7 +4039,7 @@ data RestoreRenameToken = RRTLit Text
4013-- | A group number for regex matching. Only values from 1-9 are
4041-- | A group number for regex matching. Only values from 1-9 are
4014−-- supported. Construct with mkRRGroupRefNum
4042+-- supported. Construct with 'mkRRGroupRefNum'
4015newtype RRGroupRefNum = RRGroupRefNum { rrGroupRefNum :: Int }
4043newtype RRGroupRefNum = RRGroupRefNum { rrGroupRefNum :: Int }
4016 deriving (Show, Eq, Generic, Typeable, Ord)
4044 deriving (Show, Eq, Generic, Typeable, Ord)
@@ -4020,8 +4048,7 @@ instance Bounded RRGroupRefNum where
4020 maxBound = RRGroupRefNum 9
4048 maxBound = RRGroupRefNum 9
4024−-- | Only allows valid group number references (0-9).
4051+-- | Only allows valid group number references (1-9).
4025mkRRGroupRefNum :: Int -> Maybe RRGroupRefNum
4052mkRRGroupRefNum :: Int -> Maybe RRGroupRefNum
4026mkRRGroupRefNum i
4053mkRRGroupRefNum i
4027 | i >= (rrGroupRefNum minBound) && i <= (rrGroupRefNum maxBound) =
4054 | i >= (rrGroupRefNum minBound) && i <= (rrGroupRefNum maxBound) =