]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGCreate2.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGCreate2.h
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
13 class MOSDPGCreate2 final : public Message {
14 public:
15 static constexpr int HEAD_VERSION = 2;
16 static constexpr int COMPAT_VERSION = 1;
17
18 epoch_t epoch = 0;
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;
21
22 MOSDPGCreate2()
23 : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION} {}
24 MOSDPGCreate2(epoch_t e)
25 : Message{MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION},
26 epoch(e) { }
27 private:
28 ~MOSDPGCreate2() final {}
29
30 public:
31 std::string_view get_type_name() const override {
32 return "pg_create2";
33 }
34 void print(std::ostream& out) const override {
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);
42 encode(pg_extra, payload);
43 }
44 void decode_payload() override {
45 auto p = payload.cbegin();
46 using ceph::decode;
47 decode(epoch, p);
48 decode(pgs, p);
49 if (header.version >= 2) {
50 decode(pg_extra, p);
51 }
52 }
53 private:
54 template<class T, typename... Args>
55 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
56 };