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

Few accesses to 'app', don't get intermediate variable.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1622 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 31087cad
......@@ -138,9 +138,8 @@ class PrimaryNotificationsHandler(BaseHandler):
# because it's in the master handler, so the connection is already
# established.
def notifyPartitionChanges(self, conn, ptid, cell_list):
pt = self.app.pt
if pt.filled():
pt.update(ptid, cell_list, self.app.nm)
if self.app.pt.filled():
self.app.pt.update(ptid, cell_list, self.app.nm)
def sendPartitionTable(self, conn, ptid, row_list):
self.app.pt.load(ptid, row_list, self.app.nm)
......@@ -159,20 +158,18 @@ class PrimaryNotificationsHandler(BaseHandler):
app.cp.removeConnection(conn)
self.dispatcher.unregister(conn)
class PrimaryAnswersHandler(AnswerBaseHandler):
""" Handle that process expected packets from the primary master """
def answerBeginTransaction(self, conn, tid):
app = self.app
app.setTID(tid)
self.app.setTID(tid)
def answerNewOIDs(self, conn, oid_list):
app = self.app
app.new_oid_list = oid_list
app.new_oid_list.reverse()
self.app.new_oid_list = oid_list
self.app.new_oid_list.reverse()
def answerTransactionFinished(self, conn, tid):
app = self.app
if tid == app.getTID():
app.setTransactionFinished()
if tid == self.app.getTID():
self.app.setTransactionFinished()
......@@ -48,18 +48,17 @@ class StorageBootstrapHandler(AnswerBaseHandler):
""" Handler used when connecting to a storage node """
def notReady(self, conn, message):
app = self.app
app.setNodeNotReady()
self.app.setNodeNotReady()
def acceptIdentification(self, conn, node_type,
uuid, num_partitions, num_replicas, your_uuid):
app = self.app
node = app.nm.getByAddress(conn.getAddress())
# this must be a storage node
if node_type != NodeTypes.STORAGE:
conn.close()
return
node = self.app.nm.getByAddress(conn.getAddress())
assert node is not None, conn.getAddress()
conn.setUUID(uuid)
node.setUUID(uuid)
......@@ -68,16 +67,14 @@ class StorageAnswersHandler(AnswerBaseHandler):
def answerObject(self, conn, oid, start_serial, end_serial,
compression, checksum, data):
app = self.app
app.local_var.asked_object = (oid, start_serial, end_serial,
self.app.local_var.asked_object = (oid, start_serial, end_serial,
compression, checksum, data)
def answerStoreObject(self, conn, conflicting, oid, serial):
app = self.app
if conflicting:
app.local_var.object_stored = -1, serial
self.app.local_var.object_stored = -1, serial
else:
app.local_var.object_stored = oid, serial
self.app.local_var.object_stored = oid, serial
def answerStoreTransaction(self, conn, tid):
app = self.app
......@@ -85,7 +82,6 @@ class StorageAnswersHandler(AnswerBaseHandler):
def answerTransactionInformation(self, conn, tid,
user, desc, ext, oid_list):
app = self.app
# transaction information are returned as a dict
info = {}
info['time'] = TimeStamp(tid).timeTime()
......@@ -93,27 +89,23 @@ class StorageAnswersHandler(AnswerBaseHandler):
info['description'] = desc
info['id'] = tid
info['oids'] = oid_list
app.local_var.txn_info = info
self.app.local_var.txn_info = info
def answerObjectHistory(self, conn, oid, history_list):
app = self.app
# history_list is a list of tuple (serial, size)
app.local_var.history = oid, history_list
self.app.local_var.history = oid, history_list
def oidNotFound(self, conn, message):
app = self.app
# This can happen either when :
# - loading an object
# - asking for history
app.local_var.asked_object = -1
app.local_var.history = -1
self.app.local_var.asked_object = -1
self.app.local_var.history = -1
def tidNotFound(self, conn, message):
app = self.app
# This can happen when requiring txn informations
app.local_var.txn_info = -1
self.app.local_var.txn_info = -1
def answerTIDs(self, conn, tid_list):
app = self.app
app.local_var.node_tids[conn.getUUID()] = tid_list
self.app.local_var.node_tids[conn.getUUID()] = tid_list
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