]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMonQuorumService.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / messages / MMonQuorumService.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_QUORUM_SERVICE_H
15 #define CEPH_MMON_QUORUM_SERVICE_H
16
17 #include "msg/Message.h"
18
19 class MMonQuorumService : public Message {
20 public:
21 epoch_t epoch = 0;
22 version_t round = 0;
23
24 protected:
25 MMonQuorumService(int type, int head)
26 : Message{type, head, 1}
27 {}
28 ~MMonQuorumService() override {}
29
30 public:
31 void set_epoch(epoch_t e) {
32 epoch = e;
33 }
34
35 void set_round(version_t r) {
36 round = r;
37 }
38
39 epoch_t get_epoch() const {
40 return epoch;
41 }
42
43 version_t get_round() const {
44 return round;
45 }
46
47 void service_encode() {
48 using ceph::encode;
49 encode(epoch, payload);
50 encode(round, payload);
51 }
52
53 void service_decode(ceph::buffer::list::const_iterator &p) {
54 using ceph::decode;
55 decode(epoch, p);
56 decode(round, p);
57 }
58
59 void encode_payload(uint64_t features) override {
60 ceph_abort_msg("MMonQuorumService message must always be a base class");
61 }
62
63 void decode_payload() override {
64 ceph_abort_msg("MMonQuorumService message must always be a base class");
65 }
66
67 std::string_view get_type_name() const override { return "quorum_service"; }
68 };
69
70 #endif /* CEPH_MMON_QUORUM_SERVICE_H */