Merge lp:~michihenning/storage-framework/parent-ids into lp:storage-framework/devel

Proposed by Michi Henning
Status: Merged
Approved by: Michi Henning
Approved revision: 91
Merged at revision: 51
Proposed branch: lp:~michihenning/storage-framework/parent-ids
Merge into: lp:storage-framework/devel
Prerequisite: lp:~michihenning/storage-framework/marshal-metadata
Diff against target: 474 lines (+77/-54)
10 files modified
data/provider.xml (+12/-9)
demo/provider_test/provider-test.cpp (+10/-10)
include/unity/storage/internal/ItemMetadata.h (+2/-1)
include/unity/storage/provider/ProviderBase.h (+1/-1)
src/internal/dbusmarshal.cpp (+2/-2)
src/provider/internal/dbusmarshal.cpp (+16/-7)
src/qt/client/internal/remote_client/ItemImpl.cpp (+1/-1)
src/qt/client/internal/remote_client/validate.cpp (+14/-4)
tests/provider-ProviderInterface/ProviderInterface_test.cpp (+7/-7)
tests/provider-ProviderInterface/TestProvider.cpp (+12/-12)
To merge this branch: bzr merge lp:~michihenning/storage-framework/parent-ids
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Approve
James Henstridge Approve
Review via email: mp+302376@code.launchpad.net

Commit message

Changed single parent_id to vector<parent_id>.

Description of the change

Changed single parent_id to vector<parent_id>.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:87
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/57/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/326/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/332
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/259
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/259
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/259
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/188/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/188/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

This looks good, except for the dict entry problem in the type signatures I've noted below.

review: Needs Fixing
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:89
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/64/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/351
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/357
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/278
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/278
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/278
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/208/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/208
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/208/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve
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:90
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/72/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/363
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/369
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/287
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/287
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/287
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/217
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/217/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Autolanding.
Merging failed. More details in the following jenkins job:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-autoland/21/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/365
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/371
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/289
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/289
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/289
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/219/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/219
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/219/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
91. By Michi Henning

