]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGTemp.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGTemp.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 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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
16
17#ifndef CEPH_MOSDPGTEMP_H
18#define CEPH_MOSDPGTEMP_H
19
20#include "messages/PaxosServiceMessage.h"
21
f67539c2 22class MOSDPGTemp final : public PaxosServiceMessage {
11fdf7f2 23public:
d2e6a577 24 epoch_t map_epoch = 0;
f67539c2 25 std::map<pg_t, std::vector<int32_t> > pg_temp;
3efd9988 26 bool forced = false;
7c673cae 27
3efd9988 28 MOSDPGTemp(epoch_t e)
9f95a23c 29 : PaxosServiceMessage{MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION},
3efd9988
FG
30 map_epoch(e)
31 {}
32 MOSDPGTemp()
33 : MOSDPGTemp(0)
34 {}
7c673cae 35private:
f67539c2 36 ~MOSDPGTemp() final {}
7c673cae
FG
37
38public:
39 void encode_payload(uint64_t features) override {
11fdf7f2 40 using ceph::encode;
7c673cae 41 paxos_encode();
11fdf7f2
TL
42 encode(map_epoch, payload);
43 encode(pg_temp, payload);
44 encode(forced, payload);
7c673cae
FG
45 }
46 void decode_payload() override {
f67539c2 47 using ceph::decode;
11fdf7f2 48 auto p = payload.cbegin();
7c673cae 49 paxos_decode(p);
11fdf7f2
TL
50 decode(map_epoch, p);
51 decode(pg_temp, p);
3efd9988 52 if (header.version >= 2) {
11fdf7f2 53 decode(forced, p);
3efd9988 54 }
7c673cae
FG
55 }
56
11fdf7f2 57 std::string_view get_type_name() const override { return "osd_pgtemp"; }
f67539c2 58 void print(std::ostream &out) const override {
7c673cae
FG
59 out << "osd_pgtemp(e" << map_epoch << " " << pg_temp << " v" << version << ")";
60 }
3efd9988
FG
61private:
62 static constexpr int HEAD_VERSION = 2;
63 static constexpr int COMPAT_VERSION = 1;
9f95a23c
TL
64
65 template<class T, typename... Args>
66 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
67};
68
69#endif