]>
Commit | Line | Data |
---|---|---|
31f18b77 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) 2017 Greg Farnum/Red Hat <gfarnum@redhat.com> | |
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 | ||
15 | #ifndef CEPH_MMONMGRREPORT_H | |
16 | #define CEPH_MMONMGRREPORT_H | |
17 | ||
18 | #include "messages/PaxosServiceMessage.h" | |
19 | #include "include/types.h" | |
20 | ||
21 | // health_status_t | |
22 | static inline void encode(health_status_t hs, bufferlist& bl) { | |
23 | uint8_t v = hs; | |
24 | ::encode(v, bl); | |
25 | } | |
26 | static inline void decode(health_status_t& hs, bufferlist::iterator& p) { | |
27 | uint8_t v; | |
28 | ::decode(v, p); | |
29 | hs = health_status_t(v); | |
30 | } | |
31 | ||
32 | class MMonMgrReport : public PaxosServiceMessage { | |
33 | ||
34 | static const int HEAD_VERSION = 1; | |
35 | static const int COMPAT_VERSION = 1; | |
36 | ||
37 | public: | |
38 | // PGMapDigest is in data payload | |
39 | list<pair<health_status_t,std::string>> health_summary, health_detail; | |
40 | ||
41 | MMonMgrReport() | |
42 | : PaxosServiceMessage(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION) | |
43 | {} | |
44 | private: | |
45 | ~MMonMgrReport() override {} | |
46 | ||
47 | public: | |
48 | const char *get_type_name() const override { return "monmgrreport"; } | |
49 | ||
50 | void print(ostream& out) const override { | |
51 | out << get_type_name(); | |
52 | } | |
53 | ||
54 | void encode_payload(uint64_t features) override { | |
55 | paxos_encode(); | |
56 | ::encode(health_summary, payload); | |
57 | ::encode(health_detail, payload); | |
58 | } | |
59 | void decode_payload() override { | |
60 | bufferlist::iterator p = payload.begin(); | |
61 | paxos_decode(p); | |
62 | ::decode(health_summary, p); | |
63 | ::decode(health_detail, p); | |
64 | } | |
65 | }; | |
66 | ||
67 | #endif |