Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: sync/notifier/invalidation_state_tracker.h

Issue 11229015: Add the InvalidationState struct to bundle local state about invalidations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/invalidator_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 InvalidationVersionTracker is an interface that handles getting 5 // An InvalidationVersionTracker is an interface that handles getting
6 // and setting (persisting) max invalidation versions. 6 // and setting (persisting) max invalidation versions.
7 7
8 #ifndef SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ 8 #ifndef SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
9 #define SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ 9 #define SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
10 10
11 #include <map> 11 #include <map>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "google/cacheinvalidation/include/types.h" 14 #include "google/cacheinvalidation/include/types.h"
15 #include "sync/notifier/invalidation_util.h" 15 #include "sync/notifier/invalidation_util.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 18
19 typedef std::map<invalidation::ObjectId, int64, ObjectIdLessThan> 19 struct InvalidationState {
20 InvalidationVersionMap; 20 int64 version;
21 };
22
23 typedef std::map<invalidation::ObjectId, InvalidationState, ObjectIdLessThan>
24 InvalidationStateMap;
21 25
22 class InvalidationStateTracker { 26 class InvalidationStateTracker {
23 public: 27 public:
24 InvalidationStateTracker() {} 28 InvalidationStateTracker() {}
25 29
26 virtual InvalidationVersionMap GetAllMaxVersions() const = 0; 30 virtual InvalidationStateMap GetAllInvalidationStates() const = 0;
27 31
28 // |max_version| should be strictly greater than any existing max 32 // |max_version| should be strictly greater than any existing max
29 // version for |model_type|. 33 // version for |model_type|.
30 virtual void SetMaxVersion(const invalidation::ObjectId& id, 34 virtual void SetMaxVersion(const invalidation::ObjectId& id,
31 int64 max_version) = 0; 35 int64 max_version) = 0;
32 // Removes all state tracked for |ids|. 36 // Removes all state tracked for |ids|.
33 virtual void Forget(const ObjectIdSet& ids) = 0; 37 virtual void Forget(const ObjectIdSet& ids) = 0;
34 38
35 // Used by invalidation::InvalidationClient for persistence. |data| is an 39 // Used by invalidation::InvalidationClient for persistence. |data| is an
36 // opaque blob that an invalidation client can use after a restart to 40 // opaque blob that an invalidation client can use after a restart to
37 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls, 41 // bootstrap itself. |data| is binary data (not valid UTF8, embedded nulls,
38 // etc). 42 // etc).
39 virtual void SetBootstrapData(const std::string& data) = 0; 43 virtual void SetBootstrapData(const std::string& data) = 0;
40 virtual std::string GetBootstrapData() const = 0; 44 virtual std::string GetBootstrapData() const = 0;
41 45
42 protected: 46 protected:
43 virtual ~InvalidationStateTracker() {} 47 virtual ~InvalidationStateTracker() {}
44 }; 48 };
45 49
46 } // namespace syncer 50 } // namespace syncer
47 51
48 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_ 52 #endif // SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/invalidator_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698