...so that by summing up over all peer maps we can easily get the total amount of memory for which we have to care about N+1 redundancy.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/HTools/PeerMap.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Ganeti/HTools/PeerMap.hs b/src/Ganeti/HTools/PeerMap.hs index 67e3050..c4b7a6f 100644 --- a/src/Ganeti/HTools/PeerMap.hs +++ b/src/Ganeti/HTools/PeerMap.hs @@ -46,6 +46,7 @@ module Ganeti.HTools.PeerMap , add , remove , maxElem + , sumElems ) where import Data.Maybe (fromMaybe) @@ -114,3 +115,7 @@ remove k ((x@(x', _)):xs) = if k == x' maxElem :: PeerMap -> Elem maxElem (x:_) = snd x maxElem _ = 0 + +-- | Sum of all peers. +sumElems :: PeerMap -> Elem +sumElems = sum . map snd -- 2.2.0.rc0.207.ga3a616c
