[Neo-report] r2418 vincent - in /trunk/neo: ./ admin/ neoctl/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 5 18:43:21 CET 2010


Author: vincent
Date: Fri Nov  5 18:43:19 2010
New Revision: 2418

Log:
Remove unused packet definitions.

Those responses are implemented using Error packets.

Modified:
    trunk/neo/admin/handler.py
    trunk/neo/handler.py
    trunk/neo/neoctl/handler.py
    trunk/neo/protocol.py
    trunk/neo/tests/testProtocol.py

Modified: trunk/neo/admin/handler.py
==============================================================================
--- trunk/neo/admin/handler.py [iso-8859-1] (original)
+++ trunk/neo/admin/handler.py [iso-8859-1] Fri Nov  5 18:43:19 2010
@@ -186,7 +186,5 @@ class MasterRequestEventHandler(EventHan
         # sent client the partition table
         self.app.sendPartitionTable(client_conn)
 
-    answerNewNodes = forward_answer(Packets.AnswerNewNodes)
-    answerNodeState = forward_answer(Packets.AnswerNodeState)
     ack = forward_answer(Errors.Ack)
     protocolError = forward_answer(Errors.ProtocolError)

Modified: trunk/neo/handler.py
==============================================================================
--- trunk/neo/handler.py [iso-8859-1] (original)
+++ trunk/neo/handler.py [iso-8859-1] Fri Nov  5 18:43:19 2010
@@ -297,15 +297,9 @@ class EventHandler(object):
     def setNodeState(self, conn, uuid, state, modify_partition_table):
         raise UnexpectedPacketError
 
-    def answerNodeState(self, conn, uuid, state):
-        raise UnexpectedPacketError
-
     def addPendingNodes(self, conn, uuid_list):
         raise UnexpectedPacketError
 
-    def answerNewNodes(self, conn, uuid_list):
-        raise UnexpectedPacketError
-
     def askNodeInformation(self, conn):
         raise UnexpectedPacketError
 
@@ -468,10 +462,8 @@ class EventHandler(object):
         d[Packets.AskNodeList] = self.askNodeList
         d[Packets.AnswerNodeList] = self.answerNodeList
         d[Packets.SetNodeState] = self.setNodeState
-        d[Packets.AnswerNodeState] = self.answerNodeState
         d[Packets.SetClusterState] = self.setClusterState
         d[Packets.AddPendingNodes] = self.addPendingNodes
-        d[Packets.AnswerNewNodes] = self.answerNewNodes
         d[Packets.AskNodeInformation] = self.askNodeInformation
         d[Packets.AnswerNodeInformation] = self.answerNodeInformation
         d[Packets.AskClusterState] = self.askClusterState

Modified: trunk/neo/neoctl/handler.py
==============================================================================
--- trunk/neo/neoctl/handler.py [iso-8859-1] (original)
+++ trunk/neo/neoctl/handler.py [iso-8859-1] Fri Nov  5 18:43:19 2010
@@ -63,7 +63,5 @@ class CommandEventHandler(EventHandler):
 
     answerPartitionList = __answer(Packets.AnswerPartitionList)
     answerNodeList = __answer(Packets.AnswerNodeList)
-    answerNodeState = __answer(Packets.AnswerNodeState)
     answerClusterState = __answer(Packets.AnswerClusterState)
-    answerNewNodes = __answer(Packets.AnswerNewNodes)
     answerPrimary = __answer(Packets.AnswerPrimary)

Modified: trunk/neo/protocol.py
==============================================================================
--- trunk/neo/protocol.py [iso-8859-1] (original)
+++ trunk/neo/protocol.py [iso-8859-1] Fri Nov  5 18:43:19 2010
@@ -1358,22 +1358,6 @@ class SetNodeState(Packet):
         uuid = _decodeUUID(uuid)
         return (uuid, state, modify)
 
-class AnswerNodeState(Packet):
-    """
-    Answer state of the node
-    """
-    _header_format = '!16sH'
-
-    def _encode(self, uuid, state):
-        uuid = _encodeUUID(uuid)
-        return ''.join([pack(self._header_format, uuid, state)])
-
-    def _decode(self, body):
-        (uuid, state) = unpack(self._header_format, body)
-        state = _decodeNodeState(state)
-        uuid = _decodeUUID(uuid)
-        return (uuid, state)
-
 class AddPendingNodes(Packet):
     """
     Ask the primary to include some pending node in the partition table
@@ -1400,32 +1384,6 @@ class AddPendingNodes(Packet):
         uuid_list = [_decodeUUID(x) for x in uuid_list]
         return (uuid_list, )
 
-class AnswerNewNodes(Packet):
-    """
-    Answer what are the nodes added in the partition table
-    """
-    _header_format = '!H'
-    _list_header_format = '!16s'
-    _list_header_len = calcsize(_list_header_format)
-
-    def _encode(self, uuid_list):
-        list_header_format = self._list_header_format
-        # an empty list means no new nodes
-        uuid_list = [pack(list_header_format, _encodeUUID(uuid)) for \
-            uuid in uuid_list]
-        return pack(self._header_format, len(uuid_list)) + ''.join(uuid_list)
-
-    def _decode(self, body):
-        header_len = self._header_len
-        (n, ) = unpack(self._header_format, body[:header_len])
-        list_header_format = self._list_header_format
-        list_header_len = self._list_header_len
-        uuid_list = [unpack(list_header_format,
-            body[header_len+i*list_header_len:\
-                 header_len+(i+1)*list_header_len])[0] for i in xrange(n)]
-        uuid_list = [_decodeUUID(x) for x in uuid_list]
-        return (uuid_list, )
-
 class NotifyNodeInformation(Packet):
     """
     Notify information about one or more nodes. PM -> Any.
@@ -1928,14 +1886,14 @@ class PacketRegistry(dict):
             0x0022,
             AskNodeList,
             AnswerNodeList)
