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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Constructs attachment store. | 36 // Constructs attachment store. |
37 OnDiskAttachmentStore( | 37 OnDiskAttachmentStore( |
38 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, | 38 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, |
39 const base::FilePath& path); | 39 const base::FilePath& path); |
40 ~OnDiskAttachmentStore() override; | 40 ~OnDiskAttachmentStore() override; |
41 | 41 |
42 // AttachmentStoreBackend implementation. | 42 // AttachmentStoreBackend implementation. |
43 void Init(const AttachmentStore::InitCallback& callback) override; | 43 void Init(const AttachmentStore::InitCallback& callback) override; |
44 void Read(const AttachmentIdList& ids, | 44 void Read(const AttachmentIdList& ids, |
45 const AttachmentStore::ReadCallback& callback) override; | 45 const AttachmentStore::ReadCallback& callback) override; |
46 void Write(AttachmentStore::AttachmentReferrer referrer, | 46 void Write(AttachmentStore::Component component, |
47 const AttachmentList& attachments, | 47 const AttachmentList& attachments, |
48 const AttachmentStore::WriteCallback& callback) override; | 48 const AttachmentStore::WriteCallback& callback) override; |
49 void Drop(AttachmentStore::AttachmentReferrer referrer, | 49 void SetReference(AttachmentStore::Component component, |
50 const AttachmentIdList& ids, | 50 const AttachmentIdList& ids) override; |
51 const AttachmentStore::DropCallback& callback) override; | 51 void DropReference(AttachmentStore::Component component, |
| 52 const AttachmentIdList& ids, |
| 53 const AttachmentStore::DropCallback& callback) override; |
52 void ReadMetadata( | 54 void ReadMetadata( |
53 const AttachmentIdList& ids, | 55 const AttachmentIdList& ids, |
54 const AttachmentStore::ReadMetadataCallback& callback) override; | 56 const AttachmentStore::ReadMetadataCallback& callback) override; |
55 void ReadAllMetadata( | 57 void ReadAllMetadata( |
56 AttachmentStore::AttachmentReferrer referrer, | 58 AttachmentStore::Component component, |
57 const AttachmentStore::ReadMetadataCallback& callback) override; | 59 const AttachmentStore::ReadMetadataCallback& callback) override; |
58 | 60 |
59 private: | 61 private: |
60 friend class OnDiskAttachmentStoreSpecificTest; | 62 friend class OnDiskAttachmentStoreSpecificTest; |
61 | 63 |
62 // Opens leveldb database at |path|, creating it if needed. In the future | 64 // 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 | 65 // upgrade code will be invoked from OpenOrCreate as well. If open fails |
64 // result is UNSPECIFIED_ERROR. | 66 // result is UNSPECIFIED_ERROR. |
65 AttachmentStore::Result OpenOrCreate(const base::FilePath& path); | 67 AttachmentStore::Result OpenOrCreate(const base::FilePath& path); |
66 // Reads single attachment from store. Returns nullptr in case of errors. | 68 // Reads single attachment from store. Returns nullptr in case of errors. |
(...skipping 17 matching lines...) Expand all Loading... |
84 | 86 |
85 const base::FilePath path_; | 87 const base::FilePath path_; |
86 scoped_ptr<leveldb::DB> db_; | 88 scoped_ptr<leveldb::DB> db_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); | 90 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace syncer | 93 } // namespace syncer |
92 | 94 |
93 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ | 95 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ |
OLD | NEW |