]>
Commit | Line | Data |
---|---|---|
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 | ||
9f95a23c | 13 | class MOSDPGCreate2 : public Message { |
11fdf7f2 | 14 | public: |
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) { } |
27 | private: | |
28 | ~MOSDPGCreate2() override {} | |
29 | ||
30 | public: | |
31 | std::string_view get_type_name() const override { | |
32 | return "pg_create2"; | |
33 | } | |
34 | void print(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); | |
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 |
53 | private: |
54 | template<class T, typename... Args> | |
55 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
11fdf7f2 | 56 | }; |