]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGNotify2.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGNotify2.h
CommitLineData
9f95a23c
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 "messages/MOSDPeeringOp.h"
7#include "osd/PGPeeringEvent.h"
8
f67539c2 9class MOSDPGNotify2 final : public MOSDPeeringOp {
9f95a23c
TL
10private:
11 static constexpr int HEAD_VERSION = 1;
12 static constexpr int COMPAT_VERSION = 1;
13
14public:
15 spg_t spgid;
16 pg_notify_t notify;
17
18 spg_t get_spg() const override {
19 return spgid;
20 }
21 epoch_t get_map_epoch() const override {
22 return notify.epoch_sent;
23 }
24 epoch_t get_min_epoch() const override {
25 return notify.query_epoch;
26 }
27
28 PGPeeringEvent *get_event() override {
29 return new PGPeeringEvent(
30 notify.epoch_sent,
31 notify.query_epoch,
32 MNotifyRec(
33 spgid,
34 pg_shard_t(get_source().num(), notify.from),
35 notify,
36 get_connection()->get_features()),
37 true,
38 new PGCreateInfo(
39 spgid,
40 notify.epoch_sent,
41 notify.info.history,
42 notify.past_intervals,
43 false));
44 }
45
46 MOSDPGNotify2() : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2,
47 HEAD_VERSION, COMPAT_VERSION} {
48 set_priority(CEPH_MSG_PRIO_HIGH);
49 }
50 MOSDPGNotify2(
51 spg_t s,
52 pg_notify_t n)
53 : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2, HEAD_VERSION, COMPAT_VERSION},
54 spgid(s),
55 notify(n) {
56 set_priority(CEPH_MSG_PRIO_HIGH);
57 }
58
59private:
f67539c2 60 ~MOSDPGNotify2() final {}
9f95a23c
TL
61
62public:
63 std::string_view get_type_name() const override {
64 return "pg_notify2";
65 }
66 void inner_print(std::ostream& out) const override {
67 out << spgid << " " << notify;
68 }
69
70 void encode_payload(uint64_t features) override {
71 using ceph::encode;
72 encode(spgid, payload);
73 encode(notify, payload);
74 }
75 void decode_payload() override {
76 using ceph::decode;
77 auto p = payload.cbegin();
78 decode(spgid, p);
79 decode(notify, p);
80 }
81private:
82 template<class T, typename... Args>
83 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
84};