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_LOG_OPS_H
5 #define CEPH_CLS_LOG_OPS_H
7 #include "cls_log_types.h"
9 struct cls_log_add_op {
10 list<cls_log_entry> entries;
13 cls_log_add_op() : monotonic_inc(true) {}
15 void encode(bufferlist& bl) const {
16 ENCODE_START(2, 1, bl);
17 ::encode(entries, bl);
18 ::encode(monotonic_inc, bl);
22 void decode(bufferlist::iterator& bl) {
24 ::decode(entries, bl);
26 ::decode(monotonic_inc, bl);
31 WRITE_CLASS_ENCODER(cls_log_add_op)
33 struct cls_log_list_op {
35 string marker; /* if not empty, overrides from_time */
36 utime_t to_time; /* not inclusive */
37 int max_entries; /* upperbound to returned num of entries
38 might return less than that and still be truncated */
40 cls_log_list_op() : max_entries(0) {}
42 void encode(bufferlist& bl) const {
43 ENCODE_START(1, 1, bl);
44 ::encode(from_time, bl);
46 ::encode(to_time, bl);
47 ::encode(max_entries, bl);
51 void decode(bufferlist::iterator& bl) {
53 ::decode(from_time, bl);
55 ::decode(to_time, bl);
56 ::decode(max_entries, bl);
60 WRITE_CLASS_ENCODER(cls_log_list_op)
62 struct cls_log_list_ret {
63 list<cls_log_entry> entries;
67 cls_log_list_ret() : truncated(false) {}
69 void encode(bufferlist& bl) const {
70 ENCODE_START(1, 1, bl);
71 ::encode(entries, bl);
73 ::encode(truncated, bl);
77 void decode(bufferlist::iterator& bl) {
79 ::decode(entries, bl);
81 ::decode(truncated, bl);
85 WRITE_CLASS_ENCODER(cls_log_list_ret)
89 * operation will return 0 when successfully removed but not done. Will return
90 * -ENODATA when done, so caller needs to repeat sending request until that.
92 struct cls_log_trim_op {
94 utime_t to_time; /* inclusive */
100 void encode(bufferlist& bl) const {
101 ENCODE_START(2, 1, bl);
102 ::encode(from_time, bl);
103 ::encode(to_time, bl);
104 ::encode(from_marker, bl);
105 ::encode(to_marker, bl);
109 void decode(bufferlist::iterator& bl) {
111 ::decode(from_time, bl);
112 ::decode(to_time, bl);
114 ::decode(from_marker, bl);
115 ::decode(to_marker, bl);
120 WRITE_CLASS_ENCODER(cls_log_trim_op)
122 struct cls_log_info_op {
125 void encode(bufferlist& bl) const {
126 ENCODE_START(1, 1, bl);
127 // currently empty request
131 void decode(bufferlist::iterator& bl) {
133 // currently empty request
137 WRITE_CLASS_ENCODER(cls_log_info_op)
139 struct cls_log_info_ret {
140 cls_log_header header;
142 void encode(bufferlist& bl) const {
143 ENCODE_START(1, 1, bl);
144 ::encode(header, bl);
148 void decode(bufferlist::iterator& bl) {
150 ::decode(header, bl);
154 WRITE_CLASS_ENCODER(cls_log_info_ret)