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

Side by Side Diff: sync/api/attachments/attachment_store_backend.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "sync/api/attachments/attachment.h"
12 #include "sync/api/attachments/attachment_id.h"
13 #include "sync/api/attachments/attachment_store.h"
14 #include "sync/base/sync_export.h"
15
16 namespace base {
17 class SequencedTaskRunner;
18 } // namespace base
19
20 namespace syncer {
21
22 // Interface for AttachmentStore backends.
23 //
24 // AttachmentStoreBackend provides interface for different backends (on-disk,
25 // in-memory). Factory methods in AttachmentStore create corresponding backend
26 // and pass reference to AttachmentStore.
27 // All functions in AttachmentStoreBackend mirror corresponding functions in
28 // AttachmentStore.
29 // All callbacks and result codes are used directly from AttachmentStore.
30 // AttachmentStoreFrontend only passes callbacks and results without modifying
31 // them, there is no need to declare separate set.
32 class SYNC_EXPORT AttachmentStoreBackend {
33 public:
34 explicit AttachmentStoreBackend(
35 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
36 virtual ~AttachmentStoreBackend();
37 virtual void Init(const AttachmentStore::InitCallback& callback) = 0;
38 virtual void Read(AttachmentStore::Component component,
39 const AttachmentIdList& ids,
40 const AttachmentStore::ReadCallback& callback) = 0;
41 virtual void Write(AttachmentStore::Component component,
42 const AttachmentList& attachments,
43 const AttachmentStore::WriteCallback& callback) = 0;
44 virtual void SetReference(AttachmentStore::Component component,
45 const AttachmentIdList& ids) = 0;
46 virtual void DropReference(AttachmentStore::Component component,
47 const AttachmentIdList& ids,
48 const AttachmentStore::DropCallback& callback) = 0;
49 virtual void ReadMetadataById(
50 AttachmentStore::Component component,
51 const AttachmentIdList& ids,
52 const AttachmentStore::ReadMetadataCallback& callback) = 0;
53 virtual void ReadMetadata(
54 AttachmentStore::Component component,
55 const AttachmentStore::ReadMetadataCallback& callback) = 0;
56
57 protected:
58 // Helper function to post callback on callback_task_runner.
59 void PostCallback(const base::Closure& callback);
60
61 private:
62 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
63
64 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
65 };
66
67 } // namespace syncer
68
69 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_store.cc ('k') | sync/api/attachments/attachment_store_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698