Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: sync/internal_api/public/non_blocking_sync_common.h

Issue 423193002: sync: Add non-blocking type encryption support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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; 17 static const int64 kUncommittedVersion = -1;
18 18
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();
24
25 // The latest progress markers received from the server.
26 sync_pb::DataTypeProgressMarker progress_marker;
27
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;
33
34 // The ID of the folder node that sits at the top of this type's folder
35 // hierarchy. We keep this around for legacy reasons. The protocol expects
36 // that all nodes of a certain type are children of the same type root
37 // entity. This entity is delivered by the server, and may not be available
38 // until the first download cycle has completed.
39 std::string type_root_id;
40
41 // A strictly increasing counter used to generate unique values for the
42 // client-assigned IDs. The incrementing and ID assignment happens on the
43 // sync thread, but we store the value here so we can pass it back to the
44 // model thread for persistence. This is probably unnecessary for the
45 // client-tagged data types supported by non-blocking sync, but we will
46 // continue to emulate the directory sync's behavior for now.
47 int64 next_client_id;
48
49 // This flag is set to true when the first download cycle is complete. The
50 // ModelTypeSyncProxy should not attempt to commit any items until this
51 // flag is set.
52 bool initial_sync_done;
53 };
54
55 struct SYNC_EXPORT_PRIVATE CommitRequestData { 19 struct SYNC_EXPORT_PRIVATE CommitRequestData {
56 CommitRequestData(); 20 CommitRequestData();
57 ~CommitRequestData(); 21 ~CommitRequestData();
58 22
59 std::string id; 23 std::string id;
60 std::string client_tag_hash; 24 std::string client_tag_hash;
61 25
62 // Strictly incrementing number for in-progress commits. More information 26 // Strictly incrementing number for in-progress commits. More information
63 // about its meaning can be found in comments in the files that make use of 27 // about its meaning can be found in comments in the files that make use of
64 // this struct. 28 // this struct.
(...skipping 22 matching lines...) Expand all
87 ~UpdateResponseData(); 51 ~UpdateResponseData();
88 52
89 std::string id; 53 std::string id;
90 std::string client_tag_hash; 54 std::string client_tag_hash;
91 int64 response_version; 55 int64 response_version;
92 base::Time ctime; 56 base::Time ctime;
93 base::Time mtime; 57 base::Time mtime;
94 std::string non_unique_name; 58 std::string non_unique_name;
95 bool deleted; 59 bool deleted;
96 sync_pb::EntitySpecifics specifics; 60 sync_pb::EntitySpecifics specifics;
61 std::string encryption_key_name;
97 }; 62 };
98 63
99 typedef std::vector<CommitRequestData> CommitRequestDataList; 64 typedef std::vector<CommitRequestData> CommitRequestDataList;
100 typedef std::vector<CommitResponseData> CommitResponseDataList; 65 typedef std::vector<CommitResponseData> CommitResponseDataList;
101 typedef std::vector<UpdateResponseData> UpdateResponseDataList; 66 typedef std::vector<UpdateResponseData> UpdateResponseDataList;
102 67
68 // Data-type global state that must be accessed and updated on the sync thread,
69 // but persisted on or through the model thread.
70 struct SYNC_EXPORT_PRIVATE DataTypeState {
71 DataTypeState();
72 ~DataTypeState();
73
74 // The latest progress markers received from the server.
75 sync_pb::DataTypeProgressMarker progress_marker;
76
77 // A data type context. Sent to the server in every commit or update
78 // request. May be updated by either by responses from the server or
79 // requests made on the model thread. The interpretation of this value may
80 // be data-type specific. Many data types ignore it.
81 sync_pb::DataTypeContext type_context;
82
83 // The ID of the folder node that sits at the top of this type's folder
84 // hierarchy. We keep this around for legacy reasons. The protocol expects
85 // that all nodes of a certain type are children of the same type root
86 // entity. This entity is delivered by the server, and may not be available
87 // until the first download cycle has completed.
88 std::string type_root_id;
89
90 // This value is set if this type's data should be encrypted on the server.
91 // If this key changes, the client will need to re-commit all of its local
92 // data to the server using the new encryption key.
93 std::string encryption_key_name;
94
95 // A strictly increasing counter used to generate unique values for the
96 // client-assigned IDs. The incrementing and ID assignment happens on the
97 // sync thread, but we store the value here so we can pass it back to the
98 // model thread for persistence. This is probably unnecessary for the
99 // client-tagged data types supported by non-blocking sync, but we will
100 // continue to emulate the directory sync's behavior for now.
101 int64 next_client_id;
102
103 // This flag is set to true when the first download cycle is complete. The
104 // ModelTypeSyncProxy should not attempt to commit any items until this
105 // flag is set.
106 bool initial_sync_done;
107 };
108
103 } // namespace syncer 109 } // namespace syncer
104 110
105 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_ 111 #endif // SYNC_INTERNAL_API_PUBLIC_NON_BLOCKING_SYNC_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698