Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / cls / replica_log / cls_replica_log_ops.h
1 /*
2  * Ceph - scalable distributed file system
3  *
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.
8  */
9
10 #ifndef CLS_REPLICA_LOG_OPS_H_
11 #define CLS_REPLICA_LOG_OPS_H_
12
13 #include "cls_replica_log_types.h"
14
15 struct cls_replica_log_delete_marker_op {
16   string entity_id;
17   cls_replica_log_delete_marker_op() {}
18   explicit cls_replica_log_delete_marker_op(const string& id) : entity_id(id) {}
19
20   void encode(bufferlist& bl) const {
21     ENCODE_START(1, 1, bl);
22     ::encode(entity_id, bl);
23     ENCODE_FINISH(bl);
24   }
25
26   void decode(bufferlist::iterator& bl) {
27     DECODE_START(1, bl);
28     ::decode(entity_id, bl);
29     DECODE_FINISH(bl);
30   }
31
32   void dump(Formatter *f) const;
33   static void generate_test_instances(std::list<cls_replica_log_delete_marker_op*>& ls);
34
35 };
36 WRITE_CLASS_ENCODER(cls_replica_log_delete_marker_op)
37
38 struct cls_replica_log_set_marker_op {
39   cls_replica_log_progress_marker marker;
40   cls_replica_log_set_marker_op() {}
41   explicit cls_replica_log_set_marker_op(const cls_replica_log_progress_marker& m) :
42     marker(m) {}
43
44   void encode(bufferlist& bl) const {
45     ENCODE_START(1, 1, bl);
46     ::encode(marker, bl);
47     ENCODE_FINISH(bl);
48   }
49
50   void decode(bufferlist::iterator& bl) {
51     DECODE_START(1, bl);
52     ::decode(marker, bl);
53     DECODE_FINISH(bl);
54   }
55
56   void dump(Formatter *f) const;
57   static void generate_test_instances(std::list<cls_replica_log_set_marker_op*>& ls);
58 };
59 WRITE_CLASS_ENCODER(cls_replica_log_set_marker_op)
60
61 struct cls_replica_log_get_bounds_op {
62   cls_replica_log_get_bounds_op() {}
63
64   void encode(bufferlist& bl) const {
65     ENCODE_START(1, 1, bl);
66     ENCODE_FINISH(bl);
67   }
68
69   void decode(bufferlist::iterator& bl) {
70     DECODE_START(1, bl);
71     DECODE_FINISH(bl);
72   }
73
74   void dump(Formatter *f) const;
75   static void generate_test_instances(std::list<cls_replica_log_get_bounds_op*>& ls);
76 };
77 WRITE_CLASS_ENCODER(cls_replica_log_get_bounds_op)
78
79 struct cls_replica_log_get_bounds_ret {
80   string position_marker; // oldest log listing position on the master
81   utime_t oldest_time; // oldest timestamp associated with position or an item
82   std::list<cls_replica_log_progress_marker> markers;
83
84   cls_replica_log_get_bounds_ret() {}
85   cls_replica_log_get_bounds_ret(const string& pos_marker,
86     const utime_t& time,
87     const std::list<cls_replica_log_progress_marker>& m) :
88     position_marker(pos_marker), oldest_time(time), markers(m)
89   {}
90   void encode(bufferlist& bl) const {
91     ENCODE_START(1, 1, bl);
92     ::encode(position_marker, bl);
93     ::encode(oldest_time, bl);
94     ::encode(markers, bl);
95     ENCODE_FINISH(bl);
96   }
97
98   void decode(bufferlist::iterator& bl) {
99     DECODE_START(1, bl);
100     ::decode(position_marker, bl);
101     ::decode(oldest_time, bl);
102     ::decode(markers, bl);
103     DECODE_FINISH(bl);
104   }
105
106   void dump(Formatter *f) const;
107   static void generate_test_instances(std::list<cls_replica_log_get_bounds_ret*>& ls);
108 };
109 WRITE_CLASS_ENCODER(cls_replica_log_get_bounds_ret)
110
111 #endif /* CLS_REPLICA_LOG_OPS_H_ */