]> git.proxmox.com Git - ceph.git/blame - ceph/src/cls/timeindex/cls_timeindex_client.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / cls / timeindex / cls_timeindex_client.h
CommitLineData
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_CLIENT_H
5#define CEPH_CLS_TIMEINDEX_CLIENT_H
6
7c673cae 7#include "include/rados/librados.hpp"
31f18b77
FG
8
9#include "cls_timeindex_ops.h"
10
7c673cae
FG
11/**
12 * timeindex objclass
13 */
14class TimeindexListCtx : public librados::ObjectOperationCompletion {
15 std::list<cls_timeindex_entry> *entries;
16 std::string *marker;
17 bool *truncated;
18
19public:
20 ///* ctor
21 TimeindexListCtx(
22 std::list<cls_timeindex_entry> *_entries,
23 std::string *_marker,
24 bool *_truncated)
25 : entries(_entries), marker(_marker), truncated(_truncated) {}
26
27 ///* dtor
28 ~TimeindexListCtx() {}
29
30 void handle_completion(int r, bufferlist& bl) override {
31 if (r >= 0) {
32 cls_timeindex_list_ret ret;
33 try {
11fdf7f2
TL
34 auto iter = bl.cbegin();
35 decode(ret, iter);
7c673cae
FG
36 if (entries)
37 *entries = ret.entries;
38 if (truncated)
39 *truncated = ret.truncated;
40 if (marker)
41 *marker = ret.marker;
42 } catch (buffer::error& err) {
43 // nothing we can do about it atm
44 }
45 }
46 }
47};
48
49void cls_timeindex_add_prepare_entry(
50 cls_timeindex_entry& entry,
51 const utime_t& key_timestamp,
52 const std::string& key_ext,
53 bufferlist& bl);
54
55void cls_timeindex_add(
56 librados::ObjectWriteOperation& op,
57 const std::list<cls_timeindex_entry>& entry);
58
59void cls_timeindex_add(
60 librados::ObjectWriteOperation& op,
61 const cls_timeindex_entry& entry);
62
63void cls_timeindex_add(
64 librados::ObjectWriteOperation& op,
65 const utime_t& timestamp,
66 const std::string& name,
67 const bufferlist& bl);
68
69void cls_timeindex_list(
70 librados::ObjectReadOperation& op,
71 const utime_t& from,
72 const utime_t& to,
73 const std::string& in_marker,
74 const int max_entries,
75 std::list<cls_timeindex_entry>& entries,
76 std::string *out_marker,
77 bool *truncated);
78
79void cls_timeindex_trim(
80 librados::ObjectWriteOperation& op,
81 const utime_t& from_time,
82 const utime_t& to_time,
83 const std::string& from_marker = std::string(),
84 const std::string& to_marker = std::string());
85
86int cls_timeindex_trim(
87 librados::IoCtx& io_ctx,
88 const std::string& oid,
89 const utime_t& from_time,
90 const utime_t& to_time,
91 const std::string& from_marker = std::string(),
92 const std::string& to_marker = std::string());
93#endif