[Neo-report] r2475 vincent - /trunk/neo/master/handlers/client.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Dec 7 17:01:29 CET 2010
Author: vincent
Date: Tue Dec 7 17:01:28 2010
New Revision: 2475
Log:
Consistently factorise access to app.
Modified:
trunk/neo/master/handlers/client.py
Modified: trunk/neo/master/handlers/client.py
==============================================================================
--- trunk/neo/master/handlers/client.py [iso-8859-1] (original)
+++ trunk/neo/master/handlers/client.py [iso-8859-1] Tue Dec 7 17:01:28 2010
@@ -54,8 +54,9 @@ class ClientServiceHandler(MasterHandler
conn.answer(Packets.AnswerBeginTransaction(self.app.tm.begin()))
def askNewOIDs(self, conn, num_oids):
- conn.answer(Packets.AnswerNewOIDs(self.app.tm.getNextOIDList(num_oids)))
- self.app.broadcastLastOID()
+ app = self.app
+ conn.answer(Packets.AnswerNewOIDs(app.tm.getNextOIDList(num_oids)))
+ app.broadcastLastOID()
def askFinishTransaction(self, conn, tid, oid_list):
app = self.app
@@ -76,25 +77,25 @@ class ClientServiceHandler(MasterHandler
if isStorageReady(uuid)))
# check if greater and foreign OID was stored
- if self.app.tm.updateLastOID(oid_list):
- self.app.broadcastLastOID()
+ if app.tm.updateLastOID(oid_list):
+ app.broadcastLastOID()
# Request locking data.
# build a new set as we may not send the message to all nodes as some
# might be not reachable at that time
p = Packets.AskLockInformation(tid, oid_list)
used_uuid_set = set()
- for node in self.app.nm.getIdentifiedList(pool_set=uuid_set):
+ for node in app.nm.getIdentifiedList(pool_set=uuid_set):
node.ask(p, timeout=60)
used_uuid_set.add(node.getUUID())
- node = self.app.nm.getByUUID(conn.getUUID())
+ node = app.nm.getByUUID(conn.getUUID())
app.tm.prepare(node, tid, oid_list, used_uuid_set, conn.getPeerId())
def askPack(self, conn, tid):
app = self.app
if app.packing is None:
- storage_list = self.app.nm.getStorageList(only_identified=True)
+ storage_list = app.nm.getStorageList(only_identified=True)
app.packing = (conn, conn.getPeerId(),
set(x.getUUID() for x in storage_list))
p = Packets.AskPack(tid)
More information about the Neo-report
mailing list