Skip to content
Snippets Groups Projects
  1. Nov 16, 2021
    • Hanna Reitz's avatar
      transactions: Invoke clean() after everything else · 079bff69
      Hanna Reitz authored
      
      Invoke the transaction drivers' .clean() methods only after all
      .commit() or .abort() handlers are done.
      
      This makes it easier to have nested transactions where the top-level
      transactions pass objects to lower transactions that the latter can
      still use throughout their commit/abort phases, while the top-level
      transaction keeps a reference that is released in its .clean() method.
      
      (Before this commit, that is also possible, but the top-level
      transaction would need to take care to invoke tran_add() before the
      lower-level transaction does.  This commit makes the ordering
      irrelevant, which is just a bit nicer.)
      
      Signed-off-by: default avatarHanna Reitz <hreitz@redhat.com>
      Message-Id: <20211111120829.81329-8-hreitz@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20211115145409.176785-8-kwolf@redhat.com>
      Signed-off-by: default avatarHanna Reitz <hreitz@redhat.com>
      079bff69
  2. Apr 30, 2021
    • Vladimir Sementsov-Ogievskiy's avatar
      util: add transactions.c · 8cad15b1
      Vladimir Sementsov-Ogievskiy authored
      
      Add simple transaction API to use in further update of block graph
      operations.
      
      Supposed usage is:
      
      - "prepare" is main function of the action and it should make the main
        effect of the action to be visible for the following actions, keeping
        possibility of roll-back, saving necessary things in action state,
        which is prepended to the action list (to do that, prepare func
        should call tran_add()). So, driver struct doesn't include "prepare"
        field, as it is supposed to be called directly.
      
      - commit/rollback is supposed to be called for the list of action
        states, to commit/rollback all the actions in reverse order
      
      - When possible "commit" should not make visible effect for other
        actions, which make possible transparent logical interaction between
        actions.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20210428151804.439460-9-vsementsov@virtuozzo.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      8cad15b1
Loading