couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <>
Subject Re: [proposal] Update Handler Conflict Resolution
Date Sun, 11 Sep 2011 19:38:25 GMT

Sorry for stupid question, but is there any reasons why _update
handlers should have custom conflict resolution logic while simple
document store API not?
I think that better to implement some update_conflict() functions
which acts like validate_doc_update one - globally for all database,
one per design document - instead of dividing documents store logic.
This way will make things more clear and rules to be universal, not
with exceptions for some cases.

In this way update_conflict function could looks like this:

function update_conflict(stored_doc, actual_doc, update_handler, userCtx){
stored_doc - document which was tried to store, but failed
actual_doc - actual document with same id
update_handler - null if document was stored by simple API or _update
handler function object or any reference to get _update function
userCtx - user context object

But even this solution would save anyone from race conditions(:


View raw message