X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fcls%2Freplica_log%2Fcls_replica_log_ops.cc;fp=src%2Fceph%2Fsrc%2Fcls%2Freplica_log%2Fcls_replica_log_ops.cc;h=7d653b64613d94728e3d10028bb07f970f180cdd;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/cls/replica_log/cls_replica_log_ops.cc b/src/ceph/src/cls/replica_log/cls_replica_log_ops.cc new file mode 100644 index 0000000..7d653b6 --- /dev/null +++ b/src/ceph/src/cls/replica_log/cls_replica_log_ops.cc @@ -0,0 +1,81 @@ +/* + * Ceph - scalable distributed file system + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include "cls_replica_log_ops.h" +#include "common/Formatter.h" +#include "common/ceph_json.h" + +void cls_replica_log_delete_marker_op::dump(Formatter *f) const +{ + f->dump_string("entity_id", entity_id); +} + +void cls_replica_log_delete_marker_op:: +generate_test_instances(std::list& ls) +{ + ls.push_back(new cls_replica_log_delete_marker_op); + ls.push_back(new cls_replica_log_delete_marker_op); + ls.back()->entity_id = "test_entity_1"; +} + +void cls_replica_log_set_marker_op::dump(Formatter *f) const +{ + encode_json("marker", marker, f); +} + +void cls_replica_log_set_marker_op:: +generate_test_instances(std::list& ls) +{ + std::list samples; + cls_replica_log_progress_marker::generate_test_instances(samples); + std::list::iterator i; + for (i = samples.begin(); i != samples.end(); ++i) { + ls.push_back(new cls_replica_log_set_marker_op(*(*i))); + } +} + +void cls_replica_log_get_bounds_op::dump(Formatter *f) const +{ + f->dump_string("contents", "empty"); +} + +void cls_replica_log_get_bounds_op:: +generate_test_instances(std::list& ls) +{ + ls.push_back(new cls_replica_log_get_bounds_op); +} + +void cls_replica_log_get_bounds_ret::dump(Formatter *f) const +{ + f->dump_string("position_marker", position_marker); + oldest_time.gmtime(f->dump_stream("oldest_time")); + encode_json("entity_markers", markers, f); +} + +void cls_replica_log_get_bounds_ret:: +generate_test_instances(std::list& ls) +{ + std::list samples; + cls_replica_log_progress_marker::generate_test_instances(samples); + std::list samples_whole; + std::list::iterator i; + int count = 0; + for (i = samples.begin(); i != samples.end(); ++i) { + ls.push_back(new cls_replica_log_get_bounds_ret()); + ls.back()->markers.push_back(*(*i)); + ls.back()->oldest_time.set_from_double(1000*count); + ls.back()->position_marker = ls.back()->markers.front().position_marker; + samples_whole.push_back(*(*i)); + } + ls.push_back(new cls_replica_log_get_bounds_ret()); + ls.back()->markers = samples_whole; + ls.back()->oldest_time = samples_whole.back().position_time; + ls.back()->position_marker = samples_whole.back().position_marker; +}