Commit e242ab2d authored by Vincent Pelletier's avatar Vincent Pelletier

Consistently factorise access to app.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2475 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2d8d3804
......@@ -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)
......
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