| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace base { | 27 namespace base { |
| 28 class TaskRunner; | 28 class TaskRunner; |
| 29 } // namespace base | 29 } // namespace base |
| 30 | 30 |
| 31 namespace syncer { | 31 namespace syncer { |
| 32 | 32 |
| 33 class InvalidationStateTracker { | 33 class InvalidationStateTracker { |
| 34 public: | 34 public: |
| 35 InvalidationStateTracker() {} | 35 InvalidationStateTracker() {} |
| 36 virtual ~InvalidationStateTracker() {} |
| 36 | 37 |
| 37 // The per-client unique ID used to register the invalidation client with the | 38 // The per-client unique ID used to register the invalidation client with the |
| 38 // server. This is used to squelch invalidation notifications that originate | 39 // server. This is used to squelch invalidation notifications that originate |
| 39 // from changes made by this client. | 40 // from changes made by this client. Setting the client ID clears all other |
| 40 virtual void SetInvalidatorClientId(const std::string& data) = 0; | 41 // state. |
| 42 virtual void ClearAndSetNewClientId(const std::string& data) = 0; |
| 41 virtual std::string GetInvalidatorClientId() const = 0; | 43 virtual std::string GetInvalidatorClientId() const = 0; |
| 42 | 44 |
| 43 // Used by invalidation::InvalidationClient for persistence. |data| is an | 45 // Used by invalidation::InvalidationClient for persistence. |data| is an |
| 44 // opaque blob that an invalidation client can use after a restart to | 46 // opaque blob that an invalidation client can use after a restart to |
| 45 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, | 47 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, |
| 46 // etc). | 48 // etc). |
| 47 virtual void SetBootstrapData(const std::string& data) = 0; | 49 virtual void SetBootstrapData(const std::string& data) = 0; |
| 48 virtual std::string GetBootstrapData() const = 0; | 50 virtual std::string GetBootstrapData() const = 0; |
| 49 | 51 |
| 50 // Used to store invalidations that have been acked to the server, but not yet | 52 // Used to store invalidations that have been acked to the server, but not yet |
| 51 // handled by our clients. We store these invalidations on disk so we won't | 53 // handled by our clients. We store these invalidations on disk so we won't |
| 52 // lose them if we need to restart. | 54 // lose them if we need to restart. |
| 53 virtual void SetSavedInvalidations(const UnackedInvalidationsMap& states) = 0; | 55 virtual void SetSavedInvalidations(const UnackedInvalidationsMap& states) = 0; |
| 54 virtual UnackedInvalidationsMap GetSavedInvalidations() const = 0; | 56 virtual UnackedInvalidationsMap GetSavedInvalidations() const = 0; |
| 55 | 57 |
| 56 // Erases invalidation versions, client ID, and state stored on disk. | 58 // Erases invalidation versions, client ID, and state stored on disk. |
| 57 virtual void Clear() = 0; | 59 virtual void Clear() = 0; |
| 58 | |
| 59 protected: | |
| 60 virtual ~InvalidationStateTracker() {} | |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 } // namespace syncer | 62 } // namespace syncer |
| 64 | 63 |
| 65 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ | 64 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ |
| OLD | NEW |