Safe Haskell | None |
---|
Implementation of the Ganeti Query2 server.
Synopsis
- makeLuxidClientId :: JQStatus -> IO ClientId
- withLockedWconfdConfig :: (MonadBase IO m, MonadError GanetiException m) => ClientId -> (ConfigData -> RpcClientMonad a) -> m a
- handleQuery :: [ItemType -> FilterField] -> ConfigData -> ItemType -> [Either String Integer] -> [String] -> Bool -> IO (GenericResult GanetiException JSValue)
- handleClassicQuery :: ConfigData -> ItemType -> [Either String Integer] -> [String] -> Bool -> IO (GenericResult GanetiException JSValue)
- handleUuidQuery :: ConfigData -> ItemType -> [Either String Integer] -> [String] -> Bool -> IO (GenericResult GanetiException JSValue)
- handleCallWrapper :: Lock -> JQStatus -> Result ConfigData -> LuxiOp -> IO (ErrorResult JSValue)
- handleCall :: Lock -> JQStatus -> ConfigData -> LuxiOp -> IO (ErrorResult JSValue)
- handleWaitForJobChangeStatus :: JobId -> JSValue -> JSValue -> Int -> IO (ErrorResult JSValue)
- waitForJobChange :: JobId -> JSValue -> Int -> IO (JSValue, JSValue) -> IO (ErrorResult JSValue)
- computeJobUpdate :: ConfigData -> JobId -> [String] -> JSValue -> IO (JSValue, JSValue)
- computeJobUpdateStatus :: JobId -> JSValue -> IO (JSValue, JSValue)
- type LuxiConfig = (Lock, JQStatus, ConfigReader)
- luxiExec :: LuxiConfig -> LuxiOp -> IO (Bool, GenericResult GanetiException JSValue)
- luxiHandler :: LuxiConfig -> Handler LuxiOp IO JSValue
- type PrepResult = (Server, IORef (Result ConfigData), JQStatus)
- activateMasterIP :: IO (Result ())
- checkMain :: CheckFn ()
- prepMain :: PrepFn () PrepResult
- main :: MainFn () PrepResult
Documentation
makeLuxidClientId :: JQStatus -> IO ClientId Source #
withLockedWconfdConfig :: (MonadBase IO m, MonadError GanetiException m) => ClientId -> (ConfigData -> RpcClientMonad a) -> m a Source #
Creates a connection to WConfd and locks the config, allowing to run some WConfd RPC commands given the locked config.
This is needed when luxid wants to change the config.
Example:
cid <- makeLuxidClientId ... withLockedWconfdConfig cid $ \lockedCfg -> do -- some (IO) action that needs to be run inside having the lock writeConfig cid (updateConfig lockedCfg)
:: [ItemType -> FilterField] | Fields to put into the query |
-> ConfigData | Cluster config |
-> ItemType | Query type |
-> [Either String Integer] | Requested names (empty means all) |
-> [String] | Requested fields |
-> Bool | Whether to do sync queries or not |
-> IO (GenericResult GanetiException JSValue) |
Helper for classic queries.
:: ConfigData | Cluster config |
-> ItemType | Query type |
-> [Either String Integer] | Requested names (empty means all) |
-> [String] | Requested fields |
-> Bool | Whether to do sync queries or not |
-> IO (GenericResult GanetiException JSValue) |
Helper for classic queries.
Queries name
and uuid
fields.
:: ConfigData | Cluster config |
-> ItemType | Query type |
-> [Either String Integer] | Requested names (empty means all) |
-> [String] | Requested fields |
-> Bool | Whether to do sync queries or not |
-> IO (GenericResult GanetiException JSValue) |
Like handleClassicQuery
, but filters only by UUID.
handleCallWrapper :: Lock -> JQStatus -> Result ConfigData -> LuxiOp -> IO (ErrorResult JSValue) Source #
Minimal wrapper to handle the missing config case.
handleCall :: Lock -> JQStatus -> ConfigData -> LuxiOp -> IO (ErrorResult JSValue) Source #
Actual luxi operation handler.
handleWaitForJobChangeStatus :: JobId -> JSValue -> JSValue -> Int -> IO (ErrorResult JSValue) Source #
Special-case handler for WaitForJobChange RPC call for fields == ["status"] that doesn't require the use of ConfigData
waitForJobChange :: JobId -> JSValue -> Int -> IO (JSValue, JSValue) -> IO (ErrorResult JSValue) Source #
Common WaitForJobChange functionality shared between handleCall and handleWaitForJobChangeStatus
computeJobUpdate :: ConfigData -> JobId -> [String] -> JSValue -> IO (JSValue, JSValue) Source #
Query the status of a job and return the requested fields and the logs newer than the given log number.
computeJobUpdateStatus :: JobId -> JSValue -> IO (JSValue, JSValue) Source #
A version of computeJobUpdate hardcoded to only return logs and the status field. By hardcoding this we avoid using the luxi Query infrastructure and the ConfigData value it requires.
type LuxiConfig = (Lock, JQStatus, ConfigReader) Source #
luxiExec :: LuxiConfig -> LuxiOp -> IO (Bool, GenericResult GanetiException JSValue) Source #
luxiHandler :: LuxiConfig -> Handler LuxiOp IO JSValue Source #
type PrepResult = (Server, IORef (Result ConfigData), JQStatus) Source #
Type alias for prepMain results
activateMasterIP :: IO (Result ()) Source #
Activate the master IP address.
prepMain :: PrepFn () PrepResult Source #
Prepare function for luxid.
main :: MainFn () PrepResult Source #
Main function.