]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMonGetOSDMap.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / messages / MMonGetOSDMap.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) 2014 Red Hat
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
15 #ifndef CEPH_MMONGETOSDMAP_H
16 #define CEPH_MMONGETOSDMAP_H
17
18 #include <iostream>
19 #include <string>
20 #include <string_view>
21
22 #include "msg/Message.h"
23
24 #include "include/types.h"
25
26 class MMonGetOSDMap final : public PaxosServiceMessage {
27 private:
28 epoch_t full_first, full_last;
29 epoch_t inc_first, inc_last;
30
31 public:
32 MMonGetOSDMap()
33 : PaxosServiceMessage{CEPH_MSG_MON_GET_OSDMAP, 0},
34 full_first(0),
35 full_last(0),
36 inc_first(0),
37 inc_last(0) { }
38 private:
39 ~MMonGetOSDMap() final {}
40
41 public:
42 void request_full(epoch_t first, epoch_t last) {
43 ceph_assert(last >= first);
44 full_first = first;
45 full_last = last;
46 }
47 void request_inc(epoch_t first, epoch_t last) {
48 ceph_assert(last >= first);
49 inc_first = first;
50 inc_last = last;
51 }
52 epoch_t get_full_first() const {
53 return full_first;
54 }
55 epoch_t get_full_last() const {
56 return full_last;
57 }
58 epoch_t get_inc_first() const {
59 return inc_first;
60 }
61 epoch_t get_inc_last() const {
62 return inc_last;
63 }
64
65 std::string_view get_type_name() const override { return "mon_get_osdmap"; }
66 void print(std::ostream& out) const override {
67 out << "mon_get_osdmap(";
68 if (full_first && full_last)
69 out << "full " << full_first << "-" << full_last;
70 if (inc_first && inc_last)
71 out << " inc" << inc_first << "-" << inc_last;
72 out << ")";
73 }
74
75 void encode_payload(uint64_t features) override {
76 using ceph::encode;
77 paxos_encode();
78 encode(full_first, payload);
79 encode(full_last, payload);
80 encode(inc_first, payload);
81 encode(inc_last, payload);
82 }
83 void decode_payload() override {
84 using ceph::decode;
85 auto p = payload.cbegin();
86 paxos_decode(p);
87 decode(full_first, p);
88 decode(full_last, p);
89 decode(inc_first, p);
90 decode(inc_last, p);
91 }
92 private:
93 template<class T, typename... Args>
94 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
95 };
96
97 #endif