]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_object_expirer_core.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rgw / rgw_object_expirer_core.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_OBJEXP_H
5#define CEPH_OBJEXP_H
6
7#include <errno.h>
8#include <iostream>
9#include <sstream>
10#include <string>
11#include <atomic>
12
13#include "auth/Crypto.h"
14
15#include "common/armor.h"
16#include "common/ceph_json.h"
17#include "common/config.h"
18#include "common/ceph_argparse.h"
19#include "common/Formatter.h"
20#include "common/errno.h"
21
22#include "common/Mutex.h"
23#include "common/Cond.h"
24#include "common/Thread.h"
25
26#include "global/global_init.h"
27
28#include "include/utime.h"
29#include "include/str_list.h"
30
31#include "rgw_user.h"
32#include "rgw_bucket.h"
33#include "rgw_rados.h"
34#include "rgw_acl.h"
35#include "rgw_acl_s3.h"
36#include "rgw_log.h"
37#include "rgw_formats.h"
38#include "rgw_usage.h"
39#include "rgw_replica_log.h"
40
41#include <atomic>
42
43class RGWObjectExpirer {
44protected:
45 RGWRados *store;
46
47 int init_bucket_info(const std::string& tenant_name,
48 const std::string& bucket_name,
49 const std::string& bucket_id,
50 RGWBucketInfo& bucket_info);
51
52 class OEWorker : public Thread {
53 CephContext *cct;
54 RGWObjectExpirer *oe;
55 Mutex lock;
56 Cond cond;
57
58 public:
59 OEWorker(CephContext * const cct,
60 RGWObjectExpirer * const oe)
61 : cct(cct),
62 oe(oe),
63 lock("OEWorker") {
64 }
65
66 void *entry() override;
67 void stop();
68 };
69
70 OEWorker *worker;
71 std::atomic<bool> down_flag = { false };
72
73public:
74 explicit RGWObjectExpirer(RGWRados *_store)
75 : store(_store) {
76 }
77
78 int garbage_single_object(objexp_hint_entry& hint);
79
80 void garbage_chunk(std::list<cls_timeindex_entry>& entries, /* in */
81 bool& need_trim); /* out */
82
83 void trim_chunk(const std::string& shard,
84 const utime_t& from,
85 const utime_t& to,
86 const string& from_marker,
87 const string& to_marker);
88
89 bool process_single_shard(const std::string& shard,
90 const utime_t& last_run,
91 const utime_t& round_start);
92
93 bool inspect_all_shards(const utime_t& last_run,
94 const utime_t& round_start);
95
96 bool going_down();
97 void start_processor();
98 void stop_processor();
99};
100#endif /* CEPH_OBJEXP_H */