Merged devel and resolved conflict.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/provider.xml'
2--- data/provider.xml 2016-07-11 07:17:04 +0000
3+++ data/provider.xml 2016-08-11 12:22:58 +0000
4@@ -5,14 +5,17 @@
5 com.canonical.StorageFramework.Provider:
6 @short_description: Interface providing access to a storage account
7
8- For methods dealing with metadata, the representation
9- "(ssssia{sv})" is used, where the struct members are:
10+ For methods returning metadata, the representation
11+ "(sasssia{sv})" is used, where the struct members are:
12 - item_id
13- - parent_id
14+ - parent_ids
15 - name
16 - etag
17 - type (enum: file, folder, root)
18 - metadata
19+
20+ Note that parent_ids is a sequence of IDs instead of a single ID to allow the client to
21+ navigate items in Google Drive, which permits more than one parent for a file or folder.
22 -->
23 <interface name="com.canonical.StorageFramework.Provider">
24 <!--
25@@ -25,7 +28,7 @@
26 of files, this list will contain a single item.
27 -->
28 <method name="Roots">
29- <arg type="a(ssssia{sv})" name="roots" direction="out"/>
30+ <arg type="a(sasssia{sv})" name="roots" direction="out"/>
31 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;unity::storage::internal::ItemMetadata&gt;"/>
32 </method>
33
34@@ -45,7 +48,7 @@
35 <method name="List">
36 <arg type="s" name="item_id" direction="in"/>
37 <arg type="s" name="page_token" direction="in"/>
38- <arg type="a(ssssia{sv})" name="children" direction="out"/>
39+ <arg type="a(sasssia{sv})" name="children" direction="out"/>
40 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;unity::storage::internal::ItemMetadata&gt;"/>
41 <arg type="s" name="next_token" direction="out"/>
42 </method>
43@@ -60,7 +63,7 @@
44 <method name="Lookup">
45 <arg type="s" name="parent_id" direction="in"/>
46 <arg type="s" name="name" direction="in"/>
47- <arg type="a(ssssia{sv})" name="items" direction="out"/>
48+ <arg type="a(sasssia{sv})" name="items" direction="out"/>
49 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;unity::storage::internal::ItemMetadata&gt;"/>
50 </method>
51
52@@ -72,7 +75,7 @@
53 -->
54 <method name="Metadata">
55 <arg type="s" name="item_id" direction="in"/>
56- <arg type="(ssssia{sv})" name="metadata" direction="out"/>
57+ <arg type="(sasssia{sv})" name="metadata" direction="out"/>
58 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="unity::storage::internal::ItemMetadata"/>
59 </method>
60
61@@ -86,7 +89,7 @@
62 <method name="CreateFolder">
63 <arg type="s" name="parent_id" direction="in"/>
64 <arg type="s" name="name" direction="in"/>
65- <arg type="(ssssia{sv})" name="metadata" direction="out"/>
66+ <arg type="(sasssia{sv})" name="metadata" direction="out"/>
67 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="unity::storage::internal::ItemMetadata"/>
68 </method>
69
70@@ -160,7 +163,7 @@
71 -->
72 <method name="FinishUpload">
73 <arg type="s" name="upload_id" direction="in"/>
74- <arg type="(ssssia{sv})" name="metadata" direction="out"/>
75+ <arg type="(sasssia{sv})" name="metadata" direction="out"/>
76 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="unity::storage::internal::ItemMetadata"/>
77 </method>
78
79
80=== modified file 'demo/provider_test/provider-test.cpp'
81--- demo/provider_test/provider-test.cpp 2016-08-11 04:07:55 +0000
82+++ demo/provider_test/provider-test.cpp 2016-08-11 12:22:58 +0000
83@@ -141,7 +141,7 @@
84 {
85 printf("roots() called by %s (%d)\n", ctx.security_label.c_str(), ctx.pid);
86 ItemList roots = {
87- {"root_id", "", "Root", "etag", ItemType::root, {}},
88+ {"root_id", {}, "Root", "etag", ItemType::root, {}},
89 };
90 return make_ready_future<ItemList>(roots);
91 }
92@@ -162,7 +162,7 @@
93 ItemList children =
94 {
95 {
96- "child_id", "root_id", "Child", "etag", ItemType::file,
97+ "child_id", { "root_id" }, "Child", "etag", ItemType::file,
98 { { SIZE_IN_BYTES, 0 }, { LAST_MODIFIED_TIME, "2007-04-05T14:30Z" } }
99 }
100 };
101@@ -181,7 +181,7 @@
102 }
103 ItemList children =
104 {
105- { "child_id", "root_id", "Child", "etag", ItemType::file,
106+ { "child_id", { "root_id" }, "Child", "etag", ItemType::file,
107 { { SIZE_IN_BYTES, 0 }, { LAST_MODIFIED_TIME, "2007-04-05T14:30Z" } } }
108 };
109 return make_ready_future<ItemList>(children);
110@@ -193,21 +193,21 @@
111 printf("metadata('%s') called by %s (%d)\n", item_id.c_str(), ctx.security_label.c_str(), ctx.pid);
112 if (item_id == "root_id")
113 {
114- Item metadata{"root_id", "", "Root", "etag", ItemType::root, {}};
115+ Item metadata{"root_id", {}, "Root", "etag", ItemType::root, {}};
116 return make_ready_future<Item>(metadata);
117 }
118 else if (item_id == "child_id")
119 {
120 Item metadata
121 {
122- "child_id", "root_id", "Child", "etag", ItemType::file,
123+ "child_id", { "root_id" }, "Child", "etag", ItemType::file,
124 { { SIZE_IN_BYTES, 0 }, { LAST_MODIFIED_TIME, "2007-04-05T14:30Z" } }
125 };
126 return make_ready_future<Item>(metadata);
127 }
128 else if (item_id == "child_folder_id")
129 {
130- Item metadata{"child_folder_id", "root_id", "Child_Folder", "etag", ItemType::folder, {}};
131+ Item metadata{"child_folder_id", { "root_id" }, "Child_Folder", "etag", ItemType::folder, {}};
132 return make_ready_future<Item>(metadata);
133 }
134 return make_exceptional_future<Item>(NotExistsException("metadata(): no such item: " + item_id, item_id));
135@@ -218,7 +218,7 @@
136 Context const& ctx)
137 {
138 printf("create_folder('%s', '%s') called by %s (%d)\n", parent_id.c_str(), name.c_str(), ctx.security_label.c_str(), ctx.pid);
139- Item metadata{"new_folder_id", parent_id, name, "etag", ItemType::folder, {}};
140+ Item metadata{"new_folder_id", { parent_id }, name, "etag", ItemType::folder, {}};
141 return make_ready_future<Item>(metadata);
142 }
143
144@@ -273,7 +273,7 @@
145 string const& new_name, Context const& ctx)
146 {
147 printf("move('%s', '%s', '%s') called by %s (%d)\n", item_id.c_str(), new_parent_id.c_str(), new_name.c_str(), ctx.security_label.c_str(), ctx.pid);
148- Item metadata{item_id, new_parent_id, new_name, "etag", ItemType::file, {}};
149+ Item metadata{item_id, { new_parent_id }, new_name, "etag", ItemType::file, {}};
150 return make_ready_future(metadata);
151 }
152
153@@ -282,7 +282,7 @@
154 string const& new_name, Context const& ctx)
155 {
156 printf("copy('%s', '%s', '%s') called by %s (%d)\n", item_id.c_str(), new_parent_id.c_str(), new_name.c_str(), ctx.security_label.c_str(), ctx.pid);
157- Item metadata{"new_item_id", new_parent_id, new_name, "etag", ItemType::file, {}};
158+ Item metadata{"new_item_id", { new_parent_id }, new_name, "etag", ItemType::file, {}};
159 return make_ready_future(metadata);
160 }
161
162@@ -304,7 +304,7 @@
163
164 Item metadata
165 {
166- "some_id", "root_id", "some_upload", "etag", ItemType::file,
167+ "some_id", { "root_id" }, "some_upload", "etag", ItemType::file,
168 { { SIZE_IN_BYTES, 10 }, { LAST_MODIFIED_TIME, "2011-04-05T14:30:10.005Z" } }
169 };
170 return make_ready_future(metadata);
171
172=== modified file 'include/unity/storage/internal/ItemMetadata.h'
173--- include/unity/storage/internal/ItemMetadata.h 2016-08-03 03:55:20 +0000
174+++ include/unity/storage/internal/ItemMetadata.h 2016-08-11 12:22:58 +0000
175@@ -25,6 +25,7 @@
176 #pragma GCC diagnostic ignored "-Wswitch-default"
177 #include <QMap>
178 #include <QVariant>
179+#include <QVector>
180 #pragma GCC diagnostic pop
181
182 namespace unity
183@@ -37,7 +38,7 @@
184 struct ItemMetadata
185 {
186 QString item_id;
187- QString parent_id;
188+ QVector<QString> parent_ids;
189 QString name;
190 QString etag;
191 ItemType type;
192
193=== modified file 'include/unity/storage/provider/ProviderBase.h'
194--- include/unity/storage/provider/ProviderBase.h 2016-08-09 02:25:13 +0000
195+++ include/unity/storage/provider/ProviderBase.h 2016-08-11 12:22:58 +0000
196@@ -56,7 +56,7 @@
197 struct UNITY_STORAGE_EXPORT Item
198 {
199 std::string item_id;
200- std::string parent_id;
201+ std::vector<std::string> parent_ids;
202 std::string name;
203 std::string etag;
204 unity::storage::ItemType type;
205
206=== modified file 'src/internal/dbusmarshal.cpp'
207--- src/internal/dbusmarshal.cpp 2016-08-11 06:53:25 +0000
208+++ src/internal/dbusmarshal.cpp 2016-08-11 12:22:58 +0000
209@@ -34,7 +34,7 @@
210 {
211 argument.beginStructure();
212 argument << metadata.item_id;
213- argument << metadata.parent_id;
214+ argument << metadata.parent_ids;
215 argument << metadata.name;
216 argument << metadata.etag;
217 argument << static_cast<int32_t>(metadata.type);
218@@ -56,7 +56,7 @@
219 {
220 argument.beginStructure();
221 argument >> metadata.item_id;
222- argument >> metadata.parent_id;
223+ argument >> metadata.parent_ids;
224 argument >> metadata.name;
225 argument >> metadata.etag;
226 int32_t enum_val;
227
228=== modified file 'src/provider/internal/dbusmarshal.cpp'
229--- src/provider/internal/dbusmarshal.cpp 2016-08-09 02:25:13 +0000
230+++ src/provider/internal/dbusmarshal.cpp 2016-08-11 12:22:58 +0000
231@@ -53,18 +53,27 @@
232 {
233 argument.beginStructure();
234 argument << QString::fromStdString(item.item_id);
235- argument << QString::fromStdString(item.parent_id);
236+ {
237+ argument.beginArray(qMetaTypeId<QString>());
238+ for (auto const& id : item.parent_ids)
239+ {
240+ argument << QString::fromStdString(id);
241+ }
242+ argument.endArray();
243+ }
244 argument << QString::fromStdString(item.name);
245 argument << QString::fromStdString(item.etag);
246 argument << static_cast<int32_t>(item.type);
247- argument.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
248- for (auto const& pair : item.metadata)
249 {
250- argument.beginMapEntry();
251- argument << QString::fromStdString(pair.first) << to_qdbus_variant(pair.second);
252- argument.endMapEntry();
253+ argument.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
254+ for (auto const& pair : item.metadata)
255+ {
256+ argument.beginMapEntry();
257+ argument << QString::fromStdString(pair.first) << to_qdbus_variant(pair.second);
258+ argument.endMapEntry();
259+ }
260+ argument.endMap();
261 }
262- argument.endMap();
263 argument.endStructure();
264 return argument;
265 }
266
267=== modified file 'src/qt/client/internal/remote_client/ItemImpl.cpp'
268--- src/qt/client/internal/remote_client/ItemImpl.cpp 2016-08-09 02:25:13 +0000
269+++ src/qt/client/internal/remote_client/ItemImpl.cpp 2016-08-11 12:22:58 +0000
270@@ -209,7 +209,7 @@
271 {
272 throw_if_destroyed("Item::parent_ids()");
273 // TODO, need different metadata representation, affects xml
274- return QVector<QString>();
275+ return md_.parent_ids;
276 }
277
278 QFuture<void> ItemImpl::delete_item()
279
280=== modified file 'src/qt/client/internal/remote_client/validate.cpp'
281--- src/qt/client/internal/remote_client/validate.cpp 2016-08-11 04:07:55 +0000
282+++ src/qt/client/internal/remote_client/validate.cpp 2016-08-11 12:22:58 +0000
283@@ -103,13 +103,23 @@
284 {
285 throw LocalCommsException(prefix + "item_id cannot be empty");
286 }
287- if (md.parent_id.isEmpty() && md.type != ItemType::root)
288+ if (md.type != ItemType::root)
289 {
290- throw LocalCommsException(prefix + "parent_id of file or folder cannot be empty");
291+ if (md.parent_ids.isEmpty())
292+ {
293+ throw LocalCommsException(prefix + "file or folder must have at least one parent ID");
294+ }
295+ for (int i = 0; i < md.parent_ids.size(); ++i)
296+ {
297+ if (md.parent_ids.at(i).isEmpty())
298+ {
299+ throw LocalCommsException(prefix + "parent_id of file or folder cannot be empty");
300+ }
301+ }
302 }
303- if (!md.parent_id.isEmpty() && md.type == ItemType::root)
304+ if (md.type == ItemType::root && !md.parent_ids.isEmpty())
305 {
306- throw LocalCommsException(prefix + "metadata: parent_id of root cannot be non-empty");
307+ throw LocalCommsException(prefix + "metadata: parent_ids of root must be empty");
308 }
309 if (md.name.isEmpty())
310 {
311
312=== modified file 'tests/provider-ProviderInterface/ProviderInterface_test.cpp'
313--- tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-08-11 06:18:17 +0000
314+++ tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-08-11 12:22:58 +0000
315@@ -125,7 +125,7 @@
316 EXPECT_EQ(1, reply.value().size());
317 auto root = reply.value()[0];
318 EXPECT_EQ("root_id", root.item_id);
319- EXPECT_EQ("", root.parent_id);
320+ EXPECT_EQ(QVector<QString>(), root.parent_ids);
321 EXPECT_EQ("Root", root.name);
322 EXPECT_EQ("etag", root.etag);
323 EXPECT_EQ(ItemType::root, root.type);
324@@ -180,7 +180,7 @@
325 ASSERT_EQ(1, items.size());
326 auto item = items[0];
327 EXPECT_EQ("child_id", item.item_id);
328- EXPECT_EQ("root_id", item.parent_id);
329+ EXPECT_EQ(QVector<QString>{ "root_id"}, item.parent_ids);
330 EXPECT_EQ("Filename", item.name);
331 EXPECT_EQ(ItemType::file, item.type);
332 }
333@@ -194,7 +194,7 @@
334 ASSERT_TRUE(reply.isValid());
335 auto item = reply.value();
336 EXPECT_EQ("root_id", item.item_id);
337- EXPECT_EQ("", item.parent_id);
338+ EXPECT_EQ(QVector<QString>(), item.parent_ids);
339 EXPECT_EQ("Root", item.name);
340 EXPECT_EQ(ItemType::root, item.type);
341 }
342@@ -208,7 +208,7 @@
343 ASSERT_TRUE(reply.isValid());
344 auto item = reply.value();
345 EXPECT_EQ("new_folder_id", item.item_id);
346- EXPECT_EQ("root_id", item.parent_id);
347+ EXPECT_EQ(QVector<QString>{ "root_id" }, item.parent_ids);
348 EXPECT_EQ("New Folder", item.name);
349 EXPECT_EQ(ItemType::folder, item.type);
350 }
351@@ -257,7 +257,7 @@
352 ASSERT_TRUE(reply.isValid()) << reply.error().message().toStdString();
353 auto item = reply.value();
354 EXPECT_EQ("new_file_id", item.item_id);
355- EXPECT_EQ("parent_id", item.parent_id);
356+ EXPECT_EQ(QVector<QString>{ "parent_id" }, item.parent_ids);
357 EXPECT_EQ("file name", item.name);
358 }
359
360@@ -493,7 +493,7 @@
361 ASSERT_TRUE(reply.isValid());
362 auto item = reply.value();
363 EXPECT_EQ("child_id", item.item_id);
364- EXPECT_EQ("new_parent_id", item.parent_id);
365+ EXPECT_EQ(QVector<QString>{ "new_parent_id" }, item.parent_ids);
366 EXPECT_EQ("New name", item.name);
367 EXPECT_EQ(ItemType::file, item.type);
368 }
369@@ -507,7 +507,7 @@
370 ASSERT_TRUE(reply.isValid());
371 auto item = reply.value();
372 EXPECT_EQ("new_id", item.item_id);
373- EXPECT_EQ("new_parent_id", item.parent_id);
374+ EXPECT_EQ(QVector<QString>{ "new_parent_id" }, item.parent_ids);
375 EXPECT_EQ("New name", item.name);
376 EXPECT_EQ(ItemType::file, item.type);
377 }
378
379=== modified file 'tests/provider-ProviderInterface/TestProvider.cpp'
380--- tests/provider-ProviderInterface/TestProvider.cpp 2016-08-11 01:36:26 +0000
381+++ tests/provider-ProviderInterface/TestProvider.cpp 2016-08-11 12:22:58 +0000
382@@ -184,7 +184,7 @@
383 Q_UNUSED(ctx);
384
385 ItemList roots = {
386- {"root_id", "", "Root", "etag", ItemType::root, {}},
387+ {"root_id", {}, "Root", "etag", ItemType::root, {}},
388 };
389 boost::promise<ItemList> p;
390 p.set_value(roots);
391@@ -205,16 +205,16 @@
392 else if (page_token == "")
393 {
394 ItemList children = {
395- {"child1_id", "root_id", "Child 1", "etag", ItemType::file, {}},
396- {"child2_id", "root_id", "Child 2", "etag", ItemType::file, {}},
397+ {"child1_id", { "root_id" }, "Child 1", "etag", ItemType::file, {}},
398+ {"child2_id", { "root_id" }, "Child 2", "etag", ItemType::file, {}},
399 };
400 p.set_value(make_tuple(children, "page_token"));
401 }
402 else if (page_token == "page_token")
403 {
404 ItemList children = {
405- {"child3_id", "root_id", "Child 4", "etag", ItemType::file, {}},
406- {"child4_id", "root_id", "Child 3", "etag", ItemType::file, {}},
407+ {"child3_id", { "root_id" }, "Child 4", "etag", ItemType::file, {}},
408+ {"child4_id", { "root_id" }, "Child 3", "etag", ItemType::file, {}},
409 };
410 p.set_value(make_tuple(children, ""));
411 }
412@@ -232,7 +232,7 @@
413
414 boost::promise<ItemList> p;
415 ItemList items = {
416- {"child_id", parent_id, name, "etag", ItemType::file, {}},
417+ {"child_id", { parent_id }, name, "etag", ItemType::file, {}},
418 };
419 p.set_value(items);
420 return p.get_future();
421@@ -246,7 +246,7 @@
422 boost::promise<Item> p;
423 if (item_id == "root_id")
424 {
425- Item item = {"root_id", "", "Root", "etag", ItemType::root, {}};
426+ Item item = {"root_id", {}, "Root", "etag", ItemType::root, {}};
427 p.set_value(item);
428 }
429 else
430@@ -262,7 +262,7 @@
431 Q_UNUSED(ctx);
432
433 boost::promise<Item> p;
434- Item item = {"new_folder_id", parent_id, name, "etag", ItemType::folder, {}};
435+ Item item = {"new_folder_id", { parent_id }, name, "etag", ItemType::folder, {}};
436 p.set_value(item);
437 return p.get_future();
438 }
439@@ -277,7 +277,7 @@
440 Q_UNUSED(ctx);
441
442 boost::promise<unique_ptr<UploadJob>> p;
443- Item item = {"new_file_id", parent_id, name, "etag", ItemType::file, {}};
444+ Item item = {"new_file_id", { parent_id }, name, "etag", ItemType::file, {}};
445 p.set_value(unique_ptr<UploadJob>(new TestUploadJob("upload_id", item, size)));
446 return p.get_future();
447 }
448@@ -291,7 +291,7 @@
449 Q_UNUSED(ctx);
450
451 boost::promise<unique_ptr<UploadJob>> p;
452- Item item = {"item_id", "parent_id", "file name", "etag", ItemType::file, {}};
453+ Item item = {"item_id", { "parent_id" }, "file name", "etag", ItemType::file, {}};
454 p.set_value(unique_ptr<UploadJob>(new TestUploadJob("upload_id", item, size)));
455 return p.get_future();
456 }
457@@ -332,7 +332,7 @@
458 Q_UNUSED(ctx);
459
460 boost::promise<Item> p;
461- Item item = {item_id, new_parent_id, new_name, "etag", ItemType::file, {}};
462+ Item item = {item_id, { new_parent_id }, new_name, "etag", ItemType::file, {}};
463 p.set_value(item);
464 return p.get_future();
465 }
466@@ -345,7 +345,7 @@
467 Q_UNUSED(ctx);
468
469 boost::promise<Item> p;
470- Item item = {"new_id", new_parent_id, new_name, "etag", ItemType::file, {}};
471+ Item item = {"new_id", { new_parent_id }, new_name, "etag", ItemType::file, {}};
472 p.set_value(item);
473 return p.get_future();
474 }

Subscribers

People subscribed via source and target branches

to all changes: