Safe Haskell | Safe-Infered |
---|
Parsing data from text-files.
This module holds the code for loading the cluster state from text
files, as produced by gnt-node
and gnt-instance
list
command.
- commaSplit :: String -> [String]
- serializeGroup :: Group -> String
- serializeGroups :: List -> String
- serializeNode :: List -> Node -> String
- serializeNodes :: List -> List -> String
- serializeInstance :: List -> Instance -> String
- serializeInstances :: List -> List -> String
- iSpecsSeparator :: Char
- serializeISpec :: ISpec -> String
- serializeDiskTemplates :: [DiskTemplate] -> String
- serializeMultipleMinMaxISpecs :: [MinMaxISpecs] -> String
- serializeIPolicy :: String -> IPolicy -> String
- serializeAllIPolicies :: IPolicy -> List -> String
- serializeCluster :: ClusterData -> String
- loadGroup :: Monad m => [String] -> m (String, Group)
- loadNode :: Monad m => NameAssoc -> [String] -> m (String, Node)
- loadInst :: NameAssoc -> [String] -> Result (String, Instance)
- loadISpec :: String -> [String] -> Result ISpec
- loadMinMaxISpecs :: String -> String -> String -> Result MinMaxISpecs
- breakISpecsPairs :: String -> [String] -> Result [(String, String)]
- loadMultipleMinMaxISpecs :: String -> [String] -> Result [MinMaxISpecs]
- loadIPolicy :: [String] -> Result (String, IPolicy)
- loadOnePolicy :: (IPolicy, List) -> String -> Result (IPolicy, List)
- loadAllIPolicies :: List -> [String] -> Result (IPolicy, List)
- loadTabular :: (Monad m, Element a) => [String] -> ([String] -> m (String, a)) -> m (NameAssoc, Container a)
- readData :: String -> IO String
- parseData :: String -> Result ClusterData
- loadData :: String -> IO (Result ClusterData)
Helper functions
commaSplit :: String -> [String]Source
Serialisation functions
serializeGroup :: Group -> StringSource
Serialize a single group.
serializeGroups :: List -> StringSource
Serialize a single node.
serializeNodes :: List -> List -> StringSource
Generate node file data from node objects.
Serialize a single instance.
serializeInstances :: List -> List -> StringSource
Generate instance file data from instance objects.
iSpecsSeparator :: CharSource
serializeISpec :: ISpec -> StringSource
Generate a spec data from a given ISpec object.
serializeDiskTemplates :: [DiskTemplate] -> StringSource
serializeMultipleMinMaxISpecs :: [MinMaxISpecs] -> StringSource
Generate min/max instance specs data.
serializeIPolicy :: String -> IPolicy -> StringSource
Generate policy data from a given policy object.
serializeAllIPolicies :: IPolicy -> List -> StringSource
serializeCluster :: ClusterData -> StringSource
Generate complete cluster data from node and instance lists.
Parsing functions
:: Monad m | |
=> NameAssoc | Association list with current groups |
-> [String] | Input data as a list of fields |
-> m (String, Node) | The result, a tuple o node name and node object |
Load a node from a field list.
:: NameAssoc | Association list with the current nodes |
-> [String] | Input data as a list of fields |
-> Result (String, Instance) | A tuple of instance name and the instance object |
Load an instance from a field list.
loadMinMaxISpecs :: String -> String -> String -> Result MinMaxISpecsSource
breakISpecsPairs :: String -> [String] -> Result [(String, String)]Source
loadMultipleMinMaxISpecs :: String -> [String] -> Result [MinMaxISpecs]Source
Load a list of min/max ispecs pairs
loadIPolicy :: [String] -> Result (String, IPolicy)Source
Loads an ipolicy from a field list.
loadTabular :: (Monad m, Element a) => [String] -> ([String] -> m (String, a)) -> m (NameAssoc, Container a)Source
:: String | Path to the text file |
-> IO (Result ClusterData) |
Top level function for data loading.