OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
11 #include "sync/api/attachments/attachment.h" | 11 #include "sync/api/attachments/attachment.h" |
12 #include "sync/api/attachments/attachment_id.h" | 12 #include "sync/api/attachments/attachment_id.h" |
13 #include "sync/api/attachments/attachment_store.h" | 13 #include "sync/api/attachments/attachment_store.h" |
14 #include "sync/api/attachments/attachment_store_backend.h" | |
15 #include "sync/base/sync_export.h" | 14 #include "sync/base/sync_export.h" |
16 | 15 |
17 namespace attachment_store_pb { | 16 namespace attachment_store_pb { |
18 class RecordMetadata; | 17 class RecordMetadata; |
19 } // namespace attachment_store_pb | 18 } // namespace attachment_store_pb |
20 | 19 |
21 namespace base { | 20 namespace base { |
22 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
23 } // namespace base | 22 } // namespace base |
24 | 23 |
(...skipping 11 matching lines...) Expand all Loading... |
36 // Constructs attachment store. | 35 // Constructs attachment store. |
37 OnDiskAttachmentStore( | 36 OnDiskAttachmentStore( |
38 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, | 37 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, |
39 const base::FilePath& path); | 38 const base::FilePath& path); |
40 ~OnDiskAttachmentStore() override; | 39 ~OnDiskAttachmentStore() override; |
41 | 40 |
42 // AttachmentStoreBackend implementation. | 41 // AttachmentStoreBackend implementation. |
43 void Init(const AttachmentStore::InitCallback& callback) override; | 42 void Init(const AttachmentStore::InitCallback& callback) override; |
44 void Read(const AttachmentIdList& ids, | 43 void Read(const AttachmentIdList& ids, |
45 const AttachmentStore::ReadCallback& callback) override; | 44 const AttachmentStore::ReadCallback& callback) override; |
46 void Write(AttachmentStore::AttachmentReferrer referrer, | 45 void Write(const AttachmentList& attachments, |
47 const AttachmentList& attachments, | |
48 const AttachmentStore::WriteCallback& callback) override; | 46 const AttachmentStore::WriteCallback& callback) override; |
49 void Drop(AttachmentStore::AttachmentReferrer referrer, | 47 void Drop(const AttachmentIdList& ids, |
50 const AttachmentIdList& ids, | |
51 const AttachmentStore::DropCallback& callback) override; | 48 const AttachmentStore::DropCallback& callback) override; |
52 void ReadMetadata( | 49 void ReadMetadata( |
53 const AttachmentIdList& ids, | 50 const AttachmentIdList& ids, |
54 const AttachmentStore::ReadMetadataCallback& callback) override; | 51 const AttachmentStore::ReadMetadataCallback& callback) override; |
55 void ReadAllMetadata( | 52 void ReadAllMetadata( |
56 AttachmentStore::AttachmentReferrer referrer, | |
57 const AttachmentStore::ReadMetadataCallback& callback) override; | 53 const AttachmentStore::ReadMetadataCallback& callback) override; |
58 | 54 |
59 private: | 55 private: |
60 friend class OnDiskAttachmentStoreSpecificTest; | 56 friend class OnDiskAttachmentStoreSpecificTest; |
61 | 57 |
62 // Opens leveldb database at |path|, creating it if needed. In the future | 58 // Opens leveldb database at |path|, creating it if needed. In the future |
63 // upgrade code will be invoked from OpenOrCreate as well. If open fails | 59 // upgrade code will be invoked from OpenOrCreate as well. If open fails |
64 // result is UNSPECIFIED_ERROR. | 60 // result is UNSPECIFIED_ERROR. |
65 AttachmentStore::Result OpenOrCreate(const base::FilePath& path); | 61 AttachmentStore::Result OpenOrCreate(const base::FilePath& path); |
66 // Reads single attachment from store. Returns nullptr in case of errors. | 62 // Reads single attachment from store. Returns nullptr in case of errors. |
(...skipping 17 matching lines...) Expand all Loading... |
84 | 80 |
85 const base::FilePath path_; | 81 const base::FilePath path_; |
86 scoped_ptr<leveldb::DB> db_; | 82 scoped_ptr<leveldb::DB> db_; |
87 | 83 |
88 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); | 84 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); |
89 }; | 85 }; |
90 | 86 |
91 } // namespace syncer | 87 } // namespace syncer |
92 | 88 |
93 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ | 89 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ |
OLD | NEW |