query: Add support for filters
authorMichael Hanselmann <hansmi@google.com>
Mon, 28 Feb 2011 11:22:50 +0000 (12:22 +0100)
committerMichael Hanselmann <hansmi@google.com>
Tue, 1 Mar 2011 13:42:04 +0000 (14:42 +0100)
commitfb0be379efb29e4d8cfe8b3ee74ea1f85ac2c7e4
treec39b03501df2856feda1a2e2326d968710b4e250
parent111bf531199a6d56649dc7a5050111aebb7cff39
query: Add support for filters

This patch adds a “compiler” for query filters, converting them to a
callable function used while preparing the query result. In addition, a
hints call allows some analysis to be done on the query (e.g. referenced
names), making data collection more efficient.

The depth of filters is limited to avoid exceeding the runtime's maximum
recursion depth.

More operators and other improvements can be implemented using this
base. Extensive unittests are provided.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
lib/query.py
test/ganeti.query_unittest.py