diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/cls/user/cls_user_ops.cc | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cls/user/cls_user_ops.cc')
-rw-r--r-- | src/cls/user/cls_user_ops.cc | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/cls/user/cls_user_ops.cc b/src/cls/user/cls_user_ops.cc new file mode 100644 index 000000000..5ae9d2c93 --- /dev/null +++ b/src/cls/user/cls_user_ops.cc @@ -0,0 +1,118 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "cls/user/cls_user_ops.h" +#include "common/Formatter.h" +#include "common/ceph_json.h" + +using std::list; + +using ceph::Formatter; + +void cls_user_set_buckets_op::dump(Formatter *f) const +{ + encode_json("entries", entries, f); + encode_json("add", add, f); + encode_json("time", utime_t(time), f); +} + +void cls_user_set_buckets_op::generate_test_instances(list<cls_user_set_buckets_op*>& ls) +{ + ls.push_back(new cls_user_set_buckets_op); + cls_user_set_buckets_op *op = new cls_user_set_buckets_op; + for (int i = 0; i < 3; i++) { + cls_user_bucket_entry e; + cls_user_gen_test_bucket_entry(&e, i); + op->entries.push_back(e); + } + op->add = true; + op->time = utime_t(1, 0).to_real_time(); + ls.push_back(op); +} + +void cls_user_remove_bucket_op::dump(Formatter *f) const +{ + encode_json("bucket", bucket, f); +} + +void cls_user_remove_bucket_op::generate_test_instances(list<cls_user_remove_bucket_op*>& ls) +{ + ls.push_back(new cls_user_remove_bucket_op); + cls_user_remove_bucket_op *op = new cls_user_remove_bucket_op; + cls_user_gen_test_bucket(&op->bucket, 0); + ls.push_back(op); +} + +void cls_user_list_buckets_op::dump(Formatter *f) const +{ + encode_json("marker", marker, f); + encode_json("max_entries", max_entries, f); +} + +void cls_user_list_buckets_op::generate_test_instances(list<cls_user_list_buckets_op*>& ls) +{ + ls.push_back(new cls_user_list_buckets_op); + cls_user_list_buckets_op *op = new cls_user_list_buckets_op; + op->marker = "marker"; + op->max_entries = 1000; + ls.push_back(op); +} + +void cls_user_list_buckets_ret::dump(Formatter *f) const +{ + encode_json("entries", entries, f); + encode_json("marker", marker, f); + encode_json("truncated", truncated, f); +} + +void cls_user_list_buckets_ret::generate_test_instances(list<cls_user_list_buckets_ret*>& ls) +{ + ls.push_back(new cls_user_list_buckets_ret); + cls_user_list_buckets_ret *ret = new cls_user_list_buckets_ret; + for (int i = 0; i < 3; i++) { + cls_user_bucket_entry e; + cls_user_gen_test_bucket_entry(&e, i); + ret->entries.push_back(e); + } + ret->marker = "123"; + ret->truncated = true; + ls.push_back(ret); +} + +void cls_user_get_header_op::dump(Formatter *f) const +{ + // empty! +} + +void cls_user_get_header_op::generate_test_instances(list<cls_user_get_header_op*>& ls) +{ + ls.push_back(new cls_user_get_header_op); +} + +void cls_user_get_header_ret::dump(Formatter *f) const +{ + encode_json("header", header, f); +} + +void cls_user_get_header_ret::generate_test_instances(list<cls_user_get_header_ret*>& ls) +{ + ls.push_back(new cls_user_get_header_ret); + cls_user_get_header_ret *ret = new cls_user_get_header_ret; + cls_user_gen_test_header(&ret->header); + ls.push_back(ret); +} + +void cls_user_complete_stats_sync_op::dump(Formatter *f) const +{ + encode_json("time", utime_t(time), f); +} + +void cls_user_complete_stats_sync_op::generate_test_instances(list<cls_user_complete_stats_sync_op*>& ls) +{ + ls.push_back(new cls_user_complete_stats_sync_op); + cls_user_complete_stats_sync_op *op = new cls_user_complete_stats_sync_op; + op->time = utime_t(12345, 0).to_real_time(); + ls.push_back(op); +} + + |