[Neo-report] r2431 gregory - /trunk/neo/master/app.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 8 11:24:36 CET 2010


Author: gregory
Date: Mon Nov  8 11:24:35 2010
New Revision: 2431

Log:
Allow specifying a node selector when broadcasting partition changes.

Modified:
    trunk/neo/master/app.py

Modified: trunk/neo/master/app.py
==============================================================================
--- trunk/neo/master/app.py [iso-8859-1] (original)
+++ trunk/neo/master/app.py [iso-8859-1] Mon Nov  8 11:24:35 2010
@@ -285,18 +285,20 @@ class Application(object):
             if node_list and node.isRunning():
                 node.notify(Packets.NotifyNodeInformation(node_list))
 
-    def broadcastPartitionChanges(self, cell_list):
+    def broadcastPartitionChanges(self, cell_list, selector=None):
         """Broadcast a Notify Partition Changes packet."""
         neo.logging.debug('broadcastPartitionChanges')
         if not cell_list:
             return
+        if not selector:
+            selector = lambda n: n.isClient() or n.isStorage() or n.isAdmin()
         self.pt.log()
         ptid = self.pt.setNextID()
         packet = Packets.NotifyPartitionChanges(ptid, cell_list)
         for node in self.nm.getIdentifiedList():
             if not node.isRunning():
                 continue
-            if node.isClient() or node.isStorage() or node.isAdmin():
+            if selector(node):
                 node.notify(packet)
 
     def outdateAndBroadcastPartition(self):





More information about the Neo-report mailing list