Commit 1745d6ac authored by Julien Muchembled's avatar Julien Muchembled

storage: optimize DatabaseManager._getPartition

parent 07e11994
...@@ -52,7 +52,9 @@ class DatabaseManager(object): ...@@ -52,7 +52,9 @@ class DatabaseManager(object):
pass pass
def _getPartition(self, oid_or_tid): def _getPartition(self, oid_or_tid):
return oid_or_tid % self.getNumPartitions() np = self.getNumPartitions()
self._getPartition = lambda x: x % np
return self._getPartition(oid_or_tid)
def getConfiguration(self, key): def getConfiguration(self, key):
""" """
...@@ -97,6 +99,7 @@ class DatabaseManager(object): ...@@ -97,6 +99,7 @@ class DatabaseManager(object):
Store the number of partitions into a database. Store the number of partitions into a database.
""" """
self.setConfiguration('partitions', num_partitions) self.setConfiguration('partitions', num_partitions)
self.__class__._getPartition(self, 0)
def getNumReplicas(self): def getNumReplicas(self):
""" """
......
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