Infobar material design refresh: bg color
[chromium-blink-merge.git] / sync / internal_api / public / non_blocking_sync_common.h
blob6e0deefd088ce2f93dc88c215e85435fc9948e45
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.
5 #ifndef SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_
6 #define SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_
8 #include <string>
9 #include <vector>
11 #include "base/time/time.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/protocol/sync.pb.h"
15 namespace syncer_v2 {
17 static const int64 kUncommittedVersion = -1;
19 // Data-type global state that must be accessed and updated on the sync thread,
20 // but persisted on or through the model thread.
21 struct SYNC_EXPORT_PRIVATE DataTypeState {
22 DataTypeState();
23 ~DataTypeState();
25 // The latest progress markers received from the server.
26 sync_pb::DataTypeProgressMarker progress_marker;
28 // A data type context. Sent to the server in every commit or update
29 // request. May be updated by either by responses from the server or
30 // requests made on the model thread. The interpretation of this value may
31 // be data-type specific. Many data types ignore it.
32 sync_pb::DataTypeContext type_context;
34 // This value is set if this type's data should be encrypted on the server.
35 // If this key changes, the client will need to re-commit all of its local
36 // data to the server using the new encryption key.
37 std::string encryption_key_name;
39 // This flag is set to true when the first download cycle is complete. The
40 // ModelTypeProcessor should not attempt to commit any items until this
41 // flag is set.
42 bool initial_sync_done;
45 struct SYNC_EXPORT_PRIVATE CommitRequestData {
46 CommitRequestData();
47 ~CommitRequestData();
49 std::string id;
50 std::string client_tag_hash;
52 // Strictly incrementing number for in-progress commits. More information
53 // about its meaning can be found in comments in the files that make use of
54 // this struct.
55 int64 sequence_number;
57 int64 base_version;
58 base::Time ctime;
59 base::Time mtime;
60 std::string non_unique_name;
61 bool deleted;
62 sync_pb::EntitySpecifics specifics;
65 struct SYNC_EXPORT_PRIVATE CommitResponseData {
66 CommitResponseData();
67 ~CommitResponseData();
69 std::string id;
70 std::string client_tag_hash;
71 int64 sequence_number;
72 int64 response_version;
75 struct SYNC_EXPORT_PRIVATE UpdateResponseData {
76 UpdateResponseData();
77 ~UpdateResponseData();
79 std::string id;
80 std::string client_tag_hash;
81 int64 response_version;
82 base::Time ctime;
83 base::Time mtime;
84 std::string non_unique_name;
85 bool deleted;
86 sync_pb::EntitySpecifics specifics;
87 std::string encryption_key_name;
90 typedef std::vector<CommitRequestData> CommitRequestDataList;
91 typedef std::vector<CommitResponseData> CommitResponseDataList;
92 typedef std::vector<UpdateResponseData> UpdateResponseDataList;
94 } // namespace syncer
96 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_