OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 // Last sync timestamp fetched from the server. | 163 // Last sync timestamp fetched from the server. |
164 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; | 164 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; |
165 // Sync-side transaction version per data type. Monotonically incremented | 165 // Sync-side transaction version per data type. Monotonically incremented |
166 // when updating native model. A copy is also saved in native model. | 166 // when updating native model. A copy is also saved in native model. |
167 // Later out-of-sync models can be detected and fixed by comparing | 167 // Later out-of-sync models can be detected and fixed by comparing |
168 // transaction versions of sync model and native model. | 168 // transaction versions of sync model and native model. |
169 // TODO(hatiaol): implement detection and fixing of out-of-sync models. | 169 // TODO(hatiaol): implement detection and fixing of out-of-sync models. |
170 // Bug 154858. | 170 // Bug 154858. |
171 int64 transaction_version[MODEL_TYPE_COUNT]; | 171 int64 transaction_version[MODEL_TYPE_COUNT]; |
172 // true iff we ever reached the end of the changelog. | |
173 ModelTypeSet initial_sync_ended; | |
174 // The store birthday we were given by the server. Contents are opaque to | 172 // The store birthday we were given by the server. Contents are opaque to |
175 // the client. | 173 // the client. |
176 std::string store_birthday; | 174 std::string store_birthday; |
177 // The next local ID that has not been used with this cache-GUID. | 175 // The next local ID that has not been used with this cache-GUID. |
178 int64 next_id; | 176 int64 next_id; |
179 // The persisted notification state. | 177 // The persisted notification state. |
180 std::string notification_state; | 178 std::string notification_state; |
181 // The serialized bag of chips we were given by the server. Contents are | 179 // The serialized bag of chips we were given by the server. Contents are |
182 // opaque to the client. This is the serialization of a message of type | 180 // opaque to the client. This is the serialization of a message of type |
183 // ChipBag defined in sync.proto. It can contains NULL characters. | 181 // ChipBag defined in sync.proto. It can contains NULL characters. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 size_t GetEntriesCount() const; | 256 size_t GetEntriesCount() const; |
259 void SetDownloadProgress( | 257 void SetDownloadProgress( |
260 ModelType type, | 258 ModelType type, |
261 const sync_pb::DataTypeProgressMarker& value); | 259 const sync_pb::DataTypeProgressMarker& value); |
262 | 260 |
263 // Gets/Increments transaction version of a model type. Must be called when | 261 // Gets/Increments transaction version of a model type. Must be called when |
264 // holding kernel mutex. | 262 // holding kernel mutex. |
265 int64 GetTransactionVersion(ModelType type) const; | 263 int64 GetTransactionVersion(ModelType type) const; |
266 void IncrementTransactionVersion(ModelType type); | 264 void IncrementTransactionVersion(ModelType type); |
267 | 265 |
268 ModelTypeSet initial_sync_ended_types() const; | 266 ModelTypeSet InitialSyncEndedTypes(); |
269 bool initial_sync_ended_for_type(ModelType type) const; | 267 bool InitialSyncEndedForType(ModelType type); |
270 void set_initial_sync_ended_for_type(ModelType type, bool value); | 268 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); |
271 | 269 |
272 const std::string& name() const { return kernel_->name; } | 270 const std::string& name() const { return kernel_->name; } |
273 | 271 |
274 // (Account) Store birthday is opaque to the client, so we keep it in the | 272 // (Account) Store birthday is opaque to the client, so we keep it in the |
275 // format it is in the proto buffer in case we switch to a binary birthday | 273 // format it is in the proto buffer in case we switch to a binary birthday |
276 // later. | 274 // later. |
277 std::string store_birthday() const; | 275 std::string store_birthday() const; |
278 void set_store_birthday(const std::string& store_birthday); | 276 void set_store_birthday(const std::string& store_birthday); |
279 | 277 |
280 // (Account) Bag of chip is an opaque state used by the server to track the | 278 // (Account) Bag of chip is an opaque state used by the server to track the |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 bool InsertEntry(WriteTransaction* trans, EntryKernel* entry); | 482 bool InsertEntry(WriteTransaction* trans, EntryKernel* entry); |
485 | 483 |
486 // Used by CheckTreeInvariants | 484 // Used by CheckTreeInvariants |
487 void GetAllMetaHandles(BaseTransaction* trans, MetahandleSet* result); | 485 void GetAllMetaHandles(BaseTransaction* trans, MetahandleSet* result); |
488 bool SafeToPurgeFromMemory(WriteTransaction* trans, | 486 bool SafeToPurgeFromMemory(WriteTransaction* trans, |
489 const EntryKernel* const entry) const; | 487 const EntryKernel* const entry) const; |
490 | 488 |
491 // Internal setters that do not acquire a lock internally. These are unsafe | 489 // Internal setters that do not acquire a lock internally. These are unsafe |
492 // on their own; caller must guarantee exclusive access manually by holding | 490 // on their own; caller must guarantee exclusive access manually by holding |
493 // a ScopedKernelLock. | 491 // a ScopedKernelLock. |
494 void set_initial_sync_ended_for_type_unsafe(ModelType type, bool x); | |
495 void SetNotificationStateUnsafe(const std::string& notification_state); | 492 void SetNotificationStateUnsafe(const std::string& notification_state); |
496 | 493 |
497 Directory& operator = (const Directory&); | 494 Directory& operator = (const Directory&); |
498 | 495 |
499 public: | 496 public: |
500 typedef Index<MetahandleIndexer>::Set MetahandlesIndex; | 497 typedef Index<MetahandleIndexer>::Set MetahandlesIndex; |
501 typedef Index<IdIndexer>::Set IdsIndex; | 498 typedef Index<IdIndexer>::Set IdsIndex; |
502 // All entries in memory must be in both the MetahandlesIndex and | 499 // All entries in memory must be in both the MetahandlesIndex and |
503 // the IdsIndex, but only non-deleted entries will be the | 500 // the IdsIndex, but only non-deleted entries will be the |
504 // ParentIdChildIndex. | 501 // ParentIdChildIndex. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 NigoriHandler* const nigori_handler_; | 633 NigoriHandler* const nigori_handler_; |
637 Cryptographer* const cryptographer_; | 634 Cryptographer* const cryptographer_; |
638 | 635 |
639 InvariantCheckLevel invariant_check_level_; | 636 InvariantCheckLevel invariant_check_level_; |
640 }; | 637 }; |
641 | 638 |
642 } // namespace syncable | 639 } // namespace syncable |
643 } // namespace syncer | 640 } // namespace syncer |
644 | 641 |
645 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 642 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
OLD | NEW |