]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGNotify2.h
Import ceph 15.2.8
[ceph.git] / ceph / src / messages / MOSDPGNotify2.h
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
9 class MOSDPGNotify2 : public MOSDPeeringOp {
10 private:
11 static constexpr int HEAD_VERSION = 1;
12 static constexpr int COMPAT_VERSION = 1;
13
14 public:
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
59 private:
60 ~MOSDPGNotify2() override {}
61
62 public:
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 }
81 private:
82 template<class T, typename... Args>
83 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
84 };