Revision 04063ba7 htools/Ganeti/Confd/Types.hs

b/htools/Ganeti/Confd/Types.hs
34 34
  , C.confdDefaultReqCoverage
35 35
  , C.confdClientExpireTimeout
36 36
  , C.maxUdpDataSize
37
  , ConfdClient(..)
37 38
  , ConfdRequestType(..)
38 39
  , ConfdReqQ(..)
39 40
  , ConfdReqField(..)
......
41 42
  , ConfdNodeRole(..)
42 43
  , ConfdErrorType(..)
43 44
  , ConfdRequest(..)
45
  , newConfdRequest
44 46
  , ConfdReply(..)
45 47
  , ConfdQuery(..)
46 48
  , SignedMessage(..)
47 49
  ) where
48 50

  
49 51
import Text.JSON
52
import qualified Network.Socket as S
50 53

  
51 54
import qualified Ganeti.Constants as C
55
import Ganeti.Hash
52 56
import Ganeti.THH
57
import Ganeti.Utils (newUUID)
53 58

  
54 59
{-
55 60
   Note that we re-export as is from Constants the following simple items:
......
152 157
  , simpleField "rsalt"    [t| String |]
153 158
  ])
154 159

  
160
-- | Client side helper function for creating requests. It automatically fills
161
-- in some default values.
162
newConfdRequest :: ConfdRequestType -> ConfdQuery -> IO ConfdRequest
163
newConfdRequest reqType query = do
164
  rsalt <- newUUID
165
  return $ ConfdRequest C.confdProtocolVersion reqType query rsalt
166

  
155 167
$(buildObject "ConfdReply" "confdReply"
156 168
  [ simpleField "protocol" [t| Int              |]
157 169
  , simpleField "status"   [t| ConfdReplyStatus |]
......
164 176
  , simpleField "msg"  [t| String |]
165 177
  , simpleField "salt" [t| String |]
166 178
  ])
179

  
180
-- | Data type containing information used by the Confd client.
181
data ConfdClient = ConfdClient
182
  { hmacKey :: HashKey         -- ^ The hmac used for authentication
183
  , peers :: [String]          -- ^ The list of nodes to query
184
  , serverPort :: S.PortNumber -- ^ The port where confd server is listening
185
  }

Also available in: Unified diff