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

Side by Side Diff: sync/api/sync_merge_result.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « sync/api/sync_error_unittest.cc ('k') | sync/api/sync_merge_result.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_API_SYNC_MERGE_RESULT_H_
6 #define SYNC_API_SYNC_MERGE_RESULT_H_
7
8 #include <stdint.h>
9
10 #include "sync/api/sync_error.h"
11 #include "sync/base/sync_export.h"
12 #include "sync/internal_api/public/base/model_type.h"
13
14 namespace syncer {
15
16 // A model-type-specific view of a sync merge. This class encapsulates the
17 // state before and after the merge as well as the deltas and any error that
18 // occurred.
19 // Note: This class only tracks one side of the merge. In other words, if built
20 // by the local SyncableService, all values correspond to the local state before
21 // and after merging, and the delta's applied to that state. Sync's change
22 // processor will create a separate merge result.
23 class SYNC_EXPORT SyncMergeResult {
24 public:
25 // Initialize an empty merge result for model type |type|.
26 explicit SyncMergeResult(ModelType type);
27 SyncMergeResult(const SyncMergeResult& other);
28 ~SyncMergeResult();
29
30 // Default copy and assign welcome.
31
32 // Setters.
33 // Note: if |error.IsSet()| is true, |error.type()| must match model_type_
34 void set_error(SyncError error);
35 void set_num_items_before_association(int num_items_before_association);
36 void set_num_items_after_association(int num_items_after_association);
37 void set_num_items_added(int num_items_added);
38 void set_num_items_deleted(int num_items_deleted);
39 void set_num_items_modified(int num_items_modified);
40 void set_pre_association_version(int64_t version);
41
42 // Getters.
43 ModelType model_type() const;
44 SyncError error() const;
45 int num_items_before_association() const;
46 int num_items_after_association() const;
47 int num_items_added() const;
48 int num_items_deleted() const;
49 int num_items_modified() const;
50 int64_t pre_association_version() const;
51
52 private:
53 // Make |this| into a copy of |other|.
54 void CopyFrom(const SyncMergeResult& other);
55
56 // The datatype that was associated.
57 ModelType model_type_;
58
59 // The error encountered during association. Unset if no error was
60 // encountered.
61 SyncError error_;
62
63 // The state of the world before association.
64 int num_items_before_association_;
65
66 // The state of the world after association.
67 int num_items_after_association_;
68
69 // The changes that took place during association. In a correctly working
70 // system these should be the deltas between before and after.
71 int num_items_added_;
72 int num_items_deleted_;
73 int num_items_modified_;
74
75 // Version of model before association.
76 int64_t pre_association_version_;
77 };
78
79 } // namespace syncer
80
81 #endif // SYNC_API_SYNC_MERGE_RESULT_H_
OLDNEW
« no previous file with comments | « sync/api/sync_error_unittest.cc ('k') | sync/api/sync_merge_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698