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