]>
Commit | Line | Data |
---|---|---|
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) 2012 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_MMON_HEALTH_H | |
15 | #define CEPH_MMON_HEALTH_H | |
16 | ||
17 | #include "msg/Message.h" | |
18 | #include "messages/MMonQuorumService.h" | |
19 | #include "mon/mon_types.h" | |
20 | ||
11fdf7f2 TL |
21 | class MMonHealth : public MessageInstance<MMonHealth, MMonQuorumService> { |
22 | public: | |
23 | friend factory; | |
7c673cae | 24 | |
11fdf7f2 | 25 | static constexpr int HEAD_VERSION = 1; |
7c673cae | 26 | |
d2e6a577 FG |
27 | int service_type = 0; |
28 | int service_op = 0; | |
7c673cae FG |
29 | |
30 | // service specific data | |
31 | DataStats data_stats; | |
32 | ||
11fdf7f2 | 33 | MMonHealth() : MessageInstance(MSG_MON_HEALTH, HEAD_VERSION) { } |
7c673cae FG |
34 | |
35 | private: | |
36 | ~MMonHealth() override { } | |
37 | ||
38 | public: | |
11fdf7f2 | 39 | std::string_view get_type_name() const override { return "mon_health"; } |
7c673cae | 40 | void print(ostream &o) const override { |
11fdf7f2 TL |
41 | o << "mon_health(" |
42 | << " e " << get_epoch() | |
43 | << " r " << get_round() | |
7c673cae FG |
44 | << " )"; |
45 | } | |
46 | ||
7c673cae | 47 | void decode_payload() override { |
11fdf7f2 | 48 | auto p = payload.cbegin(); |
7c673cae | 49 | service_decode(p); |
11fdf7f2 TL |
50 | decode(service_type, p); |
51 | decode(service_op, p); | |
52 | decode(data_stats, p); | |
7c673cae FG |
53 | } |
54 | ||
55 | void encode_payload(uint64_t features) override { | |
11fdf7f2 | 56 | using ceph::encode; |
7c673cae | 57 | service_encode(); |
11fdf7f2 TL |
58 | encode(service_type, payload); |
59 | encode(service_op, payload); | |
60 | encode(data_stats, payload); | |
7c673cae FG |
61 | } |
62 | ||
63 | }; | |
64 | ||
65 | #endif /* CEPH_MMON_HEALTH_H */ |