summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-04-16 17:44:46 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-04-16 17:44:46 -0700
commitf255038f3c56995746fad39f1a13abcd8460a2ce (patch)
tree0ea356a6cae0b9d703804c6821b4e2c52ab5535e
parentdc6d6c3da68e46a358dc09ce26e2ae4616d472fc (diff)
downloadceph-f255038f3c56995746fad39f1a13abcd8460a2ce.tar.gz
rgw-admin: bucket list also specifies object namespace
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_admin.cc4
-rw-r--r--src/rgw/rgw_bucket.cc7
-rw-r--r--src/rgw/rgw_common.h1
-rw-r--r--src/rgw/rgw_json_enc.cc1
-rw-r--r--src/rgw/rgw_op.cc6
-rw-r--r--src/rgw/rgw_rados.cc8
-rw-r--r--src/rgw/rgw_rados.h2
7 files changed, 18 insertions, 11 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index e49dfe97729..a90200ae970 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -1185,8 +1185,8 @@ int main(int argc, char **argv)
do {
list<rgw_bi_log_entry> entries;
ret = store->list_objects(bucket, max_entries - count, prefix, delim,
- marker, result, common_prefixes, true, ns,
- &truncated, NULL);
+ marker, result, common_prefixes, true,
+ ns, false, &truncated, NULL);
if (ret < 0) {
cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
return -ret;
diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc
index aa4ead07426..03cefaff132 100644
--- a/src/rgw/rgw_bucket.cc
+++ b/src/rgw/rgw_bucket.cc
@@ -343,7 +343,7 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
if (delete_children) {
ret = store->list_objects(bucket, max, prefix, delim, marker,
objs, common_prefixes,
- false, ns, (bool *)false, NULL);
+ false, ns, true, NULL, NULL);
if (ret < 0)
return ret;
@@ -358,7 +358,7 @@ int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
objs.clear();
ret = store->list_objects(bucket, max, prefix, delim, marker, objs, common_prefixes,
- false, ns, (bool *)false, NULL);
+ false, ns, true, NULL, NULL);
if (ret < 0)
return ret;
}
@@ -606,7 +606,8 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state,
do {
vector<RGWObjEnt> result;
int r = store->list_objects(bucket, max, prefix, delim, marker,
- result, common_prefixes, false, ns,
+ result, common_prefixes, false,
+ ns, true,
&is_truncated, NULL);
if (r < 0) {
diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h
index 9ecda6a9fae..aead4598061 100644
--- a/src/rgw/rgw_common.h
+++ b/src/rgw/rgw_common.h
@@ -657,6 +657,7 @@ struct req_state {
/** Store basic data on an object */
struct RGWObjEnt {
std::string name;
+ std::string ns;
std::string owner;
std::string owner_display_name;
uint64_t size;
diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc
index b376be991b3..895ef0a7eea 100644
--- a/src/rgw/rgw_json_enc.cc
+++ b/src/rgw/rgw_json_enc.cc
@@ -400,6 +400,7 @@ void RGWBucketInfo::dump(Formatter *f) const
void RGWObjEnt::dump(Formatter *f) const
{
encode_json("name", name, f);
+ encode_json("namespace", ns, f);
encode_json("owner", owner, f);
encode_json("owner_display_name", owner_display_name, f);
encode_json("size", size, f);
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index ed140b8f5b3..faaf652f478 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -430,7 +430,7 @@ int RGWGetObj::iterate_user_manifest_parts(rgw_bucket& bucket, string& obj_prefi
#define MAX_LIST_OBJS 100
int r = store->list_objects(bucket, MAX_LIST_OBJS, obj_prefix, delim, marker,
objs, common_prefixes,
- true, no_ns, &is_truncated, NULL);
+ true, no_ns, true, &is_truncated, NULL);
if (r < 0)
return r;
@@ -770,7 +770,7 @@ void RGWListBucket::execute()
return;
ret = store->list_objects(s->bucket, max, prefix, delimiter, marker, objs, common_prefixes,
- !!(s->prot_flags & RGW_REST_SWIFT), no_ns, &is_truncated, NULL);
+ !!(s->prot_flags & RGW_REST_SWIFT), no_ns, true, &is_truncated, NULL);
}
int RGWGetBucketLogging::verify_permission()
@@ -2395,7 +2395,7 @@ void RGWListBucketMultiparts::execute()
}
marker_meta = marker.get_meta();
ret = store->list_objects(s->bucket, max_uploads, prefix, delimiter, marker_meta, objs, common_prefixes,
- !!(s->prot_flags & RGW_REST_SWIFT), mp_ns, &is_truncated, &mp_filter);
+ !!(s->prot_flags & RGW_REST_SWIFT), mp_ns, true, &is_truncated, &mp_filter);
if (!objs.empty()) {
vector<RGWObjEnt>::iterator iter;
RGWMultipartUploadEntry entry;
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 2d7c9956ed4..e03ae816009 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -1151,7 +1151,8 @@ int RGWRados::decode_policy(bufferlist& bl, ACLOwner *owner)
*/
int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string& delim,
string& marker, vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
- bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter)
+ bool get_content_type, string& ns, bool enforce_ns,
+ bool *is_truncated, RGWAccessListFilter *filter)
{
int count = 0;
bool truncated;
@@ -1178,7 +1179,9 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
string obj = eiter->first;
string key = obj;
- if (!rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns)) {
+ bool check_ns = rgw_obj::translate_raw_obj_to_obj_in_ns(obj, ns);
+
+ if (enforce_ns && !check_ns) {
if (!ns.empty()) {
/* we've iterated past the namespace we're searching -- done now */
truncated = false;
@@ -1206,6 +1209,7 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
RGWObjEnt ent = eiter->second;
ent.name = obj;
+ ent.ns = ns;
result.push_back(ent);
count++;
}
diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h
index b12e58a2901..e81fbe28d3a 100644
--- a/src/rgw/rgw_rados.h
+++ b/src/rgw/rgw_rados.h
@@ -650,7 +650,7 @@ public:
*/
virtual int list_objects(rgw_bucket& bucket, int max, std::string& prefix, std::string& delim,
std::string& marker, std::vector<RGWObjEnt>& result, map<string, bool>& common_prefixes,
- bool get_content_type, string& ns, bool *is_truncated, RGWAccessListFilter *filter);
+ bool get_content_type, string& ns, bool enforce_ns, bool *is_truncated, RGWAccessListFilter *filter);
virtual int create_pool(rgw_bucket& bucket);