Merge lp:~michihenning/storage-framework/remove-qfuture-overloads into lp:storage-framework/devel
- remove-qfuture-overloads
- Merge into devel
Status: | Merged |
---|---|
Merged at revision: | 66 |
Proposed branch: | lp:~michihenning/storage-framework/remove-qfuture-overloads |
Merge into: | lp:storage-framework/devel |
Diff against target: |
705 lines (+131/-92) 13 files modified
include/unity/storage/qt/client/internal/make_future.h (+13/-28) include/unity/storage/qt/client/internal/remote_client/Handler.h (+8/-4) src/qt/client/internal/local_client/DownloaderImpl.cpp (+6/-5) src/qt/client/internal/local_client/UploaderImpl.cpp (+22/-11) src/qt/client/internal/remote_client/AccountImpl.cpp (+4/-2) src/qt/client/internal/remote_client/DownloaderImpl.cpp (+1/-1) src/qt/client/internal/remote_client/FileImpl.cpp (+13/-6) src/qt/client/internal/remote_client/FolderImpl.cpp (+24/-12) src/qt/client/internal/remote_client/ItemImpl.cpp (+17/-9) src/qt/client/internal/remote_client/RootImpl.cpp (+6/-3) src/qt/client/internal/remote_client/RuntimeImpl.cpp (+10/-5) src/qt/client/internal/remote_client/UploaderImpl.cpp (+7/-4) tests/local-client/local-client_test.cpp (+0/-2) |
To merge this branch: | bzr merge lp:~michihenning/storage-framework/remove-qfuture-overloads |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
unity-api-1-bot | continuous-integration | Needs Fixing | |
Michi Henning (community) | Approve | ||
James Henstridge | Approve | ||
Review via email:
|
Commit message
Removed overloads from make_future.h that accept a QFutureInterface because that made it too easy to accidentally call the wrong overload. Added attribute to remaining functions to warn if the return value is unused.
Description of the change
Removed overloads from make_future.h that accept a QFutureInterface because that made it too easy to accidentally call the wrong overload. Added attribute to remaining functions to warn if the return value is unused.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michi Henning (michihenning) wrote : | # |
Merged manually into devel because Jenkins is sick.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:69
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'include/unity/storage/qt/client/internal/make_future.h' |
2 | --- include/unity/storage/qt/client/internal/make_future.h 2016-08-02 03:02:15 +0000 |
3 | +++ include/unity/storage/qt/client/internal/make_future.h 2016-09-06 03:34:37 +0000 |
4 | @@ -37,7 +37,9 @@ |
5 | { |
6 | |
7 | template<typename T> |
8 | -QFuture<T> make_ready_future(T const& val) |
9 | +QFuture<T> |
10 | +__attribute__ ((warn_unused_result)) |
11 | +make_ready_future(T const& val) |
12 | { |
13 | QFutureInterface<T> qf; |
14 | qf.reportResult(val); |
15 | @@ -45,30 +47,19 @@ |
16 | return qf.future(); |
17 | } |
18 | |
19 | -template<typename T> |
20 | -QFuture<T> make_ready_future(QFutureInterface<T> qf, T const& val) |
21 | -{ |
22 | - qf.reportResult(val); |
23 | - qf.reportFinished(); |
24 | - return qf.future(); |
25 | -} |
26 | - |
27 | -template<typename T = void> |
28 | -QFuture<T> make_ready_future(QFutureInterface<T> qf) |
29 | -{ |
30 | - qf.reportFinished(); |
31 | - return qf.future(); |
32 | -} |
33 | - |
34 | -template<typename T = void> |
35 | -QFuture<T> make_ready_future() |
36 | +template<typename T = void> |
37 | +QFuture<T> |
38 | +__attribute__ ((warn_unused_result)) |
39 | +make_ready_future() |
40 | { |
41 | QFutureInterface<void> qf; |
42 | return make_ready_future(qf); |
43 | } |
44 | |
45 | template<typename E> |
46 | -QFuture<void> make_exceptional_future(E const& ex) |
47 | +QFuture<void> |
48 | +__attribute__ |
49 | +((warn_unused_result)) make_exceptional_future(E const& ex) |
50 | { |
51 | QFutureInterface<void> qf; |
52 | qf.reportException(ex); |
53 | @@ -77,7 +68,9 @@ |
54 | } |
55 | |
56 | template<typename T, typename E> |
57 | -QFuture<T> make_exceptional_future(E const& ex) |
58 | +QFuture<T> |
59 | +__attribute__ ((warn_unused_result)) |
60 | +make_exceptional_future(E const& ex) |
61 | { |
62 | QFutureInterface<T> qf; |
63 | qf.reportException(ex); |
64 | @@ -85,14 +78,6 @@ |
65 | return qf.future(); |
66 | } |
67 | |
68 | -template<typename T, typename E> |
69 | -QFuture<T> make_exceptional_future(QFutureInterface<T> qf, E const& ex) |
70 | -{ |
71 | - qf.reportException(ex); |
72 | - qf.reportFinished(); |
73 | - return qf.future(); |
74 | -} |
75 | - |
76 | } // namespace internal |
77 | } // namespace client |
78 | } // namespace qt |
79 | |
80 | === modified file 'include/unity/storage/qt/client/internal/remote_client/Handler.h' |
81 | --- include/unity/storage/qt/client/internal/remote_client/Handler.h 2016-08-17 02:55:12 +0000 |
82 | +++ include/unity/storage/qt/client/internal/remote_client/Handler.h 2016-09-06 03:34:37 +0000 |
83 | @@ -84,21 +84,25 @@ |
84 | catch (LocalCommsException const& e) |
85 | { |
86 | qCritical() << "provider exception:" << e.what(); |
87 | - make_exceptional_future<T>(qf_, e); |
88 | + qf_.reportException(e); |
89 | + qf_.reportFinished(); |
90 | } |
91 | catch (RemoteCommsException const& e) |
92 | { |
93 | qCritical() << "provider exception:" << e.what(); |
94 | - make_exceptional_future<T>(qf_, e); |
95 | + qf_.reportException(e); |
96 | + qf_.reportFinished(); |
97 | } |
98 | catch (ResourceException const& e) |
99 | { |
100 | qCritical() << "provider exception:" << e.what(); |
101 | - make_exceptional_future<T>(qf_, e); |
102 | + qf_.reportException(e); |
103 | + qf_.reportFinished(); |
104 | } |
105 | catch (StorageException const& e) |
106 | { |
107 | - make_exceptional_future<T>(qf_, e); |
108 | + qf_.reportException(e); |
109 | + qf_.reportFinished(); |
110 | } |
111 | // LCOV_EXCL_START |
112 | catch (...) |
113 | |
114 | === modified file 'src/qt/client/internal/local_client/DownloaderImpl.cpp' |
115 | --- src/qt/client/internal/local_client/DownloaderImpl.cpp 2016-09-01 03:09:40 +0000 |
116 | +++ src/qt/client/internal/local_client/DownloaderImpl.cpp 2016-09-06 03:34:37 +0000 |
117 | @@ -121,7 +121,7 @@ |
118 | + QString::number(written) + " byte"; |
119 | msg += written == 1 ? " was" : "s were"; |
120 | msg += " consumed."; |
121 | - make_exceptional_future(qf_, LogicException(msg)); |
122 | + qf_.reportException(LogicException(msg)); |
123 | } |
124 | else |
125 | { |
126 | @@ -136,12 +136,12 @@ |
127 | case cancelled: |
128 | { |
129 | QString msg = "Downloader::finish_download(): download of " + filename_ + " was cancelled"; |
130 | - make_exceptional_future(qf_, CancelledException(msg)); |
131 | + qf_.reportException(CancelledException(msg)); |
132 | break; |
133 | } |
134 | case error: |
135 | { |
136 | - make_exceptional_future(qf_, ResourceException(error_msg_, error_code_)); |
137 | + qf_.reportException(ResourceException(error_msg_, error_code_)); |
138 | break; |
139 | } |
140 | default: |
141 | @@ -149,7 +149,7 @@ |
142 | abort(); // LCOV_EXCL_LINE // Impossible |
143 | } |
144 | } |
145 | - make_ready_future(qf_); |
146 | + qf_.reportFinished(); |
147 | QThread::currentThread()->quit(); |
148 | } |
149 | |
150 | @@ -268,7 +268,8 @@ |
151 | // LCOV_EXCL_START |
152 | QString msg = "Downloader: cannot create socket pair: " |
153 | + QString::fromStdString(storage::internal::safe_strerror(errno)); |
154 | - make_exceptional_future(qf_, ResourceException(msg, errno)); |
155 | + qf_.reportException(ResourceException(msg, errno)); |
156 | + qf_.reportFinished(); |
157 | return; |
158 | // LCOV_EXCL_STOP |
159 | } |
160 | |
161 | === modified file 'src/qt/client/internal/local_client/UploaderImpl.cpp' |
162 | --- src/qt/client/internal/local_client/UploaderImpl.cpp 2016-09-01 03:09:40 +0000 |
163 | +++ src/qt/client/internal/local_client/UploaderImpl.cpp 2016-09-06 03:34:37 +0000 |
164 | @@ -151,7 +151,8 @@ |
165 | { |
166 | QString msg = "Uploader::finish_upload(): " + path_ + ": upload size of " + QString::number(size_) |
167 | + " does not match actual number of bytes read: " + QString::number(bytes_read_); |
168 | - make_exceptional_future(qf_, LogicException(msg)); |
169 | + qf_.reportException(LogicException(msg)); |
170 | + qf_.reportFinished(); |
171 | } |
172 | else |
173 | { |
174 | @@ -167,13 +168,15 @@ |
175 | case cancelled: |
176 | { |
177 | QString msg = "Uploader::finish_upload(): upload was cancelled"; |
178 | - make_exceptional_future(qf_, CancelledException(msg)); |
179 | + qf_.reportException(CancelledException(msg)); |
180 | + qf_.reportFinished(); |
181 | break; |
182 | } |
183 | case error: |
184 | { |
185 | // LCOV_EXCL_START |
186 | - make_exceptional_future(qf_, ResourceException(error_msg_, error_code_)); |
187 | + qf_.reportException(ResourceException(error_msg_, error_code_)); |
188 | + qf_.reportFinished(); |
189 | break; |
190 | // LCOV_EXCL_STOP |
191 | } |
192 | @@ -241,7 +244,8 @@ |
193 | if (impl->has_conflict()) |
194 | { |
195 | state_ = error; |
196 | - make_exceptional_future(qf_, ConflictException("Uploader::finish_upload(): ETag mismatch")); |
197 | + qf_.reportException(ConflictException("Uploader::finish_upload(): ETag mismatch")); |
198 | + qf_.reportFinished(); |
199 | return; |
200 | } |
201 | } |
202 | @@ -254,7 +258,8 @@ |
203 | state_ = error; |
204 | QString msg = "Uploader::finish_upload(): item with name \"" + path_ + "\" exists already"; |
205 | QString name = QString::fromStdString(boost::filesystem::path(path_.toStdString()).filename().native()); |
206 | - make_exceptional_future(qf_, ExistsException(msg, path_, name)); |
207 | + qf_.reportException(ExistsException(msg, path_, name)); |
208 | + qf_.reportFinished(); |
209 | return; |
210 | } |
211 | if (close(fd) == -1) |
212 | @@ -263,7 +268,8 @@ |
213 | state_ = error; |
214 | QString msg = "Uploader::finish_upload(): cannot close tmp file: " |
215 | + QString::fromStdString(storage::internal::safe_strerror(errno)); |
216 | - make_exceptional_future(qf_, ResourceException(msg, errno)); |
217 | + qf_.reportException(ResourceException(msg, errno)); |
218 | + qf_.reportFinished(); |
219 | return; |
220 | // LCOV_EXCL_STOP |
221 | } |
222 | @@ -277,7 +283,8 @@ |
223 | // LCOV_EXCL_START |
224 | state_ = error; |
225 | QString msg = "Uploader::finish_upload(): cannot flush output file: " + output_file_->errorString(); |
226 | - make_exceptional_future(qf_, ResourceException(msg, output_file_->error())); |
227 | + qf_.reportException(ResourceException(msg, output_file_->error())); |
228 | + qf_.reportFinished(); |
229 | return; |
230 | // LCOV_EXCL_STOP |
231 | } |
232 | @@ -296,7 +303,8 @@ |
233 | QString msg = "Uploader::finish_upload(): linkat \"" + QString::fromStdString(old_path) |
234 | + "\" to \"" + file->native_identity() + "\" failed: " |
235 | + QString::fromStdString(storage::internal::safe_strerror(errno)); |
236 | - make_exceptional_future(qf_, ResourceException(msg, error_code)); |
237 | + qf_.reportException(ResourceException(msg, error_code)); |
238 | + qf_.reportFinished(); |
239 | return; |
240 | // LCOV_EXCL_STOP |
241 | } |
242 | @@ -312,7 +320,8 @@ |
243 | QString msg = "Uploader::finish_upload(): rename \"" + QString::fromStdString(old_path) |
244 | + "\" to \"" + file->native_identity() + "\" failed: " |
245 | + QString::fromStdString(storage::internal::safe_strerror(errno)); |
246 | - make_exceptional_future(qf_, ResourceException(msg, error_code)); |
247 | + qf_.reportException(ResourceException(msg, error_code)); |
248 | + qf_.reportFinished(); |
249 | return; |
250 | } |
251 | // LCOV_EXCL_STOP |
252 | @@ -321,7 +330,8 @@ |
253 | state_ = finalized; |
254 | output_file_->close(); |
255 | impl->set_timestamps(); |
256 | - make_ready_future(qf_, file); |
257 | + qf_.reportResult(file); |
258 | + qf_.reportFinished(); |
259 | } |
260 | |
261 | // LCOV_EXCL_START |
262 | @@ -366,7 +376,8 @@ |
263 | // LCOV_EXCL_START |
264 | QString msg = "Uploader: cannot create socket pair: " |
265 | + QString::fromStdString(storage::internal::safe_strerror(errno)); |
266 | - make_exceptional_future(qf_, ResourceException(msg, errno)); |
267 | + qf_.reportException(ResourceException(msg, errno)); |
268 | + qf_.reportFinished(); |
269 | return; |
270 | // LCOV_EXCL_STOP |
271 | } |
272 | |
273 | === modified file 'src/qt/client/internal/remote_client/AccountImpl.cpp' |
274 | --- src/qt/client/internal/remote_client/AccountImpl.cpp 2016-08-22 04:56:44 +0000 |
275 | +++ src/qt/client/internal/remote_client/AccountImpl.cpp 2016-09-06 03:34:37 +0000 |
276 | @@ -96,7 +96,8 @@ |
277 | } |
278 | catch (RuntimeDestroyedException const& e) |
279 | { |
280 | - make_exceptional_future(qf, RuntimeDestroyedException("Account::roots()")); |
281 | + qf.reportException(RuntimeDestroyedException("Account::roots()")); |
282 | + qf.reportFinished(); |
283 | return; |
284 | } |
285 | |
286 | @@ -113,7 +114,8 @@ |
287 | roots.append(root); |
288 | } |
289 | roots_ = roots; |
290 | - make_ready_future(qf, roots); |
291 | + qf.reportResult(roots); |
292 | + qf.reportFinished(); |
293 | }; |
294 | |
295 | auto handler = new Handler<QVector<Root::SPtr>>(this, reply, process_reply); |
296 | |
297 | === modified file 'src/qt/client/internal/remote_client/DownloaderImpl.cpp' |
298 | --- src/qt/client/internal/remote_client/DownloaderImpl.cpp 2016-09-01 03:09:40 +0000 |
299 | +++ src/qt/client/internal/remote_client/DownloaderImpl.cpp 2016-09-06 03:34:37 +0000 |
300 | @@ -81,7 +81,7 @@ |
301 | |
302 | auto process_reply = [this](decltype(reply) const&, QFutureInterface<void>& qf) |
303 | { |
304 | - make_ready_future(qf); |
305 | + qf.reportFinished(); |
306 | }; |
307 | |
308 | auto handler = new Handler<void>(this, reply, process_reply); |
309 | |
310 | === modified file 'src/qt/client/internal/remote_client/FileImpl.cpp' |
311 | --- src/qt/client/internal/remote_client/FileImpl.cpp 2016-08-11 07:06:35 +0000 |
312 | +++ src/qt/client/internal/remote_client/FileImpl.cpp 2016-09-06 03:34:37 +0000 |
313 | @@ -80,7 +80,8 @@ |
314 | auto root = get_root(); |
315 | if (!root) |
316 | { |
317 | - make_exceptional_future(qf, RuntimeDestroyedException("File::create_uploader()")); |
318 | + qf.reportException(RuntimeDestroyedException("File::create_uploader()")); |
319 | + qf.reportFinished(); |
320 | return; |
321 | } |
322 | |
323 | @@ -91,11 +92,13 @@ |
324 | // TODO: log server error here |
325 | QString msg = "File::create_uploader(): impossible file descriptor returned by server: " |
326 | + QString::number(fd.fileDescriptor()); |
327 | - make_exceptional_future(qf, LocalCommsException(msg)); |
328 | + qf.reportException(LocalCommsException(msg)); |
329 | + qf.reportFinished(); |
330 | return; |
331 | } |
332 | auto uploader = UploaderImpl::make_uploader(upload_id, fd, size, old_etag, root, prov); |
333 | - make_ready_future(qf, uploader); |
334 | + qf.reportResult(uploader); |
335 | + qf.reportFinished(); |
336 | }; |
337 | auto handler = new Handler<shared_ptr<Uploader>>(this, reply, process_reply); |
338 | return handler->future(); |
339 | @@ -124,7 +127,9 @@ |
340 | } |
341 | catch (StorageException const& e) |
342 | { |
343 | - make_exceptional_future(qf, e); |
344 | + qf.reportException(e); |
345 | + qf.reportFinished(); |
346 | + return; |
347 | } |
348 | |
349 | auto download_id = reply.argumentAt<0>(); |
350 | @@ -134,13 +139,15 @@ |
351 | // TODO: log server error here |
352 | QString msg = "File::create_downloader(): impossible file descriptor returned by server: " |
353 | + QString::number(fd.fileDescriptor()); |
354 | - make_exceptional_future(qf, LocalCommsException(msg)); |
355 | + qf.reportException(LocalCommsException(msg)); |
356 | + qf.reportFinished(); |
357 | return; |
358 | } |
359 | auto file = dynamic_pointer_cast<File>(public_instance_.lock()); |
360 | // TODO: provider may not be around anymore if the runtime was destroyed. |
361 | auto downloader = DownloaderImpl::make_downloader(download_id, fd, file, prov); |
362 | - make_ready_future(qf, downloader); |
363 | + qf.reportResult(downloader); |
364 | + qf.reportFinished(); |
365 | }; |
366 | |
367 | auto handler = new Handler<shared_ptr<Downloader>>(this, reply, process_reply); |
368 | |
369 | === modified file 'src/qt/client/internal/remote_client/FolderImpl.cpp' |
370 | --- src/qt/client/internal/remote_client/FolderImpl.cpp 2016-08-09 02:25:13 +0000 |
371 | +++ src/qt/client/internal/remote_client/FolderImpl.cpp 2016-09-06 03:34:37 +0000 |
372 | @@ -78,7 +78,8 @@ |
373 | auto root = get_root(); |
374 | if (!root) |
375 | { |
376 | - make_exceptional_future(qf, RuntimeDestroyedException("Folder::list()")); |
377 | + qf.reportException(RuntimeDestroyedException("Folder::list()")); |
378 | + qf.reportFinished(); |
379 | return; |
380 | } |
381 | |
382 | @@ -92,7 +93,8 @@ |
383 | } |
384 | catch (StorageException const& e) |
385 | { |
386 | - make_exceptional_future(qf, e); |
387 | + qf.reportException(e); |
388 | + qf.reportFinished(); |
389 | return; |
390 | } |
391 | if (md.type == ItemType::root) |
392 | @@ -140,7 +142,8 @@ |
393 | auto root = get_root(); |
394 | if (!root) |
395 | { |
396 | - make_exceptional_future(qf, RuntimeDestroyedException("Folder::lookup()")); |
397 | + qf.reportException(RuntimeDestroyedException("Folder::lookup()")); |
398 | + qf.reportFinished(); |
399 | return; |
400 | } |
401 | |
402 | @@ -154,7 +157,8 @@ |
403 | } |
404 | catch (StorageException const& e) |
405 | { |
406 | - make_exceptional_future(qf, e); |
407 | + qf.reportException(e); |
408 | + qf.reportFinished(); |
409 | return; |
410 | } |
411 | if (md.type == ItemType::root) |
412 | @@ -166,10 +170,12 @@ |
413 | } |
414 | if (items.isEmpty()) |
415 | { |
416 | - make_exceptional_future(qf, NotExistsException("Folder::lookup(): no such item: " + name, name)); |
417 | + qf.reportException(NotExistsException("Folder::lookup(): no such item: " + name, name)); |
418 | + qf.reportFinished(); |
419 | return; |
420 | } |
421 | - make_ready_future(qf, items); |
422 | + qf.reportResult(items); |
423 | + qf.reportFinished(); |
424 | }; |
425 | |
426 | auto handler = new Handler<QVector<shared_ptr<Item>>>(const_cast<FolderImpl*>(this), reply, process_reply); |
427 | @@ -195,7 +201,8 @@ |
428 | auto root = get_root(); |
429 | if (!root) |
430 | { |
431 | - make_exceptional_future(qf, RuntimeDestroyedException("Folder::create_folder()")); |
432 | + qf.reportException(RuntimeDestroyedException("Folder::create_folder()")); |
433 | + qf.reportFinished(); |
434 | return; |
435 | } |
436 | |
437 | @@ -207,7 +214,8 @@ |
438 | } |
439 | catch (StorageException const& e) |
440 | { |
441 | - make_exceptional_future(qf, e); |
442 | + qf.reportException(e); |
443 | + qf.reportFinished(); |
444 | return; |
445 | } |
446 | if (md.type != ItemType::folder) |
447 | @@ -215,10 +223,12 @@ |
448 | // TODO: log server error here |
449 | QString msg = "File::create_folder(): impossible item type returned by server: " |
450 | + QString::number(int(md.type)); |
451 | - make_exceptional_future(qf, LocalCommsException(msg)); |
452 | + qf.reportException(LocalCommsException(msg)); |
453 | + qf.reportFinished(); |
454 | return; |
455 | } |
456 | - make_ready_future(qf, FolderImpl::make_folder(md, root)); |
457 | + qf.reportResult(FolderImpl::make_folder(md, root)); |
458 | + qf.reportFinished(); |
459 | }; |
460 | |
461 | auto handler = new Handler<shared_ptr<Folder>>(this, reply, process_reply); |
462 | @@ -249,14 +259,16 @@ |
463 | auto root = get_root(); |
464 | if (!root) |
465 | { |
466 | - make_exceptional_future(qf, RuntimeDestroyedException("Folder::create_file()")); |
467 | + qf.reportException(RuntimeDestroyedException("Folder::create_file()")); |
468 | + qf.reportFinished(); |
469 | return; |
470 | } |
471 | |
472 | auto upload_id = reply.argumentAt<0>(); |
473 | auto fd = reply.argumentAt<1>(); |
474 | auto uploader = UploaderImpl::make_uploader(upload_id, fd, size, "", root, provider()); |
475 | - make_ready_future(qf, uploader); |
476 | + qf.reportResult(uploader); |
477 | + qf.reportFinished(); |
478 | }; |
479 | |
480 | auto handler = new Handler<shared_ptr<Uploader>>(this, reply, process_reply); |
481 | |
482 | === modified file 'src/qt/client/internal/remote_client/ItemImpl.cpp' |
483 | --- src/qt/client/internal/remote_client/ItemImpl.cpp 2016-08-09 07:04:11 +0000 |
484 | +++ src/qt/client/internal/remote_client/ItemImpl.cpp 2016-09-06 03:34:37 +0000 |
485 | @@ -102,7 +102,8 @@ |
486 | auto root = get_root(); |
487 | if (!root) |
488 | { |
489 | - make_exceptional_future(qf, RuntimeDestroyedException("Item::copy()")); |
490 | + qf.reportException(RuntimeDestroyedException("Item::copy()")); |
491 | + qf.reportFinished(); |
492 | return; |
493 | } |
494 | |
495 | @@ -113,7 +114,8 @@ |
496 | } |
497 | catch (StorageException const& e) |
498 | { |
499 | - make_exceptional_future(qf, e); |
500 | + qf.reportException(e); |
501 | + qf.reportFinished(); |
502 | return; |
503 | } |
504 | if (md.type == ItemType::root) |
505 | @@ -121,10 +123,12 @@ |
506 | // TODO: log server error here |
507 | QString msg = "File::create_folder(): impossible item type returned by server: " |
508 | + QString::number(int(md.type)); |
509 | - make_exceptional_future(qf, LocalCommsException(msg)); |
510 | + qf.reportException(LocalCommsException(msg)); |
511 | + qf.reportFinished(); |
512 | return; |
513 | } |
514 | - make_ready_future(qf, ItemImpl::make_item(md, root)); |
515 | + qf.reportResult(ItemImpl::make_item(md, root)); |
516 | + qf.reportFinished(); |
517 | return; |
518 | }; |
519 | |
520 | @@ -163,7 +167,8 @@ |
521 | auto root = get_root(); |
522 | if (!root) |
523 | { |
524 | - make_exceptional_future(qf, RuntimeDestroyedException("Item::move()")); |
525 | + qf.reportException(RuntimeDestroyedException("Item::move()")); |
526 | + qf.reportFinished(); |
527 | return; |
528 | } |
529 | |
530 | @@ -174,17 +179,20 @@ |
531 | } |
532 | catch (StorageException const& e) |
533 | { |
534 | - make_exceptional_future(qf, e); |
535 | + qf.reportException(e); |
536 | + qf.reportFinished(); |
537 | return; |
538 | } |
539 | if (md.type == ItemType::root) |
540 | { |
541 | // TODO: log server error here |
542 | QString msg = "Item::move(): impossible root item returned by server"; |
543 | - make_exceptional_future(qf, LocalCommsException(msg)); |
544 | + qf.reportException(LocalCommsException(msg)); |
545 | + qf.reportFinished(); |
546 | return; |
547 | } |
548 | - make_ready_future(qf, ItemImpl::make_item(md, root)); |
549 | + qf.reportResult(ItemImpl::make_item(md, root)); |
550 | + qf.reportFinished(); |
551 | }; |
552 | |
553 | auto handler = new Handler<shared_ptr<Item>>(this, reply, process_reply); |
554 | @@ -229,7 +237,7 @@ |
555 | auto process_reply = [this](decltype(reply) const&, QFutureInterface<void>& qf) |
556 | { |
557 | deleted_ = true; |
558 | - make_ready_future(qf); |
559 | + qf.reportFinished(); |
560 | }; |
561 | |
562 | auto handler = new Handler<void>(this, reply, process_reply); |
563 | |
564 | === modified file 'src/qt/client/internal/remote_client/RootImpl.cpp' |
565 | --- src/qt/client/internal/remote_client/RootImpl.cpp 2016-08-09 02:25:13 +0000 |
566 | +++ src/qt/client/internal/remote_client/RootImpl.cpp 2016-09-06 03:34:37 +0000 |
567 | @@ -133,7 +133,8 @@ |
568 | } |
569 | catch (RuntimeDestroyedException const&) |
570 | { |
571 | - make_exceptional_future(qf, RuntimeDestroyedException("Root::get()")); |
572 | + qf.reportException(RuntimeDestroyedException("Root::get()")); |
573 | + qf.reportFinished(); |
574 | return; |
575 | } |
576 | |
577 | @@ -144,7 +145,8 @@ |
578 | } |
579 | catch (StorageException const& e) |
580 | { |
581 | - make_exceptional_future(qf, e); |
582 | + qf.reportException(e); |
583 | + qf.reportFinished(); |
584 | return; |
585 | } |
586 | Item::SPtr item; |
587 | @@ -157,7 +159,8 @@ |
588 | // acc owns the root, so the root weak_ptr is guaranteed to be lockable. |
589 | item = ItemImpl::make_item(md, root_); |
590 | } |
591 | - make_ready_future(qf, item); |
592 | + qf.reportResult(item); |
593 | + qf.reportFinished(); |
594 | }; |
595 | |
596 | auto handler = new Handler<Item::SPtr>(const_cast<RootImpl*>(this), reply, process_reply); |
597 | |
598 | === modified file 'src/qt/client/internal/remote_client/RuntimeImpl.cpp' |
599 | --- src/qt/client/internal/remote_client/RuntimeImpl.cpp 2016-08-19 06:18:54 +0000 |
600 | +++ src/qt/client/internal/remote_client/RuntimeImpl.cpp 2016-09-06 03:34:37 +0000 |
601 | @@ -105,7 +105,9 @@ |
602 | { |
603 | if (destroyed_) |
604 | { |
605 | - return make_exceptional_future(qf_, RuntimeDestroyedException("Runtime::accounts()")); |
606 | + qf_.reportException(RuntimeDestroyedException("Runtime::accounts()")); |
607 | + qf_.reportFinished(); |
608 | + return qf_.future(); |
609 | } |
610 | |
611 | if (!manager_) |
612 | @@ -131,7 +133,8 @@ |
613 | if (destroyed_) |
614 | { |
615 | // LCOV_EXCL_START |
616 | - make_exceptional_future(qf_, RuntimeDestroyedException("Runtime::accounts()")); |
617 | + qf_.reportException(RuntimeDestroyedException("Runtime::accounts()")); |
618 | + qf_.reportFinished(); |
619 | return; |
620 | // LCOV_EXCL_STOP |
621 | } |
622 | @@ -161,20 +164,22 @@ |
623 | } |
624 | } |
625 | accounts_ = accounts; |
626 | - make_ready_future(qf_, accounts); |
627 | + qf_.reportResult(accounts); |
628 | } |
629 | // LCOV_EXCL_START |
630 | catch (StorageException const& e) |
631 | { |
632 | - make_exceptional_future(qf_, e); |
633 | + qf_.reportException(e); |
634 | } |
635 | // LCOV_EXCL_STOP |
636 | + qf_.reportFinished(); |
637 | } |
638 | |
639 | // LCOV_EXCL_START |
640 | void RuntimeImpl::timeout() |
641 | { |
642 | - make_exceptional_future(qf_, ResourceException("Runtime::accounts(): timeout retrieving Online accounts", 0)); |
643 | + qf_.reportException(ResourceException("Runtime::accounts(): timeout retrieving Online accounts", 0)); |
644 | + qf_.reportFinished(); |
645 | } |
646 | // LCOV_EXCL_STOP |
647 | |
648 | |
649 | === modified file 'src/qt/client/internal/remote_client/UploaderImpl.cpp' |
650 | --- src/qt/client/internal/remote_client/UploaderImpl.cpp 2016-09-01 03:09:40 +0000 |
651 | +++ src/qt/client/internal/remote_client/UploaderImpl.cpp 2016-09-06 03:34:37 +0000 |
652 | @@ -92,7 +92,8 @@ |
653 | } |
654 | catch (StorageException const& e) |
655 | { |
656 | - make_exceptional_future(qf, e); |
657 | + qf.reportException(e); |
658 | + qf.reportFinished(); |
659 | return; |
660 | } |
661 | if (md.type != ItemType::file) |
662 | @@ -100,10 +101,12 @@ |
663 | // TODO: log server error here |
664 | QString msg = "Uploader::finish_upload(): impossible item type returned by server: " |
665 | + QString::number(int(md.type)); |
666 | - make_exceptional_future(qf, LocalCommsException(msg)); |
667 | + qf.reportException(LocalCommsException(msg)); |
668 | + qf.reportFinished(); |
669 | return; |
670 | } |
671 | - make_ready_future(qf, FileImpl::make_file(md, root_)); |
672 | + qf.reportResult(FileImpl::make_file(md, root_)); |
673 | + qf.reportFinished(); |
674 | }; |
675 | |
676 | write_socket_->disconnectFromServer(); |
677 | @@ -118,7 +121,7 @@ |
678 | auto reply = provider_->CancelUpload(upload_id_); |
679 | auto process_reply = [this](decltype(reply) const&, QFutureInterface<void>& qf) |
680 | { |
681 | - make_ready_future(qf); |
682 | + qf.reportFinished(); |
683 | }; |
684 | |
685 | write_socket_->abort(); |
686 | |
687 | === modified file 'tests/local-client/local-client_test.cpp' |
688 | --- tests/local-client/local-client_test.cpp 2016-08-25 04:05:18 +0000 |
689 | +++ tests/local-client/local-client_test.cpp 2016-09-06 03:34:37 +0000 |
690 | @@ -425,7 +425,6 @@ |
691 | EXPECT_EQ(0, file->size()); |
692 | auto old_etag = file->etag(); |
693 | |
694 | - qDebug() << "Uploading 0 bytes"; |
695 | // Create uploader for the file and write nothing. |
696 | uploader = call(file->create_uploader(ConflictPolicy::overwrite, 0)); |
697 | file = call(uploader->finish_upload()); |
698 | @@ -436,7 +435,6 @@ |
699 | uploader = call(file->create_uploader(ConflictPolicy::overwrite, s.size())); |
700 | EXPECT_EQ(1000000, uploader->size()); |
701 | uploader->socket()->write(&s[0], s.size()); |
702 | - qDebug() << "Waiting for write to complete"; |
703 | uploader->socket()->waitForBytesWritten(SIGNAL_WAIT_TIME); |
704 | |
705 | // Need to sleep here, otherwise it is possible for the |
PASSED: Continuous integration, rev:68 /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/101/ /jenkins. canonical. com/unity- api-1/job/ build/508 /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/514 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= vivid+overlay/ 419 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= xenial+ overlay/ 419 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= yakkety/ 419 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 349/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 349 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 349/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/101/ rebuild
https:/