367 if an operation failed while commited, this event is triggered for |
367 if an operation failed while commited, this event is triggered for |
368 all operations which had their commit event already to let them |
368 all operations which had their commit event already to let them |
369 revert things (including the operation which made fail the commit) |
369 revert things (including the operation which made fail the commit) |
370 |
370 |
371 rollback: |
371 rollback: |
372 the transaction has been either rollbacked either |
372 the transaction has been either rollbacked either: |
373 * intentionaly |
373 * intentionaly |
374 * a precommit event failed, all operations are rollbacked |
374 * a precommit event failed, all operations are rollbacked |
375 * a commit event failed, all operations which are not been triggered for |
375 * a commit event failed, all operations which are not been triggered for |
376 commit are rollbacked |
376 commit are rollbacked |
377 |
377 |
378 order of operations may be important, and is controlled according to: |
378 order of operations may be important, and is controlled according to |
379 * operation's class |
379 the insert_index's method output |
380 """ |
380 """ |
381 |
381 |
382 def __init__(self, session, **kwargs): |
382 def __init__(self, session, **kwargs): |
383 self.session = session |
383 self.session = session |
384 self.__dict__.update(kwargs) |
384 self.__dict__.update(kwargs) |
473 since handling operations becomes coslty on massive data import. |
473 since handling operations becomes coslty on massive data import. |
474 """ |
474 """ |
475 try: |
475 try: |
476 session.transaction_data[datakey].add(value) |
476 session.transaction_data[datakey].add(value) |
477 except KeyError: |
477 except KeyError: |
478 opcls(session, *opkwargs) |
478 opcls(session, **opkwargs) |
479 session.transaction_data[datakey] = set((value,)) |
479 session.transaction_data[datakey] = set((value,)) |
480 |
480 |
481 |
481 |
482 class LateOperation(Operation): |
482 class LateOperation(Operation): |
483 """special operation which should be called after all possible (ie non late) |
483 """special operation which should be called after all possible (ie non late) |