On Jan 30, 2008, at 1:39 PM, Chris McDonough wrote:

Ricardo Newbery wrote:
On Jan 30, 2008, at 12:59 PM, Tres Seaver wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ricardo Newbery wrote:

Has anyone given thought to maybe providing a more general class with conflict resolution in the core distribution? The Length class works
for simple counters and I guess it can also be used for just simple
assignments, but what about something more complicated, perhaps with
some sort of factory defined at the moment of instantiation?

Assuming this is even possible, having such a general purpose
conflict resolution class defined in the Zope products directory
might make it easier to distribute a third-party product that needs a
little conflict resolution.  Just a thought.

Custom CR code is *hard* to get right: most people would be better off
using stock code (e.g., on of the tree types defined in the BTrees
package, or Length). Those who can get it right aren't likely to need
their hands held.  ;)
I meant easier for the end user, not the developer. It's kind of complicated right now to explain how to set up a ZEO configuration to work with your third-party product. Makes it a bit of hurdle to distribute such a thing for general use. Oops, I just realized that Length won't work for simple assignments as the conflict resolution assumes it's trying to resolve a counter (which should have been obvious, I know). Is there zope core class I can use for a simple assignment, that maybe resolves conflicts by just picking the last value assigned?

There is no such thing as the "last value" during a conflict (only three states: what's in the database, and the two conflicting states: what connection1 says, and what connection2 says). If the values are always going to have a __cmp__ method or if they can be otherwise compared (like integers), and if you're willing to accept the "highest" of the three states, you might use the conflict resolution policy of Products.Transience.Transience.py.Increaser.


Great, that's exactly what I need.  Thanks.

I also noticed another interesting option for a counter at Products.Transience.Transience.Length2.

Ric


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to