1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
13 #include "auth/Crypto.h"
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"
22 #include "common/Mutex.h"
23 #include "common/Cond.h"
24 #include "common/Thread.h"
26 #include "global/global_init.h"
28 #include "include/utime.h"
29 #include "include/str_list.h"
32 #include "rgw_bucket.h"
33 #include "rgw_rados.h"
35 #include "rgw_acl_s3.h"
37 #include "rgw_formats.h"
38 #include "rgw_usage.h"
39 #include "rgw_replica_log.h"
41 class RGWObjectExpirer {
45 int init_bucket_info(const std::string& tenant_name,
46 const std::string& bucket_name,
47 const std::string& bucket_id,
48 RGWBucketInfo& bucket_info);
50 class OEWorker : public Thread {
57 OEWorker(CephContext * const cct,
58 RGWObjectExpirer * const oe)
64 void *entry() override;
68 OEWorker *worker{nullptr};
69 std::atomic<bool> down_flag = { false };
72 explicit RGWObjectExpirer(RGWRados *_store)
73 : store(_store), worker(NULL) {
79 int garbage_single_object(objexp_hint_entry& hint);
81 void garbage_chunk(std::list<cls_timeindex_entry>& entries, /* in */
82 bool& need_trim); /* out */
84 void trim_chunk(const std::string& shard,
87 const string& from_marker,
88 const string& to_marker);
90 bool process_single_shard(const std::string& shard,
91 const utime_t& last_run,
92 const utime_t& round_start);
94 bool inspect_all_shards(const utime_t& last_run,
95 const utime_t& round_start);
98 void start_processor();
99 void stop_processor();
101 #endif /* CEPH_OBJEXP_H */