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 QrViaLuxi
= QRLock
| QRInstance
| QRNode
| QRGroup
| QROs
qrViaLuxiFromRaw :: forall m[aGoW]. Monad m[aGoW] => String -> m[aGoW] QrViaLuxi
qrViaLuxiToRaw :: QrViaLuxi -> String
data LuxiReq
= ReqQuery
| ReqQueryNodes
| ReqQueryGroups
| ReqQueryInstances
| ReqQueryJobs
| ReqQueryExports
| ReqQueryConfigValues
| ReqQueryClusterInfo
| ReqQueryTags
| ReqSubmitJob
| ReqSubmitManyJobs
| ReqWaitForJobChange
| ReqArchiveJob
| ReqAutoArchiveJobs
| ReqCancelJob
| ReqSetDrainFlag
| ReqSetWatcherPause
data LuxiOp
= Query QrViaLuxi [String] ()
| QueryNodes [String] [String] Bool
| QueryGroups [String] [String] Bool
| QueryInstances [String] [String] Bool
| QueryJobs [Int] [String]
| QueryExports [String] Bool
| QueryConfigValues [String]
| QueryClusterInfo
| QueryTags String String
| SubmitJob [OpCode]
| SubmitManyJobs [[OpCode]]
| WaitForJobChange Int [String] JSValue JSValue Int
| ArchiveJob Int
| AutoArchiveJobs Int Int
| CancelJob Int
| SetDrainFlag Bool
| SetWatcherPause Double
luxiReqFromRaw :: forall m[aGNO]. Monad m[aGNO] => String -> m[aGNO] LuxiReq
luxiReqToRaw :: LuxiReq -> String
opToArgs :: LuxiOp -> JSValue
strOfOp :: LuxiOp -> String
data ResultStatus
= RSNormal
| RSUnknown
| RSNoData
| RSUnavailable
| RSOffline
resultStatusFromRaw :: forall m[aHhq]. Monad m[aHhq] => Int -> m[aHhq] ResultStatus
resultStatusToRaw :: ResultStatus -> Int
data LuxiCall = LuxiCall LuxiReq JSValue
checkRS :: Monad m => ResultStatus -> a -> m a
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 -> String
validateCall :: String -> Result LuxiCall
decodeCall :: LuxiCall -> Result LuxiOp
validateResult :: String -> Result JSValue
callMethod :: LuxiOp -> Client -> IO (Result JSValue)
submitManyJobs :: Client -> [[OpCode]] -> 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 QrViaLuxi Source
Constructors
QRLock
QRInstance
QRNode
QRGroup
QROs
qrViaLuxiFromRaw :: forall m[aGoW]. Monad m[aGoW] => String -> m[aGoW] QrViaLuxiSource
qrViaLuxiToRaw :: QrViaLuxi -> StringSource
data LuxiReq Source
Currently supported Luxi operations and JSON serialization.
Constructors
ReqQuery
ReqQueryNodes
ReqQueryGroups
ReqQueryInstances
ReqQueryJobs
ReqQueryExports
ReqQueryConfigValues
ReqQueryClusterInfo
ReqQueryTags
ReqSubmitJob
ReqSubmitManyJobs
ReqWaitForJobChange
ReqArchiveJob
ReqAutoArchiveJobs
ReqCancelJob
ReqSetDrainFlag
ReqSetWatcherPause
data LuxiOp Source
Constructors
Query QrViaLuxi [String] ()
QueryNodes [String] [String] Bool
QueryGroups [String] [String] Bool
QueryInstances [String] [String] Bool
QueryJobs [Int] [String]
QueryExports [String] Bool
QueryConfigValues [String]
QueryClusterInfo
QueryTags String String
SubmitJob [OpCode]
SubmitManyJobs [[OpCode]]
WaitForJobChange Int [String] JSValue JSValue Int
ArchiveJob Int
AutoArchiveJobs Int Int
CancelJob Int
SetDrainFlag Bool
SetWatcherPause Double
luxiReqFromRaw :: forall m[aGNO]. Monad m[aGNO] => String -> m[aGNO] LuxiReqSource
luxiReqToRaw :: LuxiReq -> StringSource
opToArgs :: LuxiOp -> JSValueSource
strOfOp :: LuxiOp -> StringSource
The serialisation of LuxiOps into strings in messages.
data ResultStatus Source
Constructors
RSNormal
RSUnknown
RSNoData
RSUnavailable
RSOffline
resultStatusFromRaw :: forall m[aHhq]. Monad m[aHhq] => Int -> m[aHhq] ResultStatusSource
resultStatusToRaw :: ResultStatus -> IntSource
data LuxiCall Source
Type holding the initial (unparsed) Luxi call.
Constructors
LuxiCall LuxiReq JSValue
checkRS :: Monad m => ResultStatus -> a -> m aSource
Check that ResultStatus is success or fail with descriptive message.
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
-> StringThe serialized form
Serialize a request to String.
validateCall :: String -> Result LuxiCallSource
Check that luxi request contains the required keys and parse it.
decodeCall :: LuxiCall -> Result LuxiOpSource

Converts Luxi call arguments into a LuxiOp data structure.

This is currently hand-coded until we make it more uniform so that it can be generated using TH.

validateResult :: String -> Result JSValueSource
Check that luxi responses contain the required keys and that the call was successful.
callMethod :: LuxiOp -> Client -> IO (Result JSValue)Source
Generic luxi method call.
submitManyJobs :: Client -> [[OpCode]] -> IO (Result [String])Source
Specialized submitManyJobs call.
queryJobsStatus :: Client -> [String] -> IO (Result [JobStatus])Source
Custom queryJobs call.
Produced by Haddock version 2.6.0