[ZODB-Dev] zodb4: adding an object before transaction commit

Roché Compaan roche at upfrontsystems.co.za
Tue Oct 7 12:45:43 EDT 2003


* Christian Robottom Reis <kiko at async.com.br> [2003-10-07 15:12]:
> On Tue, Oct 07, 2003 at 09:38:12AM +0200, Roché Compaan wrote:
> > * John Belmonte <jvb at prairienet.org> [2003-10-06 19:37]:
> > > Steve Alexander wrote:
> > > >I want to do some things with the oids of persistent objects, such as 
> > > >use them as keys in a BTree.
> > > >
> > > >The thing is that an object doesn't get an oid until it is added to the 
> > > >database, and a transaction is committed.
> > > 
> > > Hello,
> > > 
> > > I'm wondering if your need can be addressed by the "ID generator" patch 
> > > posted by Roché Compaan (see 
> > > http://mail.zope.org/pipermail/zodb-dev/2003-August/005690.html).  I 
> > > think it is a more general solution.
> > > 
> > > I would like to see some form of Roché's idea put into ZODB proper, and 
> > > would be willing to help with the maintenance, documentation, and testing.
> > 
> > FYI, that patch has 2 issues - first, counters are not persisted so they
> > get lost after a restart and second, TmpStore is not patched. But at
> > least it shows the idea.
> 
> As for the first problem, have you tried storing the counter as a key in
> the ZODB root? It should work 

I don't think it would - you want to keep the counter outside the ZODB
transaction machinery. At the moment I just pickle it and save it to a
separate <FileName>.counter file.

> > If anyone is interested I made a small FileStorage123 package with the
> > id generator functionality that doesn't patch any ZODB code - I only
> > subclass and extend File-, Server- and ClienStorage.
> 
> Sounds interesting, where's the code? :-)

Just uploaded it to http://zope.org/Members/upfront/FileStorage123.tgz.
If it is still "pending" there you can grab it at 
http://www.upfrontsystems.co.za/FileStorage123.tgz

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the ZODB-Dev mailing list