Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MOSDFull.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_MOSDFULL_H
5 #define CEPH_MOSDFULL_H
6
7 #include "messages/PaxosServiceMessage.h"
8 #include "osd/OSDMap.h"
9
10 // tell the mon to update the full/nearfull bits.  note that in the
11 // future this message could be generalized to other state bits, but
12 // for now name it for its sole application.
13
14 class MOSDFull : public PaxosServiceMessage {
15  public:
16   epoch_t map_epoch = 0;
17   uint32_t state = 0;
18
19 private:
20   ~MOSDFull() {}
21
22 public:
23   MOSDFull(epoch_t e, unsigned s)
24     : PaxosServiceMessage(MSG_OSD_FULL, e), map_epoch(e), state(s) { }
25   MOSDFull()
26     : PaxosServiceMessage(MSG_OSD_FULL, 0) {}
27
28 public:
29   void encode_payload(uint64_t features) {
30     paxos_encode();
31     ::encode(map_epoch, payload);
32     ::encode(state, payload);
33   }
34   void decode_payload() {
35     bufferlist::iterator p = payload.begin();
36     paxos_decode(p);
37     ::decode(map_epoch, p);
38     ::decode(state, p);
39   }
40
41   const char *get_type_name() const { return "osd_full"; }
42   void print(ostream &out) const {
43     set<string> states;
44     OSDMap::calc_state_set(state, states);
45     out << "osd_full(e" << map_epoch << " " << states << " v" << version << ")";
46   }
47
48 };
49
50 #endif