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

Proposed by Marcus Tomlinson
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
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

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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

colon is not allowed in filename for mcloud

105. By Marcus Tomlinson

try..catch over uploader_closed_watcher_ and uploader_ready_watcher_ result() calls

Revision history for this message
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

Merged devel

Revision history for this message
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)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

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

Subscribers

People subscribed via source and target branches