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

Unified Diff: chrome/browser/sync/syncable/syncable.h

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/syncable/syncable.h
diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h
index cccf4170e9fed440cd616badb6089abd6455138a..1c5b42ef9d75bcf7e501f801dc4364a5819afbd4 100644
--- a/chrome/browser/sync/syncable/syncable.h
+++ b/chrome/browser/sync/syncable/syncable.h
@@ -557,13 +557,6 @@ class LessEntryMetaHandles {
};
typedef std::set<EntryKernel, LessEntryMetaHandles> OriginalEntries;
-// Represents one or more model types sharing an update timestamp, as is
-// the case with a GetUpdates request.
-struct MultiTypeTimeStamp {
- syncable::ModelTypeBitSet data_types;
- int64 timestamp;
-};
-
// a WriteTransaction has a writer tag describing which body of code is doing
// the write. This is defined up here since DirectoryChangeEvent also contains
// one.
@@ -666,8 +659,10 @@ class Directory {
PersistedKernelInfo();
~PersistedKernelInfo();
+ void reset_download_progress(ModelType model_type);
tim (not reviewing) 2011/01/11 19:14:23 comment? Just seems out of place without context..
ncarter (slow) 2011/01/13 00:06:13 Done.
+
// Last sync timestamp fetched from the server.
- int64 last_download_timestamp[MODEL_TYPE_COUNT];
+ sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT];
// true iff we ever reached the end of the changelog.
ModelTypeBitSet initial_sync_ended;
// The store birthday we were given by the server. Contents are opaque to
@@ -727,35 +722,17 @@ class Directory {
const FilePath& file_path() const { return kernel_->db_path; }
bool good() const { return NULL != store_; }
- // The download timestamp is an index into the server's list of changes for
- // an account. We keep this for each datatype. It doesn't actually map
- // to any time scale; its name is an historical artifact.
- int64 last_download_timestamp(ModelType type) const;
- virtual void set_last_download_timestamp(ModelType type, int64 value);
-
- // Find the model type or model types which have the least timestamp, and
- // return them along with the types having that timestamp. This is done
- // with the intent of sequencing GetUpdates requests in an efficient way:
- // bundling together requests that have the same timestamp, and requesting
- // the oldest such bundles first in hopes that they might catch up to
- // (and thus be merged with) the newer bundles.
- MultiTypeTimeStamp GetTypesWithOldestLastDownloadTimestamp(
- ModelTypeBitSet enabled_types) {
- MultiTypeTimeStamp result;
- result.timestamp = std::numeric_limits<int64>::max();
- for (int i = 0; i < MODEL_TYPE_COUNT; ++i) {
- if (!enabled_types[i])
- continue;
- int64 stamp = last_download_timestamp(ModelTypeFromInt(i));
- if (stamp < result.timestamp) {
- result.data_types.reset();
- result.timestamp = stamp;
- }
- if (stamp == result.timestamp)
- result.data_types.set(i);
- }
- return result;
- }
+ // The download progress is an opaque token provided by the sync server
+ // to indicate the continuation state of the next GetUpdates operation.
+ void GetDownloadProgress(
+ ModelType type,
+ sync_pb::DataTypeProgressMarker* value_out) const;
+ void GetDownloadProgressAsString(
+ ModelType type,
+ std::string* value_out) const;
+ void SetDownloadProgress(
+ ModelType type,
+ const sync_pb::DataTypeProgressMarker& value);
bool initial_sync_ended_for_type(ModelType type) const;
void set_initial_sync_ended_for_type(ModelType type, bool value);
@@ -934,7 +911,6 @@ class Directory {
// on their own; caller must guarantee exclusive access manually by holding
// a ScopedKernelLock.
void set_initial_sync_ended_for_type_unsafe(ModelType type, bool x);
- void set_last_download_timestamp_unsafe(ModelType model_type, int64 x);
void SetNotificationStateUnsafe(const std::string& notification_state);
Directory& operator = (const Directory&);

Powered by Google App Engine
This is Rietveld 408576698