summaryrefslogtreecommitdiffstats
path: root/sync/engine/update_applicator.cc
Commit message (Collapse)AuthorAgeFilesLines
* sync: Per-type update applicationrlarocque@chromium.org2013-12-041-29/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This change moves the update application functionality from the ApplyUpdatesAndResolveConflictsCommand into the SyncDirectoryUpdateHandler class. This change will allow us to implement update application differently for different types. Because update application happens on the model threads, the ApplyUpdatesAndResolveConflictsCommand had to be aware of ModelSafeRoutingInfo, ModelSafeWorkers, and other concepts intended to hide threading details. The new code takes a different approach. It hides the threading details specific to each type inside its SyncDirectoryUpateHandler by initializing it with a scoped_refptr to its associated ModelSafeWorker. The ApplyUpdatesAndResolveConflictsCommand was the last SyncerCommand. With its removal, we can also remove the definitions of SyncerCommand, ModelChangingSyncerCommand and SyncerCommandTest. BUG=278484 Review URL: https://codereview.chromium.org/72403003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238532 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Add getters and setters to Entry classesrlarocque@chromium.org2013-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the Entry and MutableEntry classes' Get(X) and Put(X, V) members with GetX() and PutX(V) style members. There are many good reasons for performing this refactor. The main reason to implement it now is that we'd like to have more fine-grained control over the visibility of the getters and setters for certain fields, and it's really hard to implement that control when several different fields use the same accessor functions. Once this refactor is complete, we can modify the inheritance hierarchy for Entry and MutableEntry to introduce a new, semi-MutableEntry that provides only the setters whose changes are not "visible" to the underlying model. We can also build on this work to simplify the implementation of MutableEntry. The interface changes are the most notable part of this CL, but there are a few smaller changes here too, including: - Some small formatting cleanups. - In cases where Put() functions had signatures that returned bool but never returned anything other than 'true', those return values have been changed to void. - Some dead code in syncer_proto_util.cc has been removed. BUG=284672 Review URL: https://chromiumcodereview.appspot.com/23484035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223111 0039d316-1c4b-4281-b951-d872f2087c98
* [sync] Componentize sync: Part 5: Eliminate filename collisions in sync.gyprsimha@chromium.org2012-12-191-2/+2
| | | | | | | | | | | | In order to move src/sync into its own compoent, all the static_library targets in sync.gyp need to be converted to targets of type 'none' and rolled into one sync target of type component. This is currently blocked by duplicate .cc filenames in syncable and internal_api, which flags an error while running gyp. The offending files are {internal_api|syncable}/{base|read|write}_transaction.cc. This patch renames syncable/{base|read|write}_transaction.{h|cc} to syncable/syncable_{base|read|write}_transaction.{h|cc}. BUG=136928 Review URL: https://codereview.chromium.org/11638018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174032 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Merge apply updates and resolve conflictsrlarocque@chromium.org2012-10-261-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conflict resolution code was executed after the commit for reasons which no longer apply. Because we no longer have to worry about resolving hierarchy conflicts or nigori node conflicts, we have the opportunity to move conflict resolution closer to update application. One advantage of resolving conflicts early is that we no longer require an extra sync cycle to commit any 'local wins' conflict resolutions. This makes SYNC_CYCLE_CONTINUATION sync cycles obsolete. Another advantage is that update application and conflict resolution can be performed without releasing the sync lock, which eliminates several types of races that we used to have to worry about. It's probably more efficient, too. It allows us to guarantee that there are no simple conflicts remaining after the update application step is completed. The effects might not be very noticeable to end users, but it will be nice to remove some of the conflict tracking code. Finally, it removes the last use PerModelSafeGroupState. This will let us delete some unused code and hopefully simplify StatusController. This patch does not pursue these cleanups as agressively as it could. The idea here is to keep the complex logic changes in one small CL, and perform the cleanups in a larger, but simpler, follow-up CL. BUG=147681,11280,156238 Review URL: https://chromiumcodereview.appspot.com/11192071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164286 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove UpdateProgress and related coderlarocque@chromium.org2012-10-171-64/+5
| | | | | | | | | | | | | | | | | | Following the merge of the process updates and verify updates step, there is no longer any need for the UpdateProgress class. Its only use outside of tests was to pass data between the verify and update steps during a sync cycle. The class had some use in tests, but most of the assertions based on it were somewhat redundant. They can be replaced by assertions on similar, but non-ModelSafe, counts. BUG=156238 Review URL: https://chromiumcodereview.appspot.com/11190013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162576 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Remove ConflictProgressrlarocque@chromium.org2012-10-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | This change removes the ConflictProgress struct from the PerModelSafeGroupState. The struct was intended to pass state between the update application and conflict resolution commands. This part of its functionality has been replaced with a vector of simple conflict item IDs. The ConflictProgress struct also had an important role to play in stats gathering and unit tests. To replace it, the update applicator has been updated to store its counts directly in the StatusController. Unlike ConflictProgress, this state is not thread-local. That's acceptable because we can guarantee it will only be read or written by one thread at a time and those threads use appropriate thread-safety mechanisms to transfer control to each other. This change is another step towards merging update application and conflict resolution. BUG=147681 Review URL: https://chromiumcodereview.appspot.com/11049002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160530 0039d316-1c4b-4281-b951-d872f2087c98
* sync: Refactor update applicationrlarocque@chromium.org2012-09-281-86/+75
| | | | | | | | | | | | | | | | This is a refactoring patch. It removes an unnecessary ConflictResolver parameter from a few helper functions and rewrites the update application logic. This patch is part of a series. I expect that future patches will be easier to implement if an applicator can be reused, and the iterator members make it difficult to do so with the current design. BUG=147681 Review URL: https://chromiumcodereview.appspot.com/10964057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159186 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopingsakalin@chromium.org2012-07-201-3/+3
| | | | | | | | | | | | | | | | | Since (almost) everything in sync/ is now in the 'syncer' namespace, all of these are redundant. Clean up indentation. Put sync_{client,listen_notifications} into syncer namespace. BUG=128060 TEST= Review URL: https://chromiumcodereview.appspot.com/10795018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147675 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Move ModelType and related classes to 'syncer' namespaceakalin@chromium.org2012-07-031-3/+3
| | | | | | | | | | | | | | Previously they were in 'syncer::syncable'. Also remove aliases to those classes from 'syncable'. BUG=128060 TEST= TBR=pkasting@chromium.org,jhawkins@chromium.org, Review URL: https://chromiumcodereview.appspot.com/10696087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145399 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Move nigori_util* to sync/syncableakalin@chromium.org2012-06-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | It's already in the syncable namespace, so syncable/ seems like a better place for it. Move a function from syncer_util.h. to syncable_util.h. Remove pseudo-namespace class SyncerUtil. After this change, everything in sync/engine will be in the syncer namespace. Also clean up some whitespace. BUG=128060 TEST= Review URL: https://chromiumcodereview.appspot.com/10704034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144977 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Rename csync namespace to syncerakalin@chromium.org2012-06-281-2/+2
| | | | | | | | | | | | | | | Everyone was confused by 'csync'. 'syncer' seems more understandable. (Note that we can't use the 'sync' namespace since sync() is a function from unistd.h.) BUG=10662035 TEST= TBR=jhawkins@chromium.org,pkasting@chromium.org Review URL: https://chromiumcodereview.appspot.com/10698014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144820 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Rename browser_sync to csync in sync/akalin@chromium.org2012-06-211-2/+2
| | | | | | | | | | | | | | | Update all references from chrome. Leave possibly-extraneous csync:: qualifications in sync/ for now. (This will be cleaned up once everything in sync/ is in csync::.) BUG=128060 TEST= TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/10600002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143449 0039d316-1c4b-4281-b951-d872f2087c98
* Split syncable.{h,cc} into several filesrlarocque@chromium.org2012-06-201-1/+3
| | | | | | | | | | | | | | | | The only functional change was to remove the dirkernel_ member from BaseTransaction, which was to reduce the number of includes required. Everything else is just moving code around, and updating includes, forward declarations, and 'using' statements. BUG=103332 TEST= Review URL: https://chromiumcodereview.appspot.com/10579036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143218 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Move 'sync' target to sync/akalin@chromium.org2012-03-151-0/+190
Also move related test files. Move WriteNode::UpdateEntryWithEncryption to nigori_util.h. Clean up defines and dependencies. In particular, get rid of SYNC_ENGINE_VERSION_STRING and hard-code the string in the single place it's used. Rename data_encryption.* to data_encryption_win.* and add a pragma for crypt32.lib. Clean up exit-time constructor warnings in sync{able,er}_unittest.cc. Remove some unused files. BUG=117585 TEST= TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/9699057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126872 0039d316-1c4b-4281-b951-d872f2087c98