Commit Graph

70 Commits

Author SHA1 Message Date
Blake Watters
a9ef1fe39d Introduce a new heuristic based approach for determining if a response can skip the mapping process. Also introduces a new Network + CoreData logging component and reduces the chattiness of the debug logging level for Core Data Network events. 2013-03-07 19:25:14 -05:00
Blake Watters
318f9659f6 Move management of RKResponseHasBeenMapped to RKObjectRequestOperation instead of RKManagedObjectRequestOperation. Add unit tests. 2013-03-07 14:39:31 -05:00
Blake Watters
d47a0c9ffd Add support for retrying RKObjectRequestOperation and RKManagedObjectRequestOperation by conforming to NSCopying. closes #1224 2013-03-07 13:55:11 -05:00
Jeff Arena
948209b254 Remove wasNotModified method in favor of setting a flag on cached response entries to determine if mapping can be skipped. 2013-03-07 13:08:30 -05:00
Blake Watters
490b233daf Add countermeasure to avoid crash in cxx_destruct during deallocation of mapping result 2013-02-25 11:28:50 -05:00
Blake Watters
4759a90cdc Add more cancellation backstopping to avoid NSObjectInaccessibleException crashes when executing RKManagedObjectRequestOperation instances that have been cancelled and the Core Data environment has shifted underneath them (i.e. records have been deleted from the store) 2013-02-05 14:07:46 -05:00
Jeff Arena
91ede3b9b6 Add a few isCancelled checks to ensure we are not performing unnecessary work after being cancelled. 2013-02-05 12:06:33 -05:00
Blake Watters
8958bc8415 Improve cancellation behaviors for in-progress RKManagedObjectRequestOperation instances 2013-02-01 19:00:04 -05:00
Blake Watters
4c39918fdb Implement support for flexible metdata mapping. closes #582, #688
* Metadata mapping is implemented via an `NSProxy` object that stands in for the `sourceObject` of each `RKMappingOperation`
* Key paths that are prefixed with `@metadata.` are mapped against the `metadata` dictionary of the operation, else they hit the `sourceObject`.
* Metadata is implemented by merging a dictionary of data in from `RKObjectRequestOperation`, through to `RKResponseMapperOperation`, into `RKMapperOperation`, and all the way down into the `RKMappingOperation`, where it is available to each object. By convention, metdata is namespaced into subdictionaries.
2013-01-24 16:31:19 -05:00
Blake Watters
2b84f667c1 Add support for obtaining a permanent managed object ID for the targetObject of an RKManagedObjectRequestOperation 2013-01-23 16:12:14 -05:00
Blake Watters
a75edcea2e Nil out targetObjectID if given a targetObject that is not an NSManagedObject. closes #1161 2013-01-18 17:28:49 -05:00
Blake Watters
3d971dc666 Encapsulate managed object refetching into an NSProxy object to enable you to defer the refetching until the mapping result is accessed (or skip it entirely if the result is not accessed) 2013-01-18 16:42:11 -05:00
Blake Watters
fc07e1fef7 Remove unnecessary exception handling for NSUndefinedKeyException 2013-01-18 14:48:22 -05:00
Blake Watters
06f2fe9c7b Radically simplify the implementation of managed object deletion and refetching within RKManagedObjectRequestOperation. closes #1163
1. Eliminates use of visitor in favor of aggregating mapping info during mapping. This avoids having to traverse the mapping graph.
1. Eliminate special case handling of cyclic key paths.
1. Eliminate issues with infinite recursion while traversing the mapping graph.
2013-01-18 12:20:51 -05:00
Blake Watters
ff7f538749 Add temporary workaround for infinite recursion 2013-01-17 23:31:28 -05:00
Blake Watters
f2abd1e107 Add test coverage verifying fix for crash during cyclic graph traversal in RKManagedObjectRequestOperation. closes #1142 2013-01-17 18:47:02 -05:00
Blake Watters
7bf14d4ea9 Rework implementation of cyclic mapping graph traversal. refs #1142 #1158 #1163 2013-01-17 15:08:30 -05:00
Blake Watters
bcbbd65fbe Fix issue in which managed objects that are the children of non-managed objects were refetched and assigned as a collection rather than as a singular value. fixes #1118 2013-01-16 17:49:32 -05:00
Blake Watters
905048f737 Fix issue where unsaved managed object POST'd to the server with unsaved changes are not persisted if no mapping occurs. fixes #1130 2013-01-07 19:56:14 -05:00
Blake Watters
e9d5a87f7b Drop unnecessary performBlockAndWait: invocation that may be correlated with occasional crashes seen in GateGuru 2013-01-07 13:50:03 -05:00
Blake Watters
879ffd73e6 Add support for deleting Core Data managed objects that fail validation out of the mapping context. This enables you to silently drop mapping for managed objects that fail validation. fixes #691 closes #694 2013-01-01 23:56:58 -05:00
Blake Watters
d024a518a4 Fix broken dynamic mapping test 2012-12-31 15:26:44 -05:00
Blake Watters
b93fe1f7c9 Restore cycle detection and cleanup visitor codebase further 2012-12-31 14:50:32 -05:00
Blake Watters
1d27679ee3 Clean up the nasty mess in the visitor code and fix flaws in implementation of algorithm. Still some test breakage and additional coverage to put down 2012-12-31 14:39:37 -05:00
Blake Watters
9a128b678c Fix issues with refetching results using visitation 2012-12-30 22:54:09 -05:00
Blake Watters
312b382f25 Add test and fix for invalid key path exceptions with dynamic mappings. refs #1111 2012-12-30 00:01:50 -05:00
Blake Watters
6493282772 Rework implementation of managed object deletion and refetching to use the refreshed visitor implementation. refs #1111, #1113 2012-12-29 17:28:31 -05:00
Blake Watters
84c6822d25 Implement Tarjan's algorithm to efficiently traverse the RKResponseDescriptors within the RKManagedObjectRequestOperation and compute the key paths to all managed objects. refs #1113, refs #1112 2012-12-28 00:29:27 -05:00
Blake Watters
7745f17d90 Add temporary workaround for crashes related to ambiguous key paths in the deletion support. refs #1111 2012-12-27 15:11:51 -05:00
Blake Watters
62aa987d17 Fix another instance of subscripted access 2012-12-26 19:17:05 -05:00
Blake Watters
9f228e0280 Expand test coverage on managed object deletion cases and fix bugs. closes #358 2012-12-16 20:45:01 -05:00
Blake Watters
b6a94de68a Remove extraneous assert on deletion case 2012-12-16 13:02:18 -05:00
Blake Watters
a424908242 Expand test coverage and fix all known issues with managed object refetching and deletion. closes #1066 2012-12-13 22:42:34 -05:00
Blake Watters
406504ff2e Skip orphaned object deletion if the 304 optimization is in effect. Update log messages during orphaned object cleanup 2012-12-13 19:00:01 -05:00
Blake Watters
a9a1c3dc48 Don't crash when encountering nil in the mapping results dictionary 2012-12-13 18:12:50 -05:00
Blake Watters
280fd5d571 Fix crashes during refetch if objects were deleted. Expand managed object deletion support to handle nested objects. refs #1066 2012-12-13 17:35:39 -05:00
Blake Watters
a471bdd8a3 Add support for refetching NSManagedObject instances mapped at any point in the object graph. refs #1066 2012-12-12 20:47:14 -05:00
Blake Watters
5efcfe2c41 Eliminate remaining use of keyed subscript access 2012-12-10 17:12:53 -05:00
Blake Watters
89d0294dcd Expose access to the RKMapperOperationDelegate to RKObjectRequestOperation subclasses. closes #1009 2012-11-29 23:35:45 -05:00
Blake Watters
54dce20ac6 Rework paginator support for 0.20. closes #1024, #900, #759
* Renamed RKObjectPaginator to RKPaginator for simplicity
* Removed delegate on paginator in favor of simple success/failure blocks
* Added `willMapDeserializedResponseBlock` for manipulating the response body before mapping begins
* Added support for cancelling an in-progress pagination request
2012-11-18 22:44:33 -05:00
Blake Watters
e088bdc186 When managedObjectContext is set to nil on RKManagedObjectRequestOperation, avoid creation of an orphaned privateContext 2012-11-09 11:05:26 -05:00
Jeff Arena
129cc6f052 Fix issue with cross-context object comparison in case of local deletes. 2012-11-08 14:24:24 -05:00
Jeff Arena
9d40138129 Change the default value for deletesOrphanedObjects to YES in RKManagedObjectRequestOperation 2012-11-08 13:58:10 -05:00
Blake Watters
94318d1cb2 Add support for returning fetched objects when a 304 'Not Modified' response is loaded. closes #1006 2012-10-28 21:44:42 -04:00
Blake Watters
de016e22f3 Refetch the mapping results from the original managed object context before returning to the caller. fixes #1011
Eliminate the thread safe invocation class.
2012-10-28 20:22:53 -04:00
Blake Watters
08110ca300 Implement support for cancellation and prioritization of response mapping operations using an operation queue global to all object request operations.
* Passes through cancellation from object request operation to HTTP request operation and response mapping operation. closes #993
* Performs all object mapping within an NSOperationQueue to enable constraining of mapping activities.
* Add default mapping queue with concurrency limit of 1 operation.
* Migrate deserialization of the response body into a serial dispatch queue to ensure that only one parse occurs at a time.
2012-10-20 00:13:48 -04:00
Blake Watters
68cebc96af Added convenience function for getting a fetch request from an array of fetch request blocks 2012-10-17 22:34:09 -04:00
Blake Watters
f2bc809502 Update to reflect change to designated initializer in superclass preventing the appropriate default value for savesToPersistentStore: to be set. refs #1000 2012-10-17 17:08:31 -04:00
Blake Watters
bc50e95036 Fix invalid references to requestOperation. refs #997 2012-10-16 11:59:39 -04:00
Blake Watters
f4bfdb389b Add support for the registration of HTTP request operation subclasses on the manager to support easy customization of request operation handling. refs #997 2012-10-16 11:25:00 -04:00