1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
6 #include "include/Context.h"
7 #include "PaxosService.h"
9 #include "mgr/ServiceMap.h"
11 class MonPGStatService
;
12 class MgrPGStatService
;
14 class MgrStatMonitor
: public PaxosService
{
16 version_t version
= 0;
18 ServiceMap service_map
;
21 PGMapDigest pending_digest
;
22 health_check_map_t pending_health_checks
;
23 bufferlist pending_service_map_bl
;
25 std::unique_ptr
<MgrPGStatService
> pgservice
;
28 MgrStatMonitor(Monitor
*mn
, Paxos
*p
, const string
& service_name
);
29 ~MgrStatMonitor() override
;
31 void init() override
{}
32 void on_shutdown() override
{}
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
;
40 bool definitely_converted_snapsets() const {
41 return digest
.definitely_converted_snapsets();
44 bool preprocess_query(MonOpRequestRef op
) override
;
45 bool prepare_update(MonOpRequestRef op
) override
;
47 void encode_full(MonitorDBStore::TransactionRef t
) override
{ }
49 bool preprocess_report(MonOpRequestRef op
);
50 bool prepare_report(MonOpRequestRef op
);
52 bool preprocess_getpoolstats(MonOpRequestRef op
);
53 bool preprocess_statfs(MonOpRequestRef op
);
55 void check_sub(Subscription
*sub
);
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
;
65 uint64_t get_last_osd_stat_seq(int osd
) {
66 return digest
.get_last_osd_stat_seq(osd
);
71 void print_summary(Formatter
*f
, std::ostream
*ss
) const;
73 MonPGStatService
*get_pg_stat_service();
74 const ServiceMap
& get_service_map() {
78 friend class C_Updated
;