]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_gc.h
update sources to v12.2.1
[ceph.git] / ceph / src / rgw / rgw_gc.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_RGW_GC_H
5#define CEPH_RGW_GC_H
6
7
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"
16
17#include <atomic>
18
19class RGWGC {
20 CephContext *cct;
21 RGWRados *store;
22 int max_objs;
23 string *obj_names;
24 std::atomic<bool> down_flag = { false };
25
26 int tag_index(const string& tag);
27
28 class GCWorker : public Thread {
29 CephContext *cct;
30 RGWGC *gc;
31 Mutex lock;
32 Cond cond;
33
34 public:
35 GCWorker(CephContext *_cct, RGWGC *_gc) : cct(_cct), gc(_gc), lock("GCWorker") {}
36 void *entry() override;
37 void stop();
38 };
39
40 GCWorker *worker;
41public:
42 RGWGC() : cct(NULL), store(NULL), max_objs(0), obj_names(NULL), worker(NULL) {}
43 ~RGWGC() {
44 stop_processor();
45 finalize();
46 }
47
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);
52
53 void initialize(CephContext *_cct, RGWRados *_store);
54 void finalize();
55
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);
59 int process();
60
61 bool going_down();
62 void start_processor();
63 void stop_processor();
64};
65
66
67#endif