]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGTemp.h
import 15.2.0 Octopus source
[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
9f95a23c 22class MOSDPGTemp : public PaxosServiceMessage {
11fdf7f2 23public:
d2e6a577 24 epoch_t map_epoch = 0;
7c673cae 25 map<pg_t, 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
FG
35private:
36 ~MOSDPGTemp() override {}
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 {
11fdf7f2 47 auto p = payload.cbegin();
7c673cae 48 paxos_decode(p);
11fdf7f2
TL
49 decode(map_epoch, p);
50 decode(pg_temp, p);
3efd9988 51 if (header.version >= 2) {
11fdf7f2 52 decode(forced, p);
3efd9988 53 }
7c673cae
FG
54 }
55
11fdf7f2 56 std::string_view get_type_name() const override { return "osd_pgtemp"; }
7c673cae
FG
57 void print(ostream &out) const override {
58 out << "osd_pgtemp(e" << map_epoch << " " << pg_temp << " v" << version << ")";
59 }
3efd9988
FG
60private:
61 static constexpr int HEAD_VERSION = 2;
62 static constexpr int COMPAT_VERSION = 1;
9f95a23c
TL
63
64 template<class T, typename... Args>
65 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
66};
67
68#endif