]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDScrub.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MOSDScrub.h
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
25 class MOSDScrub : public MessageInstance<MOSDScrub> {
26 public:
27 friend factory;
28
29 static constexpr int HEAD_VERSION = 2;
30 static constexpr int COMPAT_VERSION = 2;
31
32 uuid_d fsid;
33 vector<pg_t> scrub_pgs;
34 bool repair = false;
35 bool deep = false;
36
37 MOSDScrub() : MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION) {}
38 MOSDScrub(const uuid_d& f, bool r, bool d) :
39 MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION),
40 fsid(f), repair(r), deep(d) {}
41 MOSDScrub(const uuid_d& f, vector<pg_t>& pgs, bool r, bool d) :
42 MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION),
43 fsid(f), scrub_pgs(pgs), repair(r), deep(d) {}
44 private:
45 ~MOSDScrub() override {}
46
47 public:
48 std::string_view get_type_name() const override { return "scrub"; }
49 void print(ostream& out) const override {
50 out << "scrub(";
51 if (scrub_pgs.empty())
52 out << "osd";
53 else
54 out << scrub_pgs;
55 if (repair)
56 out << " repair";
57 if (deep)
58 out << " deep";
59 out << ")";
60 }
61
62 void encode_payload(uint64_t features) override {
63 using ceph::encode;
64 encode(fsid, payload);
65 encode(scrub_pgs, payload);
66 encode(repair, payload);
67 encode(deep, payload);
68 }
69 void decode_payload() override {
70 auto p = payload.cbegin();
71 decode(fsid, p);
72 decode(scrub_pgs, p);
73 decode(repair, p);
74 decode(deep, p);
75 }
76 };
77
78 #endif