Nested component transactions

View: New views
1 Messages — Rating Filter:   Alert me  

Nested component transactions

by mlemos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have not made many Metastorage releases recently but I made some
developments in Metabase that provide flexibility to Metastorage
generated components.

Some applications may need to use classes of multiple components at the
same time, like for instance a blog component may use a forum component
to implement blog comments.

However, if both components start transactions, previously Metabase
would fail complaining that a transaction was already started when the
second component starts the transaction.

In the latest revision of Metastorage, nested transactions are allowed.
This means that when the second component starts a transaction, nothing
happens, the transaction started by the first continues.

When the second component ends a transaction, with either a commit or a
rollback implemented by a factory function of type finishtransaction,
nothing happens either. The transaction is only ended when the outer
component finishes the transaction.

Note that if an inner component requests to end a transaction by
commiting it, the outer component must also do the same consistently,
ie. request to commit the transaction. Likewise, if the inner component
request to rollback the transaction, the outer component must also
rollback the transaction.

Otherwise, Metabase will fail with an error and the transaction is
always rolled back because partial transactions are not supported and so
there is a consistency bug in your application.

If you never have mixed multiple components in an application, never
mind, you do not need to worry about these details.

For now, the version of Metabase that supports nested transactions is
available only from CVS:

http://www.meta-language.net/download.html#snapshots

--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
LightInTheBox - Buy quality products at wholesale price