Exemple #1
0
 def sendPartitionTable(self, conn, min_offset, max_offset, uuid):
     pt = self.pt
     if max_offset == 0:
         max_offset = pt.getPartitions()
     try:
         row_list = map(pt.getRow, xrange(min_offset, max_offset))
     except IndexError:
         conn.send(Errors.ProtocolError('invalid partition table offset'))
     else:
         conn.answer(
             Packets.AnswerPartitionList(pt.getID(), pt.getReplicas(),
                                         row_list))
Exemple #2
0
 def sendPartitionTable(self, conn, min_offset, max_offset, uuid):
     # we have a pt
     self.pt.log()
     row_list = []
     if max_offset == 0:
         max_offset = self.pt.getPartitions()
     try:
         for offset in xrange(min_offset, max_offset):
             row = []
             try:
                 for cell in self.pt.getCellList(offset):
                     if uuid is None or cell.getUUID() == uuid:
                         row.append((cell.getUUID(), cell.getState()))
             except TypeError:
                 pass
             row_list.append((offset, row))
     except IndexError:
         conn.send(Errors.ProtocolError('invalid partition table offset'))
     else:
         conn.answer(Packets.AnswerPartitionList(self.pt.getID(), row_list))