]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMonHealth.h
aecdf00800d015b38e2a985946a37f2e14ee18cc
[ceph.git] / ceph / src / messages / MMonHealth.h
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
21 struct MMonHealth : public MMonQuorumService
22 {
23 static const int HEAD_VERSION = 1;
24
25 enum {
26 OP_TELL = 1,
27 };
28
29 int service_type;
30 int service_op;
31
32 // service specific data
33 DataStats data_stats;
34
35 MMonHealth() : MMonQuorumService(MSG_MON_HEALTH, HEAD_VERSION) { }
36 MMonHealth(uint32_t type, int op = 0) :
37 MMonQuorumService(MSG_MON_HEALTH, HEAD_VERSION),
38 service_type(type),
39 service_op(op)
40 { }
41
42 private:
43 ~MMonHealth() override { }
44
45 public:
46 const char *get_type_name() const override { return "mon_health"; }
47 const char *get_service_op_name() const {
48 switch (service_op) {
49 case OP_TELL: return "tell";
50 }
51 return "???";
52 }
53 void print(ostream &o) const override {
54 o << "mon_health( service " << get_service_type()
55 << " op " << get_service_op_name()
56 << " e " << get_epoch() << " r " << get_round()
57 << " )";
58 }
59
60 int get_service_type() const {
61 return service_type;
62 }
63
64 int get_service_op() {
65 return service_op;
66 }
67
68 void decode_payload() override {
69 bufferlist::iterator p = payload.begin();
70 service_decode(p);
71 ::decode(service_type, p);
72 ::decode(service_op, p);
73 ::decode(data_stats, p);
74 }
75
76 void encode_payload(uint64_t features) override {
77 service_encode();
78 ::encode(service_type, payload);
79 ::encode(service_op, payload);
80 ::encode(data_stats, payload);
81 }
82
83 };
84
85 #endif /* CEPH_MMON_HEALTH_H */