[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / sync / internal_api / public / read_transaction.h
blob3a3dc8d8acdc981e48b2b4db9a7910187fd25f0c
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.
5 #ifndef SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
6 #define SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_
8 #include "base/compiler_specific.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/internal_api/public/base_transaction.h"
12 namespace tracked_objects {
13 class Location;
14 } // namespace tracked_objects
16 namespace sync_pb {
17 class DataTypeContext;
20 namespace syncer {
22 struct UserShare;
24 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps
25 // a syncable::ReadTransaction.
26 class SYNC_EXPORT ReadTransaction : public BaseTransaction {
27 public:
28 // Start a new read-only transaction on the specified repository.
29 ReadTransaction(const tracked_objects::Location& from_here,
30 UserShare* share);
32 // Resume the middle of a transaction. Will not close transaction.
33 ReadTransaction(UserShare* share, syncable::BaseTransaction* trans);
35 virtual ~ReadTransaction();
37 // BaseTransaction override.
38 virtual syncable::BaseTransaction* GetWrappedTrans() const OVERRIDE;
40 // Return |transaction_version| of |type| stored in sync directory's
41 // persisted info.
42 int64 GetModelVersion(ModelType type) const;
44 // Fills |context| with the datatype context associated with |type|.
45 void GetDataTypeContext(ModelType type,
46 sync_pb::DataTypeContext* context) const;
48 private:
49 void* operator new(size_t size); // Transaction is meant for stack use only.
51 // The underlying syncable object which this class wraps.
52 syncable::BaseTransaction* transaction_;
53 bool close_transaction_;
55 DISALLOW_COPY_AND_ASSIGN(ReadTransaction);
58 } // namespace syncer
60 #endif // SYNC_INTERNAL_API_PUBLIC_READ_TRANSACTION_H_