ganeti
Safe HaskellNone

Ganeti.Confd.Client

Description

Implementation of the Ganeti Confd client functionality.

Synopsis

Documentation

getConfdClient :: Maybe String -> Maybe Int -> IO ConfdClient Source #

Builds a properly initialized ConfdClient. The parameters (an IP address and the port number for the Confd client to connect to) are mainly meant for testing purposes. If they are not provided, the list of master candidates and the default port number will be used.

query :: ConfdClient -> ConfdRequestType -> ConfdQuery -> IO (Maybe ConfdReply) Source #

Sends a query to all the Confd servers the client is connected to. Returns the most up-to-date result according to the serial number, chosen between those received before the timeout.

updateConfdReply :: ConfdReply -> Maybe ConfdReply -> Maybe ConfdReply Source #

Updates the reply to the query. As per the Confd design document, only the reply with the highest serial number is kept.

queryOneServer Source #

Arguments

:: MVar ()

The semaphore that will be signalled

-> MVar (Maybe ConfdReply)

The shared variable for the result

-> ConfdRequestType

The type of the query to be sent

-> ConfdQuery

The content of the query

-> HashKey

The hmac key to sign the message

-> (String, PortNumber)

The address and port of the server

-> IO () 

Send a query to a single server, waits for the result and stores it in a shared variable. Then, sends a signal on another shared variable acting as a semaphore. This function is meant to be used as one of multiple threads querying multiple servers in parallel.