Revision dd69cd3c src/Ganeti/DataCollectors/Types.hs
b/src/Ganeti/DataCollectors/Types.hs | ||
---|---|---|
34 | 34 |
, DCStatusCode(..) |
35 | 35 |
, DCVersion(..) |
36 | 36 |
, buildReport |
37 |
, mergeStatuses |
|
37 | 38 |
) where |
38 | 39 |
|
39 | 40 |
import Data.Char |
... | ... | |
116 | 117 |
, ("data", value) |
117 | 118 |
] |
118 | 119 |
|
120 |
-- | Helper function for merging statuses. |
|
121 |
mergeStatuses :: (DCStatusCode, String) -> (DCStatusCode, [String]) |
|
122 |
-> (DCStatusCode, [String]) |
|
123 |
mergeStatuses (newStat, newStr) (storedStat, storedStrs) = |
|
124 |
let resStat = max newStat storedStat |
|
125 |
resStrs = |
|
126 |
if newStr == "" |
|
127 |
then storedStrs |
|
128 |
else storedStrs ++ [newStr] |
|
129 |
in (resStat, resStrs) |
|
130 |
|
|
119 | 131 |
-- | Utility function for building a report automatically adding the current |
120 | 132 |
-- timestamp (rounded up to seconds). |
121 | 133 |
-- If the version is not specified, it will be set to the value indicating |
Also available in: Unified diff