]>
git.proxmox.com Git - ceph.git/blob - 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
4 #ifndef CEPH_CLS_TIMEINDEX_OPS_H
5 #define CEPH_CLS_TIMEINDEX_OPS_H
7 #include "include/types.h"
8 #include "cls_timeindex_types.h"
10 struct cls_timeindex_add_op
{
11 list
<cls_timeindex_entry
> entries
;
13 cls_timeindex_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_timeindex_add_op
)
29 struct cls_timeindex_list_op
{
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 */
36 cls_timeindex_list_op() : max_entries(0) {}
38 void encode(bufferlist
& bl
) const {
39 ENCODE_START(1, 1, bl
);
40 ::encode(from_time
, bl
);
42 ::encode(to_time
, bl
);
43 ::encode(max_entries
, bl
);
47 void decode(bufferlist::iterator
& bl
) {
49 ::decode(from_time
, bl
);
51 ::decode(to_time
, bl
);
52 ::decode(max_entries
, bl
);
56 WRITE_CLASS_ENCODER(cls_timeindex_list_op
)
58 struct cls_timeindex_list_ret
{
59 list
<cls_timeindex_entry
> entries
;
63 cls_timeindex_list_ret() : truncated(false) {}
65 void encode(bufferlist
& bl
) const {
66 ENCODE_START(1, 1, bl
);
67 ::encode(entries
, bl
);
69 ::encode(truncated
, bl
);
73 void decode(bufferlist::iterator
& bl
) {
75 ::decode(entries
, bl
);
77 ::decode(truncated
, bl
);
81 WRITE_CLASS_ENCODER(cls_timeindex_list_ret
)
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.
88 struct cls_timeindex_trim_op
{
90 utime_t to_time
; /* inclusive */
94 cls_timeindex_trim_op() {}
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
);
105 void decode(bufferlist::iterator
& bl
) {
107 ::decode(from_time
, bl
);
108 ::decode(to_time
, bl
);
109 ::decode(from_marker
, bl
);
110 ::decode(to_marker
, bl
);
114 WRITE_CLASS_ENCODER(cls_timeindex_trim_op
)
116 #endif /* CEPH_CLS_TIMEINDEX_OPS_H */