]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MMonGetOSDMap.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / messages / MMonGetOSDMap.h
CommitLineData
7c673cae
FG
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
9f95a23c
TL
18#include <iostream>
19#include <string>
20#include <string_view>
21
7c673cae
FG
22#include "msg/Message.h"
23
24#include "include/types.h"
25
9f95a23c 26class MMonGetOSDMap : public PaxosServiceMessage {
11fdf7f2 27private:
7c673cae
FG
28 epoch_t full_first, full_last;
29 epoch_t inc_first, inc_last;
30
31public:
32 MMonGetOSDMap()
9f95a23c 33 : PaxosServiceMessage{CEPH_MSG_MON_GET_OSDMAP, 0},
7c673cae
FG
34 full_first(0),
35 full_last(0),
36 inc_first(0),
37 inc_last(0) { }
38private:
39 ~MMonGetOSDMap() override {}
40
41public:
42 void request_full(epoch_t first, epoch_t last) {
11fdf7f2 43 ceph_assert(last >= first);
7c673cae
FG
44 full_first = first;
45 full_last = last;
46 }
47 void request_inc(epoch_t first, epoch_t last) {
11fdf7f2 48 ceph_assert(last >= first);
7c673cae
FG
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
11fdf7f2 65 std::string_view get_type_name() const override { return "mon_get_osdmap"; }
9f95a23c 66 void print(std::ostream& out) const override {
7c673cae
FG
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 {
11fdf7f2 76 using ceph::encode;
7c673cae 77 paxos_encode();
11fdf7f2
TL
78 encode(full_first, payload);
79 encode(full_last, payload);
80 encode(inc_first, payload);
81 encode(inc_last, payload);
7c673cae
FG
82 }
83 void decode_payload() override {
11fdf7f2
TL
84 using ceph::decode;
85 auto p = payload.cbegin();
7c673cae 86 paxos_decode(p);
11fdf7f2
TL
87 decode(full_first, p);
88 decode(full_last, p);
89 decode(inc_first, p);
90 decode(inc_last, p);
7c673cae 91 }
9f95a23c
TL
92private:
93 template<class T, typename... Args>
94 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
95};
96
97#endif