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