]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MGetConfig.h
Import ceph 15.2.8
[ceph.git] / ceph / src / messages / MGetConfig.h
CommitLineData
11fdf7f2
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#pragma once
5
6#include "msg/Message.h"
7
9f95a23c 8class MGetConfig : public Message {
11fdf7f2 9public:
11fdf7f2
TL
10 static constexpr int HEAD_VERSION = 1;
11 static constexpr int COMPAT_VERSION = 1;
12
13 EntityName name; ///< e.g., mon.a, client.foo
9f95a23c
TL
14 std::string host; ///< our hostname
15 std::string device_class;
11fdf7f2 16
9f95a23c
TL
17 MGetConfig() : Message{MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION} { }
18 MGetConfig(const EntityName& n, const std::string& h)
19 : Message{MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION},
11fdf7f2
TL
20 name(n),
21 host(h) {}
22
23 std::string_view get_type_name() const override {
24 return "get_config";
25 }
9f95a23c 26 void print(std::ostream& o) const override {
11fdf7f2
TL
27 o << "get_config(" << name << "@" << host;
28 if (device_class.size()) {
29 o << " device_class " << device_class;
30 }
31 o << ")";
32 }
33
34 void decode_payload() override {
35 using ceph::decode;
36 auto p = payload.cbegin();
37 decode(name, p);
38 decode(host, p);
39 decode(device_class, p);
40 }
41
42 void encode_payload(uint64_t) override {
43 using ceph::encode;
44 encode(name, payload);
45 encode(host, payload);
46 encode(device_class, payload);
47 }
48};