Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 void Read(const AttachmentIdList& ids, const ReadCallback& callback) override; | 40 void Read(const AttachmentIdList& ids, const ReadCallback& callback) override; |
| 41 void Write(const AttachmentList& attachments, | 41 void Write(const AttachmentList& attachments, |
| 42 const WriteCallback& callback) override; | 42 const WriteCallback& callback) override; |
| 43 void Drop(const AttachmentIdList& ids, const DropCallback& callback) override; | 43 void Drop(const AttachmentIdList& ids, const DropCallback& callback) override; |
| 44 | 44 |
| 45 // Opens leveldb database at |path|. It will create directory and database if | 45 // Opens leveldb database at |path|. It will create directory and database if |
| 46 // it doesn't exist. | 46 // it doesn't exist. |
| 47 Result OpenOrCreate(const base::FilePath& path); | 47 Result OpenOrCreate(const base::FilePath& path); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 std::string MakeDataKeyFromAttachmentId(const AttachmentId& attachment_id); | 50 friend class OnDiskAttachmentStoreSpecificTest; |
|
maniscalco
2014/10/30 16:40:20
Would FRIEND_TEST_ALL_PREFIXES work here?
pavely
2014/10/30 18:28:36
FRIEND_TEST_ALL_PREFIXES is for befriending indivi
maniscalco
2014/10/30 18:33:10
I see.
| |
| 51 | |
| 52 // Reads single attachment from store. Returns nullptr in case of errors. | |
| 53 scoped_ptr<Attachment> ReadSingleAttachment( | |
| 54 const AttachmentId& attachment_id); | |
| 55 // Writes single attachment to store. Returns false in case of errors. | |
| 56 bool WriteSingleAttachment(const Attachment& attachment); | |
| 57 | |
| 58 static std::string MakeDataKeyFromAttachmentId( | |
| 59 const AttachmentId& attachment_id); | |
| 60 static std::string MakeMetadataKeyFromAttachmentId( | |
| 61 const AttachmentId& attachment_id); | |
| 51 | 62 |
| 52 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_; | 63 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_; |
| 53 scoped_ptr<leveldb::DB> db_; | 64 scoped_ptr<leveldb::DB> db_; |
| 54 }; | 65 }; |
| 55 | 66 |
| 56 } // namespace syncer | 67 } // namespace syncer |
| 57 | 68 |
| 58 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ | 69 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ |
| OLD | NEW |