ganeti-htoolsSource codeContentsIndex
Ganeti.Luxi
Contents
Utility functions
Generic protocol functionality
Description
Implementation of the Ganeti LUXI interface.
Synopsis
withTimeout :: Int -> String -> IO a -> IO a
data LuxiOp
= QueryInstances
| QueryNodes
| QueryJobs
| QueryClusterInfo
| SubmitManyJobs
strOfOp :: LuxiOp -> String
eOM :: Char
data MsgKeys
= Method
| Args
| Success
| Result
strOfKey :: MsgKeys -> String
data Client = Client {
socket :: Socket
rbuf :: IORef String
}
getClient :: String -> IO Client
closeClient :: Client -> IO ()
sendMsg :: Client -> String -> IO ()
recvMsg :: Client -> IO String
buildCall :: LuxiOp -> JSValue -> String
validateResult :: String -> Result JSValue
callMethod :: LuxiOp -> JSValue -> Client -> IO (Result JSValue)
submitManyJobs :: Client -> JSValue -> IO (Result [String])
queryJobsStatus :: Client -> [String] -> IO (Result [JobStatus])
Utility functions
withTimeout :: Int -> String -> IO a -> IO aSource
Wrapper over System.Timeout.timeout that fails in the IO monad.
Generic protocol functionality
data LuxiOp Source
Currently supported Luxi operations.
Constructors
QueryInstances
QueryNodes
QueryJobs
QueryClusterInfo
SubmitManyJobs
strOfOp :: LuxiOp -> StringSource
The serialisation of LuxiOps into strings in messages.
eOM :: CharSource
The end-of-message separator.
data MsgKeys Source
Valid keys in the requests and responses.
Constructors
Method
Args
Success
Result
strOfKey :: MsgKeys -> StringSource
The serialisation of MsgKeys into strings in messages.
data Client Source
Luxi client encapsulation.
Constructors
Client
socket :: SocketThe socket of the client
rbuf :: IORef StringAlready received buffer
getClient :: String -> IO ClientSource
Connects to the master daemon and returns a luxi Client.
closeClient :: Client -> IO ()Source
Closes the client socket.
sendMsg :: Client -> String -> IO ()Source
Sends a message over a luxi transport.
recvMsg :: Client -> IO StringSource
Waits for a message over a luxi transport.
buildCallSource
:: LuxiOpThe method
-> JSValueThe arguments
-> StringThe serialized form
Serialize a request to String.
validateResult :: String -> Result JSValueSource
Check that luxi responses contain the required keys and that the call was successful.
callMethod :: LuxiOp -> JSValue -> Client -> IO (Result JSValue)Source
Generic luxi method call.
submitManyJobs :: Client -> JSValue -> IO (Result [String])Source
Specialized submitManyJobs call.
queryJobsStatus :: Client -> [String] -> IO (Result [JobStatus])Source
Custom queryJobs call.
Produced by Haddock version 2.4.2