Last week at NSConf 5 my colleague Charles Parnot presented a 15 minute blitz talk titled Rethinking Syncing. In this talk he details PARStore
: a key value store designed to work on top of syncing mechanisms like iCloud and DropBox.
To make syncing as transparent as possible this store’s functionality is kept as limited as possible. It is definitely not a fits all solution but works well in our use-case.
Currently PARStore:
- stores key-value-timestamp triplets
- is an append only store
- treats the newest entry for a key as the current value
Next to that each device operating on the same store only writes to it’s own database file. Locally it reads in databases from other devices and merges everything into a single timeline.
The store is currently implemented using CoreData. Each device database is added as a NSPersistentStore
to the same NSPersistentStoreCoordinator
. Only the database owned by the local device is added as a read-write store.
Having each device writing to it’s own database file prevents possibly destructive merge-conflicts on that file.
The source code for PARStore is available on github with a liberal BSD license attached. Feedback is appreciated.