Commit Graph

273 Commits

Author SHA1 Message Date
Drew McCormack
70103af2e3 Got all targets working with new static framework. Made the Mac Idiomatic app use the dynamic framework. 2014-04-30 12:57:08 +02:00
Drew McCormack
f17faae13c Added a static framework target for iOS. It builds. Not fully working yet. 2014-04-30 11:13:14 +02:00
Drew McCormack
fd9c8bbc0b Changed the baseline consolidator to use the revision number 0 if the local persistent store is not found in the baselines. 2014-04-29 14:18:33 +02:00
Drew McCormack
1b06286792 Fixed static analyzer errors to do with not checking error parameters for NULL values. 2014-04-29 11:14:15 +02:00
Drew McCormack
7550cb8357 Reduced size of transaction logs by not storing nil values in the property change values with keyed archiving. 2014-04-28 12:34:18 +02:00
Drew McCormack
45a18e8c1f Minor changes. 2014-04-22 10:22:54 +02:00
Drew McCormack
7e2dab7a80 Removed a assertion for revision sets. Replaced with error logging. 2014-04-22 09:55:58 +02:00
Drew McCormack
619bee1b99 Removed some code (and a test) that would try to avoid importing a known event. This test was not needed, because the code would already avoid importing a known event, and it actually caused a minor bug in certain cases where it was not testing properly. So it has been removed. 2014-04-20 16:46:37 +02:00
Drew McCormack
f300f5745c Added extra logging for baseline consolidation and removing outdated files. 2014-04-19 12:40:15 +02:00
Drew McCormack
69bb8f901c Added a check to make sure events have changes before merging. Without this, it was possible for two devices to continuously ping pong back and forth. 2014-04-19 11:04:55 +02:00
Drew McCormack
31724638c6 Set undoManager on a few contexts to nil.
Also set a merge policy for the event store context. It should not be needed, but Kevin Hoctor is getting conflicts between PSC and Store global ids on 10.9. This should not be possible, because there is only one MOC accessing the store, but it seems to happen when a save interrupts a merge.

