ganeti

Safe HaskellSafe-Infered

Ganeti.HTools.Backend.Luxi

Contents

Description

Implementation of the LUXI loader.

Synopsis

Utility functions

getData :: Monad m => JSValue -> m JSValueSource

parseQueryField :: Monad m => JSValue -> m (JSValue, JSValue)Source

parseQueryRow :: Monad m => JSValue -> m [(JSValue, JSValue)]Source

parseQueryResult :: Monad m => JSValue -> m [[(JSValue, JSValue)]]Source

extractArray :: Monad m => JSValue -> m [[(JSValue, JSValue)]]Source

fromJValWithStatus :: (JSON a, Monad m) => (JSValue, JSValue) -> m aSource

genericConvert :: JSON a => String -> String -> String -> (JSValue, JSValue) -> Result aSource

Data querying functionality

queryNodes :: Client -> IO (Result JSValue)Source

queryGroups :: Client -> IO (Result JSValue)Source

getInstances :: NameAssoc -> JSValue -> Result [(String, Instance)]Source

parseInstance :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Instance)Source

getNodes :: NameAssoc -> JSValue -> Result [(String, Node)]Source

parseNode :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Node)Source

getClusterData :: JSValue -> Result ([String], IPolicy, String)Source

getGroups :: JSValue -> Result [(String, Group)]Source

parseGroup :: [(JSValue, JSValue)] -> Result (String, Group)Source

Main loader functionality

readData :: String -> IO (Result JSValue, Result JSValue, Result JSValue, Result JSValue)Source

parseData :: (Result JSValue, Result JSValue, Result JSValue, Result JSValue) -> Result ClusterDataSource

Converts the output of readData into the internal cluster representation.

loadDataSource

Arguments

:: String

Unix socket to use as source

-> IO (Result ClusterData) 

Top level function for data loading.