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_TIMEINDEX_OPS_H
5 #define CEPH_CLS_TIMEINDEX_OPS_H
7 #include "cls_timeindex_types.h"
9 struct cls_timeindex_add_op {
10 list<cls_timeindex_entry> entries;
12 cls_timeindex_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_timeindex_add_op)
28 struct cls_timeindex_list_op {
30 string marker; /* if not empty, overrides from_time */
31 utime_t to_time; /* not inclusive */
32 int max_entries; /* upperbound to returned num of entries
33 might return less than that and still be truncated */
35 cls_timeindex_list_op() : max_entries(0) {}
37 void encode(bufferlist& bl) const {
38 ENCODE_START(1, 1, bl);
39 ::encode(from_time, bl);
41 ::encode(to_time, bl);
42 ::encode(max_entries, bl);
46 void decode(bufferlist::iterator& bl) {
48 ::decode(from_time, bl);
50 ::decode(to_time, bl);
51 ::decode(max_entries, bl);
55 WRITE_CLASS_ENCODER(cls_timeindex_list_op)
57 struct cls_timeindex_list_ret {
58 list<cls_timeindex_entry> entries;
62 cls_timeindex_list_ret() : truncated(false) {}
64 void encode(bufferlist& bl) const {
65 ENCODE_START(1, 1, bl);
66 ::encode(entries, bl);
68 ::encode(truncated, bl);
72 void decode(bufferlist::iterator& bl) {
74 ::decode(entries, bl);
76 ::decode(truncated, bl);
80 WRITE_CLASS_ENCODER(cls_timeindex_list_ret)
84 * operation will return 0 when successfully removed but not done. Will return
85 * -ENODATA when done, so caller needs to repeat sending request until that.
87 struct cls_timeindex_trim_op {
89 utime_t to_time; /* inclusive */
93 cls_timeindex_trim_op() {}
95 void encode(bufferlist& bl) const {
96 ENCODE_START(1, 1, bl);
97 ::encode(from_time, bl);
98 ::encode(to_time, bl);
99 ::encode(from_marker, bl);
100 ::encode(to_marker, bl);
104 void decode(bufferlist::iterator& bl) {
106 ::decode(from_time, bl);
107 ::decode(to_time, bl);
108 ::decode(from_marker, bl);
109 ::decode(to_marker, bl);
113 WRITE_CLASS_ENCODER(cls_timeindex_trim_op)
115 #endif /* CEPH_CLS_TIMEINDEX_OPS_H */