This issue has been reported for 10.9 online, and seems to be a genuine Apple bug (http://lists.apple.com/archives/cocoa-dev/2005/Aug/msg00899.html).
2014-04-18 12:52:30 +02:00
Drew McCormack
04389ef898 Small change to prevent a NSManagedObject being accessed on the wrong thread. The access was purely a retain, no access to properties, but better to be safe than sorry. 2014-04-18 11:51:32 +02:00
Drew McCormack
c40f7da80b Work on avoiding race conditions between saves and merges. There is now a new event type: CDEStoreModificationEventTypeIncomplete. While events are being built, they have this type. Fetch requests have predicates to avoid including these events.
This was prompted by a case where there were two non-baseline events with the same revision number from the same device. This should not be possible, and various steps have been taken to avoid this arising.
2014-04-17 12:53:34 +02:00
Drew McCormack
e5afbaa437 Removed a potential race condition where events were created before they were registered with the event store for cleanup after a crash. 2014-04-17 10:45:08 +02:00
Drew McCormack
0f635b490e Standardized NSURL paths. 2014-04-17 10:31:27 +02:00
Drew McCormack
8648e247ab Removed propertiesToFetch from Core Data fetches. According to docs, it is only used for dictionary results, and I suspect it may have been causing fetches to ignore in-memory changes. 2014-04-17 09:47:01 +02:00
Drew McCormack
9fbd6e30fd Changed variable name. 2014-04-17 09:46:02 +02:00
Drew McCormack
1c72afc6da Fixed a comment. 2014-04-14 21:01:25 +02:00
Drew McCormack
94c9c1a0cf Added whitespace to make CDEPersistentStoreEnsemble.h more readable. 2014-04-12 14:17:37 +02:00
Drew McCormack
c0dece2231 Fixed a comment. 2014-04-12 14:15:38 +02:00
Drew McCormack
3031d53b6c Replaced the localDataRootDirectory path with a file URL in the CDEPersistentStoreEnsemble class. 2014-04-12 13:46:47 +02:00
Drew McCormack
8118e35ff1 Changed the initializers of CDEPersistentStoreEnsemble to consistently use NSURL for files. Was mixing the two.
Also cleaned up the Xcode schemes, removing the dropbox ones, and naming them better.
2014-04-12 10:52:05 +02:00
Drew McCormack
7dee1230f3 Changed file upload and download operation classes to use a NSURLRequest. Makes them more flexible. 2014-04-11 10:50:28 +02:00
Drew McCormack
ccdf348335 Added method for removing the data for an ensemble from the cloud. Use with caution. 2014-04-11 10:10:05 +02:00
Drew McCormack
2c42b0e9f5 Added retrieveEnsembleIdentifiers... method to CDEPersistentStoreEnsemble, to help people discover what ensembles exist. It is useful for document based apps. 2014-04-10 19:50:28 +02:00
Drew McCormack
d4934066a5 Remove files in the upload folder before transferring data files to cloud. Sometimes, old files would be left around, and uploaded. 2014-04-10 15:05:07 +02:00
Drew McCormack
2f9b587d56 Moved code that removed unused global identifiers from the CDERebaser class, to the CDEPersistentStoreEnsemble. It is now run first thing when the ensemble initializes. This is the safest. Otherwise, a race situation between a merge and a save could potentially interfere. 2014-04-09 11:36:35 +02:00
Drew McCormack
064022f19b Changed the way the global count is updated on baselines. When consolidating baselines, it is now the maximum count.
The global count is not used anymore for determining out of date events, so its only purpose is ordering. It makes more sense that a baseline should keep the maximum global count when merging, to give it priority over older baselines.
2014-04-09 11:17:50 +02:00
Drew McCormack
d60c9d2804 Small improvement to detecting if the store has been left behind. Accounts for baselines that don’t include a revision for the store. 2014-04-09 11:06:41 +02:00
Drew McCormack
0e5bf9ff09 Added logging for when it is doing a full integration. 2014-04-09 10:49:50 +02:00
Drew McCormack
15a45ee142 Improved the code to remove redundant baselines. It now accounts for possibility the two baselines have exactly the same revisions. It is also a bit more efficient, only visiting each pair of events once. 2014-04-09 09:17:46 +02:00
Drew McCormack
1caacaeedc Changed naming scheme for baselines to include a persistent store identifier prefix. This should avoid the unlikely event that two different baselines end up with the same filename.
This required more general changes. The CDEEventFile class was introduced. It effectively maps the events to filenames, and you can now have more than one alias (filename) for each event.
2014-04-09 08:49:13 +02:00
Drew McCormack
e540b51c5b Refactored event builder so that the save monitor can create and commit its event atomically, in a single performBlock…
Previously it was spread over several blocks, and it is thought this may have caused a race condition with the rebaser, which would process a half made event.
2014-04-08 13:26:57 +02:00
Drew McCormack
549a9dc79b Removed recently added locking of the event store. Doesn’t really solve problems, and it could cause deadlocks. 2014-04-08 13:22:05 +02:00
Drew McCormack
331e29c32e Merge branch 'master' of https://github.com/drewmccormack/ensembles 2014-04-08 09:25:03 +02:00
Drew McCormack
6dd5265373 Updated a comment. 2014-04-08 09:24:45 +02:00
Drew McCormack
e48f8b2928 Added locking to rebaser, baseline consolidator, and the save monitor. They now lock the event store context to perform atomic operations, where necessary.
This was motivated by a case where a new object was lost on the saving device. There were a lot of rebases occurring on each device, and it seems possible that a race condition could have occurred between the save monitor creating a new event, and the rebaser absorbing that event.
2014-04-07 19:45:06 +02:00
Drew McCormack
27f0fa4c8b Updated comment. 2014-04-07 18:59:10 +02:00
Drew McCormack
02a05890cc Changed the CDERebaser class to be less trigger-happy with rebasing. The way the compaction is estimated has been changed. It used to just estimate the reduction in the number of object changes. Now it has a rough evaluation of the data change, and it also only triggers for 500 object changes or more. 2014-04-07 14:47:18 +02:00
Drew McCormack
414109f46b Changed the baseline fetching method to return the most recent baseline where there are more than one. It was raising an exception (which is not cool).
There are times when there is legitimately more than one baseline (i.e. before a merge has consolidated it). The problem was arising during saves, which were apparently occurring before the second baseline was consolidated.
2014-04-02 14:05:06 +02:00
Drew McCormack
496ca9c80b Changed the timestamp used for data imported during leeching to distantPast. This data should be subordinate to the existing sync data, and this should achieve that goal.
Because it is a baseline, the timestamp doesn’t have too much meaning anyway.
2014-03-27 09:02:22 +01:00
Drew McCormack
ae89305b72 Fixed a loop causing a compiler warning about unused variable. 2014-03-24 10:56:19 +01:00
Drew McCormack
cec86d305c Merge branch 'master' of https://github.com/drewmccormack/ensembles 2014-03-10 09:16:55 +01:00
Drew McCormack
6e46329d2b Added checks in awakeFromInsert: to make sure attributes (e.g. unique ids) are only initialized once.
awakeFromInsert: can be invoked multiple times when using child contexts.
2014-03-10 09:16:34 +01:00
Drew McCormack
306f77d36d Added documentation comments for errors. 2014-03-08 13:41:34 +01:00
Drew McCormack
c450f90c9e Minor changes to comment docs, and made the API of the CDEFileDownloadOperation a bit more flexible by exposing the url request. 2014-03-08 10:48:07 +01:00
Drew McCormack
31e2dc748f Added an extra includesSubentities in a fetch request. Should not have been an issue, but may have become one at some point. Better to be explicit. 2014-03-08 10:23:04 +01:00
Drew McCormack
e050f9f200 Merge branch 'master' of https://github.com/drewmccormack/ensembles 2014-03-08 10:02:40 +01:00
Drew McCormack
13aba62c87 Merge pull request #117 from realmacsoftware/framework
Create a framework target for Mac project
2014-03-08 10:01:53 +01:00
Drew McCormack
8e7dbdb14b Added documentation to CDECloudFileSystem. 2014-03-08 09:56:01 +01:00