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

Side by Side Diff: components/sync/model/sync_metadata_store.h

Issue 2794413002: [USS] Add SyncMetadataStore interface (Closed)
Patch Set: update names Created 3 years, 8 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
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/model_impl/sync_metadata_store_change_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SYNC_MODEL_SYNC_METADATA_STORE_H_
6 #define COMPONENTS_SYNC_MODEL_SYNC_METADATA_STORE_H_
7
8 #include <string>
9
10 #include "components/sync/base/model_type.h"
11
12 namespace sync_pb {
13 class EntityMetadata;
14 class ModelTypeState;
15 } // namespace sync_pb
16
17 namespace syncer {
18
19 // SyncMetadataStore defines interface implemented by model types for persisting
20 // sync metadata and datatype state. It allows model type to use common
21 // implementation of MetadataChangeList (SyncMetadataStoreChangeList) instead of
22 // implementing their own.
23 // Model type in implementation of ModelTypeSyncBridge::CreateMetadataChangeList
24 // should create instance of SyncMetadataStoreChangeList passing pointer to
25 // SyncMetadataStore to its constructor.
26 // Implementations of SyncMetadataStore methods should support add/update/delete
27 // metadata in model type specific sync metadata storage.
28
29 class SyncMetadataStore {
30 public:
31 SyncMetadataStore() {}
32 virtual ~SyncMetadataStore() {}
33
34 // Update the metadata row for |model_type|, keyed by |storage_key|, to
35 // contain the contents of |metadata|.
36 // Return true on success.
37 virtual bool UpdateSyncMetadata(syncer::ModelType model_type,
38 const std::string& storage_key,
39 const sync_pb::EntityMetadata& metadata) = 0;
40
41 // Remove the metadata row of type |model_type| keyed by |storage_key|.
42 // Return true on success.
43 virtual bool ClearSyncMetadata(syncer::ModelType model_type,
44 const std::string& storage_key) = 0;
45
46 // Update the stored sync state for the |model_type|.
47 // Return true on success.
48 virtual bool UpdateModelTypeState(
49 syncer::ModelType model_type,
50 const sync_pb::ModelTypeState& model_type_state) = 0;
51
52 // Clear the stored sync state for |model_type|.
53 // Return true on success.
54 virtual bool ClearModelTypeState(syncer::ModelType model_type) = 0;
55 };
56
57 } // namespace syncer
58
59 #endif // COMPONENTS_SYNC_MODEL_SYNC_METADATA_STORE_H_
OLDNEW
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/model_impl/sync_metadata_store_change_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698