Re: CoreData database sharing and migration
Re: CoreData database sharing and migration
- Subject: Re: CoreData database sharing and migration
- From: Ben Trumbull <email@hidden>
- Date: Sat, 20 Mar 2010 17:52:55 -0700
I'm not sure I understand your question. "How" is they just use Core Data with our SQLite NSPersistentStore and it works for multiple processes on a single machine. For most but not all customers, that's coordinated with POSIX byte range advisory locks (fcntl). "Why" is to have Cocoa frameworks vending the user's Contacts and Events to various apps through an API. Mail, iCal, and Address Book may all be working with Contacts data simultaneously. etc.
- Ben
On Mar 19, 2010, at 12:42 PM, Aurélien Hugelé wrote:
> Hi Ben,
>
> Can you be kind enough to explain how Apple frameworks do that ? (multiple processes, single machine, one SQLite database)
> I'm thinking of CalendarStore, AddressBook framework. Can you describe what is the general idea behind those Apple frameworks?
>
>
> Aurélien,
> Objective Decision Team
>
>
>
>
> On 17 mars 2010, at 22:29, Ben Trumbull wrote:
>
>>> I am wondering whether it is possible to create a database in core
>>> data that can be opened by more than one application at the same time.
>>> It is currently impossible to handle one SQLite database with two
>>> instances of the same app. The problem is if user1 quits the app, the
>>> data is saved but user2's instance of the app doesn't recognize this
>>> file system change and just overwrites its version in memory. So the
>>> data from user1 is gone. Is there a way I can handle this?
>>>
>>> Second -- I am having more than two database versions now but still
>>> want to support my version 1.0 but the mapping model only allows one
>>> source model as well as only one target model. I would have to remove
>>> one version but that makes version 1.0 users' database unusable.
>>>
>>> Has anyone gotten something like this to work?
>>
>> Yes, several Apple frameworks use Core Data databases from multiple processes simultaneously with a single user account and single physical machine.
>>
>> Do you mean "more than one application simultaneously on more than one physical computer over NFS/AFP/SMB" ? Don't do that.
>>
>> Or do you mean an NSDocument based application using Core Data & an SQLite store ? NSDocuments intentionally behave like TextEdit. Last writer wins, overwites everything. If so, you should be using a non-document based Core Data project template.
>>
>> - Ben
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden