[Neo-report] r1991 gregory - in /trunk/neo/admin: app.py handler.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 1 16:10:04 CEST 2010
Author: gregory
Date: Thu Apr 1 16:09:58 2010
New Revision: 1991
Log:
Use methods and properties of PartitionTable.
Remove admin's app.ptid attribute, use pt.load() and pt.update() instead
of copy/paste the code.
Modified:
trunk/neo/admin/app.py
trunk/neo/admin/handler.py
Modified: trunk/neo/admin/app.py
==============================================================================
--- trunk/neo/admin/app.py [iso-8859-1] (original)
+++ trunk/neo/admin/app.py [iso-8859-1] Thu Apr 1 16:09:58 2010
@@ -69,7 +69,6 @@
self.pt = None
self.uuid = config.getUUID()
self.primary_master_node = None
- self.ptid = None
self.request_handler = MasterRequestEventHandler(self)
self.master_event_handler = MasterEventHandler(self)
self.dispatcher = Dispatcher()
@@ -162,5 +161,5 @@
p = Errors.ProtocolError('invalid partition table offset')
conn.notify(p)
return
- p = Packets.AnswerPartitionList(self.ptid, row_list)
+ p = Packets.AnswerPartitionList(self.pt.getID(), row_list)
conn.answer(p)
Modified: trunk/neo/admin/handler.py
==============================================================================
--- trunk/neo/admin/handler.py [iso-8859-1] (original)
+++ trunk/neo/admin/handler.py [iso-8859-1] Thu Apr 1 16:09:58 2010
@@ -152,29 +152,12 @@
logging.debug("answerPartitionTable")
def notifyPartitionChanges(self, conn, ptid, cell_list):
- app = self.app
- if ptid < app.ptid:
- # Ignore this packet.
- return
- app.ptid = ptid
- app.pt.update(ptid, cell_list, app.nm)
+ self.app.pt.update(ptid, cell_list, self.app.nm)
def sendPartitionTable(self, conn, ptid, row_list):
- uuid = conn.getUUID()
- app = self.app
- nm = app.nm
- pt = app.pt
- node = app.nm.getByUUID(uuid)
- if app.ptid != ptid:
- app.ptid = ptid
- pt.clear()
- for offset, row in row_list:
- for uuid, state in row:
- node = nm.getByUUID(uuid)
- if node is None:
- node = nm.createStorage(uuid=uuid)
- pt.setCell(offset, node, state)
- pt.log()
+ self.app.pt.clear()
+ self.app.pt.load(ptid, row_list, self.app.nm)
+ self.app.pt.log()
def notifyClusterInformation(self, conn, cluster_state):
self.app.cluster_state = cluster_state
More information about the Neo-report
mailing list