X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/e4c5beaf3ee5cf16fd40573e3afe9a708b58bb4f..b513faa10514ee88b3166539288976eeccded381:/Ganeti/HTools/Types.hs diff --git a/Ganeti/HTools/Types.hs b/Ganeti/HTools/Types.hs index 0a24802..8bae7c3 100644 --- a/Ganeti/HTools/Types.hs +++ b/Ganeti/HTools/Types.hs @@ -39,3 +39,24 @@ instance Monad Result where (>>=) (Ok x) fn = fn x return = Ok fail = Bad + +-- | A generic class for nodes and instances +class Element a where + name :: a -> String + idx :: a -> Int + setName :: a -> String -> a + setIdx :: a -> Int -> a + +-- Let's make nodes elements of the cluster +instance Element Node.Node where + name = Node.name + idx = Node.idx + setName = Node.setName + setIdx = Node.setIdx + +-- And instances too +instance Element Instance.Instance where + name = Instance.name + idx = Instance.idx + setName = Instance.setName + setIdx = Instance.setIdx