Commit 9adb3fe7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Move getPartition() in master's pt module for consistency.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1060 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 18341e55
......@@ -424,7 +424,7 @@ class Application(object):
uuid_set = set()
# Determine to which nodes I should ask.
partition = self.getPartition(tid)
partition = self.pt.getPartition(tid)
transaction_uuid_list = [cell.getUUID() for cell \
in self.pt.getCellList(partition, readable=True)]
if len(transaction_uuid_list) == 0:
......@@ -456,7 +456,7 @@ class Application(object):
# Verify that all objects are present.
for oid in self.unfinished_oid_set:
self.asking_uuid_dict.clear()
partition = self.getPartition(oid)
partition = self.pt.getPartition(oid)
object_uuid_list = [cell.getUUID() for cell \
in self.pt.getCellList(partition, readable=True)]
if len(object_uuid_list) == 0:
......@@ -710,9 +710,6 @@ class Application(object):
self.ltid = tid
return tid
def getPartition(self, oid_or_tid):
return unpack('!Q', oid_or_tid)[0] % self.pt.getPartitions()
def getNewOIDList(self, num_oids):
if self.loid is None:
raise RuntimeError, 'I do not know the last OID'
......
......@@ -118,7 +118,7 @@ class ClientServiceHandler(BaseServiceHandler):
raise UnexpectedPacketError
# Collect partitions related to this transaction.
getPartition = app.getPartition
getPartition = app.pt.getPartition
partition_set = set()
partition_set.add(getPartition(tid))
partition_set.update((getPartition(oid) for oid in oid_list))
......
......@@ -33,6 +33,9 @@ class PartitionTable(neo.pt.PartitionTable):
self.id = pack('!Q', last_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
......
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