Package ganeti :: Module query :: Class Query
[hide private]
[frames] | no frames]

Class Query

source code

Instance Methods [hide private]
 
__init__(self, fieldlist, selected)
Initializes this class.
source code
frozenset
RequestedData(self)
Gets requested kinds of data.
source code
List of objects.QueryFieldDefinition
GetFields(self)
Returns the list of fields for this query.
source code
 
Query(self, ctx)
Execute a query.
source code
 
OldStyleQuery(self, ctx)
Query with "old" query result format.
source code
Method Details [hide private]

__init__(self, fieldlist, selected)
(Constructor)

source code 

Initializes this class.

The field definition is a dictionary with the field's name as a key and a tuple containing, in order, the field definition object (objects.QueryFieldDefinition, the data kind to help calling code collect data and a retrieval function. The retrieval function is called with two parameters, in order, the data container and the item in container (see Query.Query).

Users of this class can call RequestedData before preparing the data container to determine what data is needed.

Parameters:
  • fieldlist (dictionary) - Field definitions
  • selected (list of strings) - List of selected fields

GetFields(self)

source code 

Returns the list of fields for this query.

Includes unknown fields.

Returns: List of objects.QueryFieldDefinition

Query(self, ctx)

source code 

Execute a query.

Parameters:
  • ctx - Data container passed to field retrieval functions, must support iteration using __iter__

OldStyleQuery(self, ctx)

source code 

Query with "old" query result format.

See Query.Query for arguments.