]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDFull.h
update source to Ceph Pacific 16.2.2
[ceph.git] / 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 final : public PaxosServiceMessage {
15 public:
16 epoch_t map_epoch = 0;
17 uint32_t state = 0;
18
19 private:
20 ~MOSDFull() final {}
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 using ceph::encode;
31 paxos_encode();
32 encode(map_epoch, payload);
33 encode(state, payload);
34 }
35 void decode_payload() {
36 using ceph::decode;
37 auto p = payload.cbegin();
38 paxos_decode(p);
39 decode(map_epoch, p);
40 decode(state, p);
41 }
42
43 std::string_view get_type_name() const { return "osd_full"; }
44 void print(std::ostream &out) const {
45 std::set<std::string> states;
46 OSDMap::calc_state_set(state, states);
47 out << "osd_full(e" << map_epoch << " " << states << " v" << version << ")";
48 }
49 private:
50 template<class T, typename... Args>
51 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
52 };
53
54 #endif