[Zope-dev] Re: [Zope] [Bug] "bobobase_modification_time" unreliable to catalog
Casey Duncan
c.duncan@nlada.org
Mon, 7 Jan 2002 09:20:47 -0500
On Saturday 05 January 2002 08:15 pm, kapil thangavelu allegedly wrote:
> On Sunday 30 December 2001 08:00 pm, Casey Duncan wrote:
> > This behavior is logical if unintuitive. I propose
> > that we can kill two birds with one stone to fix this:
> >
> > - Add a new method perhaps: getModificationTime() to
> > the API of SimpleItem or even Persistent that returns
> > the ZODB modification time or if the object has been
> > changed, but not yet commited, the current date/time.
> >
> > - Deprecate bobobase_mod_time and perhaps even omit it
> > entirely from Zope3.
> >
> > This will fix the aforementioned bug and get rid of an
> > API anachronism.
> >
> > Thoughts?
>
> sounds good, i played around with an implementation to do the above. i'm
> not posting it here causes its inefficient, although i'm happy to email it
> to anyone who's interested. it basically added three methods.
>
[snip details]
>
> there are two inefficiencies one is memory because of DateTime for every
> registered object and two is computational from the lack of a uniform
> (across subclasses) hash function for persistent objects which results in
> traversal of the registered object list to identify if an object is
> registered or not (and to determine position to figure out the index into
> registration_times). a much better solution memory wise would have the
> transaction.py keep a DateTime for its initialization and then have
> registered objects store registration times as deltas of that. i'm not sure
> what the better solution is in terms of the computational issue. but as is
> this solution doesn't seem scalable to me until the computational issues
> can be handled.
For memory concerns, couldn't you just store the DateTime as a floating point
number? This would incur just a small overhead to create a DateTime object
when the value is looked up.
I am interested in seeing this code. From my perspective it seems overly
sophisticated. I'm interested how you derive the registration time in the
first place.
/---------------------------------------------------\
Casey Duncan, Sr. Web Developer
National Legal Aid and Defender Association
c.duncan@nlada.org
\---------------------------------------------------/