[ZODB-Dev] Commit or lock object accross transactions

Christian Reis kiko at async.com.br
Wed Aug 6 00:23:50 EDT 2003


On Tue, Aug 05, 2003 at 08:52:04PM +0200, Roché Compaan wrote:
> * Chris Withers <chrisw at nipltd.com> [2003-07-31 19:00]:
> > Roché Compaan wrote:
> > <snip>
> > >FWIW, this works great. I can now request a counter for a string key
> > >from my storage and be confident that there will be no duplicates.
> > >
> > >I am very glad there is an easy way to do this :-)
> > 
> > Does that mean you've implemented the code?
> 
> Yes. All I did was to add a method 'unique_id' to BaseStorage that takes
> any string prefix as paremeter and increments a counter in a mapping
> keyed on the prefix. In addition I had to make on-liner modifications to
> ZODB.Connection and ZEO.StorageServer. I also added 'unique_ids' to
> ZEO.ClientStorage that requests a block of ids from the master.
> 
> Is this what you had in mind too, Christian?

Well, that's the general idea I had. Method names such as
generate_serial() or generate_id() for the storage and
get_serial_block() or get_id_block() for ClientStorage might be more
appropriate, but that's details. I'm curious about how you handled the
zRPC bits.

Could you produce a diff -u so we can take a look at the code? A
testcase would be doubly appreciated, so if you can attach a simple one,
it would be even better.

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



More information about the ZODB-Dev mailing list