Crackpot Idea for Core Data Multi-User Document

I’m still a bit new to Cocoa and Objective-C, but not to programming in general.

I’ve been grappling with a way to use all the goodness and time-savingness of Apple’s new Core Data such that multiple users can access the same data but not mess each other up. I have no idea if this would work. But I’ve done quite a lot of digging and the consensus seems to be that this is impossible, and it would be much easier to settle for FileMaker 7, or maybe Servoy or 4D.

From what I’ve read on various listservs and forums, it seems that it’s safe for multiple users to access the same Core Data document over AFP (assuming it’s stored in SQLite format), and it’s quite unlikely to get corrupted. The problem is that no notifications are sent, so if User A and User B are both editing the same Object, you could run into trouble: they can overwrite each others’ changes and that makes the data unreliable.

My crackpot idea for a potential way around this problem is that the Client app has to log in to a Coordinator server. Any time a user starts editing an object, the client sends a notification to the Coordinator, which quickly tells all the other Clients to lock their user from editing that particular object. When the edit (or creation of a new object) is complete, client tells Coordinator, which tells the other clients to refresh their copy of that object. This might require the use of an “Edit” button similar to how Apple’s Address Book works.

The client app has to be responsible for sending some kind of “hey, I’m editing this object” message to the Coordinator before letting the user finalize a change, and it has to quickly mark an entire object uneditable when it receives a notification from the Coordinator (which means each client is running a server thread to listen for these).

Here’s a rough diagram:

Idea for Multi-User Core Data document

That’s the basic idea. So am I nuts? Is this just too impossibly complex, is it even possible, is there a better way?

I was also kicking around the possibility of the Client apps coordinating themselves, by way of Bonjour. But that means you couldn’t run this across the Internet, only on a LAN (which may be OK for most cases, and there is always VPN).

Anybody want to work together on an open source proof of concept?