]> git.proxmox.com Git - ceph.git/blame - ceph/src/mon/HealthMonitor.h
update sources to v12.1.1
[ceph.git] / ceph / src / mon / HealthMonitor.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 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2013 Inktank, Inc
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14#ifndef CEPH_HEALTH_MONITOR_H
15#define CEPH_HEALTH_MONITOR_H
16
224ce89b 17#include "mon/PaxosService.h"
7c673cae
FG
18
19//forward declaration
20namespace ceph { class Formatter; }
21class HealthService;
22
224ce89b 23class HealthMonitor : public PaxosService
7c673cae
FG
24{
25 map<int,HealthService*> services;
224ce89b
WB
26 version_t version = 0;
27 map<int,health_check_map_t> quorum_checks; // for each quorum member
28 health_check_map_t leader_checks; // leader only
7c673cae
FG
29
30public:
224ce89b 31 HealthMonitor(Monitor *m, Paxos *p, const string& service_name);
7c673cae
FG
32 ~HealthMonitor() override {
33 assert(services.empty());
34 }
35
7c673cae
FG
36 /**
37 * @defgroup HealthMonitor_Inherited_h Inherited abstract methods
38 * @{
39 */
40 void init() override;
7c673cae 41
224ce89b
WB
42 void get_health(
43 list<pair<health_status_t,string> >& summary,
44 list<pair<health_status_t,string> > *detail,
45 CephContext *cct) const override {}
7c673cae 46
224ce89b
WB
47 bool preprocess_query(MonOpRequestRef op) override;
48 bool prepare_update(MonOpRequestRef op) override;
7c673cae 49
224ce89b
WB
50 bool preprocess_health_checks(MonOpRequestRef op);
51 bool prepare_health_checks(MonOpRequestRef op);
7c673cae 52
224ce89b
WB
53 bool check_leader_health();
54 bool check_member_health();
7c673cae 55
224ce89b
WB
56 void create_initial() override;
57 void update_from_paxos(bool *need_bootstrap) override;
58 void create_pending() override;
59 void encode_pending(MonitorDBStore::TransactionRef t) override;
60 version_t get_trim_to() override;
61
62 void encode_full(MonitorDBStore::TransactionRef t) override { }
63
64 void tick() override;
7c673cae
FG
65
66 /**
67 * @} // HealthMonitor_Inherited_h
68 */
69};
70
71#endif // CEPH_HEALTH_MONITOR_H