Commit 426c2ebb authored by Grégory Wisniewski's avatar Grégory Wisniewski

Allow specifying a node selector when broadcasting partition changes.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2431 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 466c5df2
...@@ -285,18 +285,20 @@ class Application(object): ...@@ -285,18 +285,20 @@ class Application(object):
if node_list and node.isRunning(): if node_list and node.isRunning():
node.notify(Packets.NotifyNodeInformation(node_list)) node.notify(Packets.NotifyNodeInformation(node_list))
def broadcastPartitionChanges(self, cell_list): def broadcastPartitionChanges(self, cell_list, selector=None):
"""Broadcast a Notify Partition Changes packet.""" """Broadcast a Notify Partition Changes packet."""
neo.logging.debug('broadcastPartitionChanges') neo.logging.debug('broadcastPartitionChanges')
if not cell_list: if not cell_list:
return return
if not selector:
selector = lambda n: n.isClient() or n.isStorage() or n.isAdmin()
self.pt.log() self.pt.log()
ptid = self.pt.setNextID() ptid = self.pt.setNextID()
packet = Packets.NotifyPartitionChanges(ptid, cell_list) packet = Packets.NotifyPartitionChanges(ptid, cell_list)
for node in self.nm.getIdentifiedList(): for node in self.nm.getIdentifiedList():
if not node.isRunning(): if not node.isRunning():
continue continue
if node.isClient() or node.isStorage() or node.isAdmin(): if selector(node):
node.notify(packet) node.notify(packet)
def outdateAndBroadcastPartition(self): def outdateAndBroadcastPartition(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment