Commit e7e39fed authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Use an old way to instance NFData CollectorData make sure we can successfully build on platforms
with older versions of the containers library.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent d89cb844
......@@ -50,6 +50,7 @@ module Ganeti.DataCollectors.Types
) where
import Control.DeepSeq (NFData, rnf, force)
import Control.Seq (using, seqFoldable, rdeepseq)
import Data.Char
import Data.Ratio
import qualified Data.Map as Map
......@@ -139,9 +140,25 @@ instance JSON DCVersion where
-- | Type for the value field of the `CollectorMap` below.
data CollectorData = CPULoadData (Seq.Seq (Integer, [Int]))
Naturally, we want to make CollectorData an instance of NFData as
instance NFData CollectorData where
rnf (CPULoadData x) = rnf x
However, Seq.Seq only became an instance of NFData in version
of containers (Released 2012). So, for the moment, we use a generic
way to reduce to normal form. In later versions of Ganeti, where we
have the infra structure to do so, we will choose implementation depending
on the version of the containers library available.
instance NFData CollectorData where
rnf (CPULoadData x) = (x `using` seqFoldable rdeepseq) `seq` ()
-- | Type for the map storing the data of the statefull DataCollectors.
type CollectorMap = Map.Map String CollectorData
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment