]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/refcount/cls_refcount_ops.h
946c11aa30bb18ac8987c4f1b99b7f6652e31dcb
[ceph.git] / ceph / src / cls / refcount / cls_refcount_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_REFCOUNT_OPS_H
5 #define CEPH_CLS_REFCOUNT_OPS_H
6
7 #include "include/types.h"
8 #include "common/hobject.h"
9
10 struct cls_refcount_get_op {
11 string tag;
12 bool implicit_ref;
13
14 cls_refcount_get_op() : implicit_ref(false) {}
15
16 void encode(bufferlist& bl) const {
17 ENCODE_START(1, 1, bl);
18 encode(tag, bl);
19 encode(implicit_ref, bl);
20 ENCODE_FINISH(bl);
21 }
22
23 void decode(bufferlist::const_iterator& bl) {
24 DECODE_START(1, bl);
25 decode(tag, bl);
26 decode(implicit_ref, bl);
27 DECODE_FINISH(bl);
28 }
29 void dump(ceph::Formatter *f) const;
30 static void generate_test_instances(list<cls_refcount_get_op*>& ls);
31 };
32 WRITE_CLASS_ENCODER(cls_refcount_get_op)
33
34 struct cls_refcount_put_op {
35 string tag;
36 bool implicit_ref; // assume wildcard reference for
37 // objects without a set ref
38
39 cls_refcount_put_op() : implicit_ref(false) {}
40
41 void encode(bufferlist& bl) const {
42 ENCODE_START(1, 1, bl);
43 encode(tag, bl);
44 encode(implicit_ref, bl);
45 ENCODE_FINISH(bl);
46 }
47
48 void decode(bufferlist::const_iterator& bl) {
49 DECODE_START(1, bl);
50 decode(tag, bl);
51 decode(implicit_ref, bl);
52 DECODE_FINISH(bl);
53 }
54
55 void dump(ceph::Formatter *f) const;
56 static void generate_test_instances(list<cls_refcount_put_op*>& ls);
57 };
58 WRITE_CLASS_ENCODER(cls_refcount_put_op)
59
60 struct cls_refcount_set_op {
61 list<string> refs;
62
63 cls_refcount_set_op() {}
64
65 void encode(bufferlist& bl) const {
66 ENCODE_START(1, 1, bl);
67 encode(refs, bl);
68 ENCODE_FINISH(bl);
69 }
70
71 void decode(bufferlist::const_iterator& bl) {
72 DECODE_START(1, bl);
73 decode(refs, bl);
74 DECODE_FINISH(bl);
75 }
76
77 void dump(ceph::Formatter *f) const;
78 static void generate_test_instances(list<cls_refcount_set_op*>& ls);
79 };
80 WRITE_CLASS_ENCODER(cls_refcount_set_op)
81
82 struct cls_refcount_read_op {
83 bool implicit_ref; // assume wildcard reference for
84 // objects without a set ref
85
86 cls_refcount_read_op() : implicit_ref(false) {}
87
88 void encode(bufferlist& bl) const {
89 ENCODE_START(1, 1, bl);
90 encode(implicit_ref, bl);
91 ENCODE_FINISH(bl);
92 }
93
94 void decode(bufferlist::const_iterator& bl) {
95 DECODE_START(1, bl);
96 decode(implicit_ref, bl);
97 DECODE_FINISH(bl);
98 }
99
100 void dump(ceph::Formatter *f) const;
101 static void generate_test_instances(list<cls_refcount_read_op*>& ls);
102 };
103 WRITE_CLASS_ENCODER(cls_refcount_read_op)
104
105 struct cls_refcount_read_ret {
106 list<string> refs;
107
108 cls_refcount_read_ret() {}
109
110 void encode(bufferlist& bl) const {
111 ENCODE_START(1, 1, bl);
112 encode(refs, bl);
113 ENCODE_FINISH(bl);
114 }
115
116 void decode(bufferlist::const_iterator& bl) {
117 DECODE_START(1, bl);
118 decode(refs, bl);
119 DECODE_FINISH(bl);
120 }
121
122 void dump(ceph::Formatter *f) const;
123 static void generate_test_instances(list<cls_refcount_read_ret*>& ls);
124 };
125 WRITE_CLASS_ENCODER(cls_refcount_read_ret)
126
127 struct obj_refcount {
128 map<string, bool> refs;
129 set<string> retired_refs;
130
131 obj_refcount() {}
132
133 void encode(bufferlist& bl) const {
134 ENCODE_START(2, 1, bl);
135 encode(refs, bl);
136 encode(retired_refs, bl);
137 ENCODE_FINISH(bl);
138 }
139
140 void decode(bufferlist::const_iterator& bl) {
141 DECODE_START(2, bl);
142 decode(refs, bl);
143 if (struct_v >= 2) {
144 decode(retired_refs, bl);
145 }
146 DECODE_FINISH(bl);
147 }
148
149 void dump(ceph::Formatter *f) const;
150 static void generate_test_instances(list<obj_refcount*>& ls);
151 };
152 WRITE_CLASS_ENCODER(obj_refcount)
153
154 #endif