Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | |
| 6 #define SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/time/time.h" | |
| 12 #include "sync/base/sync_export.h" | |
| 13 #include "sync/protocol/sync.pb.h" | |
| 14 | |
| 15 namespace syncer { | |
| 16 | |
| 17 // Data-type global state that must be accessed and updated on the sync thread, | |
| 18 // but persisted on or through the model thread. | |
| 19 struct SYNC_EXPORT_PRIVATE DataTypeState { | |
| 20 DataTypeState(); | |
| 21 ~DataTypeState(); | |
| 22 | |
| 23 // The latest progress markers received from the server. | |
| 24 sync_pb::DataTypeProgressMarker progress_marker; | |
| 25 | |
| 26 // A data type context. Sent to the server in every commit or updat request. | |
|
Nicolas Zea
2014/05/21 22:20:08
nit: update
rlarocque
2014/05/21 22:39:33
Done.
| |
| 27 // May be updated by either by responses from the server or requests made on | |
| 28 // the model thread. The interpretation of this value may be data-type | |
| 29 // specific. Many data types ignore it. | |
| 30 sync_pb::DataTypeContext type_context; | |
| 31 | |
| 32 // 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 | |
| 34 // 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 | |
| 36 // until the first download cycle has completed. | |
| 37 std::string type_root_id; | |
| 38 | |
| 39 // A strictly increasing counter used to generate unique values for the | |
| 40 // 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 | |
| 42 // model thread for persistence. This is probably unnecessary for the | |
| 43 // client-tagged data types supported by non-blocking sync, but we will | |
| 44 // continue to emulate the directory sync's behavior for now. | |
| 45 int64 next_client_id; | |
| 46 }; | |
| 47 | |
| 48 struct SYNC_EXPORT_PRIVATE CommitRequestData { | |
| 49 CommitRequestData(); | |
| 50 ~CommitRequestData(); | |
| 51 | |
| 52 std::string id; | |
| 53 std::string client_tag_hash; | |
| 54 | |
| 55 // Strictly incrementing number for in-progress commits. More information | |
| 56 // about its meaning can be found in comments in the files that make use of | |
| 57 // this struct. | |
| 58 int64 sequence_number; | |
| 59 | |
| 60 int64 base_version; | |
| 61 base::Time ctime; | |
| 62 base::Time mtime; | |
| 63 std::string non_unique_name; | |
| 64 bool deleted; | |
| 65 sync_pb::EntitySpecifics specifics; | |
| 66 }; | |
| 67 | |
| 68 struct SYNC_EXPORT_PRIVATE CommitResponseData { | |
| 69 CommitResponseData(); | |
| 70 ~CommitResponseData(); | |
| 71 | |
| 72 std::string id; | |
| 73 std::string client_tag_hash; | |
| 74 int64 sequence_number; | |
| 75 int64 response_version; | |
| 76 }; | |
| 77 | |
| 78 struct SYNC_EXPORT_PRIVATE UpdateResponseData { | |
| 79 UpdateResponseData(); | |
| 80 ~UpdateResponseData(); | |
| 81 | |
| 82 std::string id; | |
| 83 std::string client_tag_hash; | |
| 84 int64 response_version; | |
| 85 base::Time ctime; | |
| 86 base::Time mtime; | |
| 87 std::string non_unique_name; | |
| 88 bool deleted; | |
| 89 sync_pb::EntitySpecifics specifics; | |
| 90 }; | |
| 91 | |
| 92 typedef std::vector<CommitRequestData> CommitRequestDataList; | |
| 93 typedef std::vector<CommitResponseData> CommitResponseDataList; | |
| 94 typedef std::vector<UpdateResponseData> UpdateResponseDataList; | |
| 95 | |
| 96 } // namespace syncer | |
| 97 | |
| 98 #endif // SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_ | |
| OLD | NEW |