| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "sync/api/entity_data.h" | 14 #include "sync/api/entity_data.h" |
| 15 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
| 16 #include "sync/protocol/sync.pb.h" | 16 #include "sync/protocol/sync.pb.h" |
| 17 | 17 |
| 18 namespace syncer_v2 { | 18 namespace syncer_v2 { |
| 19 | 19 |
| 20 static const int64_t kUncommittedVersion = -1; | 20 static const int64_t kUncommittedVersion = -1; |
| 21 | 21 |
| 22 // Data-type global state that must be accessed and updated on the sync thread, | |
| 23 // but persisted on or through the model thread. | |
| 24 struct SYNC_EXPORT DataTypeState { | |
| 25 DataTypeState(); | |
| 26 ~DataTypeState(); | |
| 27 | |
| 28 // The latest progress markers received from the server. | |
| 29 sync_pb::DataTypeProgressMarker progress_marker; | |
| 30 | |
| 31 // A data type context. Sent to the server in every commit or update | |
| 32 // request. May be updated by either by responses from the server or | |
| 33 // requests made on the model thread. The interpretation of this value may | |
| 34 // be data-type specific. Many data types ignore it. | |
| 35 sync_pb::DataTypeContext type_context; | |
| 36 | |
| 37 // This value is set if this type's data should be encrypted on the server. | |
| 38 // If this key changes, the client will need to re-commit all of its local | |
| 39 // data to the server using the new encryption key. | |
| 40 std::string encryption_key_name; | |
| 41 | |
| 42 // This flag is set to true when the first download cycle is complete. The | |
| 43 // ModelTypeProcessor should not attempt to commit any items until this | |
| 44 // flag is set. | |
| 45 bool initial_sync_done = false; | |
| 46 }; | |
| 47 | |
| 48 struct SYNC_EXPORT CommitRequestData { | 22 struct SYNC_EXPORT CommitRequestData { |
| 49 CommitRequestData(); | 23 CommitRequestData(); |
| 50 ~CommitRequestData(); | 24 ~CommitRequestData(); |
| 51 | 25 |
| 52 EntityDataPtr entity; | 26 EntityDataPtr entity; |
| 53 | 27 |
| 54 // Strictly incrementing number for in-progress commits. More information | 28 // Strictly incrementing number for in-progress commits. More information |
| 55 // about its meaning can be found in comments in the files that make use of | 29 // about its meaning can be found in comments in the files that make use of |
| 56 // this struct. | 30 // this struct. |
| 57 int64_t sequence_number = 0; | 31 int64_t sequence_number = 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 std::string encryption_key_name; | 52 std::string encryption_key_name; |
| 79 }; | 53 }; |
| 80 | 54 |
| 81 typedef std::vector<CommitRequestData> CommitRequestDataList; | 55 typedef std::vector<CommitRequestData> CommitRequestDataList; |
| 82 typedef std::vector<CommitResponseData> CommitResponseDataList; | 56 typedef std::vector<CommitResponseData> CommitResponseDataList; |
| 83 typedef std::vector<UpdateResponseData> UpdateResponseDataList; | 57 typedef std::vector<UpdateResponseData> UpdateResponseDataList; |
| 84 | 58 |
| 85 } // namespace syncer_v2 | 59 } // namespace syncer_v2 |
| 86 | 60 |
| 87 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ | 61 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ |
| OLD | NEW |