doc/book/en/development/devrepo/operations.rst
brancholdstable
changeset 5422 0865e1e90674
parent 4985 02b52bf9f5f8
parent 5421 8167de96c523
child 5424 8ecbcbff9777
equal deleted inserted replaced
4985:02b52bf9f5f8 5422:0865e1e90674
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 Repository operations
       
     4 ======================
       
     5 
       
     6 When one needs to perform operations (real world operations like mail
       
     7 notifications, file operations, real-world side-effects) at
       
     8 transaction commit time, Operations are the way to go.
       
     9 
       
    10 Possible events are:
       
    11 
       
    12 * precommit: the pool is preparing to commit. You shouldn't do
       
    13   anything things which has to be reverted if the commit fail at this
       
    14   point, but you can freely do any heavy computation or raise an
       
    15   exception if the commit can't go.  You can add some new operation
       
    16   during this phase but their precommit event won't be triggered
       
    17 
       
    18 * commit: the pool is preparing to commit. You should avoid to do to
       
    19   expensive stuff or something that may cause an exception in this
       
    20   event
       
    21 
       
    22 * revertcommit: if an operation failed while commited, this event is
       
    23   triggered for all operations which had their commit event already to
       
    24   let them revert things (including the operation which made fail the
       
    25   commit)
       
    26 
       
    27 * rollback: the transaction has been either rollbacked either
       
    28 
       
    29   - intentionaly
       
    30   - a precommit event failed, all operations are rollbacked
       
    31   - a commit event failed, all operations which are not been triggered
       
    32     for commit are rollbacked
       
    33 
       
    34 Exceptions signaled from within a rollback are logged and swallowed.
       
    35 
       
    36 The order of operations may be important, and is controlled according
       
    37 to operation's class (see : Operation, LateOperation, SingleOperation,
       
    38 SingleLastOperation).