Commit dfa4e9e5 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Add helper methods to filter nodes depending on connection state.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1816 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6c55fec4
...@@ -279,6 +279,24 @@ class NodeManager(object): ...@@ -279,6 +279,24 @@ class NodeManager(object):
return list(self._node_set) return list(self._node_set)
return filter(node_filter, self._node_set) return filter(node_filter, self._node_set)
def getIdentifiedList(self, pool_set=None):
"""
Returns a generator to iterate over identified nodes
"""
# TODO: use an index
if pool_set is None:
return [x for x in self._node_set if x.isIdentified()]
else:
return [x for x in self._node_set if x.isIdentified() and
x.getUUID() in pool_set]
def getConnectedList(self):
"""
Returns a generator to iterate over connected nodes
"""
# TODO: use an index
return [x for x in self._node_set if x.isConnected()]
def __getList(self, index_dict, key): def __getList(self, index_dict, key):
return list(index_dict.setdefault(key, set())) return list(index_dict.setdefault(key, set()))
......
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