]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/cas/cls_cas_ops.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / cls / cas / cls_cas_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_CAS_OPS_H
5 #define CEPH_CLS_CAS_OPS_H
6
7 #include "include/types.h"
8 #include "common/hobject.h"
9
10 #define CHUNK_REFCOUNT_ATTR "chunk_refcount"
11
12 struct cls_chunk_refcount_get_op {
13 hobject_t source;
14
15 cls_chunk_refcount_get_op() {}
16
17 void encode(bufferlist& bl) const {
18 ENCODE_START(1, 1, bl);
19 encode(source, bl);
20 ENCODE_FINISH(bl);
21 }
22
23 void decode(bufferlist::const_iterator& bl) {
24 DECODE_START(1, bl);
25 decode(source, bl);
26 DECODE_FINISH(bl);
27 }
28 void dump(ceph::Formatter *f) const;
29 static void generate_test_instances(list<cls_chunk_refcount_get_op*>& ls);
30 };
31 WRITE_CLASS_ENCODER(cls_chunk_refcount_get_op)
32
33 struct cls_chunk_refcount_put_op {
34 hobject_t source;
35
36 cls_chunk_refcount_put_op() {}
37
38 void encode(bufferlist& bl) const {
39 ENCODE_START(1, 1, bl);
40 encode(source, bl);
41 ENCODE_FINISH(bl);
42 }
43
44 void decode(bufferlist::const_iterator& bl) {
45 DECODE_START(1, bl);
46 decode(source, bl);
47 DECODE_FINISH(bl);
48 }
49
50 void dump(ceph::Formatter *f) const;
51 static void generate_test_instances(list<cls_chunk_refcount_put_op*>& ls);
52 };
53 WRITE_CLASS_ENCODER(cls_chunk_refcount_put_op)
54
55 struct cls_chunk_refcount_set_op {
56 set<hobject_t> refs;
57
58 cls_chunk_refcount_set_op() {}
59
60 void encode(bufferlist& bl) const {
61 ENCODE_START(1, 1, bl);
62 encode(refs, bl);
63 ENCODE_FINISH(bl);
64 }
65
66 void decode(bufferlist::const_iterator& bl) {
67 DECODE_START(1, bl);
68 decode(refs, bl);
69 DECODE_FINISH(bl);
70 }
71
72 void dump(ceph::Formatter *f) const;
73 static void generate_test_instances(list<cls_chunk_refcount_set_op*>& ls);
74 };
75 WRITE_CLASS_ENCODER(cls_chunk_refcount_set_op)
76
77 struct cls_chunk_refcount_read_ret {
78 set<hobject_t> refs;
79
80 cls_chunk_refcount_read_ret() {}
81
82 void encode(bufferlist& bl) const {
83 ENCODE_START(1, 1, bl);
84 encode(refs, bl);
85 ENCODE_FINISH(bl);
86 }
87
88 void decode(bufferlist::const_iterator& bl) {
89 DECODE_START(1, bl);
90 decode(refs, bl);
91 DECODE_FINISH(bl);
92 }
93
94 void dump(ceph::Formatter *f) const;
95 static void generate_test_instances(list<cls_chunk_refcount_read_ret*>& ls);
96 };
97 WRITE_CLASS_ENCODER(cls_chunk_refcount_read_ret)
98
99 struct chunk_obj_refcount {
100 set<hobject_t> refs;
101
102 chunk_obj_refcount() {}
103
104 void encode(bufferlist& bl) const {
105 ENCODE_START(1, 1, bl);
106 encode(refs, bl);
107 ENCODE_FINISH(bl);
108 }
109
110 void decode(bufferlist::const_iterator& bl) {
111 DECODE_START(1, bl);
112 decode(refs, bl);
113 DECODE_FINISH(bl);
114 }
115 };
116 WRITE_CLASS_ENCODER(chunk_obj_refcount)
117
118 struct obj_refcount {
119 map<string, bool> refs;
120 set<string> retired_refs;
121
122 obj_refcount() {}
123
124 void encode(bufferlist& bl) const {
125 ENCODE_START(2, 1, bl);
126 encode(refs, bl);
127 encode(retired_refs, bl);
128 ENCODE_FINISH(bl);
129 }
130
131 void decode(bufferlist::const_iterator& bl) {
132 DECODE_START(2, bl);
133 decode(refs, bl);
134 if (struct_v >= 2) {
135 decode(retired_refs, bl);
136 }
137 DECODE_FINISH(bl);
138 }
139 };
140 WRITE_CLASS_ENCODER(obj_refcount)
141
142 #endif