]> git.proxmox.com Git - ceph.git/blob - ceph/src/mon/MgrStatMonitor.h
update sources to v12.2.1
[ceph.git] / ceph / src / mon / MgrStatMonitor.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #pragma once
5
6 #include "include/Context.h"
7 #include "PaxosService.h"
8 #include "mon/PGMap.h"
9 #include "mgr/ServiceMap.h"
10
11 class MonPGStatService;
12 class MgrPGStatService;
13
14 class MgrStatMonitor : public PaxosService {
15 // live version
16 version_t version = 0;
17 PGMapDigest digest;
18 ServiceMap service_map;
19
20 // pending commit
21 PGMapDigest pending_digest;
22 health_check_map_t pending_health_checks;
23 bufferlist pending_service_map_bl;
24
25 std::unique_ptr<MgrPGStatService> pgservice;
26
27 public:
28 MgrStatMonitor(Monitor *mn, Paxos *p, const string& service_name);
29 ~MgrStatMonitor() override;
30
31 void init() override {}
32 void on_shutdown() override {}
33
34 void create_initial() override;
35 void update_from_paxos(bool *need_bootstrap) override;
36 void create_pending() override;
37 void encode_pending(MonitorDBStore::TransactionRef t) override;
38 version_t get_trim_to() override;
39
40 bool definitely_converted_snapsets() const {
41 return digest.definitely_converted_snapsets();
42 }
43
44 bool preprocess_query(MonOpRequestRef op) override;
45 bool prepare_update(MonOpRequestRef op) override;
46
47 void encode_full(MonitorDBStore::TransactionRef t) override { }
48
49 bool preprocess_report(MonOpRequestRef op);
50 bool prepare_report(MonOpRequestRef op);
51
52 bool preprocess_getpoolstats(MonOpRequestRef op);
53 bool preprocess_statfs(MonOpRequestRef op);
54
55 void check_sub(Subscription *sub);
56 void check_subs();
57 void send_digests();
58
59 void on_active() override;
60 void get_health(list<pair<health_status_t,string> >& summary,
61 list<pair<health_status_t,string> > *detail,
62 CephContext *cct) const override;
63 void tick() override;
64
65 uint64_t get_last_osd_stat_seq(int osd) {
66 return digest.get_last_osd_stat_seq(osd);
67 }
68
69 void update_logger();
70
71 void print_summary(Formatter *f, std::ostream *ss) const;
72
73 MonPGStatService *get_pg_stat_service();
74 const ServiceMap& get_service_map() {
75 return service_map;
76 }
77
78 friend class C_Updated;
79 };