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_CLIENT_H
5 #define CEPH_CLS_TIMEINDEX_CLIENT_H
7 #include "include/rados/librados.hpp"
9 #include "cls_timeindex_ops.h"
12 class ObjectWriteOperation;
13 class ObjectReadOperation;
20 class TimeindexListCtx : public librados::ObjectOperationCompletion {
21 std::list<cls_timeindex_entry> *entries;
28 std::list<cls_timeindex_entry> *_entries,
31 : entries(_entries), marker(_marker), truncated(_truncated) {}
34 ~TimeindexListCtx() {}
36 void handle_completion(int r, bufferlist& bl) override {
38 cls_timeindex_list_ret ret;
40 bufferlist::iterator iter = bl.begin();
43 *entries = ret.entries;
45 *truncated = ret.truncated;
48 } catch (buffer::error& err) {
49 // nothing we can do about it atm
55 void cls_timeindex_add_prepare_entry(
56 cls_timeindex_entry& entry,
57 const utime_t& key_timestamp,
58 const std::string& key_ext,
61 void cls_timeindex_add(
62 librados::ObjectWriteOperation& op,
63 const std::list<cls_timeindex_entry>& entry);
65 void cls_timeindex_add(
66 librados::ObjectWriteOperation& op,
67 const cls_timeindex_entry& entry);
69 void cls_timeindex_add(
70 librados::ObjectWriteOperation& op,
71 const utime_t& timestamp,
72 const std::string& name,
73 const bufferlist& bl);
75 void cls_timeindex_list(
76 librados::ObjectReadOperation& op,
79 const std::string& in_marker,
80 const int max_entries,
81 std::list<cls_timeindex_entry>& entries,
82 std::string *out_marker,
85 void cls_timeindex_trim(
86 librados::ObjectWriteOperation& op,
87 const utime_t& from_time,
88 const utime_t& to_time,
89 const std::string& from_marker = std::string(),
90 const std::string& to_marker = std::string());
92 int cls_timeindex_trim(
93 librados::IoCtx& io_ctx,
94 const std::string& oid,
95 const utime_t& from_time,
96 const utime_t& to_time,
97 const std::string& from_marker = std::string(),
98 const std::string& to_marker = std::string());