[ZODB-Dev] simple example of undo( )

Christian Reis kiko@async.com.br
Mon, 23 Sep 2002 22:28:27 -0300


On Mon, Sep 23, 2002 at 08:41:20PM -0400, Jeremy Hylton wrote:
>   CR> abort() works in the same fashion. IIRC is has been said this is
>   CR> by design, as sync() invalidates all objects that are live at
>   CR> that point in time, and this would be considered rude by many
>   CR> applications (our included).
> 
> sync() just invalidates all out of date objects in use by the current
> connection.  Is that really rude?  They are out of date <0.5 wink>.

Not necessarily out of date, are they? Or rather, you might not want all
of them to go away.

Let's say you modified 5 objects in the last transaction. The problem
with sync(), specially in a system like ours, in which many parts of the
UI may have objects that have been modified (but not committed, as
nobody has had the guts to click on "OK" yet). So calling abort()/sync()
can undo things beyond what's desired. 

Yes, one alternative is to separate the UI to one window/instance per
thread, though it does complicate things somewhat in the UI front, of
course.

>   >> The sync() method makes this happen explicitly, but I wonder why
>   >> there isn't some other implicit mechanism.
> 
>   CR> Can we send per-instance invalidation messages? If we can't,
>   CR> then I surmise that may be the reason why it's not done
>   CR> implicitly.
> 
> How would you know what objects to invalidate?

That's a good point. So transactions are atomic in the sense that a
per-instance rollback/undo isn't really possible? The transaction *does*
know what instances have been changed, though, doesn't it?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL