| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // An UpdateApplicator is used to iterate over a number of unapplied updates, | 5 // An UpdateApplicator is used to iterate over a number of unapplied updates, |
| 6 // applying them to the client using the given syncer session. | 6 // applying them to the client using the given syncer session. |
| 7 // | 7 // |
| 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying | 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying |
| 9 // failed updates until no remaining updates can be successfully applied. | 9 // failed updates until no remaining updates can be successfully applied. |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace syncable { | 28 namespace syncable { |
| 29 class WriteTransaction; | 29 class WriteTransaction; |
| 30 class Entry; | 30 class Entry; |
| 31 } | 31 } |
| 32 | 32 |
| 33 class ConflictResolver; | 33 class ConflictResolver; |
| 34 class Cryptographer; | 34 class Cryptographer; |
| 35 | 35 |
| 36 class UpdateApplicator { | 36 class UpdateApplicator { |
| 37 public: | 37 public: |
| 38 typedef std::vector<int64>::iterator UpdateIterator; | |
| 39 | |
| 40 UpdateApplicator(Cryptographer* cryptographer, | 38 UpdateApplicator(Cryptographer* cryptographer, |
| 41 const ModelSafeRoutingInfo& routes, | 39 const ModelSafeRoutingInfo& routes, |
| 42 ModelSafeGroup group_filter); | 40 ModelSafeGroup group_filter); |
| 43 ~UpdateApplicator(); | 41 ~UpdateApplicator(); |
| 44 | 42 |
| 45 // Attempt to apply the specified updates. | 43 // Attempt to apply the specified updates. |
| 46 void AttemptApplications(syncable::WriteTransaction* trans, | 44 void AttemptApplications(syncable::WriteTransaction* trans, |
| 47 const std::vector<int64>& handles, | 45 const std::vector<int64>& handles); |
| 48 sessions::StatusController* status); | 46 |
| 47 int updates_applied() { |
| 48 return updates_applied_; |
| 49 } |
| 50 |
| 51 int encryption_conflicts() { |
| 52 return encryption_conflicts_; |
| 53 } |
| 54 |
| 55 int hierarchy_conflicts() { |
| 56 return hierarchy_conflicts_; |
| 57 } |
| 58 |
| 59 const std::set<syncable::Id>& simple_conflict_ids() { |
| 60 return simple_conflict_ids_; |
| 61 } |
| 49 | 62 |
| 50 private: | 63 private: |
| 51 // If true, AttemptOneApplication will skip over |entry| and return true. | 64 // If true, AttemptOneApplication will skip over |entry| and return true. |
| 52 bool SkipUpdate(const syncable::Entry& entry); | 65 bool SkipUpdate(const syncable::Entry& entry); |
| 53 | 66 |
| 54 // Used to decrypt sensitive sync nodes. | 67 // Used to decrypt sensitive sync nodes. |
| 55 Cryptographer* cryptographer_; | 68 Cryptographer* cryptographer_; |
| 56 | 69 |
| 57 ModelSafeGroup group_filter_; | 70 ModelSafeGroup group_filter_; |
| 58 | 71 |
| 59 const ModelSafeRoutingInfo routing_info_; | 72 const ModelSafeRoutingInfo routing_info_; |
| 60 | 73 |
| 61 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); | 74 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); |
| 75 |
| 76 int updates_applied_; |
| 77 int encryption_conflicts_; |
| 78 int hierarchy_conflicts_; |
| 79 std::set<syncable::Id> simple_conflict_ids_; |
| 62 }; | 80 }; |
| 63 | 81 |
| 64 } // namespace syncer | 82 } // namespace syncer |
| 65 | 83 |
| 66 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 84 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| OLD | NEW |