Example #1
0
 def test_concurrent_tx_sees_original_value_on_delete(self, keyfs):
     D = keyfs.add_key("NAME", "hello", dict)
     with keyfs.transaction(write=True):
         D.set({1:2})
     tx_1 = Transaction(keyfs, write=True)
     tx_2 = Transaction(keyfs)
     tx_1.delete(D)
     tx_1.commit()
     assert tx_2.get(D) == {1:2}
Example #2
0
 def test_at_serial_restart(self, keyfs):
     key = keyfs.add_key("hello", "hello", dict)
     with keyfs.transaction() as txr:
         tx = Transaction(keyfs, write=True)
         tx.set(key, {1:1})
         tx.commit()
         keyfs.restart_read_transaction()
     assert txr.commit_serial is None
     assert txr.at_serial == 0
Example #3
0
 def test_concurrent_tx_sees_original_value_on_write(self, keyfs):
     D = keyfs.add_key("NAME", "hello", dict)
     tx_1 = Transaction(keyfs, write=True)
     tx_2 = Transaction(keyfs)
     ser = tx_1.conn.last_changelog_serial + 1
     tx_1.set(D, {1:1})
     tx1_serial = tx_1.commit()
     assert tx1_serial == ser
     assert tx_2.at_serial == ser - 1
     with keyfs._storage.get_connection() as conn:
         assert conn.last_changelog_serial == ser
     assert D not in tx_2.cache and D not in tx_2.dirty
     assert tx_2.get(D) == {}