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 | 32 | , uploader_() | 32 | , uploader_() |
6 | 33 | { | 33 | { |
7 | 34 | QObject::connect(&uploader_ready_watcher_,&QFutureWatcher<std::shared_ptr<Uploader>>::finished, this, &StorageFrameworkClient::uploaderReady); | 34 | QObject::connect(&uploader_ready_watcher_,&QFutureWatcher<std::shared_ptr<Uploader>>::finished, this, &StorageFrameworkClient::uploaderReady); |
9 | 35 | QObject::connect(&uploader_closed_watcher_,&QFutureWatcher<std::shared_ptr<unity::storage::qt::client::File>>::finished, this, &StorageFrameworkClient::onUploaderClosed); | 35 | QObject::connect(&uploader_closed_watcher_,&QFutureWatcher<std::shared_ptr<File>>::finished, this, &StorageFrameworkClient::onUploaderClosed); |
10 | 36 | QObject::connect(&accounts_watcher_,&QFutureWatcher<QVector<std::shared_ptr<Account>>>::finished, this, &StorageFrameworkClient::accountsReady); | ||
11 | 37 | QObject::connect(&roots_watcher_,&QFutureWatcher<QVector<std::shared_ptr<Root>>>::finished, this, &StorageFrameworkClient::rootsReady); | ||
12 | 36 | } | 38 | } |
13 | 37 | 39 | ||
14 | 38 | |||
15 | 39 | void StorageFrameworkClient::getNewFileForBackup(quint64 n_bytes) | 40 | void StorageFrameworkClient::getNewFileForBackup(quint64 n_bytes) |
16 | 40 | { | 41 | { |
40 | 41 | // Get the acccounts. (There is only one account for the local client implementation.) | 42 | accounts_watcher_.setProperty("n_bytes", n_bytes); |
41 | 42 | // We do this synchronously for simplicity. | 43 | accounts_watcher_.setFuture(runtime_->accounts()); |
19 | 43 | try { | ||
20 | 44 | auto accounts = runtime_->accounts().result(); | ||
21 | 45 | Root::SPtr root = accounts[0]->roots().result()[0]; | ||
22 | 46 | qDebug() << "id:" << root->native_identity(); | ||
23 | 47 | qDebug() << "time:" << root->last_modified_time(); | ||
24 | 48 | |||
25 | 49 | |||
26 | 50 | // XGM ADD A new file to the root | ||
27 | 51 | QFutureWatcher<std::shared_ptr<Uploader>> new_file_watcher; | ||
28 | 52 | |||
29 | 53 | // get the current date and time to create the new file | ||
30 | 54 | QDateTime now = QDateTime::currentDateTime(); | ||
31 | 55 | QString new_file_name = QString("Backup_%1").arg(now.toString("dd.MM.yyyy-hh:mm:ss.zzz")); | ||
32 | 56 | |||
33 | 57 | uploader_ready_watcher_.setFuture(root->create_file(new_file_name, n_bytes)); | ||
34 | 58 | } | ||
35 | 59 | catch (std::exception & e) | ||
36 | 60 | { | ||
37 | 61 | qDebug() << "ERROR: StorageFrameworkClient::getNewFileForBackup():" << e.what(); | ||
38 | 62 | throw; | ||
39 | 63 | } | ||
42 | 64 | } | 44 | } |
43 | 65 | 45 | ||
44 | 66 | void StorageFrameworkClient::finish(bool do_commit) | 46 | void StorageFrameworkClient::finish(bool do_commit) |
45 | @@ -85,16 +65,75 @@ | |||
46 | 85 | 65 | ||
47 | 86 | void StorageFrameworkClient::onUploaderClosed() | 66 | void StorageFrameworkClient::onUploaderClosed() |
48 | 87 | { | 67 | { |
51 | 88 | auto file = uploader_closed_watcher_.result(); | 68 | try |
52 | 89 | qDebug() << "Uploader for file" << file->name() << "was closed"; | 69 | { |
53 | 70 | auto file = uploader_closed_watcher_.result(); | ||
54 | 71 | qDebug() << "Uploader for file" << file->name() << "was closed"; | ||
55 | 72 | } | ||
56 | 73 | catch (std::exception const& e) | ||
57 | 74 | { | ||
58 | 75 | qDebug() << "ERROR: StorageFrameworkClient::onUploaderClosed():" << e.what(); | ||
59 | 76 | } | ||
60 | 77 | |||
61 | 90 | uploader_->socket()->disconnectFromServer(); | 78 | uploader_->socket()->disconnectFromServer(); |
62 | 91 | uploader_.reset(); | 79 | uploader_.reset(); |
63 | 92 | Q_EMIT(finished()); | 80 | Q_EMIT(finished()); |
64 | 93 | } | 81 | } |
65 | 94 | 82 | ||
66 | 83 | void StorageFrameworkClient::accountsReady() | ||
67 | 84 | { | ||
68 | 85 | // Get the acccounts. (There is only one account for the client implementation.) | ||
69 | 86 | try { | ||
70 | 87 | auto accounts = accounts_watcher_.result(); | ||
71 | 88 | |||
72 | 89 | if (accounts.empty()) | ||
73 | 90 | { | ||
74 | 91 | throw std::runtime_error("No accounts returned from Storage Framework"); | ||
75 | 92 | } | ||
76 | 93 | |||
77 | 94 | roots_watcher_.setFuture(accounts[0]->roots()); | ||
78 | 95 | } | ||
79 | 96 | catch (std::exception & e) | ||
80 | 97 | { | ||
81 | 98 | qDebug() << "ERROR: StorageFrameworkClient::accountsReady():" << e.what(); | ||
82 | 99 | throw; | ||
83 | 100 | } | ||
84 | 101 | } | ||
85 | 102 | |||
86 | 103 | void StorageFrameworkClient::rootsReady() | ||
87 | 104 | { | ||
88 | 105 | try { | ||
89 | 106 | Root::SPtr root = roots_watcher_.result()[0]; | ||
90 | 107 | |||
91 | 108 | qDebug() << "id:" << root->native_identity(); | ||
92 | 109 | qDebug() << "time:" << root->last_modified_time(); | ||
93 | 110 | |||
94 | 111 | // XGM ADD A new file to the root | ||
95 | 112 | QFutureWatcher<std::shared_ptr<Uploader>> new_file_watcher; | ||
96 | 113 | |||
97 | 114 | // get the current date and time to create the new file | ||
98 | 115 | QDateTime now = QDateTime::currentDateTime(); | ||
99 | 116 | QString new_file_name = QString("Backup_%1").arg(now.toString("dd.MM.yyyy-hh.mm.ss.zzz")); | ||
100 | 117 | |||
101 | 118 | uploader_ready_watcher_.setFuture(root->create_file(new_file_name, accounts_watcher_.property("n_bytes").toUInt())); | ||
102 | 119 | } | ||
103 | 120 | catch (std::exception & e) | ||
104 | 121 | { | ||
105 | 122 | qDebug() << "ERROR: StorageFrameworkClient::rootsReady():" << e.what(); | ||
106 | 123 | throw; | ||
107 | 124 | } | ||
108 | 125 | } | ||
109 | 126 | |||
110 | 95 | void StorageFrameworkClient::uploaderReady() | 127 | void StorageFrameworkClient::uploaderReady() |
111 | 96 | { | 128 | { |
113 | 97 | uploader_ = uploader_ready_watcher_.result(); | 129 | try |
114 | 130 | { | ||
115 | 131 | uploader_ = uploader_ready_watcher_.result(); | ||
116 | 132 | } | ||
117 | 133 | catch (std::exception const& e) | ||
118 | 134 | { | ||
119 | 135 | qDebug() << "ERROR: StorageFrameworkClient::uploaderReady():" << e.what(); | ||
120 | 136 | } | ||
121 | 98 | 137 | ||
122 | 99 | Q_EMIT (socketReady(uploader_->socket())); | 138 | Q_EMIT (socketReady(uploader_->socket())); |
123 | 100 | } | 139 | } |
124 | 101 | 140 | ||
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 | 45 | private Q_SLOTS: | 45 | private Q_SLOTS: |
130 | 46 | void uploaderReady(); | 46 | void uploaderReady(); |
131 | 47 | void onUploaderClosed(); | 47 | void onUploaderClosed(); |
132 | 48 | void accountsReady(); | ||
133 | 49 | void rootsReady(); | ||
134 | 48 | 50 | ||
135 | 49 | private: | 51 | private: |
136 | 50 | unity::storage::qt::client::Runtime::SPtr runtime_; | 52 | unity::storage::qt::client::Runtime::SPtr runtime_; |
137 | @@ -52,5 +54,7 @@ | |||
138 | 52 | // watchers | 54 | // watchers |
139 | 53 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::Uploader>> uploader_ready_watcher_; | 55 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::Uploader>> uploader_ready_watcher_; |
140 | 54 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::File>> uploader_closed_watcher_; | 56 | QFutureWatcher<std::shared_ptr<unity::storage::qt::client::File>> uploader_closed_watcher_; |
141 | 57 | QFutureWatcher<QVector<std::shared_ptr<unity::storage::qt::client::Account>>> accounts_watcher_; | ||
142 | 58 | QFutureWatcher<QVector<std::shared_ptr<unity::storage::qt::client::Root>>> roots_watcher_; | ||
143 | 55 | std::shared_ptr<unity::storage::qt::client::Uploader> uploader_; | 59 | std::shared_ptr<unity::storage::qt::client::Uploader> uploader_; |
144 | 56 | }; | 60 | }; |
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:/