]>
Commit | Line | Data |
---|---|---|
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 | #ifndef CEPH_MOSDPGCREATE_H | |
17 | #define CEPH_MOSDPGCREATE_H | |
18 | ||
19 | #include "msg/Message.h" | |
20 | #include "osd/osd_types.h" | |
21 | ||
22 | /* | |
23 | * PGCreate - instruct an OSD to create a pg, if it doesn't already exist | |
24 | */ | |
25 | ||
9f95a23c | 26 | class MOSDPGCreate : public Message { |
11fdf7f2 | 27 | public: |
11fdf7f2 TL |
28 | static constexpr int HEAD_VERSION = 3; |
29 | static constexpr int COMPAT_VERSION = 3; | |
7c673cae | 30 | |
d2e6a577 | 31 | version_t epoch = 0; |
7c673cae FG |
32 | map<pg_t,pg_create_t> mkpg; |
33 | map<pg_t,utime_t> ctimes; | |
34 | ||
35 | MOSDPGCreate() | |
9f95a23c TL |
36 | : MOSDPGCreate{0} |
37 | {} | |
7c673cae | 38 | MOSDPGCreate(epoch_t e) |
9f95a23c TL |
39 | : Message{MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION}, |
40 | epoch(e) | |
41 | {} | |
7c673cae FG |
42 | private: |
43 | ~MOSDPGCreate() override {} | |
44 | ||
45 | public: | |
11fdf7f2 | 46 | std::string_view get_type_name() const override { return "pg_create"; } |
7c673cae FG |
47 | |
48 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
49 | using ceph::encode; |
50 | encode(epoch, payload); | |
51 | encode(mkpg, payload); | |
52 | encode(ctimes, payload); | |
7c673cae FG |
53 | } |
54 | void decode_payload() override { | |
11fdf7f2 TL |
55 | auto p = payload.cbegin(); |
56 | decode(epoch, p); | |
57 | decode(mkpg, p); | |
58 | decode(ctimes, p); | |
7c673cae | 59 | } |
7c673cae FG |
60 | void print(ostream& out) const override { |
61 | out << "osd_pg_create(e" << epoch; | |
62 | for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin(); | |
63 | i != mkpg.end(); | |
64 | ++i) { | |
65 | out << " " << i->first << ":" << i->second.created; | |
66 | } | |
67 | out << ")"; | |
68 | } | |
9f95a23c TL |
69 | private: |
70 | template<class T, typename... Args> | |
71 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
72 | }; |
73 | ||
74 | #endif |