OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ | 5 #ifndef COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ |
6 #define COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ | 6 #define COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 void RemoveEntry(const ReadingListEntry& entry) override; | 41 void RemoveEntry(const ReadingListEntry& entry) override; |
42 | 42 |
43 // Creates an object used to communicate changes in the sync metadata to the | 43 // Creates an object used to communicate changes in the sync metadata to the |
44 // model type store. | 44 // model type store. |
45 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() | 45 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() |
46 override; | 46 override; |
47 | 47 |
48 // Perform the initial merge between local and sync data. This should only be | 48 // Perform the initial merge between local and sync data. This should only be |
49 // called when a data type is first enabled to start syncing, and there is no | 49 // called when a data type is first enabled to start syncing, and there is no |
50 // sync metadata. Best effort should be made to match local and sync data. The | 50 // sync metadata. Best effort should be made to match local and sync data. The |
51 // keys in the |entity_data_map| will have been created via GetClientTag(...), | 51 // storage keys in the |entity_data| are populated with GetStorageKey(...), |
52 // and if a local and sync data should match/merge but disagree on tags, the | 52 // local and sync copies of the same entity should resolve to the same storage |
53 // service should use the sync data's tag. Any local pieces of data that are | 53 // key. Any local pieces of data that are not present in sync should |
54 // not present in sync should immediately be Put(...) to the processor before | 54 // immediately be Put(...) to the processor before returning. The same |
55 // returning. The same MetadataChangeList that was passed into this function | 55 // MetadataChangeList that was passed into this function can be passed to |
56 // can be passed to Put(...) calls. Delete(...) can also be called but should | 56 // Put(...) calls. Delete(...) can also be called but should not be needed for |
57 // not be needed for most model types. Durable storage writes, if not able to | 57 // most model types. Durable storage writes, if not able to combine all change |
58 // combine all change atomically, should save the metadata after the data | 58 // atomically, should save the metadata after the data changes, so that this |
59 // changes, so that this merge will be re-driven by sync if is not completely | 59 // merge will be re-driven by sync if is not completely saved during the |
60 // saved during the current run. | 60 // current run. |
61 base::Optional<syncer::ModelError> MergeSyncData( | 61 base::Optional<syncer::ModelError> MergeSyncData( |
62 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 62 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
63 syncer::EntityDataMap entity_data_map) override; | 63 syncer::EntityChangeList entity_data) override; |
64 | 64 |
65 // Apply changes from the sync server locally. | 65 // Apply changes from the sync server locally. |
66 // Please note that |entity_changes| might have fewer entries than | 66 // Please note that |entity_changes| might have fewer entries than |
67 // |metadata_change_list| in case when some of the data changes are filtered | 67 // |metadata_change_list| in case when some of the data changes are filtered |
68 // out, or even be empty in case when a commit confirmation is processed and | 68 // out, or even be empty in case when a commit confirmation is processed and |
69 // only the metadata needs to persisted. | 69 // only the metadata needs to persisted. |
70 base::Optional<syncer::ModelError> ApplySyncChanges( | 70 base::Optional<syncer::ModelError> ApplySyncChanges( |
71 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, | 71 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, |
72 syncer::EntityChangeList entity_changes) override; | 72 syncer::EntityChangeList entity_changes) override; |
73 | 73 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; | 166 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; |
167 | 167 |
168 base::Clock* clock_; | 168 base::Clock* clock_; |
169 | 169 |
170 SEQUENCE_CHECKER(sequence_checker_); | 170 SEQUENCE_CHECKER(sequence_checker_); |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(ReadingListStore); | 172 DISALLOW_COPY_AND_ASSIGN(ReadingListStore); |
173 }; | 173 }; |
174 | 174 |
175 #endif // COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ | 175 #endif // COMPONENTS_READING_LIST_CORE_READING_LIST_STORE_H_ |
OLD | NEW |