-    SetNodeState, AnswerNodeState = register(
+    SetNodeState = register(
             0x0023,
             SetNodeState,
-            AnswerNodeState)
-    AddPendingNodes, AnswerNewNodes = register(
+            Error)
+    AddPendingNodes = register(
             0x0024,
             AddPendingNodes,
-            AnswerNewNodes)
+            Error)
     AskNodeInformation, AnswerNodeInformation = register(
             0x0025,
             AskNodeInformation,

Modified: trunk/neo/tests/testProtocol.py
==============================================================================
--- trunk/neo/tests/testProtocol.py [iso-8859-1] (original)
+++ trunk/neo/tests/testProtocol.py [iso-8859-1] Fri Nov  5 18:43:19 2010
@@ -518,22 +518,11 @@ class ProtocolTests(NeoUnitTestBase):
         p = Packets.AskNodeInformation()
         self.assertEqual(p.decode(), ())
 
-    def test_AnswerNewNodes(self):
-        uuid1, uuid2 = self.getNewUUID(), self.getNewUUID()
-        p = Packets.AnswerNewNodes([uuid1, uuid2])
-        self.assertEqual(p.decode(), ([uuid1, uuid2], ))
-
     def test_AddPendingNodes(self):
         uuid1, uuid2 = self.getNewUUID(), self.getNewUUID()
         p = Packets.AddPendingNodes([uuid1, uuid2])
         self.assertEqual(p.decode(), ([uuid1, uuid2], ))
 
-    def test_AnswerNodeState(self):
-        uuid = self.getNewUUID()
-        state = NodeStates.RUNNING
-        p = Packets.AnswerNodeState(uuid, state)
-        self.assertEqual(p.decode(), (uuid, state))
-
     def test_SetNodeState(self):
         uuid = self.getNewUUID()
         state = NodeStates.PENDING





More information about the Neo-report mailing list