Re: [ZODB-Dev] Re: Historical Persistent References -- Feedback Wanted!

2006-03-15 Thread Jim Fulton

Dieter Maurer wrote:

Matt Hahnfeld wrote at 2006-3-13 14:33 -0500:


...
I found your code a while back and actually looked it over quit a bit
before I started coding the solution I attached.  Would you be able to
explain how it works?



It works through a special HistoryJar (for some unknown reason,
the ZODB uses jar as a term for a ZODB connection).


This goes back to early BoboPOS versions and is based on the
notion of a pickle jar.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Re: Historical Persistent References -- Feedback Wanted!

2006-03-14 Thread Dieter Maurer
Matt Hahnfeld wrote at 2006-3-13 14:33 -0500:
 ...
I found your code a while back and actually looked it over quit a bit
before I started coding the solution I attached.  Would you be able to
explain how it works?

It works through a special HistoryJar (for some unknown reason,
the ZODB uses jar as a term for a ZODB connection).

When you create a HistoryJar, you pass in a serial (a timestamp).
Objects retrieved via this connection have (all) the state
as it was current at the time identified by the serial.

The implementation uses the ZODB history for an object
which is the sequence of the object's states corresponding to the
various object modifications. The state with the smallest serial
not smaller than the HistoryJars serial is retrieved by
the HistoryJar (if any).

Most of the implementation is just doing the above operations
in an efficient way.

 ...
BTW, if your posted solution is still viable, I'd be more than happy to
help port it to 2.8, or help out in whatever other capacity I can.

I had to override a few (I think a single) Connection methods;
with Zope 2.8 (and upward) almost surely some more/other methods
need overriding (as connections and transaction handling
have changed quite some bit).


-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


[ZODB-Dev] Re: Historical Persistent References -- Feedback Wanted!

2006-03-13 Thread Matt Hahnfeld
On Mon, 13 Mar 2006 19:54:43 +0100, Dieter Maurer wrote:

To make a long story short, the current implementation of
historicalRevision in Zope's OFS/History.py calls oldstate() in
ZODB/Connection.py.  The serializer then calls getState() in
ZODB/serialize.py (class ObjectReader), which sets up an unpickler to
handle persistent references by overriding _persistent_load(). 
Unfortunately, when the _persistent_load subroutine comes across a
persistent reference, it either loads the CURRENT referenced object
from the ZODB (using the oid and ZODB/Connection.py's get()), or loads the
CURRENT referenced object from cache.  It does not take 'tid' into account
when it loads persistent references.
 
 A long time ago, I posted code (I think to zope-dev@zope.org)
 that does it for you in the right way.
 It defines a HistoricalConnection which retrieves objects
 with a state as of a given time.
 You might search for historicalRevision and HistoryJar
 to locate the post.
 
 
 Zope 2.8/ZODB 3.4 broke my implementation but it would probably
 not too difficult to get fixed.

Dieter --

I found your code a while back and actually looked it over quit a bit
before I started coding the solution I attached.  Would you be able to
explain how it works?  A lot of your code made sense, but I was a bit
overwhelmed by some of it.

Here's the link:
http://article.gmane.org/gmane.comp.web.zope.zodb/6327

BTW, if your posted solution is still viable, I'd be more than happy to
help port it to 2.8, or help out in whatever other capacity I can.


___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev