| 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(BaseTransaction* trans, |
| 203 ModelType type, |
| 204 sync_pb::DataTypeContext* context) const; |
| 205 void SetDataTypeContext(BaseWriteTransaction* trans, |
| 206 ModelType type, |
| 207 const sync_pb::DataTypeContext& context); |
| 208 |
| 199 ModelTypeSet InitialSyncEndedTypes(); | 209 ModelTypeSet InitialSyncEndedTypes(); |
| 200 bool InitialSyncEndedForType(ModelType type); | 210 bool InitialSyncEndedForType(ModelType type); |
| 201 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); | 211 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); |
| 202 | 212 |
| 203 const std::string& name() const { return kernel_->name; } | 213 const std::string& name() const { return kernel_->name; } |
| 204 | 214 |
| 205 // (Account) Store birthday is opaque to the client, so we keep it in the | 215 // (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 | 216 // format it is in the proto buffer in case we switch to a binary birthday |
| 207 // later. | 217 // later. |
| 208 std::string store_birthday() const; | 218 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. | 556 // are deleted in native models as well. |
| 547 scoped_ptr<DeleteJournal> delete_journal_; | 557 scoped_ptr<DeleteJournal> delete_journal_; |
| 548 | 558 |
| 549 DISALLOW_COPY_AND_ASSIGN(Directory); | 559 DISALLOW_COPY_AND_ASSIGN(Directory); |
| 550 }; | 560 }; |
| 551 | 561 |
| 552 } // namespace syncable | 562 } // namespace syncable |
| 553 } // namespace syncer | 563 } // namespace syncer |
| 554 | 564 |
| 555 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 565 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
| OLD | NEW |