Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
transaction
Commits
9cc735ff
Commit
9cc735ff
authored
Feb 08, 2017
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated for explicit mode.
parent
9d288f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
7 deletions
+57
-7
transaction/interfaces.py
transaction/interfaces.py
+57
-7
No files found.
transaction/interfaces.py
View file @
9cc735ff
...
...
@@ -21,40 +21,70 @@ class ITransactionManager(Interface):
Applications use transaction managers to establish transaction boundaries.
"""
explicit
=
Attribute
(
"""Explicit mode indicator.
This is true if the transaction manager is in explicit mode.
In explicit mode, transactions must be begun explicitly, by
calling ``begin()`` and ended explicitly by calling
``commit()`` or ``abort()``.
"""
)
def
begin
():
"""Explicitly begin a new transaction.
If an existing transaction is in progress, it will be aborted.
If an existing transaction is in progress and the transaction
manager not in explicit mode, the previous transaction will be
aborted. If an existing transaction is in progress and the
transaction manager is in explicit mode, an
``AlreadyInTransaction`` exception will be raised..
The ``newTransaction`` method of registered synchronizers is called,
passing the new transaction object.
Note that transactions may be started implicitly without
calling ``begin``. In that case, ``newTransaction`` isn't
called because the transaction manager doesn't know when to
call it. The transaction is likely to have begun long before
the transaction manager is involved. (Conceivably the ``commit`` and
``abort`` methods could call ``begin``, but they don't.)
Note that when not in explicit mode, transactions may be
started implicitly without calling ``begin``. In that case,
``newTransaction`` isn't called because the transaction
manager doesn't know when to call it. The transaction is
likely to have begun long before the transaction manager is
involved. (Conceivably the ``commit`` and ``abort`` methods
could call ``begin``, but they don't.)
"""
def
get
():
"""Get the current transaction.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
commit
():
"""Commit the current transaction.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
abort
():
"""Abort the current transaction.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
doom
():
"""Doom the current transaction.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
isDoomed
():
"""Returns True if the current transaction is doomed, otherwise False.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
savepoint
(
optimistic
=
False
):
...
...
@@ -65,6 +95,9 @@ class ITransactionManager(Interface):
raised if the savepoint is rolled back.
An ISavepoint object is returned.
In explicit mode, if a transaction hasn't begun, a
``NoTransaction`` exception will be raised.
"""
def
registerSynch
(
synch
):
...
...
@@ -525,3 +558,20 @@ class TransientError(TransactionError):
It's possible that retrying the transaction will succeed.
"""
class
NoTransaction
(
TransactionError
):
"""No transaction has been defined
An application called an operation on a transaction manager that
affects an exciting transaction, but no transaction was begun.
The transaction manager was in explicit mode, so a new transaction
was not explicitly created.
"""
class
AlreadyInTransaction
(
TransactionError
):
"""Attempt to create a new transaction without ending a preceding one
An application called ``begin()`` on a transaction manager in
explicit mode, without committing or aborting the previous
transaction.
"""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment