]>
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_MOSDSCRUB_H | |
17 | #define CEPH_MOSDSCRUB_H | |
18 | ||
19 | #include "msg/Message.h" | |
20 | ||
21 | /* | |
22 | * instruct an OSD to scrub some or all pg(s) | |
23 | */ | |
24 | ||
9f95a23c | 25 | class MOSDScrub : public Message { |
11fdf7f2 | 26 | public: |
11fdf7f2 TL |
27 | static constexpr int HEAD_VERSION = 2; |
28 | static constexpr int COMPAT_VERSION = 2; | |
7c673cae FG |
29 | |
30 | uuid_d fsid; | |
31 | vector<pg_t> scrub_pgs; | |
d2e6a577 FG |
32 | bool repair = false; |
33 | bool deep = false; | |
7c673cae | 34 | |
9f95a23c | 35 | MOSDScrub() : Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION} {} |
7c673cae | 36 | MOSDScrub(const uuid_d& f, bool r, bool d) : |
9f95a23c | 37 | Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION}, |
7c673cae FG |
38 | fsid(f), repair(r), deep(d) {} |
39 | MOSDScrub(const uuid_d& f, vector<pg_t>& pgs, bool r, bool d) : | |
9f95a23c | 40 | Message{MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION}, |
7c673cae FG |
41 | fsid(f), scrub_pgs(pgs), repair(r), deep(d) {} |
42 | private: | |
43 | ~MOSDScrub() override {} | |
44 | ||
45 | public: | |
11fdf7f2 | 46 | std::string_view get_type_name() const override { return "scrub"; } |
7c673cae FG |
47 | void print(ostream& out) const override { |
48 | out << "scrub("; | |
49 | if (scrub_pgs.empty()) | |
50 | out << "osd"; | |
51 | else | |
52 | out << scrub_pgs; | |
53 | if (repair) | |
54 | out << " repair"; | |
55 | if (deep) | |
56 | out << " deep"; | |
57 | out << ")"; | |
58 | } | |
59 | ||
60 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
61 | using ceph::encode; |
62 | encode(fsid, payload); | |
63 | encode(scrub_pgs, payload); | |
64 | encode(repair, payload); | |
65 | encode(deep, payload); | |
7c673cae FG |
66 | } |
67 | void decode_payload() override { | |
11fdf7f2 TL |
68 | auto p = payload.cbegin(); |
69 | decode(fsid, p); | |
70 | decode(scrub_pgs, p); | |
71 | decode(repair, p); | |
72 | decode(deep, p); | |
7c673cae | 73 | } |
9f95a23c TL |
74 | private: |
75 | template<class T, typename... Args> | |
76 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
77 | }; |
78 | ||
79 | #endif |