Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / 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 struct MMonQuorumService : public Message
20 {
21   epoch_t epoch;
22   version_t round;
23
24   MMonQuorumService(int type, int head=1, int compat=1) :
25     Message(type, head, compat),
26     epoch(0),
27     round(0)
28   { }
29
30 protected:
31   ~MMonQuorumService() override { }
32
33 public:
34
35   void set_epoch(epoch_t e) {
36     epoch = e;
37   }
38
39   void set_round(version_t r) {
40     round = r;
41   }
42
43   epoch_t get_epoch() const {
44     return epoch;
45   }
46
47   version_t get_round() const {
48     return round;
49   }
50
51   void service_encode() {
52     ::encode(epoch, payload);
53     ::encode(round, payload);
54   }
55
56   void service_decode(bufferlist::iterator &p) {
57     ::decode(epoch, p);
58     ::decode(round, p);
59   }
60
61   void encode_payload(uint64_t features) override {
62     assert(0 == "MMonQuorumService message must always be a base class");
63   }
64
65   void decode_payload() override {
66     assert(0 == "MMonQuorumService message must always be a base class");
67   }
68
69   const char *get_type_name() const override { return "quorum_service"; }
70 };
71
72 #endif /* CEPH_MMON_QUORUM_SERVICE_H */