Merge lp:~marcustomlinson/keeper/link-against-real-storage-framework into lp:keeper/devel

Proposed by Marcus Tomlinson on 2016-08-18
Status: Merged
Approved by: Charles Kerr on 2016-08-29
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
Reviewer Review Type Date Requested Status
Charles Kerr (community) 2016-08-18 Approve on 2016-08-29
unity-api-1-bot continuous-integration Needs Fixing on 2016-08-24
Review via email: mp+303250@code.launchpad.net

Commit message

The branch links keeper-service against the non-local version of storage-framework

To post a comment you must log in.
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:103
https://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/8/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/406
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/412
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/320
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/320
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/320
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/250/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/250
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/250/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/8/rebuild

review: Approve (continuous-integration)
104. By Marcus Tomlinson on 2016-08-24

colon is not allowed in filename for mcloud

105. By Marcus Tomlinson on 2016-08-24

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://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/27/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/463/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/469
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/374
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/374
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/374
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/304/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/304/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/304/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/304/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/304/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/304/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/304/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/304
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/304/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/304/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/27/rebuild

review: Needs Fixing (continuous-integration)
106. By Marcus Tomlinson on 2016-08-24

Merged devel

unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/28/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/464/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/470
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/375
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/375
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/375
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/305/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/305
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/305/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/305/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-keeper-ci/28/rebuild

review: Needs Fixing (continuous-integration)
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 };

Subscribers

People subscribed via source and target branches