Esempio n. 1
0
 def checkTypicalUsage(self):
     tbuf = TransactionBuffer(0)
     store(tbuf)
     store(tbuf)
     for o in tbuf:
         pass
     tbuf.close()
 def checkTypicalUsage(self):
     tbuf = TransactionBuffer(0)
     store(tbuf)
     store(tbuf)
     for o in tbuf:
         pass
     tbuf.close()
Esempio n. 3
0
    def checkOrderPreserved(self):
        tbuf = TransactionBuffer(0)
        data = []
        for i in range(10):
            data.append((store(tbuf), False))
            data.append((store(tbuf, True), True))

        for i, (oid, d, resolved) in enumerate(tbuf):
            self.assertEqual((oid, d), data[i][0])
            self.assertEqual(resolved, data[i][1])
        tbuf.close()
    def checkOrderPreserved(self):
        tbuf = TransactionBuffer(0)
        data = []
        for i in range(10):
            data.append((store(tbuf), False))
            data.append((store(tbuf, True), True))

        for i, (oid, d, resolved) in enumerate(tbuf):
            self.assertEqual((oid, d), data[i][0])
            self.assertEqual(resolved, data[i][1])
        tbuf.close()
Esempio n. 5
0
    def tpc_begin(self, txn, tid=None, status=' '):
        """Storage API: begin a transaction."""
        if self._is_read_only:
            raise POSException.ReadOnlyError()

        try:
            tbuf = txn.data(self)
        except AttributeError:
            # Gaaaa. This is a recovery transaction. Work around this
            # until we can think of something better. XXX
            tb = {}
            txn.data = tb.__getitem__
            txn.set_data = tb.__setitem__
        except KeyError:
            pass
        else:
            if tbuf is not None:
                raise POSException.StorageTransactionError(
                    "Duplicate tpc_begin calls for same transaction")

        txn.set_data(self, TransactionBuffer(self._connection_generation))

        # XXX we'd like to allow multiple transactions at a time at some point,
        # but for now, due to server limitations, TCBOO.
        self._commit_lock.acquire()
        self._tbuf = txn.data(self)

        try:
            self._async('tpc_begin', id(txn), txn.user, txn.description,
                        txn.extension, tid, status)
        except ClientDisconnected:
            self.tpc_end(txn)
            raise
Esempio n. 6
0
 def checkReusable(self):
     tbuf = TransactionBuffer()
     self.doUpdates(tbuf)
     tbuf.clear()
     self.doUpdates(tbuf)
     tbuf.clear()
     self.doUpdates(tbuf)
Esempio n. 7
0
 def checkOrderPreserved(self):
     tbuf = TransactionBuffer()
     self.doUpdates(tbuf)
Esempio n. 8
0
 def checkTypicalUsage(self):
     tbuf = TransactionBuffer()
     tbuf.store(*new_store_data())
     tbuf.invalidate(*new_invalidate_data())
     for o in tbuf:
         pass