drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Detect events that contain multiple objects for a single global id #112

Closed drewmccormack closed 10 years ago

drewmccormack commented 10 years ago

It is possible that an app can inadvertently have two objects representing the same global id. For example, if the app deletes an object, and then reinserts a new object with the same global id, without saving in between. In this case, there will be a delete and an insert in one transaction. Because ensembles has no way to order these, it can lead to undesirable effects such as duplicate objects appearing later.

It would be difficult to fully account for this, because it breaks the uniqueness of global ids, but we should be able to at least easily detect it, simply by seeing if the global ids of inserted/updated/deleted objects have any intersection. They should not. If this is detected during a save, a severe error should occur, perhaps even an exception, and possibly a forced deleech.

drewmccormack commented 10 years ago

Added in v2.