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/engine/model_type_entity.h

Issue 442623002: Revert of 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
« no previous file with comments | « sync/engine/entity_tracker.cc ('k') | sync/engine/model_type_entity.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ENGINE_MODEL_TYPE_ENTITY_H_ 5 #ifndef SYNC_ENGINE_MODEL_TYPE_ENTITY_H_
6 #define SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ 6 #define SYNC_ENGINE_MODEL_TYPE_ENTITY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 28 matching lines...) Expand all
39 39
40 // Construct an instance representing an item newly received from the server. 40 // Construct an instance representing an item newly received from the server.
41 static scoped_ptr<ModelTypeEntity> FromServerUpdate( 41 static scoped_ptr<ModelTypeEntity> FromServerUpdate(
42 const std::string& id, 42 const std::string& id,
43 const std::string& client_tag_hash, 43 const std::string& client_tag_hash,
44 const std::string& non_unique_name, 44 const std::string& non_unique_name,
45 int64 version, 45 int64 version,
46 const sync_pb::EntitySpecifics& specifics, 46 const sync_pb::EntitySpecifics& specifics,
47 bool deleted, 47 bool deleted,
48 base::Time ctime, 48 base::Time ctime,
49 base::Time mtime, 49 base::Time mtime);
50 const std::string& encryption_key_name);
51 50
52 // TODO(rlarocque): Implement FromDisk constructor when we implement storage. 51 // TODO(rlarocque): Implement FromDisk constructor when we implement storage.
53 52
54 ~ModelTypeEntity(); 53 ~ModelTypeEntity();
55 54
56 // Returns true if this data is out of sync with local storage. 55 // Returns true if this data is out of sync with local storage.
57 bool IsWriteRequired() const; 56 bool IsWriteRequired() const;
58 57
59 // Returns true if this data is out of sync with the server. 58 // Returns true if this data is out of sync with the server.
60 // A commit may or may not be in progress at this time. 59 // A commit may or may not be in progress at this time.
(...skipping 12 matching lines...) Expand all
73 // Returns true if the specified update version conflicts with local changes. 72 // Returns true if the specified update version conflicts with local changes.
74 bool UpdateIsInConflict(int64 update_version) const; 73 bool UpdateIsInConflict(int64 update_version) const;
75 74
76 // Applies an update from the sync server. 75 // Applies an update from the sync server.
77 // 76 //
78 // Overrides any local changes. Check UpdateIsInConflict() before calling 77 // Overrides any local changes. Check UpdateIsInConflict() before calling
79 // this function if you want to handle conflicts differently. 78 // this function if you want to handle conflicts differently.
80 void ApplyUpdateFromServer(int64 update_version, 79 void ApplyUpdateFromServer(int64 update_version,
81 bool deleted, 80 bool deleted,
82 const sync_pb::EntitySpecifics& specifics, 81 const sync_pb::EntitySpecifics& specifics,
83 base::Time mtime, 82 base::Time mtime);
84 const std::string& encryption_key_name);
85 83
86 // Applies a local change to this item. 84 // Applies a local change to this item.
87 void MakeLocalChange(const sync_pb::EntitySpecifics& specifics); 85 void MakeLocalChange(const sync_pb::EntitySpecifics& specifics);
88 86
89 // Schedule a commit if the |name| does not match this item's last known
90 // encryption key. The worker that performs the commit is expected to
91 // encrypt the item using the latest available key.
92 void UpdateDesiredEncryptionKey(const std::string& name);
93
94 // Applies a local deletion to this item. 87 // Applies a local deletion to this item.
95 void Delete(); 88 void Delete();
96 89
97 // Initializes a message representing this item's uncommitted state 90 // Initializes a message representing this item's uncommitted state
98 // to be forwarded to the sync server for committing. 91 // to be forwarded to the sync server for committing.
99 void InitializeCommitRequestData(CommitRequestData* request) const; 92 void InitializeCommitRequestData(CommitRequestData* request) const;
100 93
101 // Notes that the current version of this item has been queued for commit. 94 // Notes that the current version of this item has been queued for commit.
102 void SetCommitRequestInProgress(); 95 void SetCommitRequestInProgress();
103 96
104 // Receives a successful commit response. 97 // Receives a successful commit response.
105 // 98 //
106 // Sucssful commit responses can overwrite an item's ID. 99 // Sucssful commit responses can overwrite an item's ID.
107 // 100 //
108 // Note that the receipt of a successful commit response does not necessarily 101 // Note that the receipt of a successful commit response does not necessarily
109 // unset IsUnsynced(). If many local changes occur in quick succession, it's 102 // unset IsUnsynced(). If many local changes occur in quick succession, it's
110 // possible that the committed item was already out of date by the time it 103 // possible that the committed item was already out of date by the time it
111 // reached the server. 104 // reached the server.
112 void ReceiveCommitResponse(const std::string& id, 105 void ReceiveCommitResponse(const std::string& id,
113 int64 sequence_number, 106 int64 sequence_number,
114 int64 response_version, 107 int64 response_version);
115 const std::string& encryption_key_name);
116 108
117 // Clears any in-memory sync state associated with outstanding commits. 109 // Clears any in-memory sync state associated with outstanding commits.
118 void ClearTransientSyncState(); 110 void ClearTransientSyncState();
119 111
120 // Clears all sync state. Invoked when a user signs out. 112 // Clears all sync state. Invoked when a user signs out.
121 void ClearSyncState(); 113 void ClearSyncState();
122 114
123 private: 115 private:
124 ModelTypeEntity(int64 sequence_number, 116 ModelTypeEntity(int64 sequence_number,
125 int64 commit_requested_sequence_number, 117 int64 commit_requested_sequence_number,
126 int64 acked_sequence_number, 118 int64 acked_sequence_number,
127 int64 base_version, 119 int64 base_version,
128 bool is_dirty, 120 bool is_dirty,
129 const std::string& id, 121 const std::string& id,
130 const std::string& client_tag_hash, 122 const std::string& client_tag_hash,
131 const std::string& non_unique_name, 123 const std::string& non_unique_name,
132 const sync_pb::EntitySpecifics& specifics, 124 const sync_pb::EntitySpecifics& specifics,
133 bool deleted, 125 bool deleted,
134 base::Time ctime, 126 base::Time ctime,
135 base::Time mtime, 127 base::Time mtime);
136 const std::string& encryption_key_name);
137 128
138 // A sequence number used to track in-progress commits. Each local change 129 // A sequence number used to track in-progress commits. Each local change
139 // increments this number. 130 // increments this number.
140 int64 sequence_number_; 131 int64 sequence_number_;
141 132
142 // The sequence number of the last item sent to the sync thread. 133 // The sequence number of the last item sent to the sync thread.
143 int64 commit_requested_sequence_number_; 134 int64 commit_requested_sequence_number_;
144 135
145 // The sequence number of the last item known to be successfully committed. 136 // The sequence number of the last item known to be successfully committed.
146 int64 acked_sequence_number_; 137 int64 acked_sequence_number_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 178
188 // Whether or not the item is deleted. The |specifics_| field may be empty 179 // Whether or not the item is deleted. The |specifics_| field may be empty
189 // if this flag is true. 180 // if this flag is true.
190 bool deleted_; 181 bool deleted_;
191 182
192 // Entity creation and modification timestamps. 183 // Entity creation and modification timestamps.
193 // Assigned by the client and synced by the server, though the server usually 184 // Assigned by the client and synced by the server, though the server usually
194 // doesn't bother to inspect their values. 185 // doesn't bother to inspect their values.
195 base::Time ctime_; 186 base::Time ctime_;
196 base::Time mtime_; 187 base::Time mtime_;
197
198 // The name of the encryption key used to encrypt this item on the server.
199 // Empty when no encryption is in use.
200 std::string encryption_key_name_;
201 }; 188 };
202 189
203 } // namespace syncer 190 } // namespace syncer
204 191
205 #endif // SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ 192 #endif // SYNC_ENGINE_MODEL_TYPE_ENTITY_H_
OLDNEW
« no previous file with comments | « sync/engine/entity_tracker.cc ('k') | sync/engine/model_type_entity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698