RGWFormatterFlusher& flusher)
{
RGWBucket bucket;
- int ret = bucket.init(store, op_state);
- if (ret < 0)
- return ret;
+ int ret;
+
string bucket_name = op_state.get_bucket_name();
+ if (!bucket_name.empty()) {
+ ret = bucket.init(store, op_state);
+ if (ret < 0)
+ return ret;
+ }
+
Formatter *formatter = flusher.get_formatter();
flusher.start(0);
} else {
RGWAccessHandle handle;
- if (store->list_buckets_init(&handle) > 0) {
+ formatter->open_array_section("buckets");
+ if (store->list_buckets_init(&handle) >= 0) {
RGWObjEnt obj;
while (store->list_buckets_next(obj, &handle) >= 0) {
formatter->dump_string("bucket", obj.name);
bucket_stats(store, obj.name, formatter);
}
}
+
+ formatter->close_section();
}
flusher.flush();
obj.name = (*state)->first;
(*state)++;
- } while (obj.name[0] == '.');
-
- /* FIXME: should read mtime/size vals for bucket */
+ } while (obj.name[0] == '.'); /* skip all entries starting with '.' */
return 0;
}