]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGCreate2.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGCreate2.h
CommitLineData
11fdf7f2
TL
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 "msg/Message.h"
7#include "osd/osd_types.h"
8
9/*
10 * PGCreate2 - instruct an OSD to create some pgs
11 */
12
f67539c2 13class MOSDPGCreate2 final : public Message {
11fdf7f2 14public:
9f95a23c 15 static constexpr int HEAD_VERSION = 2;
11fdf7f2
TL
16 static constexpr int COMPAT_VERSION = 1;
17
18 epoch_t epoch = 0;
9f95a23c
TL
19 std::map<spg_t,std::pair<epoch_t,utime_t>> pgs;
20 std::map<spg_t,std::pair<pg_history_t,PastIntervals>> pg_extra;
11fdf7f2
TL
21
22 MOSDPGCreate2()
9f95a23c 23 : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION} {}
11fdf7f2 24 MOSDPGCreate2(epoch_t e)
9f95a23c 25 : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION},
11fdf7f2
TL
26 epoch(e) { }
27private:
f67539c2 28 ~MOSDPGCreate2() final {}
11fdf7f2
TL
29
30public:
31 std::string_view get_type_name() const override {
32 return "pg_create2";
33 }
f67539c2 34 void print(std::ostream& out) const override {
11fdf7f2
TL
35 out << "pg_create2(e" << epoch << " " << pgs << ")";
36 }
37
38 void encode_payload(uint64_t features) override {
39 using ceph::encode;
40 encode(epoch, payload);
41 encode(pgs, payload);
9f95a23c 42 encode(pg_extra, payload);
11fdf7f2
TL
43 }
44 void decode_payload() override {
45 auto p = payload.cbegin();
46 using ceph::decode;
47 decode(epoch, p);
48 decode(pgs, p);
9f95a23c
TL
49 if (header.version >= 2) {
50 decode(pg_extra, p);
51 }
11fdf7f2 52 }
9f95a23c
TL
53private:
54 template<class T, typename... Args>
55 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
11fdf7f2 56};