-}
module Ganeti.HTools.Types
- where
+ ( Idx
+ , Ndx
+ , NameAssoc
+ , Result(..)
+ , Element(..)
+ ) where
--- | The type used to hold idx-to-name mappings
-type NameList = [(Int, String)]
+-- | The instance index type.
+type Idx = Int
--- | The type used to hold name-to-idx mappings
+-- | The node index type.
+type Ndx = Int
+
+-- | The type used to hold name-to-idx mappings.
type NameAssoc = [(String, Int)]
{-|
return = Ok
fail = Bad
--- | A generic class for items that have names and indices
+-- | A generic class for items that have updateable names and indices.
class Element a where
+ -- | Returns the name of the element
nameOf :: a -> String
+ -- | Returns the index of the element
idxOf :: a -> Int
+ -- | Updates the name of the element
setName :: a -> String -> a
+ -- | Updates the index of the element
setIdx :: a -> Int -> a