ganeti
Safe HaskellNone

Ganeti.THH.RPC

Description

Implements Template Haskell generation of RPC server components from Haskell functions.

Synopsis

Documentation

data RpcFn m Source #

Constructors

forall i o.(JSON i, JSON o) => RpcFn (i -> m o) 

type RpcServer m = Handler Request m JSValue Source #

data Request Source #

A RPC request consiting of a method and its argument(s).

Constructors

Request 

Fields

Instances

Instances details
Eq Request # 
Instance details

Defined in Ganeti.THH.RPC

Methods

(==) :: Request -> Request -> Bool

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

Ord Request # 
Instance details

Defined in Ganeti.THH.RPC

Methods

compare :: Request -> Request -> Ordering

(<) :: Request -> Request -> Bool

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

(>) :: Request -> Request -> Bool

(>=) :: Request -> Request -> Bool

max :: Request -> Request -> Request

min :: Request -> Request -> Request

Show Request # 
Instance details

Defined in Ganeti.THH.RPC

Methods

showsPrec :: Int -> Request -> ShowS

show :: Request -> String

showList :: [Request] -> ShowS

decodeRequest :: JSValue -> JSValue -> Result Request Source #

dispatch :: Monad m => Map String (RpcFn (ResultT GanetiException m)) -> RpcServer m Source #

toRpcFn :: Name -> Q Exp Source #

Converts a function into the appropriate RpcFn m expression. The function's result must be monadic.

rpcFnsList :: [(String, Q Exp)] -> Q Exp Source #

Convert a list of named expressions into an expression containing a list of name/expression pairs.

mkRpcM Source #

Arguments

:: [Name]

the names of functions to include

-> Q Exp 

Takes a list of function names and creates a RPC handler that delegates calls to them.

The functions must conform to (J.JSON i, J.JSON o) => i -> ResultT GanetiException m o. The m monads types of all the functions must unify.

The result expression is of type RpcServer m.