]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_TYPES_H | |
5 | #define CEPH_CLS_TIMEINDEX_TYPES_H | |
6 | ||
7 | #include "include/encoding.h" | |
8 | #include "include/types.h" | |
9 | ||
10 | #include "include/utime.h" | |
11 | ||
12 | class JSONObj; | |
13 | ||
14 | struct cls_timeindex_entry { | |
15 | /* Mandatory timestamp. Will be part of the key. */ | |
16 | utime_t key_ts; | |
17 | /* Not mandatory. The name_ext field, if not empty, will form second | |
18 | * part of the key. */ | |
19 | string key_ext; | |
20 | /* Become value of OMAP-based mapping. */ | |
21 | bufferlist value; | |
22 | ||
23 | cls_timeindex_entry() {} | |
24 | ||
25 | void encode(bufferlist& bl) const { | |
26 | ENCODE_START(1, 1, bl); | |
11fdf7f2 TL |
27 | encode(key_ts, bl); |
28 | encode(key_ext, bl); | |
29 | encode(value, bl); | |
7c673cae FG |
30 | ENCODE_FINISH(bl); |
31 | } | |
32 | ||
11fdf7f2 | 33 | void decode(bufferlist::const_iterator& bl) { |
7c673cae | 34 | DECODE_START(1, bl); |
11fdf7f2 TL |
35 | decode(key_ts, bl); |
36 | decode(key_ext, bl); | |
37 | decode(value, bl); | |
7c673cae FG |
38 | DECODE_FINISH(bl); |
39 | } | |
40 | }; | |
41 | WRITE_CLASS_ENCODER(cls_timeindex_entry) | |
42 | ||
43 | #endif /* CEPH_CLS_TIMEINDEX_TYPES_H */ |