[Zodb-checkins] CVS: ZODB4/Transaction - interfaces.py:1.1 Transaction.py:1.7 Manager.py:1.6 _defaultTransaction.py:NONE ITransaction.py:NONE IDataManager.py:NONE Exceptions.py:NONE

Jeremy Hylton jeremy@zope.com
Fri, 20 Dec 2002 13:54:54 -0500


Update of /cvs-repository/ZODB4/Transaction
In directory cvs.zope.org:/tmp/cvs-serv6232/Transaction

Modified Files:
	Transaction.py Manager.py 
Added Files:
	interfaces.py 
Removed Files:
	_defaultTransaction.py ITransaction.py IDataManager.py 
	Exceptions.py 
Log Message:
Consolidate interfaces in Transaction package


=== Added File ZODB4/Transaction/interfaces.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
from Interface import Interface

class TransactionError(StandardError):
    """An error occured due to normal transaction processing."""

class ConflictError(TransactionError):
    """Two transactions tried to modify the same object at once

    This transaction should be resubmitted.
    """

class RollbackError(TransactionError):
    """An error occurred rolling back a savepoint."""

class IDataManager(Interface):
    """Data management interface for storing objects transactionally

    This is currently implemented by ZODB database connections.
    """

    def prepare(transaction):
        """Begin two-phase commit of a transaction.

        DataManager should return True or False.
        """
        
    def abort(transaction):
        """Abort changes made by transaction."""
    
    def commit(transaction):
        """Commit changes made by transaction."""

    def savepoint(transaction):
        """Do tentative commit of changes to this point.

        Should return an object implementing IRollback
        """
        
class IRollback(Interface):
    
    def rollback():
        """Rollback changes since savepoint."""

class ITransaction(Interface):
    """Transaction objects

    Application code typically gets these by calling
    get_transaction().
    """

    def abort():
        """Abort the current transaction."""

    def begin():
        """Begin a transaction."""

    def commit():
        """Commit a transaction."""

    def join(resource):
        """Join a resource manager to the current transaction."""

    def status():
        """Return status of the current transaction."""


=== ZODB4/Transaction/Transaction.py 1.6 => 1.7 ===
--- ZODB4/Transaction/Transaction.py:1.6	Fri Dec 13 12:09:58 2002
+++ ZODB4/Transaction/Transaction.py	Fri Dec 20 13:54:53 2002
@@ -3,8 +3,7 @@
 
 __metaclass__ = type
 
-from ITransaction import ITransaction
-from Exceptions import TransactionError
+from interfaces import ITransaction, TransactionError
 
 class Set(dict):
 


=== ZODB4/Transaction/Manager.py 1.5 => 1.6 ===
--- ZODB4/Transaction/Manager.py:1.5	Thu Dec 19 17:05:29 2002
+++ ZODB4/Transaction/Manager.py	Fri Dec 20 13:54:53 2002
@@ -1,6 +1,6 @@
 import logging
 
-from IDataManager import IRollback
+from interfaces import IRollback
 from Transaction import Transaction, Status
 
 # XXX need to change asserts of transaction status into explicit checks

=== Removed File ZODB4/Transaction/_defaultTransaction.py ===

=== Removed File ZODB4/Transaction/ITransaction.py ===

=== Removed File ZODB4/Transaction/IDataManager.py ===

=== Removed File ZODB4/Transaction/Exceptions.py ===