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

Side by Side Diff: sync/internal_api/public/attachments/on_disk_attachment_store.h

Issue 986743004: [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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
« no previous file with comments | « sync/internal_api/public/attachments/in_memory_attachment_store.h ('k') | sync/sync.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
14 #include "sync/base/sync_export.h" 15 #include "sync/base/sync_export.h"
15 16
16 namespace attachment_store_pb { 17 namespace attachment_store_pb {
17 class RecordMetadata; 18 class RecordMetadata;
18 } // namespace attachment_store_pb 19 } // namespace attachment_store_pb
19 20
20 namespace base { 21 namespace base {
21 class SequencedTaskRunner; 22 class SequencedTaskRunner;
22 } // namespace base 23 } // namespace base
23 24
(...skipping 11 matching lines...) Expand all
35 // Constructs attachment store. 36 // Constructs attachment store.
36 OnDiskAttachmentStore( 37 OnDiskAttachmentStore(
37 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner, 38 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner,
38 const base::FilePath& path); 39 const base::FilePath& path);
39 ~OnDiskAttachmentStore() override; 40 ~OnDiskAttachmentStore() override;
40 41
41 // AttachmentStoreBackend implementation. 42 // AttachmentStoreBackend implementation.
42 void Init(const AttachmentStore::InitCallback& callback) override; 43 void Init(const AttachmentStore::InitCallback& callback) override;
43 void Read(const AttachmentIdList& ids, 44 void Read(const AttachmentIdList& ids,
44 const AttachmentStore::ReadCallback& callback) override; 45 const AttachmentStore::ReadCallback& callback) override;
45 void Write(const AttachmentList& attachments, 46 void Write(AttachmentStore::AttachmentReferrer referrer,
47 const AttachmentList& attachments,
46 const AttachmentStore::WriteCallback& callback) override; 48 const AttachmentStore::WriteCallback& callback) override;
47 void Drop(const AttachmentIdList& ids, 49 void Drop(AttachmentStore::AttachmentReferrer referrer,
50 const AttachmentIdList& ids,
48 const AttachmentStore::DropCallback& callback) override; 51 const AttachmentStore::DropCallback& callback) override;
49 void ReadMetadata( 52 void ReadMetadata(
50 const AttachmentIdList& ids, 53 const AttachmentIdList& ids,
51 const AttachmentStore::ReadMetadataCallback& callback) override; 54 const AttachmentStore::ReadMetadataCallback& callback) override;
52 void ReadAllMetadata( 55 void ReadAllMetadata(
56 AttachmentStore::AttachmentReferrer referrer,
53 const AttachmentStore::ReadMetadataCallback& callback) override; 57 const AttachmentStore::ReadMetadataCallback& callback) override;
54 58
55 private: 59 private:
56 friend class OnDiskAttachmentStoreSpecificTest; 60 friend class OnDiskAttachmentStoreSpecificTest;
57 61
58 // Opens leveldb database at |path|, creating it if needed. In the future 62 // Opens leveldb database at |path|, creating it if needed. In the future
59 // upgrade code will be invoked from OpenOrCreate as well. If open fails 63 // upgrade code will be invoked from OpenOrCreate as well. If open fails
60 // result is UNSPECIFIED_ERROR. 64 // result is UNSPECIFIED_ERROR.
61 AttachmentStore::Result OpenOrCreate(const base::FilePath& path); 65 AttachmentStore::Result OpenOrCreate(const base::FilePath& path);
62 // Reads single attachment from store. Returns nullptr in case of errors. 66 // Reads single attachment from store. Returns nullptr in case of errors.
(...skipping 17 matching lines...) Expand all
80 84
81 const base::FilePath path_; 85 const base::FilePath path_;
82 scoped_ptr<leveldb::DB> db_; 86 scoped_ptr<leveldb::DB> db_;
83 87
84 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore); 88 DISALLOW_COPY_AND_ASSIGN(OnDiskAttachmentStore);
85 }; 89 };
86 90
87 } // namespace syncer 91 } // namespace syncer
88 92
89 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_ 93 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ON_DISK_ATTACHMENT_STORE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/attachments/in_memory_attachment_store.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698