Abstract the individual query functions
authorIustin Pop <iustin@google.com>
Mon, 25 Feb 2013 12:59:01 +0000 (13:59 +0100)
committerIustin Pop <iustin@google.com>
Mon, 4 Mar 2013 16:09:09 +0000 (17:09 +0100)
commitd5b2753abf43fc7f3cc26d7542d43bcb7ddf3a2c
tree0f3918b016aa6501537db280577e48434310ecdb
parentdce08ad33ad7b82898720f71b133df3e1a523ced
Abstract the individual query functions

After implementing a few of the query executor functions, it turns out
that we have the same general pattern:

- compile the filter
- extract the selected fields
- determine whether we need to run collectors
- do a first pass filtering
- run the collector if needed
- compute the final fields

For pure config queries, the collector/final computation is not
needed, but otherwise the code flow is the same.

We can therefore abstract all the queries that originate in the config
(i.e. except the job query) and have a single code path for all of
them, just with different parameters.

To do this, we add some stub collectors for group/network queries,
which don't have live data.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
src/Ganeti/Query/Group.hs
src/Ganeti/Query/Network.hs
src/Ganeti/Query/Query.hs