[Zope-dev] Re: ThreadSafeCounter

Steve Alexander steve@cat-box.net
Tue, 13 Feb 2001 18:09:54 +0000


Andy McKay wrote:

>> | The ideal solution would be to use an object that lives in the ZODB,
>> | I wonder if there is a way to keep the 'object history' empty?  That
>> | is, keeping the counter 'packed' while retaining 'object history'
>> | information on all other objects.
> 
> 
> That would work, however I just dont think that fits neatly into the ZODB in
> any way since all objects are appended.

Don't get ZODB confused with FileStorage. What you say is true of FileStorage, not of ZODB.

 
>> I'm no ZODB expert, but I think the short story is that you can't have
>> this across several threads -- because you would have to use _v_
>> attribs.  And what good is a ThreadSafeCounter if it's not threadsafe?
> 
> Well it would be threadsafe since the object cannot be written too by
> multiple threads as discussed earlier it will keep try 3 times and then
> fail. To me the ideal answer is a simple FileSystem product that allows you
> to mount a file system inside the ZODB. This would implrement locking and be
> hence be thread safe. Its a real science project. This would also have to be
> ZEO friendly, but to be honest for my use and most other peoples, this isnt
> a huge concern.

A simpler solution is to use a mounted storage that doesn't do undo, and stores changes in place.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net