1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
8 #include "include/types.h"
9 #include "include/rados/librados.hpp"
10 #include "common/Mutex.h"
11 #include "common/Cond.h"
12 #include "common/Thread.h"
13 #include "rgw_common.h"
14 #include "rgw_rados.h"
15 #include "cls/rgw/cls_rgw_types.h"
24 std::atomic<bool> down_flag = { false };
26 int tag_index(const string& tag);
28 class GCWorker : public Thread {
35 GCWorker(CephContext *_cct, RGWGC *_gc) : cct(_cct), gc(_gc), lock("GCWorker") {}
36 void *entry() override;
42 RGWGC() : cct(NULL), store(NULL), max_objs(0), obj_names(NULL), worker(NULL) {}
48 void add_chain(librados::ObjectWriteOperation& op, cls_rgw_obj_chain& chain, const string& tag);
49 int send_chain(cls_rgw_obj_chain& chain, const string& tag, bool sync);
50 int defer_chain(const string& tag, bool sync);
51 int remove(int index, const std::list<string>& tags);
53 void initialize(CephContext *_cct, RGWRados *_store);
56 int list(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
57 void list_init(int *index) { *index = 0; }
58 int process(int index, int process_max_secs);
62 void start_processor();
63 void stop_processor();