]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDMarkMeDown.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / messages / MOSDMarkMeDown.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) 2013 Inktank Storage, Inc.
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 #ifndef CEPH_MOSDMARKMEDOWN_H
16 #define CEPH_MOSDMARKMEDOWN_H
17
18 #include "messages/PaxosServiceMessage.h"
19
20 class MOSDMarkMeDown final : public PaxosServiceMessage {
21 private:
22 static constexpr int HEAD_VERSION = 4;
23 static constexpr int COMPAT_VERSION = 3;
24
25 public:
26 uuid_d fsid;
27 int32_t target_osd;
28 entity_addrvec_t target_addrs;
29 epoch_t epoch = 0;
30 bool request_ack = false; // ack requested
31 bool down_and_dead = false; // mark down and dead
32
33 MOSDMarkMeDown()
34 : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, 0,
35 HEAD_VERSION, COMPAT_VERSION} { }
36 MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av,
37 epoch_t e, bool request_ack)
38 : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, e,
39 HEAD_VERSION, COMPAT_VERSION},
40 fsid(fs), target_osd(osd), target_addrs(av),
41 epoch(e), request_ack(request_ack) {}
42 MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av,
43 epoch_t e, bool request_ack, bool down_and_dead)
44 : PaxosServiceMessage{MSG_OSD_MARK_ME_DOWN, e,
45 HEAD_VERSION, COMPAT_VERSION},
46 fsid(fs), target_osd(osd), target_addrs(av),
47 epoch(e), request_ack(request_ack), down_and_dead(down_and_dead) {}
48 private:
49 ~MOSDMarkMeDown() final {}
50
51 public:
52 epoch_t get_epoch() const { return epoch; }
53
54 void decode_payload() override {
55 using ceph::decode;
56 auto p = payload.cbegin();
57 paxos_decode(p);
58 assert(header.version >= 3);
59 decode(fsid, p);
60 decode(target_osd, p);
61 decode(target_addrs, p);
62 decode(epoch, p);
63 decode(request_ack, p);
64 if(header.version >= 4)
65 decode(down_and_dead, p);
66 }
67
68 void encode_payload(uint64_t features) override {
69 using ceph::encode;
70 paxos_encode();
71 assert(HAVE_FEATURE(features, SERVER_NAUTILUS));
72 header.version = HEAD_VERSION;
73 header.compat_version = COMPAT_VERSION;
74 encode(fsid, payload);
75 encode(target_osd, payload, features);
76 encode(target_addrs, payload, features);
77 encode(epoch, payload);
78 encode(request_ack, payload);
79 encode(down_and_dead, payload);
80 }
81
82 std::string_view get_type_name() const override { return "MOSDMarkMeDown"; }
83 void print(std::ostream& out) const override {
84 out << "MOSDMarkMeDown("
85 << "request_ack=" << request_ack
86 << ", down_and_dead=" << down_and_dead
87 << ", osd." << target_osd
88 << ", " << target_addrs
89 << ", fsid=" << fsid
90 << ")";
91 }
92 private:
93 template<class T, typename... Args>
94 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
95 };
96
97 #endif