Commit c109d56c authored by Vincent Pelletier's avatar Vincent Pelletier

Change Connection.answer prototype: it now takes a msg_id as parameter, not a...

Change Connection.answer prototype: it now takes a msg_id as parameter, not a message any longer. This make this method easier to call from places where the entire message might not be available.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1045 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f04b641b
...@@ -28,7 +28,7 @@ class AdminEventHandler(EventHandler): ...@@ -28,7 +28,7 @@ class AdminEventHandler(EventHandler):
def __notConnected(self, conn, packet): def __notConnected(self, conn, packet):
conn.answer(protocol.notReady('Not connected to a primary master.'), conn.answer(protocol.notReady('Not connected to a primary master.'),
packet) packet.getId())
def handleAskPartitionList(self, conn, packet, min_offset, max_offset, uuid): def handleAskPartitionList(self, conn, packet, min_offset, max_offset, uuid):
logging.info("ask partition list from %s to %s for %s" %(min_offset, max_offset, dump(uuid))) logging.info("ask partition list from %s to %s for %s" %(min_offset, max_offset, dump(uuid)))
...@@ -64,7 +64,7 @@ class AdminEventHandler(EventHandler): ...@@ -64,7 +64,7 @@ class AdminEventHandler(EventHandler):
port = 0 port = 0
node_information_list.append((node.getNodeType(), (ip, port), node.getUUID(), node.getState())) node_information_list.append((node.getNodeType(), (ip, port), node.getUUID(), node.getState()))
p = protocol.answerNodeList(node_information_list) p = protocol.answerNodeList(node_information_list)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleSetNodeState(self, conn, packet, uuid, state, modify_partition_table): def handleSetNodeState(self, conn, packet, uuid, state, modify_partition_table):
logging.info("set node state for %s-%s" %(dump(uuid), state)) logging.info("set node state for %s-%s" %(dump(uuid), state))
...@@ -76,7 +76,7 @@ class AdminEventHandler(EventHandler): ...@@ -76,7 +76,7 @@ class AdminEventHandler(EventHandler):
if node.getState() == state and modify_partition_table is False: if node.getState() == state and modify_partition_table is False:
# no change # no change
p = protocol.answerNodeState(node.getUUID(), node.getState()) p = protocol.answerNodeState(node.getUUID(), node.getState())
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
# forward to primary master node # forward to primary master node
master_conn = self.app.master_conn master_conn = self.app.master_conn
...@@ -120,7 +120,7 @@ class AdminEventHandler(EventHandler): ...@@ -120,7 +120,7 @@ class AdminEventHandler(EventHandler):
msg_id = master_conn.ask(protocol.askClusterState()) msg_id = master_conn.ask(protocol.askClusterState())
self.app.dispatcher.register(msg_id, conn, {'msg_id' : packet.getId()}) self.app.dispatcher.register(msg_id, conn, {'msg_id' : packet.getId()})
return return
conn.answer(protocol.answerClusterState(self.app.cluster_state), packet) conn.answer(protocol.answerClusterState(self.app.cluster_state), packet.getId())
class MasterEventHandler(EventHandler): class MasterEventHandler(EventHandler):
......
...@@ -242,7 +242,7 @@ class Connection(BaseConnection): ...@@ -242,7 +242,7 @@ class Connection(BaseConnection):
packet_type = packet.getType() packet_type = packet.getType()
if packet_type == protocol.PING: if packet_type == protocol.PING:
# Send a pong notification # Send a pong notification
self.answer(protocol.pong(), packet) self.answer(protocol.pong(), packet.getId())
elif packet_type != protocol.PONG: elif packet_type != protocol.PONG:
# Skip PONG packets, its only purpose is to drop IdleEvent # Skip PONG packets, its only purpose is to drop IdleEvent
# generated upong ping. # generated upong ping.
...@@ -400,9 +400,8 @@ class Connection(BaseConnection): ...@@ -400,9 +400,8 @@ class Connection(BaseConnection):
return msg_id return msg_id
@not_closed @not_closed
def answer(self, packet, answered_packet): def answer(self, packet, msg_id):
""" Answer to a packet by re-using its ID for the packet answer """ """ Answer to a packet by re-using its ID for the packet answer """
msg_id = answered_packet.getId()
packet.setId(msg_id) packet.setId(msg_id)
self._addPacket(packet) self._addPacket(packet)
......
...@@ -101,7 +101,7 @@ class EventHandler(object): ...@@ -101,7 +101,7 @@ class EventHandler(object):
logging.error('malformed packet %s from %s:%d: %s', packet.getType(), *args) logging.error('malformed packet %s from %s:%d: %s', packet.getType(), *args)
response = protocol.protocolError(message) response = protocol.protocolError(message)
if packet is not None: if packet is not None:
conn.answer(response, packet) conn.answer(response, packet.getId())
else: else:
conn.notify(response) conn.notify(response)
conn.abort() conn.abort()
...@@ -116,23 +116,23 @@ class EventHandler(object): ...@@ -116,23 +116,23 @@ class EventHandler(object):
message = 'unexpected packet: %s in %s' % (message, message = 'unexpected packet: %s in %s' % (message,
self.__class__.__name__) self.__class__.__name__)
logging.error('%s', message) logging.error('%s', message)
conn.answer(protocol.protocolError(message), packet) conn.answer(protocol.protocolError(message), packet.getId())
conn.abort() conn.abort()
self.peerBroken(conn) self.peerBroken(conn)
def brokenNodeDisallowedError(self, conn, packet, *args): def brokenNodeDisallowedError(self, conn, packet, *args):
""" Called when a broken node send packets """ """ Called when a broken node send packets """
conn.answer(protocol.brokenNodeDisallowedError('go away'), packet) conn.answer(protocol.brokenNodeDisallowedError('go away'), packet.getId())
conn.abort() conn.abort()
def notReadyError(self, conn, packet, *args): def notReadyError(self, conn, packet, *args):
""" Called when the node is not ready """ """ Called when the node is not ready """
conn.answer(protocol.notReady('retry later'), packet) conn.answer(protocol.notReady('retry later'), packet.getId())
conn.abort() conn.abort()
def protocolError(self, conn, packet, message='', *args): def protocolError(self, conn, packet, message='', *args):
""" Called for any other protocol error """ """ Called for any other protocol error """
conn.answer(protocol.protocolError(message), packet) conn.answer(protocol.protocolError(message), packet.getId())
conn.abort() conn.abort()
def dispatch(self, conn, packet): def dispatch(self, conn, packet):
......
...@@ -78,22 +78,24 @@ class MasterHandler(EventHandler): ...@@ -78,22 +78,24 @@ class MasterHandler(EventHandler):
continue continue
known_master_list.append((n.getServer(), n.getUUID(), )) known_master_list.append((n.getServer(), n.getUUID(), ))
conn.answer(protocol.answerPrimaryMaster(primary_uuid, conn.answer(protocol.answerPrimaryMaster(primary_uuid,
known_master_list), packet) known_master_list),
packet.getId())
def handleAskClusterState(self, conn, packet): def handleAskClusterState(self, conn, packet):
assert conn.getUUID() is not None assert conn.getUUID() is not None
state = self.app.getClusterState() state = self.app.getClusterState()
conn.answer(protocol.answerClusterState(state), packet) conn.answer(protocol.answerClusterState(state), packet.getId())
def handleAskNodeInformation(self, conn, packet): def handleAskNodeInformation(self, conn, packet):
self.app.sendNodesInformations(conn) self.app.sendNodesInformations(conn)
conn.answer(protocol.answerNodeInformation([]), packet) conn.answer(protocol.answerNodeInformation([]), packet.getId())
def handleAskPartitionTable(self, conn, packet, offset_list): def handleAskPartitionTable(self, conn, packet, offset_list):
assert len(offset_list) == 0 assert len(offset_list) == 0
app = self.app app = self.app
app.sendPartitionTable(conn) app.sendPartitionTable(conn)
conn.answer(protocol.answerPartitionTable(app.pt.getID(), []), packet) conn.answer(protocol.answerPartitionTable(app.pt.getID(), []),
packet.getId())
class BaseServiceHandler(MasterHandler): class BaseServiceHandler(MasterHandler):
...@@ -101,10 +103,10 @@ class BaseServiceHandler(MasterHandler): ...@@ -101,10 +103,10 @@ class BaseServiceHandler(MasterHandler):
def handleAskLastIDs(self, conn, packet): def handleAskLastIDs(self, conn, packet):
app = self.app app = self.app
conn.answer(protocol.answerLastIDs(app.loid, app.ltid, app.pt.getID()), packet) conn.answer(protocol.answerLastIDs(app.loid, app.ltid, app.pt.getID()), packet.getId())
def handleAskUnfinishedTransactions(self, conn, packet): def handleAskUnfinishedTransactions(self, conn, packet):
app = self.app app = self.app
p = protocol.answerUnfinishedTransactions(app.finishing_transaction_dict.keys()) p = protocol.answerUnfinishedTransactions(app.finishing_transaction_dict.keys())
conn.answer(p, packet) conn.answer(p, packet.getId())
...@@ -32,12 +32,12 @@ class AdministrationHandler(MasterHandler): ...@@ -32,12 +32,12 @@ class AdministrationHandler(MasterHandler):
def handleAskPrimaryMaster(self, conn, packet): def handleAskPrimaryMaster(self, conn, packet):
app = self.app app = self.app
# I'm the primary # I'm the primary
conn.answer(protocol.answerPrimaryMaster(app.uuid, []), packet) conn.answer(protocol.answerPrimaryMaster(app.uuid, []), packet.getId())
def handleSetClusterState(self, conn, packet, state): def handleSetClusterState(self, conn, packet, state):
self.app.changeClusterState(state) self.app.changeClusterState(state)
p = protocol.noError('cluster state changed') p = protocol.noError('cluster state changed')
conn.answer(p, packet) conn.answer(p, packet.getId())
if state == protocol.STOPPING: if state == protocol.STOPPING:
self.app.cluster_state = state self.app.cluster_state = state
self.app.shutdown() self.app.shutdown()
...@@ -48,7 +48,7 @@ class AdministrationHandler(MasterHandler): ...@@ -48,7 +48,7 @@ class AdministrationHandler(MasterHandler):
node = app.nm.getNodeByUUID(uuid) node = app.nm.getNodeByUUID(uuid)
if node is None: if node is None:
p = protocol.protocolError('invalid uuid') p = protocol.protocolError('invalid uuid')
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
if uuid == app.uuid: if uuid == app.uuid:
...@@ -56,19 +56,19 @@ class AdministrationHandler(MasterHandler): ...@@ -56,19 +56,19 @@ class AdministrationHandler(MasterHandler):
if state == RUNNING_STATE: if state == RUNNING_STATE:
# yes I know # yes I know
p = protocol.noError('node state changed') p = protocol.noError('node state changed')
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
else: else:
# I was asked to shutdown # I was asked to shutdown
node.setState(state) node.setState(state)
p = protocol.noError('node state changed') p = protocol.noError('node state changed')
conn.answer(p, packet) conn.answer(p, packet.getId())
app.shutdown() app.shutdown()
if node.getState() == state: if node.getState() == state:
# no change, just notify admin node # no change, just notify admin node
p = protocol.noError('node state changed') p = protocol.noError('node state changed')
conn.answer(p, packet) conn.answer(p, packet.getId())
else: else:
# first make sure to have a connection to the node # first make sure to have a connection to the node
node_conn = None node_conn = None
...@@ -85,7 +85,7 @@ class AdministrationHandler(MasterHandler): ...@@ -85,7 +85,7 @@ class AdministrationHandler(MasterHandler):
node.setState(state) node.setState(state)
p = protocol.noError('state changed') p = protocol.noError('state changed')
conn.answer(p, packet) conn.answer(p, packet.getId())
app.broadcastNodeInformation(node) app.broadcastNodeInformation(node)
# If this is a storage node, ask it to start. # If this is a storage node, ask it to start.
if node.isStorage() and state == RUNNING_STATE \ if node.isStorage() and state == RUNNING_STATE \
...@@ -128,7 +128,7 @@ class AdministrationHandler(MasterHandler): ...@@ -128,7 +128,7 @@ class AdministrationHandler(MasterHandler):
if not uuid_set: if not uuid_set:
logging.warning('No nodes added') logging.warning('No nodes added')
p = protocol.noError('no nodes added') p = protocol.noError('no nodes added')
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
uuids = ', '.join([dump(uuid) for uuid in uuid_set]) uuids = ', '.join([dump(uuid) for uuid in uuid_set])
logging.info('Adding nodes %s' % uuids) logging.info('Adding nodes %s' % uuids)
...@@ -146,4 +146,4 @@ class AdministrationHandler(MasterHandler): ...@@ -146,4 +146,4 @@ class AdministrationHandler(MasterHandler):
# broadcast the new partition table # broadcast the new partition table
app.broadcastPartitionChanges(app.pt.setNextID(), cell_list) app.broadcastPartitionChanges(app.pt.setNextID(), cell_list)
p = protocol.noError('node added') p = protocol.noError('node added')
conn.answer(p, packet) conn.answer(p, packet.getId())
...@@ -104,11 +104,11 @@ class ClientServiceHandler(BaseServiceHandler): ...@@ -104,11 +104,11 @@ class ClientServiceHandler(BaseServiceHandler):
tid = app.getNextTID() tid = app.getNextTID()
app.ltid = tid app.ltid = tid
app.finishing_transaction_dict[tid] = FinishingTransaction(conn) app.finishing_transaction_dict[tid] = FinishingTransaction(conn)
conn.answer(protocol.answerBeginTransaction(tid), packet) conn.answer(protocol.answerBeginTransaction(tid), packet.getId())
def handleAskNewOIDs(self, conn, packet, num_oids): def handleAskNewOIDs(self, conn, packet, num_oids):
oid_list = self.app.getNewOIDList(num_oids) oid_list = self.app.getNewOIDList(num_oids)
conn.answer(protocol.answerNewOIDs(oid_list), packet) conn.answer(protocol.answerNewOIDs(oid_list), packet.getId())
def handleFinishTransaction(self, conn, packet, oid_list, tid): def handleFinishTransaction(self, conn, packet, oid_list, tid):
app = self.app app = self.app
......
...@@ -253,7 +253,7 @@ class ServerElectionHandler(MasterHandler): ...@@ -253,7 +253,7 @@ class ServerElectionHandler(MasterHandler):
p = protocol.acceptNodeIdentification(MASTER_NODE_TYPE, app.uuid, p = protocol.acceptNodeIdentification(MASTER_NODE_TYPE, app.uuid,
app.server, app.pt.getPartitions(), app.pt.getReplicas(), uuid) app.server, app.pt.getPartitions(), app.pt.getReplicas(), uuid)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAnnouncePrimaryMaster(self, conn, packet): def handleAnnouncePrimaryMaster(self, conn, packet):
uuid = conn.getUUID() uuid = conn.getUUID()
......
...@@ -76,7 +76,7 @@ class IdentificationHandler(MasterHandler): ...@@ -76,7 +76,7 @@ class IdentificationHandler(MasterHandler):
# answer # answer
args = (protocol.MASTER_NODE_TYPE, app.uuid, app.server, args = (protocol.MASTER_NODE_TYPE, app.uuid, app.server,
app.pt.getPartitions(), app.pt.getReplicas(), uuid) app.pt.getPartitions(), app.pt.getReplicas(), uuid)
conn.answer(protocol.acceptNodeIdentification(*args), packet) conn.answer(protocol.acceptNodeIdentification(*args), packet.getId())
# trigger the event # trigger the event
handler.connectionCompleted(conn) handler.connectionCompleted(conn)
app.broadcastNodeInformation(node) app.broadcastNodeInformation(node)
......
...@@ -99,7 +99,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler): ...@@ -99,7 +99,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler):
tid_list = app.dm.getTIDList(first, last - first, tid_list = app.dm.getTIDList(first, last - first,
app.pt.getPartitions(), partition_list) app.pt.getPartitions(), partition_list)
conn.answer(protocol.answerTIDs(tid_list), packet) conn.answer(protocol.answerTIDs(tid_list), packet.getId())
def handleAskObjectHistory(self, conn, packet, oid, first, last): def handleAskObjectHistory(self, conn, packet, oid, first, last):
if first >= last: if first >= last:
...@@ -110,7 +110,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler): ...@@ -110,7 +110,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler):
if history_list is None: if history_list is None:
history_list = [] history_list = []
p = protocol.answerObjectHistory(oid, history_list) p = protocol.answerObjectHistory(oid, history_list)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskTransactionInformation(self, conn, packet, tid): def handleAskTransactionInformation(self, conn, packet, tid):
app = self.app app = self.app
...@@ -119,7 +119,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler): ...@@ -119,7 +119,7 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler):
p = protocol.tidNotFound('%s does not exist' % dump(tid)) p = protocol.tidNotFound('%s does not exist' % dump(tid))
else: else:
p = protocol.answerTransactionInformation(tid, t[1], t[2], t[3], t[0]) p = protocol.answerTransactionInformation(tid, t[1], t[2], t[3], t[0])
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskObject(self, conn, packet, oid, serial, tid): def handleAskObject(self, conn, packet, oid, serial, tid):
app = self.app app = self.app
...@@ -138,5 +138,5 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler): ...@@ -138,5 +138,5 @@ class BaseClientAndStorageOperationHandler(BaseStorageHandler):
else: else:
logging.debug('oid = %s not found', dump(oid)) logging.debug('oid = %s not found', dump(oid))
p = protocol.oidNotFound('%s does not exist' % dump(oid)) p = protocol.oidNotFound('%s does not exist' % dump(oid))
conn.answer(p, packet) conn.answer(p, packet.getId())
...@@ -103,7 +103,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -103,7 +103,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
app = self.app app = self.app
t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid)) t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid))
t.addTransaction(oid_list, user, desc, ext) t.addTransaction(oid_list, user, desc, ext)
conn.answer(protocol.answerStoreTransaction(tid), packet) conn.answer(protocol.answerStoreTransaction(tid), packet.getId())
def handleAskStoreObject(self, conn, packet, oid, serial, def handleAskStoreObject(self, conn, packet, oid, serial,
compression, checksum, data, tid): compression, checksum, data, tid):
...@@ -127,7 +127,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -127,7 +127,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
# do not try to resolve a conflict, so return immediately. # do not try to resolve a conflict, so return immediately.
logging.info('unresolvable conflict in %s', dump(oid)) logging.info('unresolvable conflict in %s', dump(oid))
p = protocol.answerStoreObject(1, oid, locking_tid) p = protocol.answerStoreObject(1, oid, locking_tid)
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
# Next, check if this is generated from the latest revision. # Next, check if this is generated from the latest revision.
...@@ -137,12 +137,12 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -137,12 +137,12 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
if last_serial != serial: if last_serial != serial:
logging.info('resolvable conflict in %s', dump(oid)) logging.info('resolvable conflict in %s', dump(oid))
p = protocol.answerStoreObject(1, oid, last_serial) p = protocol.answerStoreObject(1, oid, last_serial)
conn.answer(p, packet) conn.answer(p, packet.getId())
return return
# Now store the object. # Now store the object.
t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid)) t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid))
t.addObject(oid, compression, checksum, data) t.addObject(oid, compression, checksum, data)
p = protocol.answerStoreObject(0, oid, serial) p = protocol.answerStoreObject(0, oid, serial)
conn.answer(p, packet) conn.answer(p, packet.getId())
app.store_lock_dict[oid] = tid app.store_lock_dict[oid] = tid
...@@ -68,6 +68,6 @@ class IdentificationHandler(BaseStorageHandler): ...@@ -68,6 +68,6 @@ class IdentificationHandler(BaseStorageHandler):
args = (protocol.STORAGE_NODE_TYPE, app.uuid, app.server, args = (protocol.STORAGE_NODE_TYPE, app.uuid, app.server,
app.pt.getPartitions(), app.pt.getReplicas(), uuid) app.pt.getPartitions(), app.pt.getReplicas(), uuid)
# accept the identification and trigger an event # accept the identification and trigger an event
conn.answer(protocol.acceptNodeIdentification(*args), packet) conn.answer(protocol.acceptNodeIdentification(*args), packet.getId())
handler.connectionCompleted(conn) handler.connectionCompleted(conn)
...@@ -69,7 +69,7 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -69,7 +69,7 @@ class MasterOperationHandler(BaseMasterHandler):
app.dm.storeTransaction(tid, object_list, t.getTransaction()) app.dm.storeTransaction(tid, object_list, t.getTransaction())
except KeyError: except KeyError:
pass pass
conn.answer(protocol.notifyInformationLocked(tid), packet) conn.answer(protocol.notifyInformationLocked(tid), packet.getId())
def handleUnlockInformation(self, conn, packet, tid): def handleUnlockInformation(self, conn, packet, tid):
app = self.app app = self.app
......
...@@ -28,7 +28,7 @@ class StorageOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -28,7 +28,7 @@ class StorageOperationHandler(BaseClientAndStorageOperationHandler):
oid = app.dm.getLastOID() oid = app.dm.getLastOID()
tid = app.dm.getLastTID() tid = app.dm.getLastTID()
p = protocol.answerLastIDs(oid, tid, app.ptid) p = protocol.answerLastIDs(oid, tid, app.ptid)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskOIDs(self, conn, packet, first, last, partition): def handleAskOIDs(self, conn, packet, first, last, partition):
# This method is complicated, because I must return OIDs only # This method is complicated, because I must return OIDs only
...@@ -51,5 +51,5 @@ class StorageOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -51,5 +51,5 @@ class StorageOperationHandler(BaseClientAndStorageOperationHandler):
partition_list = [partition] partition_list = [partition]
oid_list = app.dm.getOIDList(first, last - first, oid_list = app.dm.getOIDList(first, last - first,
app.pt.getPartitions(), partition_list) app.pt.getPartitions(), partition_list)
conn.answer(protocol.answerOIDs(oid_list), packet) conn.answer(protocol.answerOIDs(oid_list), packet.getId())
...@@ -30,7 +30,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -30,7 +30,7 @@ class VerificationHandler(BaseMasterHandler):
oid = app.dm.getLastOID() oid = app.dm.getLastOID()
tid = app.dm.getLastTID() tid = app.dm.getLastTID()
p = protocol.answerLastIDs(oid, tid, app.ptid) p = protocol.answerLastIDs(oid, tid, app.ptid)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskPartitionTable(self, conn, packet, offset_list): def handleAskPartitionTable(self, conn, packet, offset_list):
app, pt = self.app, self.app.pt app, pt = self.app, self.app.pt
...@@ -51,7 +51,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -51,7 +51,7 @@ class VerificationHandler(BaseMasterHandler):
raise protocol.ProtocolError('invalid partition table offset') raise protocol.ProtocolError('invalid partition table offset')
p = protocol.answerPartitionTable(app.ptid, row_list) p = protocol.answerPartitionTable(app.ptid, row_list)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list): def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list):
"""This is very similar to Send Partition Table, except that """This is very similar to Send Partition Table, except that
...@@ -75,7 +75,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -75,7 +75,7 @@ class VerificationHandler(BaseMasterHandler):
def handleAskUnfinishedTransactions(self, conn, packet): def handleAskUnfinishedTransactions(self, conn, packet):
tid_list = self.app.dm.getUnfinishedTIDList() tid_list = self.app.dm.getUnfinishedTIDList()
p = protocol.answerUnfinishedTransactions(tid_list) p = protocol.answerUnfinishedTransactions(tid_list)
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskTransactionInformation(self, conn, packet, tid): def handleAskTransactionInformation(self, conn, packet, tid):
app = self.app app = self.app
...@@ -84,7 +84,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -84,7 +84,7 @@ class VerificationHandler(BaseMasterHandler):
p = protocol.tidNotFound('%s does not exist' % dump(tid)) p = protocol.tidNotFound('%s does not exist' % dump(tid))
else: else:
p = protocol.answerTransactionInformation(tid, t[1], t[2], t[3], t[0]) p = protocol.answerTransactionInformation(tid, t[1], t[2], t[3], t[0])
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleAskObjectPresent(self, conn, packet, oid, tid): def handleAskObjectPresent(self, conn, packet, oid, tid):
if self.app.dm.objectPresent(oid, tid): if self.app.dm.objectPresent(oid, tid):
...@@ -92,7 +92,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -92,7 +92,7 @@ class VerificationHandler(BaseMasterHandler):
else: else:
p = protocol.oidNotFound( p = protocol.oidNotFound(
'%s:%s do not exist' % (dump(oid), dump(tid))) '%s:%s do not exist' % (dump(oid), dump(tid)))
conn.answer(p, packet) conn.answer(p, packet.getId())
def handleDeleteTransaction(self, conn, packet, tid): def handleDeleteTransaction(self, conn, packet, tid):
self.app.dm.deleteTransaction(tid, all = True) self.app.dm.deleteTransaction(tid, all = True)
......
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