OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 SYNC_SYNCABLE_DIRECTORY_H_ | 5 #ifndef SYNC_SYNCABLE_DIRECTORY_H_ |
6 #define SYNC_SYNCABLE_DIRECTORY_H_ | 6 #define SYNC_SYNCABLE_DIRECTORY_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int64 transaction_version[MODEL_TYPE_COUNT]; | 113 int64 transaction_version[MODEL_TYPE_COUNT]; |
114 // The store birthday we were given by the server. Contents are opaque to | 114 // The store birthday we were given by the server. Contents are opaque to |
115 // the client. | 115 // the client. |
116 std::string store_birthday; | 116 std::string store_birthday; |
117 // The next local ID that has not been used with this cache-GUID. | 117 // The next local ID that has not been used with this cache-GUID. |
118 int64 next_id; | 118 int64 next_id; |
119 // The serialized bag of chips we were given by the server. Contents are | 119 // The serialized bag of chips we were given by the server. Contents are |
120 // opaque to the client. This is the serialization of a message of type | 120 // opaque to the client. This is the serialization of a message of type |
121 // ChipBag defined in sync.proto. It can contains NULL characters. | 121 // ChipBag defined in sync.proto. It can contains NULL characters. |
122 std::string bag_of_chips; | 122 std::string bag_of_chips; |
| 123 // The per-datatype context. |
| 124 sync_pb::DataTypeContext datatype_context[MODEL_TYPE_COUNT]; |
123 }; | 125 }; |
124 | 126 |
125 // What the Directory needs on initialization to create itself and its Kernel. | 127 // What the Directory needs on initialization to create itself and its Kernel. |
126 // Filled by DirectoryBackingStore::Load. | 128 // Filled by DirectoryBackingStore::Load. |
127 struct KernelLoadInfo { | 129 struct KernelLoadInfo { |
128 PersistedKernelInfo kernel_info; | 130 PersistedKernelInfo kernel_info; |
129 std::string cache_guid; // Created on first initialization, never changes. | 131 std::string cache_guid; // Created on first initialization, never changes. |
130 int64 max_metahandle; // Computed (using sql MAX aggregate) on init. | 132 int64 max_metahandle; // Computed (using sql MAX aggregate) on init. |
131 KernelLoadInfo() : max_metahandle(0) { | 133 KernelLoadInfo() : max_metahandle(0) { |
132 } | 134 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 size_t GetEntriesCount() const; | 191 size_t GetEntriesCount() const; |
190 void SetDownloadProgress( | 192 void SetDownloadProgress( |
191 ModelType type, | 193 ModelType type, |
192 const sync_pb::DataTypeProgressMarker& value); | 194 const sync_pb::DataTypeProgressMarker& value); |
193 | 195 |
194 // Gets/Increments transaction version of a model type. Must be called when | 196 // Gets/Increments transaction version of a model type. Must be called when |
195 // holding kernel mutex. | 197 // holding kernel mutex. |
196 int64 GetTransactionVersion(ModelType type) const; | 198 int64 GetTransactionVersion(ModelType type) const; |
197 void IncrementTransactionVersion(ModelType type); | 199 void IncrementTransactionVersion(ModelType type); |
198 | 200 |
| 201 // Getter/setters for the per datatype context. |
| 202 void GetDataTypeContext(ModelType type, |
| 203 sync_pb::DataTypeContext* context) const; |
| 204 void SetDataTypeContext(ModelType type, |
| 205 const sync_pb::DataTypeContext& context); |
| 206 |
199 ModelTypeSet InitialSyncEndedTypes(); | 207 ModelTypeSet InitialSyncEndedTypes(); |
200 bool InitialSyncEndedForType(ModelType type); | 208 bool InitialSyncEndedForType(ModelType type); |
201 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); | 209 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); |
202 | 210 |
203 const std::string& name() const { return kernel_->name; } | 211 const std::string& name() const { return kernel_->name; } |
204 | 212 |
205 // (Account) Store birthday is opaque to the client, so we keep it in the | 213 // (Account) Store birthday is opaque to the client, so we keep it in the |
206 // format it is in the proto buffer in case we switch to a binary birthday | 214 // format it is in the proto buffer in case we switch to a binary birthday |
207 // later. | 215 // later. |
208 std::string store_birthday() const; | 216 std::string store_birthday() const; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // are deleted in native models as well. | 554 // are deleted in native models as well. |
547 scoped_ptr<DeleteJournal> delete_journal_; | 555 scoped_ptr<DeleteJournal> delete_journal_; |
548 | 556 |
549 DISALLOW_COPY_AND_ASSIGN(Directory); | 557 DISALLOW_COPY_AND_ASSIGN(Directory); |
550 }; | 558 }; |
551 | 559 |
552 } // namespace syncable | 560 } // namespace syncable |
553 } // namespace syncer | 561 } // namespace syncer |
554 | 562 |
555 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 563 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
OLD | NEW |