Commit 2d5cb3d7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Merge getNextOID() and getNewOIDList() to remove an XXX.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1058 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 41937c5e
...@@ -690,16 +690,6 @@ class Application(object): ...@@ -690,16 +690,6 @@ class Application(object):
handler.connectionCompleted(conn) handler.connectionCompleted(conn)
self.cluster_state = state self.cluster_state = state
# XXX: switch this to private and optimize since it's used only to generate
# ranges of OIDs
def getNextOID(self):
if self.loid is None:
raise RuntimeError, 'I do not know the last OID'
oid = unpack('!Q', self.loid)[0]
self.loid = pack('!Q', oid + 1)
return self.loid
def getNextTID(self): def getNextTID(self):
tm = time() tm = time()
gmt = gmtime(tm) gmt = gmtime(tm)
...@@ -728,7 +718,11 @@ class Application(object): ...@@ -728,7 +718,11 @@ class Application(object):
return unpack('!Q', oid_or_tid)[0] % self.pt.getPartitions() return unpack('!Q', oid_or_tid)[0] % self.pt.getPartitions()
def getNewOIDList(self, num_oids): def getNewOIDList(self, num_oids):
oid_list = [self.getNextOID() for i in xrange(num_oids)] if self.loid is None:
raise RuntimeError, 'I do not know the last OID'
oid = unpack('!Q', self.loid)[0]
oid_list = [pack('!Q', oid + i) for i in xrange(num_oids)]
self.loid = oid_list[-1]
self.broadcastLastOID(self.loid) self.broadcastLastOID(self.loid)
return oid_list return oid_list
......
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