[node-patches] Change in ovirt-node[master]: Allow nested transactions

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Sep 24 15:31:16 UTC 2013


Fabian Deutsch has posted comments on this change.

Change subject: Allow nested transactions
......................................................................


Patch Set 1: Code-Review-1

Hey,

if I understand your patch correctly, then a nested transaction behave like adding all the transaction elemements of the "inner" (or sub-TX) transaction to the "outer" (or super-TX) transaction.
Is this correct?

This functionality can already easily achieved by doing the following:

    supertx = CustomTransaction()
    supertx += AnotherCustomTransaction() # Append all TXEs of the sub-TX (AnotherCustomTransaction)

So for nested transaction I imagined a short-cut for the following:

   # Wrapper class so the sub-TX appears liek _one_ TXE in the outer/super-TX
   class TXElementForSubTX(Transaction.Element):
       def commit(self):
           # This will run all TEs of the sub-TX
           SubTX().commit()

   supertx = CustomTransaction()
   supertx.append(TXElementForSubTX()) # Append TX as one TXE

The difference to the first approach is, that now we don't exhibit the Transaction.Elements of the SubTX when running the SuperTX.

Does this make sense?

-- 
To view, visit http://gerrit.ovirt.org/19493
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia74e1dff22827f0b5fb47ba57eaa72c304998474
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No



More information about the node-patches mailing list