2 * Ceph - scalable distributed file system
4 * This is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License version 2.1, as published by the Free Software
7 * Foundation. See file COPYING.
11 #include "cls_replica_log_ops.h"
12 #include "common/Formatter.h"
13 #include "common/ceph_json.h"
15 void cls_replica_log_delete_marker_op::dump(Formatter
*f
) const
17 f
->dump_string("entity_id", entity_id
);
20 void cls_replica_log_delete_marker_op::
21 generate_test_instances(std::list
<cls_replica_log_delete_marker_op
*>& ls
)
23 ls
.push_back(new cls_replica_log_delete_marker_op
);
24 ls
.push_back(new cls_replica_log_delete_marker_op
);
25 ls
.back()->entity_id
= "test_entity_1";
28 void cls_replica_log_set_marker_op::dump(Formatter
*f
) const
30 encode_json("marker", marker
, f
);
33 void cls_replica_log_set_marker_op::
34 generate_test_instances(std::list
<cls_replica_log_set_marker_op
*>& ls
)
36 std::list
<cls_replica_log_progress_marker
*> samples
;
37 cls_replica_log_progress_marker::generate_test_instances(samples
);
38 std::list
<cls_replica_log_progress_marker
*>::iterator i
;
39 for (i
= samples
.begin(); i
!= samples
.end(); ++i
) {
40 ls
.push_back(new cls_replica_log_set_marker_op(*(*i
)));
44 void cls_replica_log_get_bounds_op::dump(Formatter
*f
) const
46 f
->dump_string("contents", "empty");
49 void cls_replica_log_get_bounds_op::
50 generate_test_instances(std::list
<cls_replica_log_get_bounds_op
*>& ls
)
52 ls
.push_back(new cls_replica_log_get_bounds_op
);
55 void cls_replica_log_get_bounds_ret::dump(Formatter
*f
) const
57 f
->dump_string("position_marker", position_marker
);
58 oldest_time
.gmtime(f
->dump_stream("oldest_time"));
59 encode_json("entity_markers", markers
, f
);
62 void cls_replica_log_get_bounds_ret::
63 generate_test_instances(std::list
<cls_replica_log_get_bounds_ret
*>& ls
)
65 std::list
<cls_replica_log_progress_marker
*> samples
;
66 cls_replica_log_progress_marker::generate_test_instances(samples
);
67 std::list
<cls_replica_log_progress_marker
> samples_whole
;
68 std::list
<cls_replica_log_progress_marker
*>::iterator i
;
70 for (i
= samples
.begin(); i
!= samples
.end(); ++i
) {
71 ls
.push_back(new cls_replica_log_get_bounds_ret());
72 ls
.back()->markers
.push_back(*(*i
));
73 ls
.back()->oldest_time
.set_from_double(1000*count
);
74 ls
.back()->position_marker
= ls
.back()->markers
.front().position_marker
;
75 samples_whole
.push_back(*(*i
));
77 ls
.push_back(new cls_replica_log_get_bounds_ret());
78 ls
.back()->markers
= samples_whole
;
79 ls
.back()->oldest_time
= samples_whole
.back().position_time
;
80 ls
.back()->position_marker
= samples_whole
.back().position_marker
;