re: Subclassing NSAtomicStore
re: Subclassing NSAtomicStore
- Subject: re: Subclassing NSAtomicStore
- From: Ben Trumbull <email@hidden>
- Date: Mon, 28 Jan 2008 13:42:18 -0800
The first point is the -setIdentifier: method, redefined in both
sample codes : it seems it is never called.
This method sets the UUID for the store. Typically, the UUID is
created with the store and saved in its metadata. But you can put
the UUID aside with a custom -setIdentifier.
The UUID of the store is very important. It establishes the identity
of the objects from that store.
One good way to test the implementation of a custom atomic store is
to use the -migratePersistentStore: method on the
NSPersistentStoreCoordinator. The migration (save as) feature will
test a lot of functionality, including assumptions about the store's
identifier.
Here the problem : if the first
object refers the second one, its cache node cannot be populated,
since the second cache node is not created yet. In [2], a subclass of
NSAtomicStoreCacheNode is used, perhaps for this reason, and it makes
the code complicated.
Yes, that's why the cache nodes are are recording the IDs for the
relationships in -newCacheNodeForManagedObject: and lazily wiring up
the actual relationship to the destination cache node in -valueForKey:
bugreport.apple.com is the place to request API enhancements.
--
-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