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 JSValueSource

data Request Source

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

Constructors

Request 

Fields

rMethod :: String
 
rArgs :: JSValue
 

Instances

Eq Request 
Ord Request 
Show Request 

decodeRequest :: JSValue -> JSValue -> Result RequestSource

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

toRpcFn :: Name -> Q ExpSource

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

mkRpcMSource

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.