]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGInfo.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MOSDPGInfo.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) 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
22 class MOSDPGInfo : public MessageInstance<MOSDPGInfo> {
23 public:
24 friend factory;
25 private:
26 static constexpr int HEAD_VERSION = 5;
27 static constexpr int COMPAT_VERSION = 5;
28
29 epoch_t epoch = 0;
30
31 public:
32 vector<pair<pg_notify_t,PastIntervals> > pg_list;
33
34 epoch_t get_epoch() const { return epoch; }
35
36 MOSDPGInfo()
37 : MessageInstance(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION) {
38 set_priority(CEPH_MSG_PRIO_HIGH);
39 }
40 MOSDPGInfo(version_t mv)
41 : MessageInstance(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION),
42 epoch(mv) {
43 set_priority(CEPH_MSG_PRIO_HIGH);
44 }
45 private:
46 ~MOSDPGInfo() override {}
47
48 public:
49 std::string_view get_type_name() const override { return "pg_info"; }
50 void print(ostream& out) const override {
51 out << "pg_info(";
52 for (auto i = pg_list.begin();
53 i != pg_list.end();
54 ++i) {
55 if (i != pg_list.begin())
56 out << " ";
57 out << i->first << "=" << i->second;
58 }
59 out << " epoch " << epoch
60 << ")";
61 }
62
63 void encode_payload(uint64_t features) override {
64 using ceph::encode;
65 encode(epoch, payload);
66 encode(pg_list, payload);
67 }
68 void decode_payload() override {
69 auto p = payload.cbegin();
70 decode(epoch, p);
71 decode(pg_list, p);
72 }
73 };
74
75 #endif