[ZODB-Dev] help enabling conflict resolution
John Belmonte
john at neggie.net
Mon Mar 1 13:02:53 EST 2004
Jeremy Hylton wrote:
> We're planning to change conflict resolution to use explicitly
> registered functions. There's no need to use methods, since conflict
> resolution operates on an object's serialized state rather than the
> object itself. The registration would allow the application to be much
> more careful about what gets loaded in the server.
I've found dealing with serialized states to be too fragile, because
when I change some implementation detail of a persistent object (for
example, use slots, change the pickle protocol, or make a custom
get/setstate) it affects the conflict resolution function. To avoid
this, my _p_resolveConflict functions have this skeleton:
def _p_resolveConflict(self, _old, _cur, _new):
old = MyClass(); old.__setstate__(_old)
cur = MyClass(); cur.__setstate__(_cur)
new = MyClass(); new.__setstate__(_new)
# [update cur with changes between old to new]
return cur.__getstate__()
I guess it would also helpful if you need to call a method of the object
during the conflict resolution, but that case hasn't come up for me yet.
In any case, for this pattern, the move to registered functions would
be moot.
I know it's not the most efficient, but I'd prefer that conflict
resolution run on the ZEO client rather than server if it's at all
reasonable.
-John
--
http:// if ile.org/
More information about the ZODB-Dev
mailing list