[Using zope-dev@ instead of zope@] Dennis Allison wrote:
A more session-friendly conflict resolution might use:
1. if any of the states are invalid (that is, has a key '_invalid') return the invalid state.
2. if any any of the states attributes ['token','id','_created'] differ then there is a conflict, raise the conflict exception.
3. order the newState and savedState by modification time (or if that cannot be computed, by access time).
4. any key appearing in oldState's dictionary but not appearing in both savedState and newState should be removed from all. This corresponds to a key-value pair being deleted in one of the transactions. Insertions will be managed automatically by the updates.
5. beginning with the oldest, update oldState dictionary of key-value pairs using the dictionary part of newState and savedState. Return oldState.
This does several things. First, it captures independent key-value changes made in both potentially conflicting transactions. Second, it provides a reasonable ordering for multiple (potentially conflicting) key-value pair updates. Third, it manages insertions and deletions to the session variable set in the presence of conflicts.
Does this make sense? I have yet to figure out how to map a TransientObject "state" back to the object it represents, but it clearly is possible.
I certainly makes sense from a high level description, but the devil is in the details. I'd be interested in looking at it if you code something. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com