summaryrefslogtreecommitdiff
path: root/src/key_value_store/kvs_arg_types.h
blob: 428415c07c9cc164187bb2e24808ff77b110d670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * Argument types used by cls_kvs.cc
 *
 *  Created on: Aug 10, 2012
 *      Author: eleanor
 */

#ifndef CLS_KVS_H_
#define CLS_KVS_H_

#define EBALANCE 137

#include "kv_flat_btree_async.h"

using namespace std;
using ceph::bufferlist;

struct assert_size_args {
  uint64_t bound; //the size to compare to - should be k or 2k
  uint64_t comparator; //should be CEPH_OSD_CMPXATTR_OP_EQ,
		  //CEPH_OSD_CMPXATTR_OP_LT, or
		  //CEPH_OSD_CMPXATTR_OP_GT

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(bound, bl);
    ::encode(comparator, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(bound, p);
    ::decode(comparator, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(assert_size_args)

struct idata_from_key_args {
  string key;
  index_data idata;
  index_data next_idata;

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(key, bl);
    ::encode(idata, bl);
    ::encode(next_idata, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(key, p);
    ::decode(idata, p);
    ::decode(next_idata, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(idata_from_key_args)

struct idata_from_idata_args {
  index_data idata;
  index_data next_idata;

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(idata, bl);
    ::encode(next_idata, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(idata, p);
    ::decode(next_idata, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(idata_from_idata_args)

struct omap_set_args {
  map<string, bufferlist> omap;
  uint64_t bound;
  bool exclusive;

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(omap, bl);
    ::encode(bound, bl);
    ::encode(exclusive, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(omap, p);
    ::decode(bound, p);
    ::decode(exclusive, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(omap_set_args)

struct omap_rm_args {
  std::set<string> omap;
  uint64_t bound;

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(omap, bl);
    ::encode(bound, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(omap, p);
    ::decode(bound, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(omap_rm_args)

struct rebalance_args {
  object_data odata;
  uint64_t bound;
  uint64_t comparator;

  void encode(bufferlist &bl) const {
    ENCODE_START(1,1,bl);
    ::encode(odata, bl);
    ::encode(bound, bl);
    ::encode(comparator, bl);
    ENCODE_FINISH(bl);
  }
  void decode(bufferlist::iterator &p) {
    DECODE_START(1, p);
    ::decode(odata,p);
    ::decode(bound, p);
    ::decode(comparator, p);
    DECODE_FINISH(p);
  }
};
WRITE_CLASS_ENCODER(rebalance_args)


#endif /* CLS_KVS_H_ */