ganeti
Safe HaskellNone

Ganeti.THH.HsRPC

Description

Creates a client out of list of RPC server components.

Synopsis

The monad for RPC clients

newtype RpcClientMonad a Source #

The monad for all client RPC functions. Given a client value, it runs the RPC call in IO and either retrieves the result or the error.

Constructors

RpcClientMonad 

Fields

Instances

Instances details
Monad RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Functor RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Methods

fmap :: (a -> b) -> RpcClientMonad a -> RpcClientMonad b

(<$) :: a -> RpcClientMonad b -> RpcClientMonad a

MonadFail RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Methods

fail :: String -> RpcClientMonad a

Applicative RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

MonadIO RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Methods

liftIO :: IO a -> RpcClientMonad a

MonadBase IO RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Methods

liftBase :: IO α -> RpcClientMonad α

MonadError GanetiException RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

MonadBaseControl IO RpcClientMonad # 
Instance details

Defined in Ganeti.THH.HsRPC

Associated Types

type StM RpcClientMonad a

Methods

liftBaseWith :: (RunInBase RpcClientMonad IO -> IO a) -> RpcClientMonad a

restoreM :: StM RpcClientMonad a -> RpcClientMonad a

type StM RpcClientMonad b # 
Instance details

Defined in Ganeti.THH.HsRPC

type StM RpcClientMonad b = StM (ReaderT Client ResultG) b

The TH functions to construct RPC client functions from RPC server ones

runRpcClient :: (MonadBase IO m, MonadError GanetiException m) => RpcClientMonad a -> Client -> m a Source #

Given a client run a given client RPC action.

callMethod :: (JSON r, JSON args) => String -> args -> RpcClientMonad r Source #

mkRpcCall :: Name -> Q [Dec] Source #

Given a server RPC function (such as from WConfd.Core), creates the corresponding client function. The monad of the result type of the given function is replaced by RpcClientMonad and the new function is implemented to issue a RPC call to the server.

mkRpcCalls :: [Name] -> Q [Dec] Source #