]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MClientMetrics.h
bump version to 19.2.0-pve1
[ceph.git] / ceph / src / messages / MClientMetrics.h
CommitLineData
f67539c2
TL
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_MDS_CLIENT_METRICS_H
5#define CEPH_MDS_CLIENT_METRICS_H
6
7#include <vector>
8
9#include "msg/Message.h"
10#include "include/cephfs/metrics/Types.h"
11
12class MClientMetrics final : public SafeMessage {
13private:
14 static constexpr int HEAD_VERSION = 1;
15 static constexpr int COMPAT_VERSION = 1;
f78120f9
TL
16 static constexpr int PRIORITY = CEPH_MSG_PRIO_HIGH-1;
17
f67539c2
TL
18public:
19 std::vector<ClientMetricMessage> updates;
20
21protected:
f78120f9
TL
22 MClientMetrics() : MClientMetrics(std::vector<ClientMetricMessage>{}) {
23 set_priority(PRIORITY);
24 }
f67539c2
TL
25 MClientMetrics(std::vector<ClientMetricMessage> updates)
26 : SafeMessage(CEPH_MSG_CLIENT_METRICS, HEAD_VERSION, COMPAT_VERSION), updates(updates) {
f78120f9 27 set_priority(PRIORITY);
f67539c2
TL
28 }
29 ~MClientMetrics() final {}
30
31public:
32 std::string_view get_type_name() const override {
33 return "client_metrics";
34 }
35
20effc67 36 void print(std::ostream &out) const override {
f67539c2
TL
37 out << "client_metrics ";
38 for (auto &i : updates) {
39 i.print(&out);
40 }
41 }
42
43 void encode_payload(uint64_t features) override {
44 using ceph::encode;
45 encode(updates, payload);
46 }
47
48 void decode_payload() override {
49 using ceph::decode;
50 auto iter = payload.cbegin();
51 decode(updates, iter);
52 }
53
54private:
55 template<class T, typename... Args>
56 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
20effc67
TL
57 template<class T, typename... Args>
58 friend MURef<T> crimson::make_message(Args&&... args);
f67539c2
TL
59};
60
61#endif // CEPH_MDS_CLIENT_METRICS_H