ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.Luxi

Description

Implementation of the Ganeti LUXI interface.

Synopsis

Documentation

data LuxiOp #

Currently supported Luxi operations and JSON serialization.

Constructors

Query ItemType [String] (Filter FilterField) 
QueryFields ItemType [String] 
QueryNodes [String] [String] Bool 
QueryGroups [String] [String] Bool 
QueryNetworks [String] [String] Bool 
QueryInstances [String] [String] Bool 
QueryFilters [String] [String] 
ReplaceFilter (Maybe String) (NonNegative Int) [FilterPredicate] FilterAction ReasonTrail 
DeleteFilter String 
QueryJobs [JobId] [String] 
QueryExports [String] Bool 
QueryConfigValues [String] 
QueryClusterInfo 
QueryTags TagKind String 
SubmitJob [MetaOpCode] 
SubmitJobToDrainedQueue [MetaOpCode] 
SubmitManyJobs [[MetaOpCode]] 
WaitForJobChange JobId [String] JSValue JSValue Int 
PickupJob JobId 
ArchiveJob JobId 
AutoArchiveJobs Int Int 
CancelJob JobId Bool 
ChangeJobPriority JobId Int 
SetDrainFlag Bool 
SetWatcherPause (Maybe ClockTime) 

Instances

Instances details
Show LuxiOp # 
Instance details

Defined in Ganeti.Luxi

Methods

showsPrec :: Int -> LuxiOp -> ShowS

show :: LuxiOp -> String

showList :: [LuxiOp] -> ShowS

DictObject LuxiOp # 
Instance details

Defined in Ganeti.Luxi

Methods

toDict :: LuxiOp -> [(String, JSValue)] #

fromDictWKeys :: [(String, JSValue)] -> WriterT UsedKeys Result LuxiOp #

fromDict :: [(String, JSValue)] -> Result LuxiOp #

Eq LuxiOp # 
Instance details

Defined in Ganeti.Luxi

Methods

(==) :: LuxiOp -> LuxiOp -> Bool

(/=) :: LuxiOp -> LuxiOp -> Bool

data LuxiReq #

Instances

Instances details
Bounded LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Enum LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Show LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Methods

showsPrec :: Int -> LuxiReq -> ShowS

show :: LuxiReq -> String

showList :: [LuxiReq] -> ShowS

Eq LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Methods

(==) :: LuxiReq -> LuxiReq -> Bool

(/=) :: LuxiReq -> LuxiReq -> Bool

Ord LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Methods

compare :: LuxiReq -> LuxiReq -> Ordering

(<) :: LuxiReq -> LuxiReq -> Bool

(<=) :: LuxiReq -> LuxiReq -> Bool

(>) :: LuxiReq -> LuxiReq -> Bool

(>=) :: LuxiReq -> LuxiReq -> Bool

max :: LuxiReq -> LuxiReq -> LuxiReq

min :: LuxiReq -> LuxiReq -> LuxiReq

JSON LuxiReq # 
Instance details

Defined in Ganeti.Luxi

Methods

readJSON :: JSValue -> Result LuxiReq

showJSON :: LuxiReq -> JSValue

readJSONs :: JSValue -> Result [LuxiReq]

showJSONs :: [LuxiReq] -> JSValue

data Client #

A client encapsulation. Note that it has separate read and write handle. For sockets it is the same handle. It is required for bi-directional inter-process pipes though.

data Server #

A server encapsulation.

data JobId #

The Ganeti job type.

Instances

Instances details
Show JobId # 
Instance details

Defined in Ganeti.Types

Methods

showsPrec :: Int -> JobId -> ShowS

show :: JobId -> String

showList :: [JobId] -> ShowS

Eq JobId # 
Instance details

Defined in Ganeti.Types

Methods

(==) :: JobId -> JobId -> Bool

(/=) :: JobId -> JobId -> Bool

Ord JobId # 
Instance details

Defined in Ganeti.Types

Methods

compare :: JobId -> JobId -> Ordering

(<) :: JobId -> JobId -> Bool

(<=) :: JobId -> JobId -> Bool

(>) :: JobId -> JobId -> Bool

(>=) :: JobId -> JobId -> Bool

max :: JobId -> JobId -> JobId

min :: JobId -> JobId -> JobId

JSON JobId # 
Instance details

Defined in Ganeti.Types

Methods

readJSON :: JSValue -> Result JobId

showJSON :: JobId -> JSValue

readJSONs :: JSValue -> Result [JobId]

showJSONs :: [JobId] -> JSValue

fromJobId :: JobId -> Int #

makeJobId :: MonadFail m => Int -> m JobId #

Builds a job ID.

data RecvResult #

Result of receiving a message from the socket.

Constructors

RecvConnClosed

Connection closed

RecvError String

Any other error

RecvOk String

Successfull receive

Instances

Instances details
Show RecvResult # 
Instance details

Defined in Ganeti.UDSServer

Methods

showsPrec :: Int -> RecvResult -> ShowS

show :: RecvResult -> String

showList :: [RecvResult] -> ShowS

Eq RecvResult # 
Instance details

Defined in Ganeti.UDSServer

Methods

(==) :: RecvResult -> RecvResult -> Bool

(/=) :: RecvResult -> RecvResult -> Bool

strOfOp :: LuxiOp -> String #

The serialisation of LuxiOps into strings in messages.

opToArgs :: LuxiOp -> JSValue #

getLuxiClient :: String -> IO Client #

Connects to the master daemon and returns a luxi Client.

getLuxiServer :: Bool -> FilePath -> IO Server #

Creates and returns a server endpoint.

acceptClient :: Server -> IO Client #

Accepts a client

closeClient :: Client -> IO () #

Closes the client socket. Performing the operation on a client that has already been closed has no effect; doing so is not an error. All other operations on a closed client will fail with an exception.

closeServer :: MonadBase IO m => Server -> m () #

Closes a server endpoint.

callMethod :: LuxiOp -> Client -> IO (ErrorResult JSValue) #

Generic luxi method call

submitManyJobs :: Client -> [[MetaOpCode]] -> IO (ErrorResult [JobId]) #

Specialized submitManyJobs call.

queryJobsStatus :: Client -> [JobId] -> IO (ErrorResult [JobStatus]) #

Custom queryJobs call.

buildCall #

Arguments

:: (JSON mth, JSON args) 
=> mth

The method

-> args

The arguments

-> String

The serialized form

Serialize a request to String.

buildResponse #

Arguments

:: Bool

Success

-> JSValue

The arguments

-> String

The serialized form

Serialize the response to String.

decodeLuxiCall :: JSValue -> JSValue -> Result LuxiOp #

Converts Luxi call arguments into a LuxiOp data structure. This is used for building a Luxi Handler.

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

recvMsg :: Client -> IO String #

Waits for a message over a transport.

recvMsgExt :: Client -> IO RecvResult #

Extended wrapper over recvMsg.

sendMsg :: Client -> String -> IO () #

Sends a message over a transport.

allLuxiCalls :: [String] #

List of all defined Luxi calls.