Revision a2ae14e9

b/htools/Ganeti/Query/Query.hs
114 114

  
115 115
-- | Check whether list of queried fields contains live fields.
116 116
needsLiveData :: [FieldGetter a b] -> Bool
117
needsLiveData = any (\getter -> case getter of
118
                     FieldRuntime _ -> True
119
                     _ -> False)
117
needsLiveData = any isRuntimeField
120 118

  
121 119
-- | Checks whether we have requested exactly some names. This is a
122 120
-- simple wrapper over 'requestedNames' and 'nameField'.
b/htools/Ganeti/Query/Types.hs
26 26

  
27 27
-}
28 28

  
29
module Ganeti.Query.Types where
29
module Ganeti.Query.Types
30
  ( FieldGetter(..)
31
  , FieldData
32
  , FieldList
33
  , FieldMap
34
  , isRuntimeField
35
  ) where
30 36

  
31 37
import qualified Data.Map as Map
32 38

  
......
52 58

  
53 59
-- | Alias for field maps.
54 60
type FieldMap a b = Map.Map String (FieldData a b)
61

  
62
-- | Helper function to check if a getter is a runtime one.
63
isRuntimeField :: FieldGetter a b -> Bool
64
isRuntimeField (FieldRuntime _) = True
65
isRuntimeField _                = False

Also available in: Unified diff