| 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 |
| 11 #ifndef SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 11 #ifndef SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| 12 #define SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 12 #define SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| 13 | 13 |
| 14 #include <stdint.h> |
| 15 |
| 14 #include <set> | 16 #include <set> |
| 15 #include <vector> | 17 #include <vector> |
| 16 | 18 |
| 17 #include "base/basictypes.h" | 19 #include "base/macros.h" |
| 18 #include "sync/internal_api/public/engine/model_safe_worker.h" | 20 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 21 #include "sync/sessions/status_controller.h" |
| 19 #include "sync/syncable/syncable_id.h" | 22 #include "sync/syncable/syncable_id.h" |
| 20 #include "sync/sessions/status_controller.h" | |
| 21 | 23 |
| 22 namespace syncer { | 24 namespace syncer { |
| 23 | 25 |
| 24 namespace sessions { | 26 namespace sessions { |
| 25 class StatusController; | 27 class StatusController; |
| 26 } | 28 } |
| 27 | 29 |
| 28 namespace syncable { | 30 namespace syncable { |
| 29 class WriteTransaction; | 31 class WriteTransaction; |
| 30 class Entry; | 32 class Entry; |
| 31 } | 33 } |
| 32 | 34 |
| 33 class ConflictResolver; | 35 class ConflictResolver; |
| 34 class Cryptographer; | 36 class Cryptographer; |
| 35 | 37 |
| 36 class UpdateApplicator { | 38 class UpdateApplicator { |
| 37 public: | 39 public: |
| 38 explicit UpdateApplicator(Cryptographer* cryptographer); | 40 explicit UpdateApplicator(Cryptographer* cryptographer); |
| 39 ~UpdateApplicator(); | 41 ~UpdateApplicator(); |
| 40 | 42 |
| 41 // Attempt to apply the specified updates. | 43 // Attempt to apply the specified updates. |
| 42 void AttemptApplications(syncable::WriteTransaction* trans, | 44 void AttemptApplications(syncable::WriteTransaction* trans, |
| 43 const std::vector<int64>& handles); | 45 const std::vector<int64_t>& handles); |
| 44 | 46 |
| 45 int updates_applied() { | 47 int updates_applied() { |
| 46 return updates_applied_; | 48 return updates_applied_; |
| 47 } | 49 } |
| 48 | 50 |
| 49 int encryption_conflicts() { | 51 int encryption_conflicts() { |
| 50 return encryption_conflicts_; | 52 return encryption_conflicts_; |
| 51 } | 53 } |
| 52 | 54 |
| 53 int hierarchy_conflicts() { | 55 int hierarchy_conflicts() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 69 int encryption_conflicts_; | 71 int encryption_conflicts_; |
| 70 int hierarchy_conflicts_; | 72 int hierarchy_conflicts_; |
| 71 std::set<syncable::Id> simple_conflict_ids_; | 73 std::set<syncable::Id> simple_conflict_ids_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); | 75 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace syncer | 78 } // namespace syncer |
| 77 | 79 |
| 78 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ | 80 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_ |
| OLD | NEW |