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_STATELOG_OPS_H
5 #define CEPH_CLS_STATELOG_OPS_H
7 #include "cls_statelog_types.h"
9 struct cls_statelog_add_op {
10 list<cls_statelog_entry> entries;
12 cls_statelog_add_op() {}
14 void encode(bufferlist& bl) const {
15 ENCODE_START(1, 1, bl);
16 ::encode(entries, bl);
20 void decode(bufferlist::iterator& bl) {
22 ::decode(entries, bl);
26 WRITE_CLASS_ENCODER(cls_statelog_add_op)
28 struct cls_statelog_list_op {
32 string marker; /* if not empty, overrides from_time */
33 int max_entries; /* upperbound to returned num of entries
34 might return less than that and still be truncated */
36 cls_statelog_list_op() : max_entries(0) {}
38 void encode(bufferlist& bl) const {
39 ENCODE_START(1, 1, bl);
41 ::encode(client_id, bl);
44 ::encode(max_entries, bl);
48 void decode(bufferlist::iterator& bl) {
51 ::decode(client_id, bl);
54 ::decode(max_entries, bl);
58 WRITE_CLASS_ENCODER(cls_statelog_list_op)
60 struct cls_statelog_list_ret {
61 list<cls_statelog_entry> entries;
65 cls_statelog_list_ret() : truncated(false) {}
67 void encode(bufferlist& bl) const {
68 ENCODE_START(1, 1, bl);
69 ::encode(entries, bl);
71 ::encode(truncated, bl);
75 void decode(bufferlist::iterator& bl) {
77 ::decode(entries, bl);
79 ::decode(truncated, bl);
83 WRITE_CLASS_ENCODER(cls_statelog_list_ret)
87 * operation will return 0 when successfully removed but not done. Will return
88 * -ENODATA when done, so caller needs to repeat sending request until that.
90 struct cls_statelog_remove_op {
95 cls_statelog_remove_op() {}
97 void encode(bufferlist& bl) const {
98 ENCODE_START(1, 1, bl);
99 ::encode(client_id, bl);
101 ::encode(object, bl);
105 void decode(bufferlist::iterator& bl) {
107 ::decode(client_id, bl);
109 ::decode(object, bl);
113 WRITE_CLASS_ENCODER(cls_statelog_remove_op)
115 struct cls_statelog_check_state_op {
121 cls_statelog_check_state_op() : state(0) {}
123 void encode(bufferlist& bl) const {
124 ENCODE_START(1, 1, bl);
125 ::encode(client_id, bl);
127 ::encode(object, bl);
132 void decode(bufferlist::iterator& bl) {
134 ::decode(client_id, bl);
136 ::decode(object, bl);
141 WRITE_CLASS_ENCODER(cls_statelog_check_state_op)