]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGNotify2.h
update ceph source to reef 18.1.2
[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 final : 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 #ifdef WITH_SEASTAR
37 features
38 #else
39 get_connection()->get_features()
40 #endif
41 ),
42 true,
43 new PGCreateInfo(
44 spgid,
45 notify.epoch_sent,
46 notify.info.history,
47 notify.past_intervals,
48 false));
49 }
50
51 MOSDPGNotify2() : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2,
52 HEAD_VERSION, COMPAT_VERSION} {
53 set_priority(CEPH_MSG_PRIO_HIGH);
54 }
55 MOSDPGNotify2(
56 spg_t s,
57 pg_notify_t n)
58 : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2, HEAD_VERSION, COMPAT_VERSION},
59 spgid(s),
60 notify(n) {
61 set_priority(CEPH_MSG_PRIO_HIGH);
62 }
63
64 private:
65 ~MOSDPGNotify2() final {}
66
67 public:
68 std::string_view get_type_name() const override {
69 return "pg_notify2";
70 }
71 void inner_print(std::ostream& out) const override {
72 out << spgid << " " << notify;
73 }
74
75 void encode_payload(uint64_t features) override {
76 using ceph::encode;
77 encode(spgid, payload);
78 encode(notify, payload);
79 }
80 void decode_payload() override {
81 using ceph::decode;
82 auto p = payload.cbegin();
83 decode(spgid, p);
84 decode(notify, p);
85 }
86 private:
87 template<class T, typename... Args>
88 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
89 };