Chromium Code Reviews| 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_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | 5 #ifndef SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ |
| 6 #define SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | 6 #define SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "sync/base/sync_export.h" | 12 #include "sync/base/sync_export.h" |
| 13 #include "sync/protocol/sync.pb.h" | 13 #include "sync/protocol/sync.pb.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 | 16 |
| 17 static const int64 kUncommittedVersion = -1; | |
| 18 | |
| 17 // Data-type global state that must be accessed and updated on the sync thread, | 19 // Data-type global state that must be accessed and updated on the sync thread, |
| 18 // but persisted on or through the model thread. | 20 // but persisted on or through the model thread. |
| 19 struct SYNC_EXPORT_PRIVATE DataTypeState { | 21 struct SYNC_EXPORT_PRIVATE DataTypeState { |
| 20 DataTypeState(); | 22 DataTypeState(); |
| 21 ~DataTypeState(); | 23 ~DataTypeState(); |
| 22 | 24 |
| 23 // The latest progress markers received from the server. | 25 // The latest progress markers received from the server. |
| 24 sync_pb::DataTypeProgressMarker progress_marker; | 26 sync_pb::DataTypeProgressMarker progress_marker; |
| 25 | 27 |
| 26 // A data type context. Sent to the server in every commit or update | 28 // A data type context. Sent to the server in every commit or update |
| 27 // request. May be updated by either by responses from the server or | 29 // request. May be updated by either by responses from the server or |
| 28 // requests made on the model thread. The interpretation of this value may | 30 // requests made on the model thread. The interpretation of this value may |
| 29 // be data-type specific. Many data types ignore it. | 31 // be data-type specific. Many data types ignore it. |
| 30 sync_pb::DataTypeContext type_context; | 32 sync_pb::DataTypeContext type_context; |
| 31 | 33 |
| 32 // The ID of the folder node that sits at the top of this type's folder | 34 // The ID of the folder node that sits at the top of this type's folder |
| 33 // hierarchy. We keep this around for legacy reasons. The protocol expects | 35 // hierarchy. We keep this around for legacy reasons. The protocol expects |
| 34 // that all nodes of a certain type are children of the same type root | 36 // that all nodes of a certain type are children of the same type root |
| 35 // entity. This entity is delivered by the server, and may not be available | 37 // entity. This entity is delivered by the server, and may not be available |
| 36 // until the first download cycle has completed. | 38 // until the first download cycle has completed. |
| 37 std::string type_root_id; | 39 std::string type_root_id; |
| 38 | 40 |
| 39 // A strictly increasing counter used to generate unique values for the | 41 // A strictly increasing counter used to generate unique values for the |
| 40 // client-assigned IDs. The incrementing and ID assignment happens on the | 42 // client-assigned IDs. The incrementing and ID assignment happens on the |
| 41 // sync thread, but we store the value here so we can pass it back to the | 43 // sync thread, but we store the value here so we can pass it back to the |
| 42 // model thread for persistence. This is probably unnecessary for the | 44 // model thread for persistence. This is probably unnecessary for the |
| 43 // client-tagged data types supported by non-blocking sync, but we will | 45 // client-tagged data types supported by non-blocking sync, but we will |
| 44 // continue to emulate the directory sync's behavior for now. | 46 // continue to emulate the directory sync's behavior for now. |
| 45 int64 next_client_id; | 47 int64 next_client_id; |
| 48 | |
| 49 // This flag is set to true when the first download cycle is complete. The | |
| 50 // model thread should not attempt to commit any items until this flag is | |
|
Nicolas Zea
2014/06/02 20:27:17
nit: prefer referring to NonBlockingTypeProcessor
rlarocque
2014/06/02 21:39:14
Done.
| |
| 51 // set. | |
| 52 bool initial_sync_done; | |
| 46 }; | 53 }; |
| 47 | 54 |
| 48 struct SYNC_EXPORT_PRIVATE CommitRequestData { | 55 struct SYNC_EXPORT_PRIVATE CommitRequestData { |
| 49 CommitRequestData(); | 56 CommitRequestData(); |
| 50 ~CommitRequestData(); | 57 ~CommitRequestData(); |
| 51 | 58 |
| 52 std::string id; | 59 std::string id; |
| 53 std::string client_tag_hash; | 60 std::string client_tag_hash; |
| 54 | 61 |
| 55 // Strictly incrementing number for in-progress commits. More information | 62 // Strictly incrementing number for in-progress commits. More information |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 sync_pb::EntitySpecifics specifics; | 96 sync_pb::EntitySpecifics specifics; |
| 90 }; | 97 }; |
| 91 | 98 |
| 92 typedef std::vector<CommitRequestData> CommitRequestDataList; | 99 typedef std::vector<CommitRequestData> CommitRequestDataList; |
| 93 typedef std::vector<CommitResponseData> CommitResponseDataList; | 100 typedef std::vector<CommitResponseData> CommitResponseDataList; |
| 94 typedef std::vector<UpdateResponseData> UpdateResponseDataList; | 101 typedef std::vector<UpdateResponseData> UpdateResponseDataList; |
| 95 | 102 |
| 96 } // namespace syncer | 103 } // namespace syncer |
| 97 | 104 |
| 98 #endif // SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | 105 #endif // SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ |
| OLD | NEW |