OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
6 #define COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Updates this entity with data from the latest version that the | 49 // Updates this entity with data from the latest version that the |
50 // model asked us to commit. May clobber state related to the | 50 // model asked us to commit. May clobber state related to the |
51 // model's previous commit attempt(s). | 51 // model's previous commit attempt(s). |
52 void RequestCommit(const CommitRequestData& data); | 52 void RequestCommit(const CommitRequestData& data); |
53 | 53 |
54 // Tracks the receipt of a commit response and fills in some local-only data | 54 // Tracks the receipt of a commit response and fills in some local-only data |
55 // on it to be passed back to the processor. | 55 // on it to be passed back to the processor. |
56 void ReceiveCommitResponse(CommitResponseData* ack); | 56 void ReceiveCommitResponse(CommitResponseData* ack); |
57 | 57 |
58 // Handles receipt of an update from the server. | 58 // Handles receipt of an update from the server. |
59 void ReceiveUpdate(int64_t version); | 59 void ReceiveUpdate(const UpdateResponseData& update); |
60 | 60 |
61 // Handles the receipt of an encrypted update from the server. | 61 // Handles the receipt of an encrypted update from the server. |
62 // | 62 // |
63 // Returns true if the tracker decides this item is worth keeping. Returns | 63 // Returns true if the tracker decides this item is worth keeping. Returns |
64 // false if the item is discarded, which could happen if the version number | 64 // false if the item is discarded, which could happen if the version number |
65 // is out of date. | 65 // is out of date. |
66 bool ReceiveEncryptedUpdate(const UpdateResponseData& data); | 66 bool ReceiveEncryptedUpdate(const UpdateResponseData& data); |
67 | 67 |
68 // Functions to fetch the latest encrypted update. | 68 // Functions to fetch the latest encrypted update. |
69 bool HasEncryptedUpdate() const; | 69 bool HasEncryptedUpdate() const; |
(...skipping 15 matching lines...) Expand all Loading... |
85 // Checks if the server knows about this item. | 85 // Checks if the server knows about this item. |
86 bool IsServerKnown() const; | 86 bool IsServerKnown() const; |
87 | 87 |
88 // Clears flag and optionally clears state associated with a pending commit. | 88 // Clears flag and optionally clears state associated with a pending commit. |
89 void ClearPendingCommit(); | 89 void ClearPendingCommit(); |
90 | 90 |
91 // The ID for this entry. May be empty if the entry has never been committed. | 91 // The ID for this entry. May be empty if the entry has never been committed. |
92 std::string id_; | 92 std::string id_; |
93 | 93 |
94 // The hashed client tag for this entry. | 94 // The hashed client tag for this entry. |
95 std::string client_tag_hash_; | 95 const std::string client_tag_hash_; |
96 | 96 |
97 // The highest version seen in a commit response for this entry. | 97 // The highest version seen in a commit response for this entry. |
98 int64_t highest_commit_response_version_; | 98 int64_t highest_commit_response_version_; |
99 | 99 |
100 // The highest version seen in a GU response for this entry. | 100 // The highest version seen in a GU response for this entry. |
101 int64_t highest_gu_response_version_; | 101 int64_t highest_gu_response_version_; |
102 | 102 |
103 // Used to track in-flight commit requests on the model thread. All we need | 103 // Used to track in-flight commit requests on the model thread. All we need |
104 // to do here is return it back to the model thread when the pending commit | 104 // to do here is return it back to the model thread when the pending commit |
105 // is completed and confirmed. Not valid if no commit is pending. | 105 // is completed and confirmed. Not valid if no commit is pending. |
(...skipping 12 matching lines...) Expand all Loading... |
118 // of an pending update prevents commits. As of this writing, the only | 118 // of an pending update prevents commits. As of this writing, the only |
119 // source of pending updates is updates that can't currently be decrypted. | 119 // source of pending updates is updates that can't currently be decrypted. |
120 std::unique_ptr<UpdateResponseData> encrypted_update_; | 120 std::unique_ptr<UpdateResponseData> encrypted_update_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); | 122 DISALLOW_COPY_AND_ASSIGN(WorkerEntityTracker); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace syncer_v2 | 125 } // namespace syncer_v2 |
126 | 126 |
127 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ | 127 #endif // COMPONENTS_SYNC_ENGINE_IMPL_WORKER_ENTITY_TRACKER_H_ |
OLD | NEW |