Merge lp:~marcustomlinson/keeper/link-against-real-storage-framework into lp:keeper/devel
- link-against-real-storage-framework
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 106 |
Merged at revision: | 96 |
Proposed branch: | lp:~marcustomlinson/keeper/link-against-real-storage-framework |
Merge into: | lp:keeper/devel |
Prerequisite: | lp:~xavi-garcia-mena/keeper/link-against-real-storage-framework |
Diff against target: |
144 lines (+71/-28) 2 files modified
src/storage-framework/storage_framework_client.cpp (+67/-28) src/storage-framework/storage_framework_client.h (+4/-0) |
To merge this branch: | bzr merge lp:~marcustomlinson/keeper/link-against-real-storage-framework |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
unity-api-1-bot | continuous-integration | Needs Fixing | |
Review via email: mp+303250@code.launchpad.net |
Commit message
The branch links keeper-service against the non-local version of storage-framework
Description of the change
unity-api-1-bot (unity-api-1-bot) wrote : | # |
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:103
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:
https:/
- 104. By Marcus Tomlinson
-
colon is not allowed in filename for mcloud
- 105. By Marcus Tomlinson
-
try..catch over uploader_
closed_ watcher_ and uploader_ ready_watcher_ result() calls
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:104
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: 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:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 106. By Marcus Tomlinson
-
Merged devel
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:106
https:/
Executed test runs:
FAILURE: 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:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Charles Kerr (charlesk) : | # |
Preview Diff
1 | === modified file 'src/storage-framework/storage_framework_client.cpp' |
2 | --- src/storage-framework/storage_framework_client.cpp 2016-08-19 16:09:44 +0000 |
3 | +++ src/storage-framework/storage_framework_client.cpp 2016-08-24 07:04:48 +0000 |
4 | @@ -32,35 +32,15 @@ |
5 | , uploader_() |
6 | { |
7 | QObject::connect(&uploader_ready_watcher_,&QFutureWatcher<std::shared_ptr<Uploader>>::finished, this, &StorageFrameworkClient::uploaderReady); |
8 | - QObject::connect(&uploader_closed_watcher_,&QFutureWatcher<std::shared_ptr<unity::storage::qt::client::File>>::finished, this, &StorageFrameworkClient::onUploaderClosed); |
9 | + QObject::connect(&uploader_closed_watcher_,&QFutureWatcher<std::shared_ptr<File>>::finished, this, &StorageFrameworkClient::onUploaderClosed); |
10 | + QObject::connect(&accounts_watcher_,&QFutureWatcher<QVector<std::shared_ptr<Account>>>::finished, this, &StorageFrameworkClient::accountsReady); |
11 | + QObject::connect(&roots_watcher_,&QFutureWatcher<QVector<std::shared_ptr<Root>>>::finished, this, &StorageFrameworkClient::rootsReady); |
12 | } |
13 | |
14 | - |
15 | void StorageFrameworkClient::getNewFileForBackup(quint64 n_bytes) |
16 | { |
17 | - // Get the acccounts. (There is only one account for the local client implementation.) |
18 | - // We do this synchronously for simplicity. |
19 | - try { |
20 | - auto accounts = runtime_->accounts().result(); |
21 | - Root::SPtr root = accounts[0]->roots().result()[0]; |
22 | - qDebug() << "id:" << root->native_identity(); |
23 | - qDebug() << "time:" << root->last_modified_time(); |
24 | - |
25 | - |
26 | - // XGM ADD A new file to the root |
27 | - QFutureWatcher<std::shared_ptr<Uploader>> new_file_watcher; |
28 | - |
29 | - // get the current date and time to create the new file |
30 | - QDateTime now = QDateTime::currentDateTime(); |
31 | - QString new_file_name = QString("Backup_%1").arg(now.toString("dd.MM.yyyy-hh:mm:ss.zzz")); |
32 | - |
33 | - uploader_ready_watcher_.setFuture(root->create_file(new_file_name, n_bytes)); |
34 | - } |
35 | - catch (std::exception & e) |
36 | - { |
37 | - qDebug() << "ERROR: StorageFrameworkClient::getNewFileForBackup():" << e.what(); |
38 | - throw; |
39 | - } |
40 | + accounts_watcher_.setProperty("n_bytes", n_bytes); |
41 | + accounts_watcher_.setFuture(runtime_->accounts()); |
42 | } |
43 | |
44 | void StorageFrameworkClient::finish(bool do_commit) |
45 | @@ -85,16 +65,75 @@ |
46 | |
47 | void StorageFrameworkClient::onUploaderClosed() |
48 | { |
49 | - auto file = uploader_closed_watcher_.result(); |
50 | - qDebug() << "Uploader for file" << file->name() << "was closed"; |
51 | + try |
52 | + { |
53 | + auto file = uploader_closed_watcher_.result(); |
54 | + qDebug() << "Uploader for file" << file->name() << "was closed"; |
55 | + } |
56 | + catch (std::exception const& e) |
57 | + { |
58 | + qDebug() << "ERROR: StorageFrameworkClient::onUploaderClosed():" << e.what(); |
59 | + } |
60 | + |
61 | uploader_->socket()->disconnectFromServer(); |
62 | uploader_.reset(); |
63 | Q_EMIT(finished()); |
64 | } |
65 | |
66 | +void StorageFrameworkClient::accountsReady() |
67 | +{ |
68 | + // Get the acccounts. (There is only one account for the client implementation.) |
69 | + try { |
70 | + auto accounts = accounts_watcher_.result(); |
71 | + |
72 | + if (accounts.empty()) |
73 | + { |
74 | + throw std::runtime_error("No accounts returned from Storage Framework"); |
75 | + } |
76 | + |
77 | + roots_watcher_.setFuture(accounts[0]->roots()); |
78 | + } |
79 | + catch (std::exception & e) |
80 | + { |
81 | + qDebug() << "ERROR: StorageFrameworkClient::accountsReady():" << e.what(); |
82 | + throw; |
83 | + } |
84 | +} |
85 | + |
86 | +void StorageFrameworkClient::rootsReady() |
87 | +{ |
88 | + try { |
89 | + Root::SPtr root = roots_watcher_.result()[0]; |
90 | + |
91 | + qDebug() << "id:" << root->native_identity(); |
92 | + qDebug() << "time:" << root->last_modified_time(); |
93 | + |
94 | + // XGM ADD A new file to the root |
95 | + QFutureWatcher<std::shared_ptr<Uploader>> new_file_watcher; |
96 | + |
97 | + // get the current date and time to create the new file |
98 | + QDateTime now = QDateTime::currentDateTime(); |
99 | + QString new_file_name = QString("Backup_%1").arg(now.toString("dd.MM.yyyy-hh.mm.ss.zzz")); |
100 | + |
101 | + uploader_ready_watcher_.setFuture(root->create_file(new_file_name, accounts_watcher_.property("n_bytes").toUInt())); |
102 | + } |
103 | + catch (std::exception & e) |
104 | + { |
105 | + qDebug() << "ERROR: StorageFrameworkClient::rootsReady():" << e.what(); |
106 | + throw; |
107 | + } |
108 | +} |
109 | + |
110 | void StorageFrameworkClient::uploaderReady() |
111 | { |
112 | - uploader_ = uploader_ready_watcher_.result(); |
113 | + try |
114 | + { |
115 | + uploader_ = uploader_ready_watcher_.result(); |
116 | + } |
117 | + catch (std::exception const& e) |
118 | + { |
119 | + qDebug() << "ERROR: StorageFrameworkClient::uploaderReady():" << e.what(); |
120 | + } |
121 | |
122 | Q_EMIT (socketReady(uploader_->socket())); |
123 | } |
124 | |
125 | === modified file 'src/storage-framework/storage_framework_client.h' |
126 | --- src/storage-framework/storage_framework_client.h 2016-08-18 02:06:58 +0000 |
127 | +++ src/storage-framework/storage_framework_client.h 2016-08-24 07:04:48 +0000 |
128 | @@ -45,6 +45,8 @@ |
129 | private Q_SLOTS: |
130 | void uploaderReady(); |
131 | void onUploaderClosed(); |
132 | + void accountsReady(); |
133 | + void rootsReady(); |
134 | |
135 | private: |
136 | unity::storage::qt::client::Runtime::SPtr runtime_; |
137 | @@ -52,5 +54,7 @@ |
138 | // watchers |
139 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::Uploader>> uploader_ready_watcher_; |
140 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::File>> uploader_closed_watcher_; |
141 | + QFutureWatcher<QVector<std::shared_ptr<unity::storage::qt::client::Account>>> accounts_watcher_; |
142 | + QFutureWatcher<QVector<std::shared_ptr<unity::storage::qt::client::Root>>> roots_watcher_; |
143 | std::shared_ptr<unity::storage::qt::client::Uploader> uploader_; |
144 | }; |
FAILED: Continuous integration, rev:103 /jenkins. canonical. com/unity- api-1/job/ lp-keeper- ci/5/ /jenkins. canonical. com/unity- api-1/job/ build/403/ console /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/409/ console
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-keeper- ci/5/rebuild
https:/