| Index: sync/notifier/invalidation_state_tracker.h
|
| diff --git a/sync/notifier/invalidation_state_tracker.h b/sync/notifier/invalidation_state_tracker.h
|
| index 3105f3a8ac9c08e23a54c7bf6cba04c3d32cd43c..bb8d0fdc8d10936594c4f24c4b450c81b00f9d5a 100644
|
| --- a/sync/notifier/invalidation_state_tracker.h
|
| +++ b/sync/notifier/invalidation_state_tracker.h
|
| @@ -2,28 +2,44 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| //
|
| -// An InvalidationVersionTracker is an interface that handles getting
|
| -// and setting (persisting) max invalidation versions.
|
| +// An InvalidationStateTracker is an interface that handles getting
|
| +// and setting (persisting) max invalidation versions and our local ack
|
| +// handles.
|
|
|
| #ifndef SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
|
| #define SYNC_NOTIFIER_INVALIDATION_STATE_TRACKER_H_
|
|
|
| +#include <string>
|
| #include <map>
|
|
|
| #include "base/basictypes.h"
|
| #include "google/cacheinvalidation/include/types.h"
|
| +#include "sync/internal_api/public/base/invalidation_state.h"
|
| #include "sync/notifier/invalidation_util.h"
|
|
|
| namespace syncer {
|
|
|
| -typedef std::map<invalidation::ObjectId, int64, ObjectIdLessThan>
|
| - InvalidationVersionMap;
|
| +// TODO(dcheng): Need a better name.
|
| +struct LocalState {
|
| + LocalState();
|
| + ~LocalState();
|
| +
|
| + int64 version;
|
| + std::string payload;
|
| + AckHandle expected;
|
| + AckHandle current;
|
| +};
|
| +
|
| +typedef std::map<invalidation::ObjectId, LocalState, ObjectIdLessThan>
|
| + InvalidationStateMap;
|
| +typedef std::map<invalidation::ObjectId, AckHandle, ObjectIdLessThan>
|
| + AckHandleMap;
|
|
|
| class InvalidationStateTracker {
|
| public:
|
| InvalidationStateTracker() {}
|
|
|
| - virtual InvalidationVersionMap GetAllMaxVersions() const = 0;
|
| + virtual InvalidationStateMap GetStateMap() const = 0;
|
|
|
| // |max_version| should be strictly greater than any existing max
|
| // version for |model_type|.
|
| @@ -39,6 +55,15 @@ class InvalidationStateTracker {
|
| virtual void SetInvalidationState(const std::string& state) = 0;
|
| virtual std::string GetInvalidationState() const = 0;
|
|
|
| + // Used for generating our own local ack handles.
|
| + // Generates a new ack handle for each object id in |ids|. The resulting ack
|
| + // handles are passed back in the output parameter rather than being returned
|
| + // directly, since this method is typically used with PostTaskAndReply.
|
| + virtual void GenerateAckHandles(const ObjectIdSet& ids,
|
| + AckHandleMap* ack_handles) = 0;
|
| + virtual void Acknowledge(const invalidation::ObjectId& id,
|
| + const AckHandle& ack_handle) = 0;
|
| +
|
| protected:
|
| virtual ~InvalidationStateTracker() {}
|
| };
|
|
|