OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 InvalidationStateTracker is an interface that handles persisting state | 5 // An InvalidationStateTracker is an interface that handles persisting state |
6 // needed for invalidations. Currently, it is responsible for managing the | 6 // needed for invalidations. Currently, it is responsible for managing the |
7 // following information: | 7 // following information: |
8 // - Max version seen from the invalidation server to help dedupe invalidations. | 8 // - Max version seen from the invalidation server to help dedupe invalidations. |
9 // - Bootstrap data for the invalidation client. | 9 // - Bootstrap data for the invalidation client. |
10 // - Payloads and locally generated ack handles, to support local acking. | 10 // - Payloads and locally generated ack handles, to support local acking. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual void SetInvalidatorClientId(const std::string& data) = 0; | 68 virtual void SetInvalidatorClientId(const std::string& data) = 0; |
69 virtual std::string GetInvalidatorClientId() const = 0; | 69 virtual std::string GetInvalidatorClientId() const = 0; |
70 | 70 |
71 // Used by invalidation::InvalidationClient for persistence. |data| is an | 71 // Used by invalidation::InvalidationClient for persistence. |data| is an |
72 // opaque blob that an invalidation client can use after a restart to | 72 // opaque blob that an invalidation client can use after a restart to |
73 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, | 73 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, |
74 // etc). | 74 // etc). |
75 virtual void SetBootstrapData(const std::string& data) = 0; | 75 virtual void SetBootstrapData(const std::string& data) = 0; |
76 virtual std::string GetBootstrapData() const = 0; | 76 virtual std::string GetBootstrapData() const = 0; |
77 | 77 |
| 78 // Erases invalidation versions, client ID, and state stored on disk. |
| 79 virtual void Clear() = 0; |
| 80 |
78 // Used for generating our own local ack handles. Generates a new ack handle | 81 // Used for generating our own local ack handles. Generates a new ack handle |
79 // for each object id in |ids|. The result is returned via |callback| posted | 82 // for each object id in |ids|. The result is returned via |callback| posted |
80 // to |task_runner|. | 83 // to |task_runner|. |
81 virtual void GenerateAckHandles( | 84 virtual void GenerateAckHandles( |
82 const ObjectIdSet& ids, | 85 const ObjectIdSet& ids, |
83 const scoped_refptr<base::TaskRunner>& task_runner, | 86 const scoped_refptr<base::TaskRunner>& task_runner, |
84 base::Callback<void(const AckHandleMap&)> callback) = 0; | 87 base::Callback<void(const AckHandleMap&)> callback) = 0; |
85 | 88 |
86 // Records an acknowledgement for |id|. Note that no attempt at ordering is | 89 // Records an acknowledgement for |id|. Note that no attempt at ordering is |
87 // made. Acknowledge() only records the last ack_handle it received, even if | 90 // made. Acknowledge() only records the last ack_handle it received, even if |
88 // the last ack_handle it received was generated before the value currently | 91 // the last ack_handle it received was generated before the value currently |
89 // recorded. | 92 // recorded. |
90 virtual void Acknowledge(const invalidation::ObjectId& id, | 93 virtual void Acknowledge(const invalidation::ObjectId& id, |
91 const AckHandle& ack_handle) = 0; | 94 const AckHandle& ack_handle) = 0; |
92 | 95 |
93 protected: | 96 protected: |
94 virtual ~InvalidationStateTracker() {} | 97 virtual ~InvalidationStateTracker() {} |
95 }; | 98 }; |
96 | 99 |
97 } // namespace syncer | 100 } // namespace syncer |
98 | 101 |
99 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ | 102 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ |
OLD | NEW |