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 "include/types.h"
8 #include "cls_statelog_types.h"
10 struct cls_statelog_add_op
{
11 list
<cls_statelog_entry
> entries
;
13 cls_statelog_add_op() {}
15 void encode(bufferlist
& bl
) const {
16 ENCODE_START(1, 1, bl
);
17 ::encode(entries
, bl
);
21 void decode(bufferlist::iterator
& bl
) {
23 ::decode(entries
, bl
);
27 WRITE_CLASS_ENCODER(cls_statelog_add_op
)
29 struct cls_statelog_list_op
{
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 */
37 cls_statelog_list_op() : max_entries(0) {}
39 void encode(bufferlist
& bl
) const {
40 ENCODE_START(1, 1, bl
);
42 ::encode(client_id
, bl
);
45 ::encode(max_entries
, bl
);
49 void decode(bufferlist::iterator
& bl
) {
52 ::decode(client_id
, bl
);
55 ::decode(max_entries
, bl
);
59 WRITE_CLASS_ENCODER(cls_statelog_list_op
)
61 struct cls_statelog_list_ret
{
62 list
<cls_statelog_entry
> entries
;
66 cls_statelog_list_ret() : truncated(false) {}
68 void encode(bufferlist
& bl
) const {
69 ENCODE_START(1, 1, bl
);
70 ::encode(entries
, bl
);
72 ::encode(truncated
, bl
);
76 void decode(bufferlist::iterator
& bl
) {
78 ::decode(entries
, bl
);
80 ::decode(truncated
, bl
);
84 WRITE_CLASS_ENCODER(cls_statelog_list_ret
)
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.
91 struct cls_statelog_remove_op
{
96 cls_statelog_remove_op() {}
98 void encode(bufferlist
& bl
) const {
99 ENCODE_START(1, 1, bl
);
100 ::encode(client_id
, bl
);
102 ::encode(object
, bl
);
106 void decode(bufferlist::iterator
& bl
) {
108 ::decode(client_id
, bl
);
110 ::decode(object
, bl
);
114 WRITE_CLASS_ENCODER(cls_statelog_remove_op
)
116 struct cls_statelog_check_state_op
{
122 cls_statelog_check_state_op() : state(0) {}
124 void encode(bufferlist
& bl
) const {
125 ENCODE_START(1, 1, bl
);
126 ::encode(client_id
, bl
);
128 ::encode(object
, bl
);
133 void decode(bufferlist::iterator
& bl
) {
135 ::decode(client_id
, bl
);
137 ::decode(object
, bl
);
142 WRITE_CLASS_ENCODER(cls_statelog_check_state_op
)