[ZODB-Dev] Locking

Marius Gedminas marius at gedmin.as
Thu Jul 3 08:25:50 EDT 2008


On Wed, Jul 02, 2008 at 04:45:53PM -0400, Joseph Turian wrote:
> How do I "lock" zodb objects?
> 
> I want the following process:
> 
> See if key is present in root.
> [it's not]
> Lock key write-access, so that no other client will try to write key.
> Compute value for key.
> Write value for key.
> Unlock key.

Usually you shouldn't need to do this.  ZODB will detect conflicting
write transactions and raise ConflictError that you're supposed to catch
and retry up to a certain reasonable number of times (3 or 5).

Marius Gedminas
-- 
Key emulation:
[ ] Intuitive
[*] Emacs        (Seen in an MCEdit dialog) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20080703/f598572a/attachment.bin


More information about the ZODB-Dev mailing list