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

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

Issue 293143002: Add AttachmentDownloader interface, change signature of AttachmentStore::Read (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes after feedback from Nick Created 6 years, 7 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
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_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 20 matching lines...) Expand all
31 virtual ~AttachmentStore(); 31 virtual ~AttachmentStore();
32 32
33 // TODO(maniscalco): Consider udpating Read and Write methods to support 33 // TODO(maniscalco): Consider udpating Read and Write methods to support
34 // resumable transfers (bug 353292). 34 // resumable transfers (bug 353292).
35 35
36 enum Result { 36 enum Result {
37 SUCCESS, // No error, all completed successfully. 37 SUCCESS, // No error, all completed successfully.
38 UNSPECIFIED_ERROR, // An unspecified error occurred for one or more items. 38 UNSPECIFIED_ERROR, // An unspecified error occurred for one or more items.
39 }; 39 };
40 40
41 typedef base::Callback<void(const Result&, scoped_ptr<AttachmentMap>)> 41 typedef base::Callback<void(const Result&,
42 ReadCallback; 42 scoped_ptr<AttachmentMap>,
43 scoped_ptr<AttachmentIdList>)> ReadCallback;
43 typedef base::Callback<void(const Result&)> WriteCallback; 44 typedef base::Callback<void(const Result&)> WriteCallback;
44 typedef base::Callback<void(const Result&)> DropCallback; 45 typedef base::Callback<void(const Result&)> DropCallback;
45 46
46 // Asynchronously reads the attachments identified by |ids|. 47 // Asynchronously reads the attachments identified by |ids|.
47 // 48 //
48 // |callback| will be invoked when finished. If any of the attachments do not 49 // |callback| will be invoked when finished. AttachmentStore will attempt to
49 // exist or could not be read, |callback|'s Result will be UNSPECIFIED_ERROR 50 // read all attachments specified in ids. If any of the attachments do not
50 // and |callback| may receive a partial result. That is, AttachmentMap may be 51 // exist or could not be read, |callback|'s Result will be UNSPECIFIED_ERROR.
51 // empty or may contain the attachments that were read successfully. 52 // Callback's AttachmentMap will contain all attachments that were
53 // successfully read, AttachmentIdList will contain attachment ids of
54 // attachments that are unavailable in attachment store, these need to be
55 // downloaded from server.
52 // 56 //
53 // Reads on individual attachments are treated atomically; |callback| will not 57 // Reads on individual attachments are treated atomically; |callback| will not
54 // read only part of an attachment. 58 // read only part of an attachment.
55 virtual void Read(const AttachmentIdList& ids, 59 virtual void Read(const AttachmentIdList& ids,
56 const ReadCallback& callback) = 0; 60 const ReadCallback& callback) = 0;
57 61
58 // Asynchronously writes |attachments| to the store. 62 // Asynchronously writes |attachments| to the store.
59 // 63 //
60 // Will not overwrite stored attachments. Attempting to overwrite an 64 // Will not overwrite stored attachments. Attempting to overwrite an
61 // attachment that already exists is not an error. 65 // attachment that already exists is not an error.
(...skipping 14 matching lines...) Expand all
76 // could not be dropped, |callback|'s Result will be UNSPECIFIED_ERROR. When 80 // could not be dropped, |callback|'s Result will be UNSPECIFIED_ERROR. When
77 // this happens, some or none of the attachments may have been dropped 81 // this happens, some or none of the attachments may have been dropped
78 // successfully. 82 // successfully.
79 virtual void Drop(const AttachmentIdList& ids, 83 virtual void Drop(const AttachmentIdList& ids,
80 const DropCallback& callback) = 0; 84 const DropCallback& callback) = 0;
81 }; 85 };
82 86
83 } // namespace syncer 87 } // namespace syncer
84 88
85 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 89 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_service_impl.cc ('k') | sync/api/attachments/attachment_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698