Commit a31e23d7 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a public method on storage TransactionManager to get write lock tid.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2107 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 36d83981
...@@ -197,6 +197,9 @@ class TransactionManager(object): ...@@ -197,6 +197,9 @@ class TransactionManager(object):
transaction = self._getTransaction(tid, uuid) transaction = self._getTransaction(tid, uuid)
transaction.prepare(oid_list, user, desc, ext, packed) transaction.prepare(oid_list, user, desc, ext, packed)
def getLockingTID(self, oid):
return self._store_lock_dict.get(oid)
def storeObject(self, uuid, tid, serial, oid, compression, checksum, data, def storeObject(self, uuid, tid, serial, oid, compression, checksum, data,
value_serial): value_serial):
""" """
......
...@@ -300,5 +300,14 @@ class TransactionManagerTests(NeoTestBase): ...@@ -300,5 +300,14 @@ class TransactionManagerTests(NeoTestBase):
self.assertEqual(self.manager.getObjectFromTransaction(tid1, obj1[0]), self.assertEqual(self.manager.getObjectFromTransaction(tid1, obj1[0]),
obj1) obj1)
def test_getLockingTID(self):
uuid = self.getNewUUID()
serial1, obj1 = self._getObject(1)
oid1 = obj1[0]
tid1, txn1 = self._getTransaction()
self.assertEqual(self.manager.getLockingTID(oid1), None)
self.manager.storeObject(uuid, tid1, serial1, *obj1)
self.assertEqual(self.manager.getLockingTID(oid1), tid1)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
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