]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MMonGetVersionReply.h
407b449a0659ddc1136eb7e2595402d838d95de5
[ceph.git] / ceph / src / messages / MMonGetVersionReply.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) 2011 New Dream Network
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_MMONGETVERSIONREPLY_H
16 #define CEPH_MMONGETVERSIONREPLY_H
17
18 #include "msg/Message.h"
19
20 #include "include/types.h"
21
22 /*
23 * This message is sent from the monitors to clients in response to a
24 * MMonGetVersion. The latest version of the requested thing is sent
25 * back.
26 */
27 class MMonGetVersionReply final : public Message {
28 private:
29 static constexpr int HEAD_VERSION = 2;
30
31 public:
32 MMonGetVersionReply() : Message{CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION} { }
33
34 std::string_view get_type_name() const override {
35 return "mon_get_version_reply";
36 }
37
38 void print(std::ostream& o) const override {
39 o << "mon_get_version_reply(handle=" << handle << " version=" << version << ")";
40 }
41
42 void encode_payload(uint64_t features) override {
43 using ceph::encode;
44 encode(handle, payload);
45 encode(version, payload);
46 encode(oldest_version, payload);
47 }
48
49 void decode_payload() override {
50 using ceph::decode;
51 auto p = payload.cbegin();
52 decode(handle, p);
53 decode(version, p);
54 if (header.version >= 2)
55 decode(oldest_version, p);
56 }
57
58 ceph_tid_t handle = 0;
59 version_t version = 0;
60 version_t oldest_version = 0;
61
62 private:
63 ~MMonGetVersionReply() final {}
64 };
65
66 #endif