Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / key_value_store / kvs_arg_types.h
1 /*
2  * Argument types used by cls_kvs.cc
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: eleanor
6  */
7
8 #ifndef CLS_KVS_H_
9 #define CLS_KVS_H_
10
11 #define EBALANCE 137
12
13 #include "include/encoding.h"
14 #include "key_value_store/kv_flat_btree_async.h"
15
16 using namespace std;
17 using ceph::bufferlist;
18
19 struct assert_size_args {
20   uint64_t bound; //the size to compare to - should be k or 2k
21   uint64_t comparator; //should be CEPH_OSD_CMPXATTR_OP_EQ,
22                   //CEPH_OSD_CMPXATTR_OP_LT, or
23                   //CEPH_OSD_CMPXATTR_OP_GT
24
25   void encode(bufferlist &bl) const {
26     ENCODE_START(1,1,bl);
27     ::encode(bound, bl);
28     ::encode(comparator, bl);
29     ENCODE_FINISH(bl);
30   }
31   void decode(bufferlist::iterator &p) {
32     DECODE_START(1, p);
33     ::decode(bound, p);
34     ::decode(comparator, p);
35     DECODE_FINISH(p);
36   }
37 };
38 WRITE_CLASS_ENCODER(assert_size_args)
39
40 struct idata_from_key_args {
41   string key;
42   index_data idata;
43   index_data next_idata;
44
45   void encode(bufferlist &bl) const {
46     ENCODE_START(1,1,bl);
47     ::encode(key, bl);
48     ::encode(idata, bl);
49     ::encode(next_idata, bl);
50     ENCODE_FINISH(bl);
51   }
52   void decode(bufferlist::iterator &p) {
53     DECODE_START(1, p);
54     ::decode(key, p);
55     ::decode(idata, p);
56     ::decode(next_idata, p);
57     DECODE_FINISH(p);
58   }
59 };
60 WRITE_CLASS_ENCODER(idata_from_key_args)
61
62 struct idata_from_idata_args {
63   index_data idata;
64   index_data next_idata;
65
66   void encode(bufferlist &bl) const {
67     ENCODE_START(1,1,bl);
68     ::encode(idata, bl);
69     ::encode(next_idata, bl);
70     ENCODE_FINISH(bl);
71   }
72   void decode(bufferlist::iterator &p) {
73     DECODE_START(1, p);
74     ::decode(idata, p);
75     ::decode(next_idata, p);
76     DECODE_FINISH(p);
77   }
78 };
79 WRITE_CLASS_ENCODER(idata_from_idata_args)
80
81 struct omap_set_args {
82   map<string, bufferlist> omap;
83   uint64_t bound;
84   bool exclusive;
85
86   void encode(bufferlist &bl) const {
87     ENCODE_START(1,1,bl);
88     ::encode(omap, bl);
89     ::encode(bound, bl);
90     ::encode(exclusive, bl);
91     ENCODE_FINISH(bl);
92   }
93   void decode(bufferlist::iterator &p) {
94     DECODE_START(1, p);
95     ::decode(omap, p);
96     ::decode(bound, p);
97     ::decode(exclusive, p);
98     DECODE_FINISH(p);
99   }
100 };
101 WRITE_CLASS_ENCODER(omap_set_args)
102
103 struct omap_rm_args {
104   std::set<string> omap;
105   uint64_t bound;
106
107   void encode(bufferlist &bl) const {
108     ENCODE_START(1,1,bl);
109     ::encode(omap, bl);
110     ::encode(bound, bl);
111     ENCODE_FINISH(bl);
112   }
113   void decode(bufferlist::iterator &p) {
114     DECODE_START(1, p);
115     ::decode(omap, p);
116     ::decode(bound, p);
117     DECODE_FINISH(p);
118   }
119 };
120 WRITE_CLASS_ENCODER(omap_rm_args)
121
122 struct rebalance_args {
123   object_data odata;
124   uint64_t bound;
125   uint64_t comparator;
126
127   void encode(bufferlist &bl) const {
128     ENCODE_START(1,1,bl);
129     ::encode(odata, bl);
130     ::encode(bound, bl);
131     ::encode(comparator, bl);
132     ENCODE_FINISH(bl);
133   }
134   void decode(bufferlist::iterator &p) {
135     DECODE_START(1, p);
136     ::decode(odata,p);
137     ::decode(bound, p);
138     ::decode(comparator, p);
139     DECODE_FINISH(p);
140   }
141 };
142 WRITE_CLASS_ENCODER(rebalance_args)
143
144
145 #endif /* CLS_KVS_H_ */