0

I'm dubious about adopting a Core Data sync solution in which it is not clear how conflicts are resolved. Unfortunately, solutions like iCloud and Simperium just state 'conflicts are handled automatically', and left at that. Often this is not enough information.

To give a concrete example, imagine you have an app that includes entities A and B, with a one-to-one relationship between them. Imagine that the relationship is non-optional.

Beginning with the stores completely in sync and two related objects A_0 and B_0, device1 creates a new B object called B_1, and associates A_0 with B_1. It deletes B_0.

Simultaneously, device 2 also deletes B_0, but creates a new object called B_2 and relates that to A_0.

How will this situation be resolved? Presumably A_0 will end up related to B_1 or B_2, probably based on timestamp order, but what will happen to the orphaned object? Deleted? Does it rollback the whole transaction from one device?

The object cannot exist in isolation, because the relationship is required.

4

1 回答 1

0

很抱歉,暂时必须将关系标记为可选。我们在这里有一张票。

使用最新版本的 lib (0.6.2),会发生什么:

  • 更改以“先进先处理”的方式进行处理。这意味着:A_0 将与 B_1 或 B_2 相关,具体取决于首先通过的更改。
  • 忽略重复的更改(如果两个设备删除 B_0,就可以了)。
  • 由于 Simperium 不支持(目前)强制关系,因此您最终会得到一个孤立对象。

希望有帮助!

于 2014-01-08T00:40:14.253 回答