[Pkg-ganeti-devel] [ganeti] 83/165: Support computing the sum of all peers in a peer map
Apollon Oikonomopoulos
apoikos at moszumanska.debian.org
Tue Aug 11 13:53:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
apoikos pushed a commit to branch master
in repository ganeti.
commit b3b701c3200c67dca9c99251d3c8d694c56d54ee
Author: Klaus Aehlig <aehlig at google.com>
Date: Tue Mar 17 16:04:11 2015 +0100
Support computing the sum of all peers in a peer map
...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 <aehlig at google.com>
Reviewed-by: Petr Pudlak <pudlak at google.com>
---
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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git
More information about the Pkg-ganeti-devel
mailing list