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

Side by Side Diff: sync/syncable/mutable_entry.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/syncable/model_type_unittest.cc ('k') | sync/syncable/mutable_entry.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_SYNCABLE_MUTABLE_ENTRY_H_
6 #define SYNC_SYNCABLE_MUTABLE_ENTRY_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 #include "base/macros.h"
13 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/base/model_type.h"
15 #include "sync/syncable/entry.h"
16 #include "sync/syncable/metahandle_set.h"
17 #include "sync/syncable/model_neutral_mutable_entry.h"
18
19 namespace syncer {
20 class WriteNode;
21
22 namespace syncable {
23
24 enum Create {
25 CREATE
26 };
27
28 class WriteTransaction;
29
30 // A mutable meta entry. Changes get committed to the database when the
31 // WriteTransaction is destroyed.
32 class SYNC_EXPORT MutableEntry : public ModelNeutralMutableEntry {
33 void Init(WriteTransaction* trans, ModelType model_type,
34 const Id& parent_id, const std::string& name);
35
36 public:
37 MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, const Id& id);
38 MutableEntry(WriteTransaction* trans,
39 Create,
40 ModelType model_type,
41 const std::string& name);
42 MutableEntry(WriteTransaction* trans,
43 Create,
44 ModelType model_type,
45 const Id& parent_id,
46 const std::string& name);
47 MutableEntry(WriteTransaction* trans, GetByHandle, int64_t);
48 MutableEntry(WriteTransaction* trans, GetById, const Id&);
49 MutableEntry(WriteTransaction* trans, GetByClientTag, const std::string& tag);
50 MutableEntry(WriteTransaction* trans, GetTypeRoot, ModelType type);
51
52 inline WriteTransaction* write_transaction() const {
53 return write_transaction_;
54 }
55
56 // Model-changing setters. These setters make user-visible changes that will
57 // need to be communicated either to the local model or the sync server.
58 void PutLocalExternalId(int64_t value);
59 void PutMtime(base::Time value);
60 void PutCtime(base::Time value);
61 void PutParentId(const Id& value);
62 void PutIsDir(bool value);
63 void PutIsDel(bool value);
64 void PutNonUniqueName(const std::string& value);
65 void PutSpecifics(const sync_pb::EntitySpecifics& value);
66 void PutUniquePosition(const UniquePosition& value);
67
68 // Sets the position of this item, and updates the entry kernels of the
69 // adjacent siblings so that list invariants are maintained. Returns false
70 // and fails if |predecessor_id| does not identify a sibling. Pass the root
71 // ID to put the node in first position.
72 bool PutPredecessor(const Id& predecessor_id);
73
74 void PutAttachmentMetadata(const sync_pb::AttachmentMetadata& value);
75
76 // Update attachment metadata for |attachment_id| to indicate that this
77 // attachment has been uploaded to the sync server.
78 void MarkAttachmentAsOnServer(
79 const sync_pb::AttachmentIdProto& attachment_id);
80
81 private:
82 // Kind of redundant. We should reduce the number of pointers
83 // floating around if at all possible. Could we store this in Directory?
84 // Scope: Set on construction, never changed after that.
85 WriteTransaction* const write_transaction_;
86
87 DISALLOW_COPY_AND_ASSIGN(MutableEntry);
88 };
89
90 // This function sets only the flags needed to get this entry to sync.
91 bool MarkForSyncing(syncable::MutableEntry* e);
92
93 } // namespace syncable
94 } // namespace syncer
95
96 #endif // SYNC_SYNCABLE_MUTABLE_ENTRY_H_
OLDNEW
« no previous file with comments | « sync/syncable/model_type_unittest.cc ('k') | sync/syncable/mutable_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698