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

Side by Side Diff: sync/engine/process_updates_util.h

Issue 38803003: sync: Implement per-type update processing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix integration tests Created 7 years, 1 month 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
(Empty)
1 // Copyright 2012 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_PROCESS_UPDATES_UTIL_H_
6 #define SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/engine/syncer_types.h"
14 #include "sync/internal_api/public/base/model_type.h"
15
16 namespace sync_pb {
17 class GetUpdatesResponse;
18 class SyncEntity;
19 }
20
21 namespace syncer {
22
23 namespace sessions {
24 class StatusController;
25 }
26
27 namespace syncable {
28 class ModelNeutralWriteTransaction;
29 class Directory;
30 }
31
32 class Cryptographer;
33
34 // TODO: Move these definitions somewhere else?
Nicolas Zea 2013/10/25 21:04:41 TODO(rlarocque)
rlarocque 2013/10/25 22:29:47 Done.
35 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
36 typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap;
37
38 // Given a GetUpdates response, iterates over all the returned items and
39 // divides them according to their type. Outputs a map from model types to
40 // received SyncEntities. The output map will have entries (possibly empty)
41 // for all types in |requested_types|.
42 void PartitionUpdatesByType(
43 const sync_pb::GetUpdatesResponse& updates,
44 ModelTypeSet requested_types,
45 TypeSyncEntityMap* updates_by_type);
46
47 // Processes all the updates associated with a single ModelType.
48 void ProcessDownloadedUpdates(
49 syncable::Directory* dir,
50 syncable::ModelNeutralWriteTransaction* trans,
51 ModelType type,
52 const SyncEntityList& applicable_updates,
53 sessions::StatusController* status);
54
55 // Checks whether or not an update is fit for processing.
56 //
57 // The answer may be "no" if the update appears invalid, or it's not releveant
58 // (ie. a delete for an item we've never heard of), or other reasons.
59 VerifyResult VerifyUpdate(
60 syncable::ModelNeutralWriteTransaction* trans,
61 const sync_pb::SyncEntity& entry,
62 ModelType requested_type);
63
64 // If the update passes a series of checks, this function will copy
65 // the SyncEntity's data into the SERVER side of the syncable::Directory.
66 void ProcessUpdate(
67 const sync_pb::SyncEntity& proto_update,
68 const Cryptographer* cryptographer,
69 syncable::ModelNeutralWriteTransaction* const trans);
70
71 } // namespace syncer
72
73 #endif // SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698