| 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 UpdateApplicator(Cryptographer* cryptographer, | 38 UpdateApplicator(Cryptographer* cryptographer); |
| 39 const ModelSafeRoutingInfo& routes, | |
| 40 ModelSafeGroup group_filter); | |
| 41 ~UpdateApplicator(); | 39 ~UpdateApplicator(); |
| 42 | 40 |
| 43 // Attempt to apply the specified updates. | 41 // Attempt to apply the specified updates. |
| 44 void AttemptApplications(syncable::WriteTransaction* trans, | 42 void AttemptApplications(syncable::WriteTransaction* trans, |
| 45 const std::vector<int64>& handles); | 43 const std::vector<int64>& handles); |
| 46 | 44 |
| 47 int updates_applied() { | 45 int updates_applied() { |
| 48 return updates_applied_; | 46 return updates_applied_; |
| 49 } | 47 } |
| 50 | 48 |
| 51 int encryption_conflicts() { | 49 int encryption_conflicts() { |
| 52 return encryption_conflicts_; | 50 return encryption_conflicts_; |
| 53 } | 51 } |
| 54 | 52 |
| 55 int hierarchy_conflicts() { | 53 int hierarchy_conflicts() { |
| 56 return hierarchy_conflicts_; | 54 return hierarchy_conflicts_; |
| 57 } | 55 } |
| 58 | 56 |
| 59 const std::set<syncable::Id>& simple_conflict_ids() { | 57 const std::set<syncable::Id>& simple_conflict_ids() { |
| 60 return simple_conflict_ids_; | 58 return simple_conflict_ids_; |
| 61 } | 59 } |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 // If true, AttemptOneApplication will skip over |entry| and return true. | 62 // If true, AttemptOneApplication will skip over |entry| and return true. |
| 65 bool SkipUpdate(const syncable::Entry& entry); | 63 bool SkipUpdate(const syncable::Entry& entry); |
| 66 | 64 |
| 67 // Used to decrypt sensitive sync nodes. | 65 // Used to decrypt sensitive sync nodes. |
| 68 Cryptographer* cryptographer_; | 66 Cryptographer* cryptographer_; |
| 69 | 67 |
| 70 ModelSafeGroup group_filter_; | |
| 71 | |
| 72 const ModelSafeRoutingInfo routing_info_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); | 68 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); |
| 75 | 69 |
| 76 int updates_applied_; | 70 int updates_applied_; |
| 77 int encryption_conflicts_; | 71 int encryption_conflicts_; |
| 78 int hierarchy_conflicts_; | 72 int hierarchy_conflicts_; |
| 79 std::set<syncable::Id> simple_conflict_ids_; | 73 std::set<syncable::Id> simple_conflict_ids_; |
| 80 }; | 74 }; |
| 81 | 75 |
| 82 } // namespace syncer | 76 } // namespace syncer |
| 83 | 77 |
| 84 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 78 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| OLD | NEW |