ganeti

Safe HaskellSafe-Infered

Ganeti.Query.Query

Contents

Description

Implementation of the Ganeti Query2 functionality.

Synopsis

Documentation

data CollectorType a b Source

Constructors

CollectorSimple (Bool -> ConfigData -> [a] -> IO [(a, b)]) 
CollectorFieldAware (Bool -> ConfigData -> [String] -> [a] -> IO [(a, b)]) 

Helper functions

Main query execution

getSelectedFields :: FieldMap a b -> [String] -> FieldList a bSource

nameField :: ItemType -> FilterFieldSource

Computes the name field for different query types.

uuidField :: ItemType -> FilterFieldSource

Computes the uuid field, or the best possible substitute, for different query types.

getRequestedNames :: Query -> [String]Source

Checks that we have either requested a valid set of names, or we have a more complex filter.

genericQuery :: FieldMap a b -> CollectorType a b -> (a -> String) -> (ConfigData -> Container a) -> (ConfigData -> String -> ErrorResult a) -> ConfigData -> Bool -> [String] -> Filter FilterField -> [String] -> IO (ErrorResult QueryResult)Source

querySource

Arguments

:: ConfigData

The current configuration

-> Bool

Whether to collect live data

-> Query

The query (item, fields, filter)

-> IO (ErrorResult QueryResult)

Result

Main query execution function.

dummyCollectLiveData :: Bool -> ConfigData -> [a] -> IO [(a, NoDataRuntime)]Source

queryInner :: ConfigData -> Bool -> Query -> [String] -> IO (ErrorResult QueryResult)Source

queryCompat :: QueryResult -> ErrorResult [[JSValue]]Source

Classic query converter. It gets a standard query result on input and computes the classic style results.