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

Unified Diff: components/sync/api/model_type_service.h

Issue 2222373003: [Sync] Adding storage key concept for ModelTypeServices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing redundant hash value. Created 4 years, 4 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
« no previous file with comments | « components/sync/api/model_type_change_processor.h ('k') | components/sync/core/data_batch_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/api/model_type_service.h
diff --git a/components/sync/api/model_type_service.h b/components/sync/api/model_type_service.h
index 9b2bec714d18b7fcf0dcf8e1d46f093866a11cc6..80f3aed87ab051051a0b7e13d4ec17cd651d2bde 100644
--- a/components/sync/api/model_type_service.h
+++ b/components/sync/api/model_type_service.h
@@ -34,7 +34,7 @@ class SYNC_EXPORT ModelTypeService {
public:
typedef base::Callback<void(syncer::SyncError, std::unique_ptr<DataBatch>)>
DataCallback;
- typedef std::vector<std::string> ClientTagList;
+ typedef std::vector<std::string> StorageKeyList;
typedef base::Callback<std::unique_ptr<ModelTypeChangeProcessor>(
syncer::ModelType type,
ModelTypeService* service)>
@@ -75,15 +75,29 @@ class SYNC_EXPORT ModelTypeService {
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) = 0;
- // Asynchronously retrieve the corresponding sync data for |client_tags|.
- virtual void GetData(ClientTagList client_tags, DataCallback callback) = 0;
+ // Asynchronously retrieve the corresponding sync data for |storage_keys|.
+ virtual void GetData(StorageKeyList storage_keys, DataCallback callback) = 0;
// Asynchronously retrieve all of the local sync data.
virtual void GetAllData(DataCallback callback) = 0;
- // Get or generate a client tag for |entity_data|.
+ // Get or generate a client tag for |entity_data|. This must be the same tag
+ // that was/would have been generated in the SyncableService/Directory world
+ // for backward compatibility with pre-USS clients. The only time this
+ // theoretically needs to be called is on the creation of local data, however
+ // it is also used to verify the hash of remote data. If a data type was never
+ // launched pre-USS, then method does not need to be different from
+ // GetStorageKey().
virtual std::string GetClientTag(const EntityData& entity_data) = 0;
+ // Get or generate a storage key for |entity_data|. This will only ever be
+ // called once when first encountering a remote entity. Local changes will
+ // provide their storage keys directly to Put instead of using this method.
+ // Theoretically this function doesn't need to be stable across multiple calls
+ // on the same or different clients, but to keep things simple, it probably
+ // should be.
+ virtual std::string GetStorageKey(const EntityData& entity_data) = 0;
+
// Overridable notification for when the processor is set. This is typically
// when the service should start loading metadata and then subsequently giving
// it to the processor.
« no previous file with comments | « components/sync/api/model_type_change_processor.h ('k') | components/sync/core/data_batch_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698