| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual InvalidationStateMap GetAllInvalidationStates() const = 0; | 55 virtual InvalidationStateMap GetAllInvalidationStates() const = 0; |
| 56 | 56 |
| 57 // |max_version| should be strictly greater than any existing max | 57 // |max_version| should be strictly greater than any existing max |
| 58 // version for |model_type|. | 58 // version for |model_type|. |
| 59 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, | 59 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, |
| 60 int64 max_version, | 60 int64 max_version, |
| 61 const std::string& payload) = 0; | 61 const std::string& payload) = 0; |
| 62 // Removes all state tracked for |ids|. | 62 // Removes all state tracked for |ids|. |
| 63 virtual void Forget(const ObjectIdSet& ids) = 0; | 63 virtual void Forget(const ObjectIdSet& ids) = 0; |
| 64 | 64 |
| 65 // The per-client unique ID used to register the invalidation client with the |
| 66 // server. This is used to squelch invalidation notifications that originate |
| 67 // from changes made by this client. |
| 68 virtual void SetInvalidatorClientId(const std::string& data) = 0; |
| 69 virtual std::string GetInvalidatorClientId() const = 0; |
| 70 |
| 65 // Used by invalidation::InvalidationClient for persistence. |data| is an | 71 // Used by invalidation::InvalidationClient for persistence. |data| is an |
| 66 // 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 |
| 67 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, | 73 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, |
| 68 // etc). | 74 // etc). |
| 69 virtual void SetBootstrapData(const std::string& data) = 0; | 75 virtual void SetBootstrapData(const std::string& data) = 0; |
| 70 virtual std::string GetBootstrapData() const = 0; | 76 virtual std::string GetBootstrapData() const = 0; |
| 71 | 77 |
| 72 // Used for generating our own local ack handles. Generates a new ack handle | 78 // Used for generating our own local ack handles. Generates a new ack handle |
| 73 // for each object id in |ids|. The result is returned via |callback| posted | 79 // for each object id in |ids|. The result is returned via |callback| posted |
| 74 // to |task_runner|. | 80 // to |task_runner|. |
| 75 virtual void GenerateAckHandles( | 81 virtual void GenerateAckHandles( |
| 76 const ObjectIdSet& ids, | 82 const ObjectIdSet& ids, |
| 77 const scoped_refptr<base::TaskRunner>& task_runner, | 83 const scoped_refptr<base::TaskRunner>& task_runner, |
| 78 base::Callback<void(const AckHandleMap&)> callback) = 0; | 84 base::Callback<void(const AckHandleMap&)> callback) = 0; |
| 79 | 85 |
| 80 // Records an acknowledgement for |id|. Note that no attempt at ordering is | 86 // Records an acknowledgement for |id|. Note that no attempt at ordering is |
| 81 // made. Acknowledge() only records the last ack_handle it received, even if | 87 // made. Acknowledge() only records the last ack_handle it received, even if |
| 82 // the last ack_handle it received was generated before the value currently | 88 // the last ack_handle it received was generated before the value currently |
| 83 // recorded. | 89 // recorded. |
| 84 virtual void Acknowledge(const invalidation::ObjectId& id, | 90 virtual void Acknowledge(const invalidation::ObjectId& id, |
| 85 const AckHandle& ack_handle) = 0; | 91 const AckHandle& ack_handle) = 0; |
| 86 | 92 |
| 87 protected: | 93 protected: |
| 88 virtual ~InvalidationStateTracker() {} | 94 virtual ~InvalidationStateTracker() {} |
| 89 }; | 95 }; |
| 90 | 96 |
| 91 } // namespace syncer | 97 } // namespace syncer |
| 92 | 98 |
| 93 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ | 99 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ |
| OLD | NEW |