diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-04-12 10:15:06 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-04-12 10:15:06 -0700 |
commit | 48bb23d60c55b14cc080d6234cbad0233d4da2b2 (patch) | |
tree | a5d4e092909b5686ed392c7ceb55c08274b31cb2 | |
parent | 25dd49cb0c14740c41e2a9810cf7f734218c70bc (diff) | |
download | ceph-48bb23d60c55b14cc080d6234cbad0233d4da2b2.tar.gz |
radosgw-admin: bilog list gets marker and max-entries params
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_admin.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 53f311ef223..9e8a40956f5 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -910,6 +910,8 @@ int main(int argc, char **argv) string infile; string metadata_key; RGWObjVersionTracker objv_tracker; + string marker; + int max_entries = -1; std::string val; std::ostringstream errs; @@ -965,6 +967,8 @@ int main(int argc, char **argv) } } else if (ceph_argparse_witharg(args, i, &val, "--max-buckets", (char*)NULL)) { max_buckets = atoi(val.c_str()); + } else if (ceph_argparse_witharg(args, i, &val, "--max-entries", (char*)NULL)) { + max_entries = atoi(val.c_str()); } else if (ceph_argparse_witharg(args, i, &val, "--date", "--time", (char*)NULL)) { date = val; if (end_date.empty()) @@ -1013,6 +1017,8 @@ int main(int argc, char **argv) infile = val; } else if (ceph_argparse_witharg(args, i, &val, "--metadata-key", (char*)NULL)) { metadata_key = val; + } else if (ceph_argparse_witharg(args, i, &val, "--marker", (char*)NULL)) { + marker = val; } else { ++i; } @@ -2088,7 +2094,6 @@ next: store->cls_obj_set_bucket_tag_timeout(bucket, BUCKET_TAG_TIMEOUT); string prefix; - string marker; bool is_truncated = true; while (is_truncated) { @@ -2152,7 +2157,6 @@ next: if (opt_cmd == OPT_GC_LIST) { int ret; int index = 0; - string marker; bool truncated; formatter->open_array_section("entries"); @@ -2307,23 +2311,30 @@ next: } if (opt_cmd == OPT_BILOG_LIST) { - string marker; formatter->open_array_section("entries"); bool truncated; + int count = 0; + if (max_entries < 0) + max_entries = 1000; + do { list<rgw_bi_log_entry> entries; - int ret = store->list_bi_log_entries(bucket, marker, 1000, entries, &truncated); + int ret = store->list_bi_log_entries(bucket, marker, max_entries - count, entries, &truncated); if (ret < 0) { cerr << "ERROR: list_bi_log_entries(): " << cpp_strerror(-ret) << std::endl; return -ret; } + count += entries.size(); + for (list<rgw_bi_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) { rgw_bi_log_entry& entry = *iter; encode_json("entry", entry, formatter); + + marker = entry.id; } formatter->flush(cout); - } while (truncated); + } while (truncated && count < max_entries); formatter->close_section(); formatter->flush(cout); |