Conflict management in P2P

52 views
Skip to first unread message

Bart Arribe

unread,
Mar 6, 2014, 6:30:12 AM3/6/14
to mobile-c...@googlegroups.com
Hi,

I would like to use Couchbase Lite only in peer-to-peer but I have some questions concerning the conflict management in this case

1. I don't think it's possible but can we run Sync Gateway to a device ?
2. Is Sync Gateway can run locally, only for the mobile side ?
3. Or how can we manage data conflicts between devices without Sync Gateway?

Thank you

Bart

Jens Alfke

unread,
Mar 6, 2014, 10:08:40 AM3/6/14
to mobile-c...@googlegroups.com
On Mar 6, 2014, at 3:30 AM, Bart Arribe <bart...@gmail.com> wrote:

1. I don't think it's possible but can we run Sync Gateway to a device ?

No, that wouldn’t make sense. It’s a server and its purpose is to act as a front-end for Couchbase Server.

2. Is Sync Gateway can run locally, only for the mobile side ?

I don’t understand that question…?

3. Or how can we manage data conflicts between devices without Sync Gateway?

The data model is the same as the Sync Gateway, just without channels or per-document access control. In either case, you handle conflicts by first using API calls to detect them (there are some options in the all-docs query for this) and then resolving them by deleting all but one of the conflicting revisions.

—Jens

Bart Arribe

unread,
Mar 6, 2014, 12:01:14 PM3/6/14
to mobile-c...@googlegroups.com


Le jeudi 6 mars 2014 15:08:40 UTC, Jens Alfke a écrit :

On Mar 6, 2014, at 3:30 AM, Bart Arribe <bart...@gmail.com> wrote:

1. I don't think it's possible but can we run Sync Gateway to a device ?

No, that wouldn’t make sense. It’s a server and its purpose is to act as a front-end for Couchbase Server.

2. Is Sync Gateway can run locally, only for the mobile side ?

I don’t understand that question…?

Basically, I was thinking, if all the devices are connected to a local area network, can we use the sync gateway to sync all the devices and manage the conflicts ?
3. Or how can we manage data conflicts between devices without Sync Gateway?

The data model is the same as the Sync Gateway, just without channels or per-document access control. In either case, you handle conflicts by first using API calls to detect them (there are some options in the all-docs query for this) and then resolving them by deleting all but one of the conflicting revisions.

—Jens

Thank you for you quick answer
Bart 

Jens Alfke

unread,
Mar 6, 2014, 12:20:56 PM3/6/14
to mobile-c...@googlegroups.com

On Mar 6, 2014, at 9:01 AM, Bart Arribe <bart...@gmail.com> wrote:

Basically, I was thinking, if all the devices are connected to a local area network, can we use the sync gateway to sync all the devices and manage the conflicts ?

Oh, sure. The gateway is pretty lightweight. You’ll need a database too, of course, but you can set up a Couchbase bucket with a small RAM allocation. This should run well for small use cases on a low-end PC. (I’d recommend using a Mac because Couchbase Server is super easy to install: it’s just an app that you double-click. Or on Linux it might be available via the package manager.)

—Jens
Reply all
Reply to author
Forward
0 new messages