Commit 11ff7360 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Rename NotifyInformationLocked packet to AnswerInformationLocked.

This packet was misnamed as it's an answer.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1572 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 64213d90
......@@ -135,8 +135,6 @@ RC - Review output of pylint (CODE)
start/stop/restart/status commands.
- Consider don't close the connection after sending a packet but wait (a
bit) for the closure from the remote peer.
- Rename packets:
- NotifyInformationLocked to AnswerInformationLocked
Storage
......
......@@ -228,7 +228,7 @@ class EventHandler(object):
def lockInformation(self, conn, tid):
raise UnexpectedPacketError
def notifyInformationLocked(self, conn, tid):
def answerInformationLocked(self, conn, tid):
raise UnexpectedPacketError
def invalidateObjects(self, conn, oid_list, tid):
......@@ -400,7 +400,7 @@ class EventHandler(object):
d[Packets.FinishTransaction] = self.finishTransaction
d[Packets.AnswerTransactionFinished] = self.answerTransactionFinished
d[Packets.LockInformation] = self.lockInformation
d[Packets.NotifyInformationLocked] = self.notifyInformationLocked
d[Packets.AnswerInformationLocked] = self.answerInformationLocked
d[Packets.InvalidateObjects] = self.invalidateObjects
d[Packets.NotifyUnlockInformation] = self.notifyUnlockInformation
d[Packets.AskNewOIDs] = self.askNewOIDs
......
......@@ -142,7 +142,7 @@ class PacketLogger(EventHandler):
def lockInformation(self, conn, tid):
pass
def notifyInformationLocked(self, conn, tid):
def answerInformationLocked(self, conn, tid):
pass
def invalidateObjects(self, conn, oid_list, tid):
......
......@@ -50,7 +50,7 @@ class StorageServiceHandler(BaseServiceHandler):
p = Packets.AnswerUnfinishedTransactions(self.app.tm.getPendingList())
conn.answer(p)
def notifyInformationLocked(self, conn, tid):
def answerInformationLocked(self, conn, tid):
uuid = conn.getUUID()
app = self.app
node = app.nm.getByUUID(uuid)
......
......@@ -665,7 +665,7 @@ class LockInformation(Packet):
(tid, ) = unpack('8s', body)
return (_decodeTID(tid), )
class NotifyInformationLocked(Packet):
class AnswerInformationLocked(Packet):
"""
Notify information on a transaction locked. S -> PM.
"""
......@@ -1291,7 +1291,7 @@ class PacketRegistry(dict):
FinishTransaction = register(0x0013, FinishTransaction)
AnswerTransactionFinished = register(0x8013, AnswerTransactionFinished)
LockInformation = register(0x0014, LockInformation)
NotifyInformationLocked = register(0x8014, NotifyInformationLocked)
AnswerInformationLocked = register(0x8014, AnswerInformationLocked)
InvalidateObjects = register(0x0015, InvalidateObjects)
NotifyUnlockInformation = register(0x0016, NotifyUnlockInformation)
AskNewOIDs = register(0x0017, AskNewOIDs)
......
......@@ -67,7 +67,7 @@ class MasterOperationHandler(BaseMasterHandler):
app.dm.storeTransaction(tid, object_list, t.getTransaction())
except KeyError:
pass
conn.answer(Packets.NotifyInformationLocked(tid))
conn.answer(Packets.AnswerInformationLocked(tid))
def notifyUnlockInformation(self, conn, tid):
app = self.app
......
......@@ -265,8 +265,8 @@ class NeoTestBase(unittest.TestCase):
def checkAnswerTransactionFinished(self, conn, **kw):
return self.checkAnswerPacket(conn, Packets.AnswerTransactionFinished, **kw)
def checkNotifyInformationLocked(self, conn, **kw):
return self.checkAnswerPacket(conn, Packets.NotifyInformationLocked, **kw)
def checkAnswerInformationLocked(self, conn, **kw):
return self.checkAnswerPacket(conn, Packets.AnswerInformationLocked, **kw)
def checkLockInformation(self, conn, **kw):
return self.checkAskPacket(conn, Packets.LockInformation, **kw)
......
......@@ -74,7 +74,7 @@ class MasterStorageHandlerTests(NeoTestBase):
conn = self.getFakeConnection(node.getUUID(),node.getAddress())
return (node, conn)
def test_notifyInformationLocked_1(self):
def test_answerInformationLocked_1(self):
"""
Master must refuse to lock if the TID is greater than the last TID
"""
......@@ -83,11 +83,11 @@ class MasterStorageHandlerTests(NeoTestBase):
self.app.tm.setLastTID(tid1)
self.assertTrue(tid1 < tid2)
node, conn = self.identifyToMasterNode()
self.checkProtocolErrorRaised(self.service.notifyInformationLocked,
self.checkProtocolErrorRaised(self.service.answerInformationLocked,
conn, tid2)
self.checkNoPacketSent(conn)
def test_notifyInformationLocked_2(self):
def test_answerInformationLocked_2(self):
"""
Master must:
- lock each storage
......@@ -112,13 +112,13 @@ class MasterStorageHandlerTests(NeoTestBase):
self.app.tm.prepare(tid, oid_list, uuid_list, msg_id)
self.assertTrue(tid in self.app.tm)
# the first storage acknowledge the lock
self.service.notifyInformationLocked(storage_conn_1, tid)
self.service.answerInformationLocked(storage_conn_1, tid)
self.checkNoPacketSent(client_conn_1)
self.checkNoPacketSent(client_conn_2)
self.checkNoPacketSent(storage_conn_1)
self.checkNoPacketSent(storage_conn_2)
# then the second
self.service.notifyInformationLocked(storage_conn_2, tid)
self.service.answerInformationLocked(storage_conn_2, tid)
self.checkAnswerTransactionFinished(client_conn_1)
self.checkInvalidateObjects(client_conn_2)
self.checkNotifyUnlockInformation(storage_conn_1)
......
......@@ -151,12 +151,12 @@ class StorageMasterHandlerTests(NeoTestBase):
self.assertEquals(self.app.load_lock_dict[0], INVALID_TID)
calls = self.app.dm.mockGetNamedCalls('storeTransaction')
self.assertEquals(len(calls), 1)
self.checkNotifyInformationLocked(conn)
self.checkAnswerInformationLocked(conn)
# transaction not in transaction_dict -> KeyError
transaction = Mock({ 'getObjectList': ((0, ), ), })
conn = Mock({ 'isServer': False, })
self.operation.lockInformation(conn, '\x01' * 8)
self.checkNotifyInformationLocked(conn)
self.checkAnswerInformationLocked(conn)
def test_23_notifyUnlockInformation2(self):
# delete transaction informations
......@@ -177,7 +177,7 @@ class StorageMasterHandlerTests(NeoTestBase):
transaction = Mock({ 'getObjectList': ((0, ), ), })
conn = Mock({ 'isServer': False, })
self.operation.lockInformation(conn, '\x01' * 8)
self.checkNotifyInformationLocked(conn)
self.checkAnswerInformationLocked(conn)
def test_30_answerLastIDs(self):
# set critical TID on replicator
......
......@@ -296,9 +296,9 @@ class ProtocolTests(NeoTestBase):
ptid = p.decode()[0]
self.assertEqual(ptid, tid)
def test_39_notifyInformationLocked(self):
def test_39_answerInformationLocked(self):
tid = self.getNextTID()
p = Packets.NotifyInformationLocked(tid)
p = Packets.AnswerInformationLocked(tid)
ptid = p.decode()[0]
self.assertEqual(ptid, 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