+-- | Loads the raw cluster data from the filesystem.
+readDataFile:: String -- ^ Path to the directory containing the files
+ -> IO (Result String, Result String, Result String, Result String)
+readDataFile path = do
+ group_body <- ioErrToResult . readFile $ path </> "groups.json"
+ node_body <- ioErrToResult . readFile $ path </> "nodes.json"
+ inst_body <- ioErrToResult . readFile $ path </> "instances.json"
+ info_body <- ioErrToResult . readFile $ path </> "info.json"
+ return (group_body, node_body, inst_body, info_body)
+
+-- | Loads data via either 'readDataFile' or 'readDataHttp'.
+readData :: String -- ^ URL to use as source
+ -> IO (Result String, Result String, Result String, Result String)
+readData url = do
+ if filePrefix `isPrefixOf` url
+ then readDataFile (drop (length filePrefix) url)
+ else readDataHttp url
+