Thank - that's help.
Now, how to model the docs and handle security.
Ido
ב-18 באוק 2011, בשעה 15:58, Dave Cottlehuber <dave@muse.net.nz> כתב/ה:
> On 18 October 2011 12:05, Ido Ran <ido.ran@gmail.com> wrote:
>> Hello again,
>>
>> I am developing a desktop application that run on Windows using WPF
>> interface. The application loading and saving data using RESTful web service
>> that is currently only a thin wrapper around relational database.
>>
>> My design require the following things:
>>
>> 1. Offline work - allow the users to work in offline mode when connection
>> to the server is not working
>> 2. Sync between local and remote databases - Either online or manual sync
>> between databases
>> 3. Conflict resolution - Both offline and sync may cause conflicts so I
>> need a way to resolve them
>> 4. Security - I need to authenticate the user and authorize them
>> according to security rules.
>>
>> The first 3 requirements available in CouchDB out-of-the-box - the question
>> here is what data model to use in order to take advantage of those those
>> capabilities.
>> My model is close to the following (top to bottom):
>>
>> - ProcessGroup is a data entity with name and set of Processes
>> - Process is a data entity with name and set of activities
>> - Activity is a data entity with name and set of participants and set of
>> properties
>>
>> If I will create a document for ProcessGroup it will cause to much conflicts
>> even if two users change different activities. On the other hand if I model
>> each entity as it own document I can't be sure that when creating a Process
>> with 100 activities all of the activities will be added, for example a power
>> down in the middle of the process or CouchDB fail half way though the
>> addition. In other words there are no transaction out side a document.
>
> The bulk docs API might be sufficient for your needs:
>
> http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Transactional_Semantics_with_Bulk_Updates
>
> A+
> Dave
|