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

Unified Diff: sync/notifier/invalidation_state_tracker.h

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sync/notifier/invalidation_state_tracker.h
diff --git a/sync/notifier/invalidation_state_tracker.h b/sync/notifier/invalidation_state_tracker.h
index e3e5bd21a94f24695b74405f14f8c8edad9aae3f..c400885b567c16d2cb0e72e634fd108df43d3020 100644
--- a/sync/notifier/invalidation_state_tracker.h
+++ b/sync/notifier/invalidation_state_tracker.h
@@ -22,6 +22,7 @@
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/invalidation.h"
#include "sync/notifier/invalidation_util.h"
+#include "sync/notifier/unacked_invalidation_set.h"
namespace base {
class TaskRunner;
@@ -29,39 +30,10 @@ class TaskRunner;
namespace syncer {
-struct SYNC_EXPORT InvalidationState {
- InvalidationState();
- ~InvalidationState();
-
- int64 version;
- std::string payload;
- AckHandle expected;
- AckHandle current;
-};
-
-// TODO(dcheng): Remove this in favor of adding an Equals() method.
-SYNC_EXPORT_PRIVATE bool operator==(const InvalidationState& lhs,
- const InvalidationState& rhs);
-
-typedef std::map<invalidation::ObjectId, InvalidationState, ObjectIdLessThan>
- InvalidationStateMap;
-typedef std::map<invalidation::ObjectId, AckHandle, ObjectIdLessThan>
- AckHandleMap;
-
class InvalidationStateTracker {
public:
InvalidationStateTracker() {}
- virtual InvalidationStateMap GetAllInvalidationStates() const = 0;
-
- // |max_version| should be strictly greater than any existing max
- // version for |model_type|.
- virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id,
- int64 max_version,
- const std::string& payload) = 0;
- // Removes all state tracked for |ids|.
- virtual void Forget(const ObjectIdSet& ids) = 0;
-
// The per-client unique ID used to register the invalidation client with the
// server. This is used to squelch invalidation notifications that originate
// from changes made by this client.
@@ -75,24 +47,15 @@ class InvalidationStateTracker {
virtual void SetBootstrapData(const std::string& data) = 0;
virtual std::string GetBootstrapData() const = 0;
+ // Used to store invalidations that have been acked to the server, but not yet
+ // handled by our clients. We stores these invalidations on disk so we won't
tim (not reviewing) 2013/11/18 21:59:05 nit - 'We store'
rlarocque 2013/11/19 00:35:49 Done.
+ // lose them if we need to restart.
+ virtual void SetSavedInvalidations(const UnackedInvalidationsMap& states) = 0;
+ virtual UnackedInvalidationsMap GetSavedInvalidations() const = 0;
+
// Erases invalidation versions, client ID, and state stored on disk.
virtual void Clear() = 0;
- // Used for generating our own local ack handles. Generates a new ack handle
- // for each object id in |ids|. The result is returned via |callback| posted
- // to |task_runner|.
- virtual void GenerateAckHandles(
- const ObjectIdSet& ids,
- const scoped_refptr<base::TaskRunner>& task_runner,
- base::Callback<void(const AckHandleMap&)> callback) = 0;
-
- // Records an acknowledgement for |id|. Note that no attempt at ordering is
- // made. Acknowledge() only records the last ack_handle it received, even if
- // the last ack_handle it received was generated before the value currently
- // recorded.
- virtual void Acknowledge(const invalidation::ObjectId& id,
- const AckHandle& ack_handle) = 0;
-
protected:
virtual ~InvalidationStateTracker() {}
};

Powered by Google App Engine
This is Rietveld 408576698