Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / cls / user / cls_user_ops.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_CLS_USER_OPS_H
5 #define CEPH_CLS_USER_OPS_H
6
7 #include "cls_user_types.h"
8
9 struct cls_user_set_buckets_op {
10   list<cls_user_bucket_entry> entries;
11   bool add;
12   real_time time; /* op time */
13
14   cls_user_set_buckets_op() : add(false) {}
15
16   void encode(bufferlist& bl) const {
17     ENCODE_START(1, 1, bl);
18     ::encode(entries, bl);
19     ::encode(add, bl);
20     ::encode(time, bl);
21     ENCODE_FINISH(bl);
22   }
23
24   void decode(bufferlist::iterator& bl) {
25     DECODE_START(1, bl);
26     ::decode(entries, bl);
27     ::decode(add, bl);
28     ::decode(time, bl);
29     DECODE_FINISH(bl);
30   }
31
32   void dump(Formatter *f) const;
33   static void generate_test_instances(list<cls_user_set_buckets_op*>& ls);
34 };
35 WRITE_CLASS_ENCODER(cls_user_set_buckets_op)
36
37 struct cls_user_remove_bucket_op {
38   cls_user_bucket bucket;
39
40   cls_user_remove_bucket_op() {}
41
42   void encode(bufferlist& bl) const {
43     ENCODE_START(1, 1, bl);
44     ::encode(bucket, bl);
45     ENCODE_FINISH(bl);
46   }
47
48   void decode(bufferlist::iterator& bl) {
49     DECODE_START(1, bl);
50     ::decode(bucket, bl);
51     DECODE_FINISH(bl);
52   }
53
54   void dump(Formatter *f) const;
55   static void generate_test_instances(list<cls_user_remove_bucket_op*>& ls);
56 };
57 WRITE_CLASS_ENCODER(cls_user_remove_bucket_op)
58
59 struct cls_user_list_buckets_op {
60   string marker;
61   string end_marker;
62   int max_entries; /* upperbound to returned num of entries
63                       might return less than that and still be truncated */
64
65   cls_user_list_buckets_op()
66     : max_entries(0) {}
67
68   void encode(bufferlist& bl) const {
69     ENCODE_START(2, 1, bl);
70     ::encode(marker, bl);
71     ::encode(max_entries, bl);
72     ::encode(end_marker, bl);
73     ENCODE_FINISH(bl);
74   }
75
76   void decode(bufferlist::iterator& bl) {
77     DECODE_START(2, bl);
78     ::decode(marker, bl);
79     ::decode(max_entries, bl);
80     if (struct_v >= 2) {
81       ::decode(end_marker, bl);
82     }
83     DECODE_FINISH(bl);
84   }
85
86   void dump(Formatter *f) const;
87   static void generate_test_instances(list<cls_user_list_buckets_op*>& ls);
88 };
89 WRITE_CLASS_ENCODER(cls_user_list_buckets_op)
90
91 struct cls_user_list_buckets_ret {
92   list<cls_user_bucket_entry> entries;
93   string marker;
94   bool truncated;
95
96   cls_user_list_buckets_ret() : truncated(false) {}
97
98   void encode(bufferlist& bl) const {
99     ENCODE_START(1, 1, bl);
100     ::encode(entries, bl);
101     ::encode(marker, bl);
102     ::encode(truncated, bl);
103     ENCODE_FINISH(bl);
104   }
105
106   void decode(bufferlist::iterator& bl) {
107     DECODE_START(1, bl);
108     ::decode(entries, bl);
109     ::decode(marker, bl);
110     ::decode(truncated, bl);
111     DECODE_FINISH(bl);
112   }
113
114   void dump(Formatter *f) const;
115   static void generate_test_instances(list<cls_user_list_buckets_ret*>& ls);
116 };
117 WRITE_CLASS_ENCODER(cls_user_list_buckets_ret)
118
119
120 struct cls_user_get_header_op {
121   cls_user_get_header_op() {}
122
123   void encode(bufferlist& bl) const {
124     ENCODE_START(1, 1, bl);
125     ENCODE_FINISH(bl);
126   }
127
128   void decode(bufferlist::iterator& bl) {
129     DECODE_START(1, bl);
130     DECODE_FINISH(bl);
131   }
132
133   void dump(Formatter *f) const;
134   static void generate_test_instances(list<cls_user_get_header_op*>& ls);
135 };
136 WRITE_CLASS_ENCODER(cls_user_get_header_op)
137
138 struct cls_user_get_header_ret {
139   cls_user_header header;
140
141   cls_user_get_header_ret() {}
142
143   void encode(bufferlist& bl) const {
144     ENCODE_START(1, 1, bl);
145     ::encode(header, bl);
146     ENCODE_FINISH(bl);
147   }
148
149   void decode(bufferlist::iterator& bl) {
150     DECODE_START(1, bl);
151     ::decode(header, bl);
152     DECODE_FINISH(bl);
153   }
154
155   void dump(Formatter *f) const;
156   static void generate_test_instances(list<cls_user_get_header_ret*>& ls);
157 };
158 WRITE_CLASS_ENCODER(cls_user_get_header_ret)
159
160 struct cls_user_complete_stats_sync_op {
161   real_time time;
162
163   cls_user_complete_stats_sync_op() {}
164
165   void encode(bufferlist& bl) const {
166     ENCODE_START(1, 1, bl);
167     ::encode(time, bl);
168     ENCODE_FINISH(bl);
169   }
170
171   void decode(bufferlist::iterator& bl) {
172     DECODE_START(1, bl);
173     ::decode(time, bl);
174     DECODE_FINISH(bl);
175   }
176
177   void dump(Formatter *f) const;
178   static void generate_test_instances(list<cls_user_complete_stats_sync_op*>& ls);
179 };
180 WRITE_CLASS_ENCODER(cls_user_complete_stats_sync_op)
181
182
183 #endif