doc/book/en/development/devrepo/operations.rst
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 08 Apr 2010 17:50:37 +0200
branchstable
changeset 5189 84d4587a92bc
parent 3581 669854258b90
permissions -rw-r--r--
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     2
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     3
Repository operations
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     4
======================
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     5
3561
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
     6
When one needs to perform operations (real world operations like mail
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
     7
notifications, file operations, real-world side-effects) at
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
     8
transaction commit time, Operations are the way to go.
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
     9
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    10
Possible events are:
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    11
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    12
* precommit: the pool is preparing to commit. You shouldn't do
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    13
  anything things which has to be reverted if the commit fail at this
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    14
  point, but you can freely do any heavy computation or raise an
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    15
  exception if the commit can't go.  You can add some new operation
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    16
  during this phase but their precommit event won't be triggered
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    17
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    18
* commit: the pool is preparing to commit. You should avoid to do to
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    19
  expensive stuff or something that may cause an exception in this
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    20
  event
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    21
3561
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    22
* revertcommit: if an operation failed while commited, this event is
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    23
  triggered for all operations which had their commit event already to
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    24
  let them revert things (including the operation which made fail the
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    25
  commit)
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    26
3561
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    27
* rollback: the transaction has been either rollbacked either
3581
669854258b90 [doc] various fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 3561
diff changeset
    28
669854258b90 [doc] various fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 3561
diff changeset
    29
  - intentionaly
669854258b90 [doc] various fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 3561
diff changeset
    30
  - a precommit event failed, all operations are rollbacked
669854258b90 [doc] various fixes
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 3561
diff changeset
    31
  - a commit event failed, all operations which are not been triggered
3561
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    32
    for commit are rollbacked
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    33
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    34
Exceptions signaled from within a rollback are logged and swallowed.
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    35
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    36
The order of operations may be important, and is controlled according
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    37
to operation's class (see : Operation, LateOperation, SingleOperation,
a267669f83f9 bits about operations (from the actual docstrings)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 1714
diff changeset
    38
SingleLastOperation).