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