]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDBeacon.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDBeacon.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#pragma once
5
11fdf7f2
TL
6#include "PaxosServiceMessage.h"
7
9f95a23c
TL
8class MOSDBeacon : public PaxosServiceMessage {
9private:
f67539c2 10 static constexpr int HEAD_VERSION = 3;
9f95a23c 11 static constexpr int COMPAT_VERSION = 1;
7c673cae
FG
12public:
13 std::vector<pg_t> pgs;
14 epoch_t min_last_epoch_clean = 0;
9f95a23c 15 utime_t last_purged_snaps_scrub;
f67539c2 16 int osd_beacon_report_interval = 0;
7c673cae
FG
17
18 MOSDBeacon()
9f95a23c
TL
19 : PaxosServiceMessage{MSG_OSD_BEACON, 0,
20 HEAD_VERSION, COMPAT_VERSION}
7c673cae 21 {}
f67539c2 22 MOSDBeacon(epoch_t e, epoch_t min_lec, utime_t ls, int interval)
9f95a23c
TL
23 : PaxosServiceMessage{MSG_OSD_BEACON, e,
24 HEAD_VERSION, COMPAT_VERSION},
25 min_last_epoch_clean(min_lec),
f67539c2
TL
26 last_purged_snaps_scrub(ls),
27 osd_beacon_report_interval(interval)
7c673cae
FG
28 {}
29 void encode_payload(uint64_t features) override {
11fdf7f2 30 using ceph::encode;
7c673cae 31 paxos_encode();
11fdf7f2
TL
32 encode(pgs, payload);
33 encode(min_last_epoch_clean, payload);
9f95a23c 34 encode(last_purged_snaps_scrub, payload);
f67539c2 35 encode(osd_beacon_report_interval, payload);
7c673cae
FG
36 }
37 void decode_payload() override {
11fdf7f2 38 auto p = payload.cbegin();
f67539c2 39 using ceph::decode;
7c673cae 40 paxos_decode(p);
11fdf7f2
TL
41 decode(pgs, p);
42 decode(min_last_epoch_clean, p);
9f95a23c
TL
43 if (header.version >= 2) {
44 decode(last_purged_snaps_scrub, p);
45 }
f67539c2
TL
46 if (header.version >= 3) {
47 decode(osd_beacon_report_interval, p);
48 } else {
49 osd_beacon_report_interval = 0;
50 }
7c673cae 51 }
11fdf7f2 52 std::string_view get_type_name() const override { return "osd_beacon"; }
f67539c2 53 void print(std::ostream &out) const {
7c673cae
FG
54 out << get_type_name()
55 << "(pgs " << pgs
56 << " lec " << min_last_epoch_clean
f67539c2
TL
57 << " last_purged_snaps_scrub " << last_purged_snaps_scrub
58 << " osd_beacon_report_interval " << osd_beacon_report_interval
7c673cae
FG
59 << " v" << version << ")";
60 }
9f95a23c
TL
61private:
62 template<class T, typename... Args>
63 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae 64};