]> git.proxmox.com Git - ceph.git/blob - ceph/src/mon/MgrStatMonitor.h
update sources to v12.1.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 preprocess_query(MonOpRequestRef op) override;
41 bool prepare_update(MonOpRequestRef op) override;
42
43 void encode_full(MonitorDBStore::TransactionRef t) override { }
44
45 bool preprocess_report(MonOpRequestRef op);
46 bool prepare_report(MonOpRequestRef op);
47
48 bool preprocess_getpoolstats(MonOpRequestRef op);
49 bool preprocess_statfs(MonOpRequestRef op);
50
51 void check_sub(Subscription *sub);
52 void check_subs();
53 void send_digests();
54
55 void on_active() override;
56 void get_health(list<pair<health_status_t,string> >& summary,
57 list<pair<health_status_t,string> > *detail,
58 CephContext *cct) const override;
59 void tick() override;
60
61 uint64_t get_last_osd_stat_seq(int osd) {
62 return digest.get_last_osd_stat_seq(osd);
63 }
64
65 void update_logger();
66
67 void print_summary(Formatter *f, std::ostream *ss) const;
68
69 MonPGStatService *get_pg_stat_service();
70 const ServiceMap& get_service_map() {
71 return service_map;
72 }
73
74 friend class C_Updated;
75 };