Revision 5771c501
b/src/Ganeti/Query/Query.hs | ||
---|---|---|
152 | 152 |
|
153 | 153 |
-- | Generic query implementation for resources that are backed by |
154 | 154 |
-- some configuration objects. |
155 |
-- |
|
156 |
-- Different query types use the same 'genericQuery' function by providing |
|
157 |
-- a collector function and a field map. The collector function retrieves |
|
158 |
-- live data, and the field map provides both the requirements and the logic |
|
159 |
-- necessary to retrieve the data needed for the field. |
|
160 |
-- |
|
161 |
-- The 'b' type in the specification is the runtime. Every query can gather |
|
162 |
-- additional live data related to the configuration object using the collector |
|
163 |
-- to perform RPC calls. |
|
164 |
-- |
|
165 |
-- The gathered data, or the failure to get it, is expressed through a runtime |
|
166 |
-- object. The type of a runtime object is determined by every query type for |
|
167 |
-- itself, and used exclusively by that query. |
|
155 | 168 |
genericQuery :: FieldMap a b -- ^ Field map |
156 | 169 |
-> (Bool -> ConfigData -> [a] -> IO [(a, b)]) -- ^ Collector |
157 | 170 |
-> (a -> String) -- ^ Object to name function |
Also available in: Unified diff