X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frgw%2Frgw_object_expirer_core.h;fp=src%2Fceph%2Fsrc%2Frgw%2Frgw_object_expirer_core.h;h=26751655d894085c07ab76a72b2278ba4a5dd27c;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/rgw/rgw_object_expirer_core.h b/src/ceph/src/rgw/rgw_object_expirer_core.h new file mode 100644 index 0000000..2675165 --- /dev/null +++ b/src/ceph/src/rgw/rgw_object_expirer_core.h @@ -0,0 +1,101 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_OBJEXP_H +#define CEPH_OBJEXP_H + +#include +#include +#include +#include +#include + +#include "auth/Crypto.h" + +#include "common/armor.h" +#include "common/ceph_json.h" +#include "common/config.h" +#include "common/ceph_argparse.h" +#include "common/Formatter.h" +#include "common/errno.h" + +#include "common/Mutex.h" +#include "common/Cond.h" +#include "common/Thread.h" + +#include "global/global_init.h" + +#include "include/utime.h" +#include "include/str_list.h" + +#include "rgw_user.h" +#include "rgw_bucket.h" +#include "rgw_rados.h" +#include "rgw_acl.h" +#include "rgw_acl_s3.h" +#include "rgw_log.h" +#include "rgw_formats.h" +#include "rgw_usage.h" +#include "rgw_replica_log.h" + +class RGWObjectExpirer { +protected: + RGWRados *store; + + int init_bucket_info(const std::string& tenant_name, + const std::string& bucket_name, + const std::string& bucket_id, + RGWBucketInfo& bucket_info); + + class OEWorker : public Thread { + CephContext *cct; + RGWObjectExpirer *oe; + Mutex lock; + Cond cond; + + public: + OEWorker(CephContext * const cct, + RGWObjectExpirer * const oe) + : cct(cct), + oe(oe), + lock("OEWorker") { + } + + void *entry() override; + void stop(); + }; + + OEWorker *worker{nullptr}; + std::atomic down_flag = { false }; + +public: + explicit RGWObjectExpirer(RGWRados *_store) + : store(_store), worker(NULL) { + } + ~RGWObjectExpirer() { + stop_processor(); + } + + int garbage_single_object(objexp_hint_entry& hint); + + void garbage_chunk(std::list& entries, /* in */ + bool& need_trim); /* out */ + + void trim_chunk(const std::string& shard, + const utime_t& from, + const utime_t& to, + const string& from_marker, + const string& to_marker); + + bool process_single_shard(const std::string& shard, + const utime_t& last_run, + const utime_t& round_start); + + bool inspect_all_shards(const utime_t& last_run, + const utime_t& round_start); + + bool going_down(); + void start_processor(); + void stop_processor(); +}; +#endif /* CEPH_OBJEXP_H */