ganeti
Safe HaskellNone

Ganeti.THH.PyRPC

Description

Combines the construction of RPC server components and their Python stubs.

Synopsis

Documentation

pythonIndentStep :: Int Source #

The indentation step in generated Python files.

nest' :: Doc -> Doc Source #

A helper function that nests a block of generated output by the default step (see pythonIndentStep).

genericInvokeName :: String Source #

The name of an abstract function to which all method in a Python stub are forwarded to.

socketPathName :: String Source #

The name of a function that returns the socket path for reaching the appropriate RPC client.

apply :: String -> [Doc] -> Doc Source #

Create a Python expression that applies a given function to a list of given expressions

emptyLine :: Doc Source #

An empty line block.

lowerFirst :: String -> String Source #

upperFirst :: String -> String Source #

toFunc :: String -> [Type] -> Q Doc Source #

Creates a method declaration given a function name and a list of Haskell types corresponding to its arguments.

nameToFunc :: Name -> Q Doc Source #

Creates a method declaration by inspecting (reifying) Haskell's function name.

namesToClass Source #

Arguments

:: String

the class name

-> Doc

Python code to include in the class

-> [Name]

the list of functions to include

-> Q Doc 

Generates a Python class stub, given a class name, the list of Haskell functions to expose as methods, and a optionally a piece of code to include.

genPyUDSRpcStub Source #

Arguments

:: String

the name of the class to be generated

-> String

the name of the constant from constants.py holding the path to a UDS socket

-> [Name]

names of functions to include

-> Q Doc 

Takes a list of function names and creates a RPC handler that delegates calls to them, as well as writes out the corresponding Python stub.

See mkRpcM for the requirements on the passed functions and the returned expression.

genPyUDSRpcStubStr Source #

Arguments

:: String

the name of the class to be generated

-> String

the constant in pathutils.py holding the socket path

-> [Name]

functions to include

-> Q Exp