Commit 60bcbc5c authored by Julien Muchembled's avatar Julien Muchembled

PartitionTable: small optimization

parent aa48adf9
...@@ -120,13 +120,9 @@ class PartitionTable(object): ...@@ -120,13 +120,9 @@ class PartitionTable(object):
def getReadableOffsetList(self, uuid): def getReadableOffsetList(self, uuid):
""" Return the partition assigned to the specified UUID """ """ Return the partition assigned to the specified UUID """
assigned_partitions = [] return [offset for offset, cell_list in enumerate(self.partition_list)
for offset in xrange(self.np): if uuid in (cell.getUUID() for cell in cell_list
for cell in self.getCellList(offset, readable=True): if cell.isReadable())]
if cell.getUUID() == uuid:
assigned_partitions.append(offset)
break
return assigned_partitions
def hasOffset(self, offset): def hasOffset(self, offset):
try: try:
...@@ -149,7 +145,7 @@ class PartitionTable(object): ...@@ -149,7 +145,7 @@ class PartitionTable(object):
return list(self.partition_list[offset]) return list(self.partition_list[offset])
def getPartition(self, oid_or_tid): def getPartition(self, oid_or_tid):
return u64(oid_or_tid) % self.getPartitions() return u64(oid_or_tid) % self.np
def getOutdatedOffsetListFor(self, uuid): def getOutdatedOffsetListFor(self, uuid):
return [ return [
......
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