]>
git.proxmox.com Git - ceph.git/blob - 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
4 #ifndef CEPH_CLS_REFCOUNT_OPS_H
5 #define CEPH_CLS_REFCOUNT_OPS_H
7 #include "include/types.h"
8 #include "common/hobject.h"
10 struct cls_refcount_get_op
{
14 cls_refcount_get_op() : implicit_ref(false) {}
16 void encode(ceph::buffer::list
& bl
) const {
17 ENCODE_START(1, 1, bl
);
19 encode(implicit_ref
, bl
);
23 void decode(ceph::buffer::list::const_iterator
& bl
) {
26 decode(implicit_ref
, bl
);
29 void dump(ceph::Formatter
*f
) const;
30 static void generate_test_instances(std::list
<cls_refcount_get_op
*>& ls
);
32 WRITE_CLASS_ENCODER(cls_refcount_get_op
)
34 struct cls_refcount_put_op
{
36 bool implicit_ref
; // assume wildcard reference for
37 // objects without a std::set ref
39 cls_refcount_put_op() : implicit_ref(false) {}
41 void encode(ceph::buffer::list
& bl
) const {
42 ENCODE_START(1, 1, bl
);
44 encode(implicit_ref
, bl
);
48 void decode(ceph::buffer::list::const_iterator
& bl
) {
51 decode(implicit_ref
, bl
);
55 void dump(ceph::Formatter
*f
) const;
56 static void generate_test_instances(std::list
<cls_refcount_put_op
*>& ls
);
58 WRITE_CLASS_ENCODER(cls_refcount_put_op
)
60 struct cls_refcount_set_op
{
61 std::list
<std::string
> refs
;
63 cls_refcount_set_op() {}
65 void encode(ceph::buffer::list
& bl
) const {
66 ENCODE_START(1, 1, bl
);
71 void decode(ceph::buffer::list::const_iterator
& bl
) {
77 void dump(ceph::Formatter
*f
) const;
78 static void generate_test_instances(std::list
<cls_refcount_set_op
*>& ls
);
80 WRITE_CLASS_ENCODER(cls_refcount_set_op
)
82 struct cls_refcount_read_op
{
83 bool implicit_ref
; // assume wildcard reference for
84 // objects without a std::set ref
86 cls_refcount_read_op() : implicit_ref(false) {}
88 void encode(ceph::buffer::list
& bl
) const {
89 ENCODE_START(1, 1, bl
);
90 encode(implicit_ref
, bl
);
94 void decode(ceph::buffer::list::const_iterator
& bl
) {
96 decode(implicit_ref
, bl
);
100 void dump(ceph::Formatter
*f
) const;
101 static void generate_test_instances(std::list
<cls_refcount_read_op
*>& ls
);
103 WRITE_CLASS_ENCODER(cls_refcount_read_op
)
105 struct cls_refcount_read_ret
{
106 std::list
<std::string
> refs
;
108 cls_refcount_read_ret() {}
110 void encode(ceph::buffer::list
& bl
) const {
111 ENCODE_START(1, 1, bl
);
116 void decode(ceph::buffer::list::const_iterator
& bl
) {
122 void dump(ceph::Formatter
*f
) const;
123 static void generate_test_instances(std::list
<cls_refcount_read_ret
*>& ls
);
125 WRITE_CLASS_ENCODER(cls_refcount_read_ret
)
127 struct obj_refcount
{
128 std::map
<std::string
, bool> refs
;
129 std::set
<std::string
> retired_refs
;
133 void encode(ceph::buffer::list
& bl
) const {
134 ENCODE_START(2, 1, bl
);
136 encode(retired_refs
, bl
);
140 void decode(ceph::buffer::list::const_iterator
& bl
) {
144 decode(retired_refs
, bl
);
149 void dump(ceph::Formatter
*f
) const;
150 static void generate_test_instances(std::list
<obj_refcount
*>& ls
);
152 WRITE_CLASS_ENCODER(obj_refcount
)