Safe Haskell | None |
---|
Implementation of the Ganeti confd server functionality.
Synopsis
- type CRef = IORef (Result (ConfigData, LinkIpMap))
- type StatusAnswer = (ConfdReplyStatus, JSValue, Int)
- queryUnknownEntry :: StatusAnswer
- queryArgumentError :: StatusAnswer
- gntErrorToResult :: ErrorResult a -> Result a
- nodeRole :: ConfigData -> String -> Result ConfdNodeRole
- getNodePipByInstanceIp :: ConfigData -> LinkIpMap -> String -> String -> StatusAnswer
- uuidToNodeName :: ConfigData -> String -> Result String
- encodeMinors :: ConfigData -> (String, Int, String, String, String, String) -> Result JSValue
- buildResponse :: (ConfigData, LinkIpMap) -> ConfdRequest -> Result StatusAnswer
- serializeResponse :: Result StatusAnswer -> ConfdReply
- responder :: CRef -> Socket -> HashKey -> String -> SockAddr -> IO ()
- respondInner :: Result (ConfigData, LinkIpMap) -> HashKey -> ConfdRequest -> String
- listener :: Socket -> HashKey -> (Socket -> HashKey -> String -> SockAddr -> IO ()) -> IO ()
- type PrepResult = (Socket, IORef (Result (ConfigData, LinkIpMap)))
- checkMain :: CheckFn (Family, SockAddr)
- prepMain :: PrepFn (Family, SockAddr) PrepResult
- main :: MainFn (Family, SockAddr) PrepResult
Types and constants definitions
type StatusAnswer = (ConfdReplyStatus, JSValue, Int) Source #
A small type alias for readability.
queryUnknownEntry :: StatusAnswer Source #
Unknown entry standard response.
queryArgumentError :: StatusAnswer Source #
Argument error standard response.
gntErrorToResult :: ErrorResult a -> Result a Source #
Converter from specific error to a string format.
Confd base functionality
nodeRole :: ConfigData -> String -> Result ConfdNodeRole Source #
Computes the node role
getNodePipByInstanceIp :: ConfigData -> LinkIpMap -> String -> String -> StatusAnswer Source #
Does an instance ip -> instance -> primary node -> primary ip transformation.
uuidToNodeName :: ConfigData -> String -> Result String Source #
Returns a node name for a given UUID
encodeMinors :: ConfigData -> (String, Int, String, String, String, String) -> Result JSValue Source #
Encodes a list of minors into a JSON representation, converting UUIDs to names in the process
buildResponse :: (ConfigData, LinkIpMap) -> ConfdRequest -> Result StatusAnswer Source #
Builds the response to a given query.
serializeResponse :: Result StatusAnswer -> ConfdReply Source #
Creates a ConfdReply from a given answer.
Client input/output handlers
responder :: CRef -> Socket -> HashKey -> String -> SockAddr -> IO () Source #
Main loop for a given client.
respondInner :: Result (ConfigData, LinkIpMap) -> HashKey -> ConfdRequest -> String Source #
Inner helper function for a given client. This generates the final encoded message (as a string), ready to be sent out to the client.
listener :: Socket -> HashKey -> (Socket -> HashKey -> String -> SockAddr -> IO ()) -> IO () Source #
Main listener loop.
type PrepResult = (Socket, IORef (Result (ConfigData, LinkIpMap))) Source #
Type alias for prepMain results
prepMain :: PrepFn (Family, SockAddr) PrepResult Source #
Prepare function for confd.
main :: MainFn (Family, SockAddr) PrepResult Source #
Main function.