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_
11 #include "base/time/time.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/protocol/sync.pb.h"
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
{
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
42 bool initial_sync_done
;
45 struct SYNC_EXPORT_PRIVATE CommitRequestData
{
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
55 int64 sequence_number
;
60 std::string non_unique_name
;
62 sync_pb::EntitySpecifics specifics
;
65 struct SYNC_EXPORT_PRIVATE CommitResponseData
{
67 ~CommitResponseData();
70 std::string client_tag_hash
;
71 int64 sequence_number
;
72 int64 response_version
;
75 struct SYNC_EXPORT_PRIVATE UpdateResponseData
{
77 ~UpdateResponseData();
80 std::string client_tag_hash
;
81 int64 response_version
;
84 std::string non_unique_name
;
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
;
96 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_