]> git.proxmox.com Git - ceph.git/blob - ceph/src/cls/timeindex/cls_timeindex_ops.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / cls / timeindex / cls_timeindex_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_TIMEINDEX_OPS_H
5 #define CEPH_CLS_TIMEINDEX_OPS_H
6
7 #include "include/types.h"
8 #include "cls_timeindex_types.h"
9
10 struct cls_timeindex_add_op {
11 list<cls_timeindex_entry> entries;
12
13 cls_timeindex_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_timeindex_add_op)
28
29 struct cls_timeindex_list_op {
30 utime_t from_time;
31 string marker; /* if not empty, overrides from_time */
32 utime_t to_time; /* not inclusive */
33 int max_entries; /* upperbound to returned num of entries
34 might return less than that and still be truncated */
35
36 cls_timeindex_list_op() : max_entries(0) {}
37
38 void encode(bufferlist& bl) const {
39 ENCODE_START(1, 1, bl);
40 ::encode(from_time, bl);
41 ::encode(marker, bl);
42 ::encode(to_time, bl);
43 ::encode(max_entries, bl);
44 ENCODE_FINISH(bl);
45 }
46
47 void decode(bufferlist::iterator& bl) {
48 DECODE_START(1, bl);
49 ::decode(from_time, bl);
50 ::decode(marker, bl);
51 ::decode(to_time, bl);
52 ::decode(max_entries, bl);
53 DECODE_FINISH(bl);
54 }
55 };
56 WRITE_CLASS_ENCODER(cls_timeindex_list_op)
57
58 struct cls_timeindex_list_ret {
59 list<cls_timeindex_entry> entries;
60 string marker;
61 bool truncated;
62
63 cls_timeindex_list_ret() : truncated(false) {}
64
65 void encode(bufferlist& bl) const {
66 ENCODE_START(1, 1, bl);
67 ::encode(entries, bl);
68 ::encode(marker, bl);
69 ::encode(truncated, bl);
70 ENCODE_FINISH(bl);
71 }
72
73 void decode(bufferlist::iterator& bl) {
74 DECODE_START(1, bl);
75 ::decode(entries, bl);
76 ::decode(marker, bl);
77 ::decode(truncated, bl);
78 DECODE_FINISH(bl);
79 }
80 };
81 WRITE_CLASS_ENCODER(cls_timeindex_list_ret)
82
83
84 /*
85 * operation will return 0 when successfully removed but not done. Will return
86 * -ENODATA when done, so caller needs to repeat sending request until that.
87 */
88 struct cls_timeindex_trim_op {
89 utime_t from_time;
90 utime_t to_time; /* inclusive */
91 string from_marker;
92 string to_marker;
93
94 cls_timeindex_trim_op() {}
95
96 void encode(bufferlist& bl) const {
97 ENCODE_START(1, 1, bl);
98 ::encode(from_time, bl);
99 ::encode(to_time, bl);
100 ::encode(from_marker, bl);
101 ::encode(to_marker, bl);
102 ENCODE_FINISH(bl);
103 }
104
105 void decode(bufferlist::iterator& bl) {
106 DECODE_START(1, bl);
107 ::decode(from_time, bl);
108 ::decode(to_time, bl);
109 ::decode(from_marker, bl);
110 ::decode(to_marker, bl);
111 DECODE_FINISH(bl);
112 }
113 };
114 WRITE_CLASS_ENCODER(cls_timeindex_trim_op)
115
116 #endif /* CEPH_CLS_TIMEINDEX_OPS_H */