]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
7c673cae FG |
16 | using ceph::bufferlist; |
17 | ||
18 | struct assert_size_args { | |
19 | uint64_t bound; //the size to compare to - should be k or 2k | |
20 | uint64_t comparator; //should be CEPH_OSD_CMPXATTR_OP_EQ, | |
21 | //CEPH_OSD_CMPXATTR_OP_LT, or | |
22 | //CEPH_OSD_CMPXATTR_OP_GT | |
23 | ||
24 | void encode(bufferlist &bl) const { | |
25 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
26 | encode(bound, bl); |
27 | encode(comparator, bl); | |
7c673cae FG |
28 | ENCODE_FINISH(bl); |
29 | } | |
11fdf7f2 | 30 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 31 | DECODE_START(1, p); |
11fdf7f2 TL |
32 | decode(bound, p); |
33 | decode(comparator, p); | |
7c673cae FG |
34 | DECODE_FINISH(p); |
35 | } | |
36 | }; | |
37 | WRITE_CLASS_ENCODER(assert_size_args) | |
38 | ||
39 | struct idata_from_key_args { | |
20effc67 | 40 | std::string key; |
7c673cae FG |
41 | index_data idata; |
42 | index_data next_idata; | |
43 | ||
44 | void encode(bufferlist &bl) const { | |
45 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
46 | encode(key, bl); |
47 | encode(idata, bl); | |
48 | encode(next_idata, bl); | |
7c673cae FG |
49 | ENCODE_FINISH(bl); |
50 | } | |
11fdf7f2 | 51 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 52 | DECODE_START(1, p); |
11fdf7f2 TL |
53 | decode(key, p); |
54 | decode(idata, p); | |
55 | decode(next_idata, p); | |
7c673cae FG |
56 | DECODE_FINISH(p); |
57 | } | |
58 | }; | |
59 | WRITE_CLASS_ENCODER(idata_from_key_args) | |
60 | ||
61 | struct idata_from_idata_args { | |
62 | index_data idata; | |
63 | index_data next_idata; | |
64 | ||
65 | void encode(bufferlist &bl) const { | |
66 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
67 | encode(idata, bl); |
68 | encode(next_idata, bl); | |
7c673cae FG |
69 | ENCODE_FINISH(bl); |
70 | } | |
11fdf7f2 | 71 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 72 | DECODE_START(1, p); |
11fdf7f2 TL |
73 | decode(idata, p); |
74 | decode(next_idata, p); | |
7c673cae FG |
75 | DECODE_FINISH(p); |
76 | } | |
77 | }; | |
78 | WRITE_CLASS_ENCODER(idata_from_idata_args) | |
79 | ||
80 | struct omap_set_args { | |
20effc67 | 81 | std::map<std::string, bufferlist> omap; |
7c673cae FG |
82 | uint64_t bound; |
83 | bool exclusive; | |
84 | ||
85 | void encode(bufferlist &bl) const { | |
86 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
87 | encode(omap, bl); |
88 | encode(bound, bl); | |
89 | encode(exclusive, bl); | |
7c673cae FG |
90 | ENCODE_FINISH(bl); |
91 | } | |
11fdf7f2 | 92 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 93 | DECODE_START(1, p); |
11fdf7f2 TL |
94 | decode(omap, p); |
95 | decode(bound, p); | |
96 | decode(exclusive, p); | |
7c673cae FG |
97 | DECODE_FINISH(p); |
98 | } | |
99 | }; | |
100 | WRITE_CLASS_ENCODER(omap_set_args) | |
101 | ||
102 | struct omap_rm_args { | |
20effc67 | 103 | std::set<std::string> omap; |
7c673cae FG |
104 | uint64_t bound; |
105 | ||
106 | void encode(bufferlist &bl) const { | |
107 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
108 | encode(omap, bl); |
109 | encode(bound, bl); | |
7c673cae FG |
110 | ENCODE_FINISH(bl); |
111 | } | |
11fdf7f2 | 112 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 113 | DECODE_START(1, p); |
11fdf7f2 TL |
114 | decode(omap, p); |
115 | decode(bound, p); | |
7c673cae FG |
116 | DECODE_FINISH(p); |
117 | } | |
118 | }; | |
119 | WRITE_CLASS_ENCODER(omap_rm_args) | |
120 | ||
121 | struct rebalance_args { | |
122 | object_data odata; | |
123 | uint64_t bound; | |
124 | uint64_t comparator; | |
125 | ||
126 | void encode(bufferlist &bl) const { | |
127 | ENCODE_START(1,1,bl); | |
11fdf7f2 TL |
128 | encode(odata, bl); |
129 | encode(bound, bl); | |
130 | encode(comparator, bl); | |
7c673cae FG |
131 | ENCODE_FINISH(bl); |
132 | } | |
11fdf7f2 | 133 | void decode(bufferlist::const_iterator &p) { |
7c673cae | 134 | DECODE_START(1, p); |
11fdf7f2 TL |
135 | decode(odata,p); |
136 | decode(bound, p); | |
137 | decode(comparator, p); | |
7c673cae FG |
138 | DECODE_FINISH(p); |
139 | } | |
140 | }; | |
141 | WRITE_CLASS_ENCODER(rebalance_args) | |
142 | ||
143 | ||
144 | #endif /* CLS_KVS_H_ */ |