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

Side by Side Diff: sync/internal_api/public/read_transaction.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
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_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <string>
12
13 #include "base/compiler_specific.h"
14 #include "base/macros.h"
15 #include "sync/api/attachments/attachment_id.h"
16 #include "sync/base/sync_export.h"
17 #include "sync/internal_api/public/base_transaction.h"
18
19 namespace tracked_objects {
20 class Location;
21 } // namespace tracked_objects
22
23 namespace sync_pb {
24 class DataTypeContext;
25 }
26
27 namespace syncer {
28
29 struct UserShare;
30
31 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps
32 // a syncable::ReadTransaction.
33 class SYNC_EXPORT ReadTransaction : public BaseTransaction {
34 public:
35 // Start a new read-only transaction on the specified repository.
36 ReadTransaction(const tracked_objects::Location& from_here,
37 UserShare* share);
38
39 // Resume the middle of a transaction. Will not close transaction.
40 ReadTransaction(UserShare* share, syncable::BaseTransaction* trans);
41
42 ~ReadTransaction() override;
43
44 // BaseTransaction override.
45 syncable::BaseTransaction* GetWrappedTrans() const override;
46
47 // Return |transaction_version| of |type| stored in sync directory's
48 // persisted info.
49 int64_t GetModelVersion(ModelType type) const;
50
51 // Fills |context| with the datatype context associated with |type|.
52 void GetDataTypeContext(ModelType type,
53 sync_pb::DataTypeContext* context) const;
54
55 // Clear |ids| and fill it with the ids of attachments that need to be
56 // uploaded to the sync server.
57 void GetAttachmentIdsToUpload(ModelType type, AttachmentIdList* ids) const;
58
59 // Return the current (opaque) store birthday.
60 std::string GetStoreBirthday() const;
61
62 private:
63 void* operator new(size_t size); // Transaction is meant for stack use only.
64
65 // The underlying syncable object which this class wraps.
66 syncable::BaseTransaction* transaction_;
67 bool close_transaction_;
68
69 DISALLOW_COPY_AND_ASSIGN(ReadTransaction);
70 };
71
72 } // namespace syncer
73
74 #endif // SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/read_node.h ('k') | sync/internal_api/public/sessions/commit_counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698