]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/statelog/cls_statelog_ops.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / cls / statelog / cls_statelog_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_STATELOG_OPS_H
5 #define CEPH_CLS_STATELOG_OPS_H
6
7 #include "include/types.h"
8 #include "cls_statelog_types.h"
9
10 struct cls_statelog_add_op {
11 list<cls_statelog_entry> entries;
12
13 cls_statelog_add_op() {}
14
15 void encode(bufferlist& bl) const {
16 ENCODE_START(1, 1, bl);
17 ::encode(entries, bl);
18 ENCODE_FINISH(bl);
19 }
20
21 void decode(bufferlist::iterator& bl) {
22 DECODE_START(1, bl);
23 ::decode(entries, bl);
24 DECODE_FINISH(bl);
25 }
26 };
27 WRITE_CLASS_ENCODER(cls_statelog_add_op)
28
29 struct cls_statelog_list_op {
30 string object;
31 string client_id;
32 string op_id;
33 string marker; /* if not empty, overrides from_time */
34 int max_entries; /* upperbound to returned num of entries
35 might return less than that and still be truncated */
36
37 cls_statelog_list_op() : max_entries(0) {}
38
39 void encode(bufferlist& bl) const {
40 ENCODE_START(1, 1, bl);
41 ::encode(object, bl);
42 ::encode(client_id, bl);
43 ::encode(op_id, bl);
44 ::encode(marker, bl);
45 ::encode(max_entries, bl);
46 ENCODE_FINISH(bl);
47 }
48
49 void decode(bufferlist::iterator& bl) {
50 DECODE_START(1, bl);
51 ::decode(object, bl);
52 ::decode(client_id, bl);
53 ::decode(op_id, bl);
54 ::decode(marker, bl);
55 ::decode(max_entries, bl);
56 DECODE_FINISH(bl);
57 }
58 };
59 WRITE_CLASS_ENCODER(cls_statelog_list_op)
60
61 struct cls_statelog_list_ret {
62 list<cls_statelog_entry> entries;
63 string marker;
64 bool truncated;
65
66 cls_statelog_list_ret() : truncated(false) {}
67
68 void encode(bufferlist& bl) const {
69 ENCODE_START(1, 1, bl);
70 ::encode(entries, bl);
71 ::encode(marker, bl);
72 ::encode(truncated, bl);
73 ENCODE_FINISH(bl);
74 }
75
76 void decode(bufferlist::iterator& bl) {
77 DECODE_START(1, bl);
78 ::decode(entries, bl);
79 ::decode(marker, bl);
80 ::decode(truncated, bl);
81 DECODE_FINISH(bl);
82 }
83 };
84 WRITE_CLASS_ENCODER(cls_statelog_list_ret)
85
86
87 /*
88 * operation will return 0 when successfully removed but not done. Will return
89 * -ENODATA when done, so caller needs to repeat sending request until that.
90 */
91 struct cls_statelog_remove_op {
92 string client_id;
93 string op_id;
94 string object;
95
96 cls_statelog_remove_op() {}
97
98 void encode(bufferlist& bl) const {
99 ENCODE_START(1, 1, bl);
100 ::encode(client_id, bl);
101 ::encode(op_id, bl);
102 ::encode(object, bl);
103 ENCODE_FINISH(bl);
104 }
105
106 void decode(bufferlist::iterator& bl) {
107 DECODE_START(1, bl);
108 ::decode(client_id, bl);
109 ::decode(op_id, bl);
110 ::decode(object, bl);
111 DECODE_FINISH(bl);
112 }
113 };
114 WRITE_CLASS_ENCODER(cls_statelog_remove_op)
115
116 struct cls_statelog_check_state_op {
117 string client_id;
118 string op_id;
119 string object;
120 uint32_t state;
121
122 cls_statelog_check_state_op() : state(0) {}
123
124 void encode(bufferlist& bl) const {
125 ENCODE_START(1, 1, bl);
126 ::encode(client_id, bl);
127 ::encode(op_id, bl);
128 ::encode(object, bl);
129 ::encode(state, bl);
130 ENCODE_FINISH(bl);
131 }
132
133 void decode(bufferlist::iterator& bl) {
134 DECODE_START(1, bl);
135 ::decode(client_id, bl);
136 ::decode(op_id, bl);
137 ::decode(object, bl);
138 ::decode(state, bl);
139 DECODE_FINISH(bl);
140 }
141 };
142 WRITE_CLASS_ENCODER(cls_statelog_check_state_op)
143
144 #endif