]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGInfo.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / messages / MOSDPGInfo.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) 2004-2006 Sage Weil <sage@newdream.net>
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
16#ifndef CEPH_MOSDPGINFO_H
17#define CEPH_MOSDPGINFO_H
18
19#include "msg/Message.h"
20#include "osd/osd_types.h"
21
f67539c2 22class MOSDPGInfo final : public Message {
11fdf7f2 23private:
9f95a23c 24 static constexpr int HEAD_VERSION = 6;
20effc67 25 static constexpr int COMPAT_VERSION = 6;
7c673cae 26
d2e6a577 27 epoch_t epoch = 0;
7c673cae
FG
28
29public:
9f95a23c
TL
30 using pg_list_t = std::vector<pg_notify_t>;
31 pg_list_t pg_list;
7c673cae
FG
32
33 epoch_t get_epoch() const { return epoch; }
34
35 MOSDPGInfo()
9f95a23c
TL
36 : MOSDPGInfo{0, {}}
37 {}
38 MOSDPGInfo(epoch_t mv)
39 : MOSDPGInfo(mv, {})
40 {}
41 MOSDPGInfo(epoch_t mv, pg_list_t&& l)
42 : Message{MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION},
43 epoch{mv},
44 pg_list{std::move(l)}
45 {
7c673cae
FG
46 set_priority(CEPH_MSG_PRIO_HIGH);
47 }
48private:
f67539c2 49 ~MOSDPGInfo() final {}
7c673cae
FG
50
51public:
11fdf7f2 52 std::string_view get_type_name() const override { return "pg_info"; }
f67539c2 53 void print(std::ostream& out) const override {
7c673cae
FG
54 out << "pg_info(";
55 for (auto i = pg_list.begin();
56 i != pg_list.end();
57 ++i) {
58 if (i != pg_list.begin())
59 out << " ";
9f95a23c 60 out << *i;
7c673cae
FG
61 }
62 out << " epoch " << epoch
63 << ")";
64 }
65
66 void encode_payload(uint64_t features) override {
11fdf7f2 67 using ceph::encode;
9f95a23c 68 header.version = HEAD_VERSION;
11fdf7f2 69 encode(epoch, payload);
20effc67 70 assert(HAVE_FEATURE(features, SERVER_OCTOPUS));
11fdf7f2 71 encode(pg_list, payload);
7c673cae
FG
72 }
73 void decode_payload() override {
f67539c2 74 using ceph::decode;
11fdf7f2
TL
75 auto p = payload.cbegin();
76 decode(epoch, p);
77 decode(pg_list, p);
7c673cae 78 }
9f95a23c
TL
79private:
80 template<class T, typename... Args>
81 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
82};
83
84#endif