[Neo-report] r2355 gregory - in /trunk/neo: client/app.py master/pt.py pt.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 26 11:44:46 CEST 2010
Author: gregory
Date: Tue Oct 26 11:44:43 2010
New Revision: 2355
Log:
Merge computation of partition from oid or tid.
Same work was done in common and master specific partition table.
Modified:
trunk/neo/client/app.py
trunk/neo/master/pt.py
trunk/neo/pt.py
Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Tue Oct 26 11:44:43 2010
@@ -910,9 +910,8 @@ class Application(object):
# Regroup objects per partition, to ask a minimum set of storage.
partition_oid_dict = {}
pt = self._getPartitionTable()
- getPartitionFromIndex = pt.getPartitionFromIndex
for oid in oid_list:
- partition = pt.getPartitionFromIndex(oid)
+ partition = pt.getPartition(oid)
try:
oid_list = partition_oid_dict[partition]
except KeyError:
Modified: trunk/neo/master/pt.py
==============================================================================
--- trunk/neo/master/pt.py [iso-8859-1] (original)
+++ trunk/neo/master/pt.py [iso-8859-1] Tue Oct 26 11:44:43 2010
@@ -32,9 +32,6 @@ class PartitionTable(neo.pt.PartitionTab
self._id += 1
return self._id
- def getPartition(self, oid_or_tid):
- return unpack('!Q', oid_or_tid)[0] % self.getPartitions()
-
def make(self, node_list):
"""Make a new partition table from scratch."""
# start with the first PTID
Modified: trunk/neo/pt.py
==============================================================================
--- trunk/neo/pt.py [iso-8859-1] (original)
+++ trunk/neo/pt.py [iso-8859-1] Tue Oct 26 11:44:43 2010
@@ -136,12 +136,13 @@ class PartitionTable(object):
return []
def getCellListForTID(self, tid, readable=False, writable=False):
- return self.getCellList(self.getPartitionFromIndex(tid),
- readable, writable)
+ return self.getCellList(self.getPartition(tid), readable, writable)
def getCellListForOID(self, oid, readable=False, writable=False):
- return self.getCellList(self.getPartitionFromIndex(oid),
- readable, writable)
+ return self.getCellList(self.getPartition(oid), readable, writable)
+
+ def getPartition(self, oid_or_tid):
+ return u64(oid_or_tid) % self.getPartitions()
def isAssigned(self, oid, uuid):
""" Check if the oid is assigned to the given node """
@@ -150,12 +151,6 @@ class PartitionTable(object):
return True
return False
- def getPartitionFromIndex(self, index):
- return self._getPartitionFromIndex(u64(index))
-
- def _getPartitionFromIndex(self, index):
- return index % self.np
-
def setCell(self, offset, node, state):
if state == CellStates.DISCARDED:
return self.removeCell(offset, node)
More information about the Neo-report
mailing list